2018-06-24 14:09:41 +00:00
|
|
|
RotateUnownFrontpic:
|
2017-12-16 02:22:26 +00:00
|
|
|
; something to do with Unown printer
|
|
|
|
push de
|
2020-04-17 14:52:59 +00:00
|
|
|
xor a ; BANK(sScratch)
|
2020-06-17 21:03:38 +00:00
|
|
|
call OpenSRAM
|
2017-12-16 02:22:26 +00:00
|
|
|
ld hl, sScratch
|
|
|
|
ld bc, 0
|
|
|
|
.loop
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
push bc
|
2020-10-28 17:35:39 +00:00
|
|
|
ld de, wPrintedUnownTileSource
|
2017-12-16 02:22:26 +00:00
|
|
|
call .Copy
|
|
|
|
call .Rotate
|
2018-03-19 15:36:14 +00:00
|
|
|
ld hl, UnownPrinter_GBPrinterRectangle
|
2017-12-16 02:22:26 +00:00
|
|
|
pop bc
|
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld d, [hl]
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, wPrintedUnownTileDest
|
2017-12-16 02:22:26 +00:00
|
|
|
call .Copy
|
|
|
|
pop hl
|
2020-10-28 17:35:39 +00:00
|
|
|
ld bc, LEN_2BPP_TILE
|
2017-12-16 02:22:26 +00:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp 7 * 7
|
|
|
|
jr c, .loop
|
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
ld hl, wGameboyPrinter2bppSource
|
2017-12-16 02:22:26 +00:00
|
|
|
ld de, sScratch
|
|
|
|
ld bc, 7 * 7 tiles
|
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
ld de, sScratch
|
|
|
|
ld c, 7 * 7
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hROMBank]
|
2017-12-16 02:22:26 +00:00
|
|
|
ld b, a
|
|
|
|
call Get2bpp
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Copy:
|
2020-10-28 17:35:39 +00:00
|
|
|
ld c, LEN_2BPP_TILE
|
2017-12-16 02:22:26 +00:00
|
|
|
.loop_copy
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop_copy
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Rotate:
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, wPrintedUnownTileDest
|
2017-12-16 02:22:26 +00:00
|
|
|
ld e, %10000000
|
|
|
|
ld d, 8
|
|
|
|
.loop_decompress
|
|
|
|
push hl
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, wPrintedUnownTileSource
|
2017-12-16 02:22:26 +00:00
|
|
|
call .CountSetBit
|
|
|
|
pop hl
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
push hl
|
2020-10-29 18:45:40 +00:00
|
|
|
ld hl, wPrintedUnownTileSource + 1
|
2017-12-16 02:22:26 +00:00
|
|
|
call .CountSetBit
|
|
|
|
pop hl
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
srl e
|
|
|
|
dec d
|
|
|
|
jr nz, .loop_decompress
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.CountSetBit:
|
2017-12-16 02:22:26 +00:00
|
|
|
ld b, 0
|
|
|
|
ld c, 8
|
|
|
|
.loop_count
|
|
|
|
ld a, [hli]
|
|
|
|
and e
|
|
|
|
jr z, .clear
|
|
|
|
scf
|
|
|
|
jr .apply
|
|
|
|
|
|
|
|
.clear
|
|
|
|
and a
|
|
|
|
|
|
|
|
.apply
|
|
|
|
rr b
|
|
|
|
inc hl
|
|
|
|
dec c
|
|
|
|
jr nz, .loop_count
|
|
|
|
ret
|
|
|
|
|
2021-04-19 20:31:37 +00:00
|
|
|
UnownPrinter_GBPrinterRectangle:
|
|
|
|
for y, 7
|
|
|
|
for x, 7 - 1, -1, -1
|
|
|
|
dw wGameboyPrinter2bppSource tile (x * 7 + y)
|
2017-12-16 02:22:26 +00:00
|
|
|
endr
|
|
|
|
endr
|