Difference between revisions of "TRACKERS MB SRC EN SNGDECR"
From MSX MUSIC WIKI
(Created page with ";--- MoonBlaster song decruncher --- ; ; Storage of song data: Only zeros crunched. ; All values above 242 = 1 or more zeros, so max. 13 sngdecrc: ld a,sngpag ; SNGPAG = ma...") |
|||
Line 1: | Line 1: | ||
− | ;--- MoonBlaster song decruncher --- | + | ;--- MoonBlaster song decruncher --- |
− | ; | + | ; |
− | ; Storage of song data: Only zeros crunched. | + | ; Storage of song data: Only zeros crunched. |
− | ; All values above 242 = 1 or more zeros, so max. 13 | + | ; All values above 242 = 1 or more zeros, so max. 13 |
− | + | ||
− | + | ||
− | sngdecrc: ld a,sngpag ; SNGPAG = mapperbank with ONGECRUNCHTE | + | sngdecrc: ld a,sngpag ; SNGPAG = mapperbank with ONGECRUNCHTE |
− | + | out (0feh),a ; songdata | |
− | + | ||
− | + | ld hl,08000h ; move the settings | |
− | + | ld de,08000h+200 | |
− | + | ld bc,376 ; number of bytes v. div. settings | |
− | sngdecrl1: call copybyte | + | sngdecrl1: call copybyte |
− | + | inc hl | |
− | + | inc de | |
− | + | dec bc | |
− | + | ld a,b | |
− | + | or c | |
− | + | jr nz,sngdecrl1 | |
− | + | ||
− | + | ld a,em1pag ; EM1PAG = mapperbank with GECRUNCHTE | |
− | + | out (0feh),a ; songdata | |
− | + | ld a,(08000h) ; last position | |
− | + | inc a | |
− | + | ld b,a | |
− | + | push bc ; move pat/pos data | |
− | + | ld de,08000h | |
− | sngdecrl2: call copybyte | + | sngdecrl2: call copybyte |
− | + | inc hl | |
− | + | inc de | |
− | + | djnz sngdecrl2 | |
− | + | pop bc | |
− | + | ||
− | + | push hl | |
− | + | ld e,1 | |
− | + | ld hl,08000h | |
− | sngdecrl3: ld a,(hl) | + | sngdecrl3: ld a,(hl) |
− | + | cp e | |
− | + | jr c,sngdecrl4 | |
− | + | ld e,a | |
− | sngdecrl4: inc hl | + | sngdecrl4: inc hl |
− | + | djnz sngdecrl3 | |
− | + | ||
− | + | ld d,0 | |
− | + | pop hl | |
− | + | add hl,de | |
− | + | add hl,de ; skip pattern adress | |
− | + | ||
− | + | ld a,em1pag | |
− | + | out (0feh),a | |
− | + | ||
− | + | ld de,08240h ; real decreases of song data | |
− | + | ld bc,03dc0h ; !maximale! number of bytes | |
− | sngdecrl6: ld a,(hl) | + | sngdecrl6: ld a,(hl) |
− | + | or a | |
− | + | jr z,sngdecrend ; found an end marker? gone earlier! | |
− | + | cp 243 | |
− | + | jr nc,sngdecrl7 ; crunched data? then decrease! | |
− | + | call wrtbyte | |
− | sngdecrl9: inc hl | + | sngdecrl9: inc hl |
− | + | dec bc | |
− | + | ld a,b | |
− | + | or c | |
− | + | jr nz,sngdecrl6 | |
− | sngdecrend: ld a,sngpag ; end of decrunch | + | sngdecrend: ld a,sngpag ; end of decrunch |
− | + | out (0feh),a | |
− | + | ret | |
− | + | ||
− | sngdecrl7: push bc ; decreasing series zeros | + | sngdecrl7: push bc ; decreasing series zeros |
− | + | sub 242 | |
− | + | ld b,a | |
− | sngdecrl8: xor a | + | sngdecrl8: xor a |
− | + | call wrtbyte | |
− | + | djnz sngdecrl8 | |
− | + | pop bc | |
− | + | jr sngdecrl9 | |
− | + | ||
− | + | ||
− | + | ||
− | ;--- copy data byte from one mapper bank to another --- | + | ;--- copy data byte from one mapper bank to another --- |
− | + | ||
− | copybyte: ld a,em1pag | + | copybyte: ld a,em1pag |
− | + | out (0feh),a | |
− | + | ld a,(hl) | |
− | + | ex af,af' | |
− | + | ld a,sngpag | |
− | + | out (0feh),a | |
− | + | ex af,af' | |
− | + | ld (de),a | |
− | + | ret | |
− | + | ||
− | ;--- write decrunched databyte --- | + | ;--- write decrunched databyte --- |
− | + | ||
− | wrtbyte: ex af,af' | + | wrtbyte: ex af,af' |
− | + | ld a,sngpag | |
− | + | out (0feh),a | |
− | + | ex af,af' | |
− | + | ld (de),a | |
− | + | ld a,em1pag | |
− | + | out (0feh),a | |
− | + | inc de | |
− | + | ret | |
− | + | ||
− | ������������������������������������������������������������������������������������������������������������������ | + | ������������������������������������������������������������������������������������������������������������������ |
Latest revision as of 08:24, 17 July 2019
;--- MoonBlaster song decruncher --- ; ; Storage of song data: Only zeros crunched. ; All values above 242 = 1 or more zeros, so max. 13 sngdecrc: ld a,sngpag ; SNGPAG = mapperbank with ONGECRUNCHTE out (0feh),a ; songdata ld hl,08000h ; move the settings ld de,08000h+200 ld bc,376 ; number of bytes v. div. settings sngdecrl1: call copybyte inc hl inc de dec bc ld a,b or c jr nz,sngdecrl1 ld a,em1pag ; EM1PAG = mapperbank with GECRUNCHTE out (0feh),a ; songdata ld a,(08000h) ; last position inc a ld b,a push bc ; move pat/pos data ld de,08000h sngdecrl2: call copybyte inc hl inc de djnz sngdecrl2 pop bc push hl ld e,1 ld hl,08000h sngdecrl3: ld a,(hl) cp e jr c,sngdecrl4 ld e,a sngdecrl4: inc hl djnz sngdecrl3 ld d,0 pop hl add hl,de add hl,de ; skip pattern adress ld a,em1pag out (0feh),a ld de,08240h ; real decreases of song data ld bc,03dc0h ; !maximale! number of bytes sngdecrl6: ld a,(hl) or a jr z,sngdecrend ; found an end marker? gone earlier! cp 243 jr nc,sngdecrl7 ; crunched data? then decrease! call wrtbyte sngdecrl9: inc hl dec bc ld a,b or c jr nz,sngdecrl6 sngdecrend: ld a,sngpag ; end of decrunch out (0feh),a ret sngdecrl7: push bc ; decreasing series zeros sub 242 ld b,a sngdecrl8: xor a call wrtbyte djnz sngdecrl8 pop bc jr sngdecrl9 ;--- copy data byte from one mapper bank to another --- copybyte: ld a,em1pag out (0feh),a ld a,(hl) ex af,af' ld a,sngpag out (0feh),a ex af,af' ld (de),a ret ;--- write decrunched databyte --- wrtbyte: ex af,af' ld a,sngpag out (0feh),a ex af,af' ld (de),a ld a,em1pag out (0feh),a inc de ret ������������������������������������������������������������������������������������������������������������������