Open s-ol opened 11 years ago
But you can't decompress it without a lot of computation, so it's not really useful.
@FaerieFrOSt you should unroll your loops anyway, and its not that much
:_scr_packed_string
SET PUSH, Y
:_scr_packed_string_loop
SET Y, [J] ; high byte
SHR Y, 8 ; shift high byte to low one
AND Y, 0x7f ; clear high
IFE Y, 0
SET PC, _scr_packed_string_done
BOR Y, B ; apply format
SET [I], Y
ADD I, 1
SET Y, [J] ; low byte
AND Y, 0x7f ; clear our high byte
IFE Y, 0
SET PC, _scr_packed_string_done
BOR Y, B ; apply format
STI [I], Y ; increment I and J
SET PC, _scr_packed_string_loop
:_scr_packed_string_done
SET Y, POP
SET PC, POP
Well okay. That's feasible. But again it's speed against size. ;)
And if you would unroll that loop, it would be much faster than a not-unrolled uncompressed loop.
Also you half the memory size of each string, so you the extra-size of the routine is easily compensated
True enough. :)
I'll look into adding this. When I do, I'll make it work like Organic says it does, with .asciiz or.asciic for c-style, .asciip for pascal, and .ascii for a raw string
Add a .asciz directive storing a string in "compressed" form (2 characters / word):
.asciz "ABC" => dat 0x4142, 0x4300