; by joshua seagoe (rabidcow@juno.com) ; 47 bytes ; on call: ; (hl) = source ; TEMP = dest ; on ret: ; all regs destroyed incl. ix ; a = 0 ; (de) = terminating 0 decode: ld de,TEMP ld b,1 ; set high nybble flag jr newchar low_nybble: inc hl ; next byte of input stream ld b,1 ; set high nybble flag jr got_nybble loop: ld a,(hl) djnz low_nybble rrca ; a certain rom call would rrca ; take 1 byte less... rrca rrca got_nybble: or $f0 ; make offsets neg so we can inc a ; cp $ff <- save a byte here jr z,next_table ld (patch),a ld a,(ix+$00) patch = $-1 ld (de),a or a ret z ; end of string inc de newchar: ld ix,table1 ; we need table1+15 because ; the offsets are neg next_table: ld a,b ld bc,15 add ix,bc ld b,a ; restore nybble flag jr loop