Añado compresión

This commit is contained in:
antoniovillena 2016-06-26 08:04:25 +02:00
parent 82ff17bedf
commit a0ee11a2a6
3 changed files with 145 additions and 87 deletions

View File

@ -1,23 +1,36 @@
output scroll.bin output scroll.bin
org $5ccb org $5d27
defb 0, 0, 0, 0 ld hl, fondo
defb $de, $c0, $37, $0e, $8f, $39, $ac ;OVER USR 7 ($5cd6) ld b, $40 ; filtro RCS inverso
start ld a, b
bucle ;ld hl, 0 xor c
;ld de, $4000 and $f8
;ld bc, $1800 xor c
;ldir ld d, a
ld a, 1 xor b
xor c
rlca
rlca
ld e, a
inc bc
ldi
inc bc
ld a, b
sub $58
jr nz, start
ld b, 3
ldir
out ($fe), a
inc a
ex af, af' ex af, af'
ld hl, chr ld hl, chr
ld de, $b400-chrend+chr push hl
ld bc, chrend-chr pop ix
ld de, $b400-fondo+chr
ld bc, fondo-chr
ldir ldir
ld hl, $b000 ld hl, $b000
; ld de, $b400
start1 ld b, $08 start1 ld b, $08
start2 ld a, (hl) start2 ld a, (hl)
rrca rrca
@ -27,83 +40,59 @@ start2 ld a, (hl)
jp pe, start2 jp pe, start2
jr nc, start1 jr nc, start1
start3 ei
bucl2 halt halt
di di
ld c, 4 ld c, 4
bucl3 djnz bucl3 start4 djnz start4
dec c dec c
jr nz, bucl3 jr nz, start4
include lineas.asm include lineas.asm
ld sp, 0 ld sp, $401b+$800*2+$100*7+$20*7
sbc hl, hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
push hl
ld sp, hl
ld hl, start3
push hl
ex af, af' ex af, af'
rlca rrca
jr c, nprn jr c, start5
ex af, af' ex af, af'
ret
start5 ex af, af'
xor a
cp (ix)
jr nz, start6
ld ix, string
start6 push ix
pop hl
ld c, $2b
cpir
ld b, c
ld c, $17
ld ix, string push bc
ld bc, $0010 srl b
call prnstr
ld ix, string
ld bc, $0111
call prnstr
ld ix, string
ld bc, $0212
call prnstr
ld ix, string
ld bc, $0313
call prnstr
ld ix, string
ld bc, $0414
call prnstr
ld ix, string
ld bc, $0515
call prnstr
ld ix, string
ld bc, $0616
call prnstr
ld ix, string
ld bc, $0717
call prnstr
jr $
ex af, af'
nprn ex af, af'
ei
halt
halt
jp bucl2
; 01234567 01234567 01234567 01234567
; abcdef
; ab cdef
; abcd ef
; abcdef 0642
; abcde f
; abcdef
; a bcdef
; abc def 3175
; -----------------------------------------------------------------------------
; Print string routine
; Parameters:
; BC: X coord (B) and Y coord (C)
; IX: null terminated string
; -----------------------------------------------------------------------------
prnstr push bc
rr b
ld a, b ld a, b
jr c, prnimp jr c, prn2
and %1111100 and %11111100
ld d, a ld d, a
xor b xor b
ld b, a
ld e, a ld e, a
jr z, prnch1 jr z, prn1
dec e dec e
prnch1 ld a, d prn1 ld a, d
rrca rrca
ld d, a ld d, a
rrca rrca
@ -131,7 +120,6 @@ pos0 ld a, (ix)
jr z, posf jr z, posf
ld h, $2c ld h, $2c
call simple call simple
dec de
pos2 ld a, (ix) pos2 ld a, (ix)
inc ix inc ix
add a, a add a, a
@ -152,6 +140,7 @@ pos6 ld a, (ix)
jr z, posf jr z, posf
ld h, $2e ld h, $2e
call simple call simple
inc de
jr pos0 jr pos0
pos26 rr b pos26 rr b
jr c, pos6 jr c, pos6
@ -161,10 +150,11 @@ posf pop bc
inc c inc c
ret ret
prnimp and %1111100 prn2 and %11111100
ld d, a ld d, a
xor b xor b
cp 3 ld b, a
cp 2
adc a, -1 adc a, -1
ld e, a ld e, a
ld a, d ld a, d
@ -207,9 +197,8 @@ pos5 ld a, (ix)
add a, a add a, a
jr z, posf jr z, posf
ld h, $33 ld h, $33
ld bc, $0401 ld bc, $04fe
call doble call doble
dec de
pos7 ld a, (ix) pos7 ld a, (ix)
inc ix inc ix
add a, a add a, a
@ -237,7 +226,7 @@ simple2 ld a, (de)
inc d inc d
inc l inc l
djnz simple2 djnz simple2
ld hl, $f801 ld hl, $f800
add hl, de add hl, de
ex de, hl ex de, hl
ret ret
@ -275,4 +264,5 @@ doble2 ld a, (de)
string include string.asm string include string.asm
chr incbin fuente6x8.bin chr incbin fuente6x8.bin
chrend fondo incbin fondo.rcs
fin

View File

@ -1,2 +1,12 @@
Png2Rcs fondo.png fondo.rcs -a fondo.atr
..\sjasmplus scroll.asm ..\sjasmplus scroll.asm
gentape scroll.tap basic "SCROLL" 0 scroll.bin call :getfilesize scroll.bin
echo define filesize %_filesize% > define.asm
..\zx7b scroll.bin scroll.bin.zx7b
..\sjasmplus scrolldesc.asm
GenTape scroll.tap basic "SCROLL" 0 scrolldesc.bin
goto :eof
:getfilesize
set _filesize=%~z1
goto :eof

View File

@ -0,0 +1,58 @@
include define.asm
output scrolldesc.bin
org $5ccb
ld de, $5d27+filesize-1
di
defb $de, $c0, $37, $0e, $8f, $39, $96
jr aqui
getbit ld a, (hl)
dec hl
adc a, a
ret
aqui ld hl, fin-1
; -----------------------------------------------------------------------------
; ZX7 Backwards by Einar Saukas, Antonio Villena
; Parameters:
; HL: source address (compressed data)
; DE: destination address (decompressing)
; -----------------------------------------------------------------------------
dzx7b ld bc, $8000
ld a, b
copyby inc c
ldd
mainlo add a, a
call z, getbit
jr nc, copyby
push de
ld d, c
defb $30
lenval add a, a
call z, getbit
rl c
rl b
add a, a
call z, getbit
jr nc, lenval
inc c
jr z, exitdz
ld e, (hl)
dec hl
sll e
jr nc, offend
ld d, $10
nexbit add a, a
call z, getbit
rl d
jr nc, nexbit
inc d
srl d
offend rr e
ex (sp), hl
ex de, hl
adc hl, de
lddr
exitdz pop hl
jr nc, mainlo
incbin scroll.bin.zx7b
fin