Skip to content

Commit 339a98e

Browse files
committed
Merge pull request #4 from Hotrootsoup/master
Added upack
2 parents c021c4b + c1c60b8 commit 339a98e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

mem/upack.dasm

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
;Unpacks text / characters / combined 8 bit values. Instead of letting color waste the high byte of each character,
2+
;use it to store another character.
3+
;This unpacks the high byte, and then the low byte into 2 words.
4+
;This essentially allows twice the amount of stored text per amount of RAM
5+
;Color is blank 0's (in the high bit), and must be added after unpacking.
6+
;Register a is the start of the packed
7+
;data. Register b is the end of the
8+
;packed data. Register c is the start
9+
;of where you want to unpack to
10+
;Copyright 2012, by Hotrootsoup, licensed unter the GNU Public License.
11+
;http://www.gnu.org/licenses/gpl.txt
12+
13+
:upack
14+
set PUSH, [a]
15+
shr PEEK, 8
16+
set [c], POP
17+
18+
add c, 1
19+
20+
set PUSH, [a]
21+
and PEEK, 0x00FF
22+
set [c], POP
23+
24+
ife a, b
25+
set PC, POP
26+
27+
add c, 1
28+
add a, 1
29+
set PC, upack

0 commit comments

Comments
 (0)