mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 18:30:50 +12:00
No more S_
This commit is contained in:
parent
5facf8377a
commit
8026d47585
|
@ -6457,7 +6457,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [$4000], a
|
||||||
ld hl, vSprites
|
ld hl, vSprites
|
||||||
ld de, S_SPRITEBUFFER1
|
ld de, sSpriteBuffer1
|
||||||
ld a, [H_LOADEDROMBANK]
|
ld a, [H_LOADEDROMBANK]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld c, 7 * 7
|
ld c, 7 * 7
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored
|
; assumes that input sprite chunks are 4x4 tiles, and the rightmost and bottommost 4 pixels will be ignored
|
||||||
; resulting in a 7*7 tile output sprite chunk
|
; resulting in a 7*7 tile output sprite chunk
|
||||||
ScaleSpriteByTwo: ; 2fe40 (b:7e40)
|
ScaleSpriteByTwo: ; 2fe40 (b:7e40)
|
||||||
ld de, S_SPRITEBUFFER1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
||||||
ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
||||||
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
||||||
call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
|
call ScaleFirstThreeSpriteColumnsByTwo ; scale first 3 tile columns
|
||||||
ld de, S_SPRITEBUFFER2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped
|
||||||
ld hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer
|
||||||
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
call ScaleLastSpriteColumnByTwo ; last tile column is special case
|
||||||
|
|
||||||
ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
|
ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55)
|
||||||
|
|
|
@ -186,8 +186,8 @@ HoFLoadPlayerPics: ; 7033e (1c:433e)
|
||||||
ld de, RedPicFront
|
ld de, RedPicFront
|
||||||
ld a, BANK(RedPicFront)
|
ld a, BANK(RedPicFront)
|
||||||
call UncompressSpriteFromDE
|
call UncompressSpriteFromDE
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
ld de, S_SPRITEBUFFER0
|
ld de, sSpriteBuffer0
|
||||||
ld bc, $310
|
ld bc, $310
|
||||||
call CopyData
|
call CopyData
|
||||||
ld de, vFrontPic
|
ld de, vFrontPic
|
||||||
|
|
|
@ -215,8 +215,8 @@ IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4)
|
||||||
push bc
|
push bc
|
||||||
ld a,b
|
ld a,b
|
||||||
call UncompressSpriteFromDE
|
call UncompressSpriteFromDE
|
||||||
ld hl,S_SPRITEBUFFER1
|
ld hl,sSpriteBuffer1
|
||||||
ld de,S_SPRITEBUFFER0
|
ld de,sSpriteBuffer0
|
||||||
ld bc,$310
|
ld bc,$310
|
||||||
call CopyData
|
call CopyData
|
||||||
ld de,vFrontPic
|
ld de,vFrontPic
|
||||||
|
|
22
home.asm
22
home.asm
|
@ -810,15 +810,15 @@ LoadUncompressedSpriteData:: ; 1672 (0:1672)
|
||||||
ld [H_SPRITEOFFSET], a
|
ld [H_SPRITEOFFSET], a
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [$4000], a
|
||||||
ld hl, S_SPRITEBUFFER0
|
ld hl, sSpriteBuffer0
|
||||||
call ZeroSpriteBuffer ; zero buffer 0
|
call ZeroSpriteBuffer ; zero buffer 0
|
||||||
ld de, S_SPRITEBUFFER1
|
ld de, sSpriteBuffer1
|
||||||
ld hl, S_SPRITEBUFFER0
|
ld hl, sSpriteBuffer0
|
||||||
call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite)
|
call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite)
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
call ZeroSpriteBuffer ; zero buffer 1
|
call ZeroSpriteBuffer ; zero buffer 1
|
||||||
ld de, S_SPRITEBUFFER2
|
ld de, sSpriteBuffer2
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite)
|
call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite)
|
||||||
pop de
|
pop de
|
||||||
jp InterlaceMergeSpriteBuffers
|
jp InterlaceMergeSpriteBuffers
|
||||||
|
@ -869,9 +869,9 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
|
||||||
xor a
|
xor a
|
||||||
ld [$4000], a
|
ld [$4000], a
|
||||||
push de
|
push de
|
||||||
ld hl, S_SPRITEBUFFER2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
|
ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2
|
||||||
ld de, S_SPRITEBUFFER1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
|
ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
|
||||||
ld bc, S_SPRITEBUFFER0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
|
ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
|
||||||
ld a, SPRITEBUFFERSIZE/2 ; $c4
|
ld a, SPRITEBUFFERSIZE/2 ; $c4
|
||||||
ld [H_SPRITEINTERLACECOUNTER], a
|
ld [H_SPRITEINTERLACECOUNTER], a
|
||||||
.interlaceLoop
|
.interlaceLoop
|
||||||
|
@ -895,7 +895,7 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
|
||||||
and a
|
and a
|
||||||
jr z, .notFlipped
|
jr z, .notFlipped
|
||||||
ld bc, 2*SPRITEBUFFERSIZE
|
ld bc, 2*SPRITEBUFFERSIZE
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
.swapLoop
|
.swapLoop
|
||||||
swap [hl] ; if flipped swap nybbles in all bytes
|
swap [hl] ; if flipped swap nybbles in all bytes
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -905,7 +905,7 @@ InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
|
||||||
jr nz, .swapLoop
|
jr nz, .swapLoop
|
||||||
.notFlipped
|
.notFlipped
|
||||||
pop hl
|
pop hl
|
||||||
ld de, S_SPRITEBUFFER1
|
ld de, sSpriteBuffer1
|
||||||
ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied
|
ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied
|
||||||
ld a, [H_LOADEDROMBANK]
|
ld a, [H_LOADEDROMBANK]
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
22
home/pic.asm
22
home/pic.asm
|
@ -19,7 +19,7 @@ UncompressSpriteData:: ; 24fd (0:24fd)
|
||||||
|
|
||||||
; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
|
; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
|
||||||
_UncompressSpriteData:: ; 251a (0:251a)
|
_UncompressSpriteData:: ; 251a (0:251a)
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
ld c, (2*SPRITEBUFFERSIZE) % $100
|
ld c, (2*SPRITEBUFFERSIZE) % $100
|
||||||
ld b, (2*SPRITEBUFFERSIZE) / $100
|
ld b, (2*SPRITEBUFFERSIZE) / $100
|
||||||
xor a
|
xor a
|
||||||
|
@ -48,19 +48,19 @@ _UncompressSpriteData:: ; 251a (0:251a)
|
||||||
ld [wSpriteWidth], a
|
ld [wSpriteWidth], a
|
||||||
call ReadNextInputBit
|
call ReadNextInputBit
|
||||||
ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit
|
ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit
|
||||||
; this will load two chunks of data to S_SPRITEBUFFER1 and S_SPRITEBUFFER2
|
; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2
|
||||||
; bit 0 decides in which one the first chunk is placed
|
; bit 0 decides in which one the first chunk is placed
|
||||||
; fall through
|
; fall through
|
||||||
|
|
||||||
; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into S_SPRITEBUFFER1 or S_SPRITEBUFFER2
|
; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2
|
||||||
; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards
|
; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards
|
||||||
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
|
; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack
|
||||||
UncompressSpriteDataLoop:: ; 2556 (0:2556)
|
UncompressSpriteDataLoop:: ; 2556 (0:2556)
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
ld a, [wSpriteLoadFlags]
|
ld a, [wSpriteLoadFlags]
|
||||||
bit 0, a
|
bit 0, a
|
||||||
jr z, .useSpriteBuffer1 ; check which buffer to use
|
jr z, .useSpriteBuffer1 ; check which buffer to use
|
||||||
ld hl, S_SPRITEBUFFER2
|
ld hl, sSpriteBuffer2
|
||||||
.useSpriteBuffer1
|
.useSpriteBuffer1
|
||||||
call StoreSpriteOutputPointer
|
call StoreSpriteOutputPointer
|
||||||
ld a, [wSpriteLoadFlags]
|
ld a, [wSpriteLoadFlags]
|
||||||
|
@ -290,9 +290,9 @@ UnpackSprite:: ; 26bf (0:26bf)
|
||||||
jp z, UnpackSpriteMode2
|
jp z, UnpackSpriteMode2
|
||||||
and a
|
and a
|
||||||
jp nz, XorSpriteChunks
|
jp nz, XorSpriteChunks
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
call SpriteDifferentialDecode
|
call SpriteDifferentialDecode
|
||||||
ld hl, S_SPRITEBUFFER2
|
ld hl, sSpriteBuffer2
|
||||||
; fall through
|
; fall through
|
||||||
|
|
||||||
; decodes differential encoded sprite data
|
; decodes differential encoded sprite data
|
||||||
|
@ -542,12 +542,12 @@ ResetSpriteBufferPointers:: ; 2841 (0:2841)
|
||||||
ld a, [wSpriteLoadFlags]
|
ld a, [wSpriteLoadFlags]
|
||||||
bit 0, a
|
bit 0, a
|
||||||
jr nz, .buffer2Selected
|
jr nz, .buffer2Selected
|
||||||
ld de, S_SPRITEBUFFER1
|
ld de, sSpriteBuffer1
|
||||||
ld hl, S_SPRITEBUFFER2
|
ld hl, sSpriteBuffer2
|
||||||
jr .storeBufferPointers
|
jr .storeBufferPointers
|
||||||
.buffer2Selected
|
.buffer2Selected
|
||||||
ld de, S_SPRITEBUFFER2
|
ld de, sSpriteBuffer2
|
||||||
ld hl, S_SPRITEBUFFER1
|
ld hl, sSpriteBuffer1
|
||||||
.storeBufferPointers
|
.storeBufferPointers
|
||||||
ld a, l
|
ld a, l
|
||||||
ld [wSpriteOutputPtr], a
|
ld [wSpriteOutputPtr], a
|
||||||
|
|
6
sram.asm
6
sram.asm
|
@ -1,8 +1,8 @@
|
||||||
SECTION "Sprite Buffers", SRAM, BANK[0]
|
SECTION "Sprite Buffers", SRAM, BANK[0]
|
||||||
|
|
||||||
S_SPRITEBUFFER0:: ds SPRITEBUFFERSIZE ; a000
|
sSpriteBuffer0:: ds SPRITEBUFFERSIZE ; a000
|
||||||
S_SPRITEBUFFER1:: ds SPRITEBUFFERSIZE ; a188
|
sSpriteBuffer1:: ds SPRITEBUFFERSIZE ; a188
|
||||||
S_SPRITEBUFFER2:: ds SPRITEBUFFERSIZE ; a310
|
sSpriteBuffer2:: ds SPRITEBUFFERSIZE ; a310
|
||||||
|
|
||||||
ds $100
|
ds $100
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue