arraywrite to a buffer then hserout str buffer
arraywrite to a buffer then hserout str buffer
Warning I'm not a teacher
I'll do some test, thank you![]()
These are my result:
1) simple program with some code and 1 line as below is 7099 bytes
2) same program with 11 line like that is 9319 bytes, so each Hserout2 eat 222 bytesCode:Hserout2["nel mezzo del cammin di nostra vita",13,10]
3) simple program with some code plus this as below is 7157 bytes
4) same program above but with 11 "arraywrite + send" is 9497 bytes, so each Hserout eat 234 bytesCode:buf VAR BYTE[200] arraywrite buf,["nel mezzo del cammin di nostra vita",13,10] gosub send send: Hserout2[str buf\200] return
Looks like it's not as you say. I did this test with PBP Long option enabled, maybe without the results are different ?
i think you misunderstand neither method is efficient
two hunted bytes to store a message 32 or so bytes long , not good
Warning I'm not a teacher
Look at this
http://www.picbasic.co.uk/forum/showthread.php?t=137
Store raw data in FLASH. Terminate your string with 0.
Use readcode to read data, send one byte at time, and that is it.
So you can store 300 bytes in 300 bytes. Readcode take little space.
EDIT:
Another way is to store strings to EEPROM. So no code space is used.
http://www.picbasic.co.uk/forum/showthread.php?t=573
Last edited by pedja089; - 4th February 2021 at 16:05.
please explain how would you do. Of course debug strings are different and mixed
a message database of null terminated strings
to find a message[x] read from messages + 2*x this is the offset from messages labelCode:@ ORG 4000h messages: @ dw 0x08 ;message 0 offset @ dw 0x12 ;message 1 offset @ dw 0x22 ;message 2 offset @ dw 0x2e ;message 3 offset @ DB "a message",0 @ DB "another message",0 @ DB "and another",0 @ DB "last one",0
message[x] start address = messages + offset
you can then copy message to a buffer and hserout it the usual way or create your own routine to
stream the message directly from flash
edited lst file
Code:004000 00839 ORG 4000h 004000 0008 00847 dw 0x08 004002 0012 00855 dw 0x12 004004 0022 00863 dw 0x22 004006 0032 00871 dw 0x2E 004008 2061 656D 7373 00879 DB "a message",0 6761 0065 004012 6E61 746F 6568 00887 DB "another message",0 2072 656D 7373 6761 0065 004022 6E61 2064 6E61 00895 DB "and another",0 746F 6568 0072 00402E 616C 7473 6F20 00903 DB "last one",0 656E 0000
Last edited by richard; - 4th February 2021 at 23:38.
Warning I'm not a teacher
Clear, thanks both. I've used something like that in the past when I needed a bunch of kbytes more to fit a program in memory.
But as I told debug strings are mostly mixed test+variables and become very difficult to manage this stuff, for example
But some messages are all plain text, so I will consider to mix the two methodCode:Hserout2["logging ",DEC ByteCount," chars at @",HEX4 BaseAddress,"-Type ",HEX2 DataType,"-Data ",str inbuff\ByteCount*2,"-",HEX2 DataCrc," "]
cheers
Bookmarks