diff options
Diffstat (limited to 'engine/battle/scale_sprites.asm')
-rw-r--r-- | engine/battle/scale_sprites.asm | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index dae4ad42..98521528 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -1,16 +1,16 @@ ; scales both uncompressed sprite chunks by two in every dimension (creating 2x2 output pixels per input pixel) ; 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 -ScaleSpriteByTwo: ; 2fe40 (b:7e40) - ld de, S_SPRITEBUFFER1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped - ld hl, S_SPRITEBUFFER0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer +ScaleSpriteByTwo: + ld de, sSpriteBuffer1 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped + ld hl, sSpriteBuffer0 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case 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 hl, S_SPRITEBUFFER1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer + ld de, sSpriteBuffer2 + (4*4*8) - 5 ; last byte of input data, last 4 rows already skipped + ld hl, sSpriteBuffer1 + SPRITEBUFFERSIZE - 1 ; end of destination buffer call ScaleLastSpriteColumnByTwo ; last tile column is special case -ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55) +ScaleFirstThreeSpriteColumnsByTwo: ld b, $3 ; 3 tile columns .columnLoop ld c, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows @@ -39,18 +39,18 @@ ScaleFirstThreeSpriteColumnsByTwo: ; 2fe55 (b:7e55) jr nz, .columnLoop ret -ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d) +ScaleLastSpriteColumnByTwo: ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows - ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b - ld bc, -1 ; $ffff + ld [H_SPRITEINTERLACECOUNTER], a + ld bc, -1 .columnInnerLoop ld a, [de] dec de swap a ; only high nybble contains information call ScalePixelsByTwo - ld a, [H_SPRITEINTERLACECOUNTER] ; $ff8b + ld a, [H_SPRITEINTERLACECOUNTER] dec a - ld [H_SPRITEINTERLACECOUNTER], a ; $ff8b + ld [H_SPRITEINTERLACECOUNTER], a jr nz, .columnInnerLoop dec de ; skip last 4 rows of new column dec de @@ -61,7 +61,7 @@ ScaleLastSpriteColumnByTwo: ; 2fe7d (b:7e7d) ; scales the given 4 bits in a (4x1 pixels) to 2 output bytes (8x2 pixels) ; hl: destination pointer ; bc: destination pointer offset (added after the two bytes have been written) -ScalePixelsByTwo: ; 2fe97 (b:7e97) +ScalePixelsByTwo: push hl and $f ld hl, DuplicateBitsTable @@ -78,7 +78,7 @@ ScalePixelsByTwo: ; 2fe97 (b:7e97) ret ; repeats each input bit twice -DuplicateBitsTable: ; 2fea8 (b:7ea8) +DuplicateBitsTable: db $00, $03, $0c, $0f db $30, $33, $3c, $3f db $c0, $c3, $cc, $cf |