2018-06-24 07:09:41 -07:00
|
|
|
RotateUnownFrontpic:
|
2017-12-15 18:22:26 -08:00
|
|
|
; something to do with Unown printer
|
|
|
|
push de
|
2020-04-17 07:52:59 -07:00
|
|
|
xor a ; BANK(sScratch)
|
2017-12-15 18:22:26 -08:00
|
|
|
call GetSRAMBank
|
|
|
|
ld hl, sScratch
|
|
|
|
ld bc, 0
|
|
|
|
.loop
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld de, wd002
|
|
|
|
call .Copy
|
|
|
|
call .Rotate
|
2018-03-19 08:36:14 -07:00
|
|
|
ld hl, UnownPrinter_GBPrinterRectangle
|
2017-12-15 18:22:26 -08:00
|
|
|
pop bc
|
|
|
|
add hl, bc
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld d, [hl]
|
|
|
|
ld hl, wd012
|
|
|
|
call .Copy
|
|
|
|
pop hl
|
|
|
|
ld bc, $10
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp 7 * 7
|
|
|
|
jr c, .loop
|
|
|
|
|
2018-03-19 08:36:14 -07:00
|
|
|
ld hl, wGameboyPrinterRAM
|
2017-12-15 18:22:26 -08:00
|
|
|
ld de, sScratch
|
|
|
|
ld bc, 7 * 7 tiles
|
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
ld de, sScratch
|
|
|
|
ld c, 7 * 7
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2017-12-15 18:22:26 -08:00
|
|
|
ld b, a
|
|
|
|
call Get2bpp
|
|
|
|
call CloseSRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Copy:
|
2017-12-15 18:22:26 -08:00
|
|
|
ld c, $10
|
|
|
|
.loop_copy
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop_copy
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Rotate:
|
2017-12-15 18:22:26 -08:00
|
|
|
ld hl, wd012
|
|
|
|
ld e, %10000000
|
|
|
|
ld d, 8
|
|
|
|
.loop_decompress
|
|
|
|
push hl
|
|
|
|
ld hl, wd002
|
|
|
|
call .CountSetBit
|
|
|
|
pop hl
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
push hl
|
|
|
|
ld hl, wd003
|
|
|
|
call .CountSetBit
|
|
|
|
pop hl
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
srl e
|
|
|
|
dec d
|
|
|
|
jr nz, .loop_decompress
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CountSetBit:
|
2017-12-15 18:22:26 -08: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
|
|
|
|
|
2018-03-19 08:36:14 -07:00
|
|
|
gbprinterrect: MACRO
|
2017-12-15 18:22:26 -08:00
|
|
|
y = 0
|
|
|
|
rept \1
|
2020-03-21 11:01:05 -07:00
|
|
|
x = \1 * (\2 - 1) + y
|
2017-12-15 18:22:26 -08:00
|
|
|
rept \2
|
2018-03-19 08:36:14 -07:00
|
|
|
dw wGameboyPrinterRAM tile x
|
2020-03-21 11:01:05 -07:00
|
|
|
x = x - \2
|
2017-12-15 18:22:26 -08:00
|
|
|
endr
|
|
|
|
y = y + 1
|
|
|
|
endr
|
2017-12-28 13:31:16 -08:00
|
|
|
ENDM
|
2017-12-15 18:22:26 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
UnownPrinter_GBPrinterRectangle:
|
2018-03-19 08:36:14 -07:00
|
|
|
gbprinterrect 7, 7
|