pokecrystal/engine/printer.asm

951 lines
15 KiB
NASM
Raw Normal View History

INCLUDE "engine/printer_serial.asm"
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
SendScreenToPrinter: ; 843f0
.loop
2015-11-19 23:07:20 +00:00
call JoyTextDelay
2016-05-11 21:16:03 +00:00
call CheckCancelPrint
jr c, .cancel
2015-11-19 23:07:20 +00:00
ld a, [wJumptableIndex]
bit 7, a
2016-05-11 21:16:03 +00:00
jr nz, .finished
call PrinterJumptableIteration
call CheckPrinterStatus
call PlacePrinterStatusString
2015-11-19 23:07:20 +00:00
call DelayFrame
2016-05-11 21:16:03 +00:00
jr .loop
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.finished
2015-11-19 23:07:20 +00:00
and a
ret
2016-05-11 21:16:03 +00:00
.cancel
2015-11-19 23:07:20 +00:00
scf
ret
; 84411
2016-05-11 21:16:03 +00:00
Printer_CleanUpAfterSend: ; 84411
2015-11-19 23:07:20 +00:00
xor a
2016-05-11 21:16:03 +00:00
ld [wPrinterConnectionOpen], a
ld [wPrinterOpcode], a
2015-11-19 23:07:20 +00:00
ret
; 84419
2016-05-11 21:16:03 +00:00
Printer_PrepareTileMapForPrint: ; 84419
2015-11-19 23:07:20 +00:00
push af
2016-05-11 21:16:03 +00:00
call Printer_StartTransmission
2015-11-19 23:07:20 +00:00
pop af
ld [wcbfa], a
2016-05-11 21:16:03 +00:00
call Printer_CopyTileMapToBuffer
2015-11-19 23:07:20 +00:00
ret
; 84425
2016-05-11 21:16:03 +00:00
Printer_ExitPrinter: ; 84425
2015-11-19 23:07:20 +00:00
call ReturnToMapFromSubmenu
2016-05-11 21:16:03 +00:00
call Printer_RestartMapMusic
2015-11-19 23:07:20 +00:00
ret
; 8442c
2015-11-23 05:21:21 +00:00
PrintDexEntry: ; 8442c
2016-05-11 21:16:03 +00:00
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
2016-05-11 21:16:03 +00:00
2017-12-28 12:32:33 +00:00
ld hl, vTiles1
2015-11-19 23:07:20 +00:00
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
2016-05-11 21:16:03 +00:00
call Printer_StartTransmission
2015-11-19 23:07:20 +00:00
ld a, $10
ld [wcbfa], a
2017-12-24 17:47:30 +00:00
farcall PrintPage1
2015-11-19 23:07:20 +00:00
call ClearTileMap
2016-05-11 21:16:03 +00:00
ld a, %11100100
2015-11-19 23:07:20 +00:00
call DmgToCgbBGPals
call DelayFrame
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
2016-05-11 21:16:03 +00:00
ld a, 8 ; 16 rows
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .skip_second_page ; canceled or got an error
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
call Printer_StartTransmission
2015-11-19 23:07:20 +00:00
ld a, $3
ld [wcbfa], a
2017-12-24 17:47:30 +00:00
farcall PrintPage2
2016-05-11 21:16:03 +00:00
call Printer_ResetJoypadRegisters
ld a, 4
ld [wPrinterQueueLength], a
call SendScreenToPrinter
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.skip_second_page
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
xor a
ld [rIF], a
pop af
ld [rIE], a
2016-05-11 21:16:03 +00:00
call Printer_ExitPrinter
ld c, 8
.low_volume_delay_frames
2015-11-19 23:07:20 +00:00
call LowVolume
call DelayFrame
dec c
2016-05-11 21:16:03 +00:00
jr nz, .low_volume_delay_frames
2015-11-19 23:07:20 +00:00
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
; 844bc
2015-11-23 05:21:21 +00:00
PrintPCBox: ; 844bc (21:44bc)
2016-05-11 21:16:03 +00:00
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
2016-05-11 21:16:03 +00:00
ld a, 18 / 2
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ld a, e
2016-05-11 21:16:03 +00:00
ld [wAddrOfBoxToPrint], a
2015-11-19 23:07:20 +00:00
ld a, d
2016-05-11 21:16:03 +00:00
ld [wAddrOfBoxToPrint + 1], a
2015-11-19 23:07:20 +00:00
ld a, b
2016-05-11 21:16:03 +00:00
ld [wBankOfBoxToPrint], a
2015-11-19 23:07:20 +00:00
ld a, c
2016-05-11 21:16:03 +00:00
ld [wWhichBoxToPrint], a
2015-11-19 23:07:20 +00:00
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
ld [wFinishedPrintingBox], a
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
2016-05-11 21:16:03 +00:00
ld a, %1001
2015-11-19 23:07:20 +00:00
ld [rIE], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
ld hl, hVBlank
ld a, [hl]
push af
2016-05-11 21:16:03 +00:00
ld [hl], %0100
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
call PrintPCBox_Page1
ld a, $10 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
call PrintPCBox_Page2
ld a, $0 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
call PrintPCBox_Page3
ld a, $0 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
call PrintPCBox_Page4
ld a, $3 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
.cancel
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
xor a
ld [rIF], a
pop af
ld [rIE], a
2016-05-11 21:16:03 +00:00
call Printer_ExitPrinter
2015-11-19 23:07:20 +00:00
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
2016-05-11 21:16:03 +00:00
Printer_ResetRegistersAndStartDataSend: ; 84559 (21:4559)
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
2015-11-19 23:07:20 +00:00
ret
2015-11-23 05:21:21 +00:00
PrintUnownStamp: ; 84560
2016-05-11 21:16:03 +00:00
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
ld a, $9
ld [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
xor a
ld [hBGMapMode], a
call LoadTileMapToTempTileMap
2017-12-24 17:47:30 +00:00
farcall PlaceUnownPrinterFrontpic
2016-05-11 21:16:03 +00:00
ld a, $0 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
2015-11-19 23:07:20 +00:00
call Call_LoadTempTileMapToTileMap
2016-05-11 21:16:03 +00:00
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
.loop
2015-11-19 23:07:20 +00:00
call JoyTextDelay
2016-05-11 21:16:03 +00:00
call CheckCancelPrint
jr c, .done
2015-11-19 23:07:20 +00:00
ld a, [wJumptableIndex]
bit 7, a
2016-05-11 21:16:03 +00:00
jr nz, .done
call PrinterJumptableIteration
2015-11-19 23:07:20 +00:00
ld a, [wJumptableIndex]
cp $2
2016-05-11 21:16:03 +00:00
jr nc, .check_status
ld a, 6 / 2
ld [wPrinterRowIndex], a
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.check_status
call CheckPrinterStatus
call PlacePrinterStatusString
2015-11-19 23:07:20 +00:00
call DelayFrame
2016-05-11 21:16:03 +00:00
jr .loop
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.done
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
call Call_LoadTempTileMapToTileMap
xor a
ld [rIF], a
pop af
ld [rIE], a
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
; 845d4
2015-11-23 05:21:21 +00:00
PrintMail: ; 845d4
2016-05-11 21:16:03 +00:00
call PrintMail_
call Printer_ExitPrinter
2015-11-19 23:07:20 +00:00
ret
; 845db
2016-05-11 21:16:03 +00:00
PrintMail_: ; 845db
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
2016-05-11 21:16:03 +00:00
ld a, %1001
2015-11-19 23:07:20 +00:00
ld [rIE], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
ld a, $13 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
2015-11-19 23:07:20 +00:00
ld hl, hVBlank
ld a, [hl]
push af
2016-05-11 21:16:03 +00:00
ld [hl], %0100
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTileMap
2015-11-19 23:07:20 +00:00
xor a
ld [rIF], a
pop af
ld [rIE], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
; 8461a
2015-11-23 05:21:21 +00:00
PrintPartymon: ; 8461a
2016-05-11 21:16:03 +00:00
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
2016-05-11 21:16:03 +00:00
ld a, %1001
2015-11-19 23:07:20 +00:00
ld [rIE], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2017-12-24 17:47:30 +00:00
farcall PrintPartyMonPage1
2016-05-11 21:16:03 +00:00
ld a, $10 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
2015-11-19 23:07:20 +00:00
ld hl, hVBlank
ld a, [hl]
push af
2016-05-11 21:16:03 +00:00
ld [hl], %0100
ld a, 16 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
ld [hBGMapMode], a
2017-12-24 17:47:30 +00:00
farcall PrintPartyMonPage2
2016-05-11 21:16:03 +00:00
ld a, $3 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
ld a, 18 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
.cancel
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTileMap
2015-11-19 23:07:20 +00:00
xor a
ld [rIF], a
pop af
ld [rIE], a
2016-05-11 21:16:03 +00:00
call Printer_ExitPrinter
2015-11-19 23:07:20 +00:00
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
; 84688
_PrintDiploma: ; 84688
2016-05-11 21:16:03 +00:00
ld a, [wPrinterQueueLength]
2015-11-19 23:07:20 +00:00
push af
2016-05-11 21:16:03 +00:00
2017-12-24 17:47:30 +00:00
farcall PlaceDiplomaOnScreen
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
xor a
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2016-05-11 21:16:03 +00:00
call Printer_PlayMusic
2015-11-19 23:07:20 +00:00
ld a, [rIE]
push af
xor a
ld [rIF], a
2016-05-11 21:16:03 +00:00
ld a, %1001
2015-11-19 23:07:20 +00:00
ld [rIE], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
ld hl, hVBlank
ld a, [hl]
push af
2016-05-11 21:16:03 +00:00
ld [hl], %0100
ld a, $10 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
ld c, 12
call DelayFrames
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
call LoadTileMapToTempTileMap
xor a
ld [hBGMapMode], a
2016-05-11 21:16:03 +00:00
2017-12-24 17:47:30 +00:00
farcall PrintDiplomaPage2
2016-05-11 21:16:03 +00:00
ld a, $3 ; to be loaded to wcbfa
call Printer_PrepareTileMapForPrint
2015-11-19 23:07:20 +00:00
call Call_LoadTempTileMapToTileMap
2016-05-11 21:16:03 +00:00
call Printer_ResetJoypadRegisters
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
.cancel
2015-11-19 23:07:20 +00:00
pop af
ld [hVBlank], a
2016-05-11 21:16:03 +00:00
call Printer_CleanUpAfterSend
2015-11-19 23:07:20 +00:00
xor a
ld [rIF], a
pop af
ld [rIE], a
2016-05-11 21:16:03 +00:00
call Printer_ExitPrinter
2015-11-19 23:07:20 +00:00
pop af
2016-05-11 21:16:03 +00:00
ld [wPrinterQueueLength], a
2015-11-19 23:07:20 +00:00
ret
; 846f6
2016-05-11 21:16:03 +00:00
CheckCancelPrint: ; 846f6
2015-11-19 23:07:20 +00:00
ld a, [hJoyDown]
and B_BUTTON
2016-05-11 21:16:03 +00:00
jr nz, .pressed_b
2015-11-19 23:07:20 +00:00
and a
ret
2016-05-11 21:16:03 +00:00
.pressed_b
2015-11-19 23:07:20 +00:00
ld a, [wca80]
cp $c
2016-05-11 21:16:03 +00:00
jr nz, .cancel
.loop
ld a, [wPrinterOpcode]
2015-11-19 23:07:20 +00:00
and a
2016-05-11 21:16:03 +00:00
jr nz, .loop
ld a, $16 ; cancel
ld [wPrinterOpcode], a
2015-11-19 23:07:20 +00:00
ld a, $88
ld [rSB], a
ld a, $1
ld [rSC], a
ld a, $81
ld [rSC], a
2016-05-11 21:16:03 +00:00
.loop2
ld a, [wPrinterOpcode]
2015-11-19 23:07:20 +00:00
and a
2016-05-11 21:16:03 +00:00
jr nz, .loop2
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.cancel
2015-11-19 23:07:20 +00:00
ld a, $1
2015-11-23 05:21:21 +00:00
ld [hPrinter], a
2015-11-19 23:07:20 +00:00
scf
ret
; 84728
2016-05-11 21:16:03 +00:00
Printer_CopyTileMapToBuffer: ; 84728
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
2016-05-11 21:16:03 +00:00
ld de, wPrinterTileMapBuffer
2015-11-19 23:07:20 +00:00
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84735
2016-05-11 21:16:03 +00:00
Printer_CopyBufferToTileMap: ; 84735
ld hl, wPrinterTileMapBuffer
2015-11-19 23:07:20 +00:00
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 84742
2016-05-11 21:16:03 +00:00
Printer_ResetJoypadRegisters: ; 84742
2015-11-19 23:07:20 +00:00
xor a
ld [hJoyReleased], a
ld [hJoyPressed], a
ld [hJoyDown], a
ld [hJoyLast], a
ret
; 8474c
2016-05-11 21:16:03 +00:00
Printer_PlayMusic: ; 8474c
2015-11-19 23:07:20 +00:00
ld de, MUSIC_PRINTER
call PlayMusic2
ret
; 84753
2016-05-11 21:16:03 +00:00
Printer_RestartMapMusic: ; 84753
2015-11-19 23:07:20 +00:00
call RestartMapMusic
ret
; 84757
2016-05-11 21:16:03 +00:00
CheckPrinterStatus: ; 84757
; Check for printer errors
; If [ca88] == -1, we're disconnected
ld a, [wPrinterHandshake]
2015-11-19 23:07:20 +00:00
cp -1
jr nz, .printer_connected
2016-05-11 21:16:03 +00:00
ld a, [wPrinterStatusFlags]
2015-11-19 23:07:20 +00:00
cp -1
jr z, .error_2
.printer_connected
2016-05-11 21:16:03 +00:00
; ca89 contains printer status flags
ld a, [wPrinterStatusFlags]
2015-11-19 23:07:20 +00:00
and %11100000
ret z ; no error
bit 7, a
jr nz, .error_1
bit 6, a
jr nz, .error_4
2016-05-11 21:16:03 +00:00
; paper error
ld a, PRINTER_ERROR_3
2015-11-19 23:07:20 +00:00
jr .load_text_index
.error_4
2016-05-11 21:16:03 +00:00
; temperature error
ld a, PRINTER_ERROR_4
2015-11-19 23:07:20 +00:00
jr .load_text_index
.error_1
2016-05-11 21:16:03 +00:00
; printer battery low
ld a, PRINTER_ERROR_1
2015-11-19 23:07:20 +00:00
jr .load_text_index
.error_2
2016-05-11 21:16:03 +00:00
; connection error
ld a, PRINTER_ERROR_2
2015-11-19 23:07:20 +00:00
.load_text_index
2016-05-11 21:16:03 +00:00
ld [wPrinterStatus], a
2015-11-19 23:07:20 +00:00
ret
; 84785
2016-05-11 21:16:03 +00:00
PlacePrinterStatusString: ; 84785
; Print nonzero printer status
ld a, [wPrinterStatus]
2015-11-19 23:07:20 +00:00
and a
ret z
push af
xor a
ld [hBGMapMode], a
hlcoord 0, 5
lb bc, 10, 18
call TextBox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
2015-11-19 23:07:20 +00:00
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 1, 7
ld a, BANK(GBPrinterStrings)
call FarString
hlcoord 2, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ld [hBGMapMode], a
xor a
2016-05-11 21:16:03 +00:00
ld [wPrinterStatus], a
2015-11-19 23:07:20 +00:00
ret
; 847bd
Function847bd: ; 847bd
2016-05-11 21:16:03 +00:00
; XXX
ld a, [wPrinterStatus]
2015-11-19 23:07:20 +00:00
and a
ret z
push af
xor a
ld [hBGMapMode], a
hlcoord 2, 4
lb bc, 13, 16
call ClearBox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
2015-11-19 23:07:20 +00:00
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 4, 7
ld a, BANK(GBPrinterStrings)
call FarString
hlcoord 4, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ld [hBGMapMode], a
xor a
2016-05-11 21:16:03 +00:00
ld [wPrinterStatus], a
2015-11-19 23:07:20 +00:00
ret
; 847f5
String_PressBToCancel:
db "Press B to Cancel@"
; 84807
PrinterStatusStringPointers: ; 84807
2016-05-11 21:16:03 +00:00
dw GBPrinterString_Null ; @
dw GBPrinterString_CheckingLink ; CHECKING LINK
dw GBPrinterString_Transmitting ; TRANSMITTING
dw GBPrinterString_Printing ; PRINTING
dw GBPrinterString_PrinterError1 ; error 1
dw GBPrinterString_PrinterError2 ; error 2
dw GBPrinterString_PrinterError3 ; error 3
dw GBPrinterString_PrinterError4 ; error 4
2015-11-19 23:07:20 +00:00
; 84817
2016-05-11 21:16:03 +00:00
PrintPCBox_Page1: ; 84817 (21:4817)
2015-11-19 23:07:20 +00:00
xor a
2016-05-11 21:16:03 +00:00
ld [wWhichBoxMonToPrint], a
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
2015-11-23 05:21:21 +00:00
call Printer_PlaceEmptyBoxSlotString
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld bc, 9 * SCREEN_WIDTH
ld a, " "
call ByteFill
2016-05-11 21:16:03 +00:00
2015-11-23 05:21:21 +00:00
call Printer_PlaceSideBorders
call Printer_PlaceTopBorder
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
hlcoord 4, 3
2015-11-23 05:21:21 +00:00
ld de, .String_PokemonList
2015-11-19 23:07:20 +00:00
call PlaceString
2016-05-11 21:16:03 +00:00
ld a, [wWhichBoxToPrint]
2015-11-19 23:07:20 +00:00
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
hlcoord 6, 5
call PlaceString
2016-05-11 21:16:03 +00:00
ld a, 1
call Printer_GetBoxMonSpecies
2015-11-19 23:07:20 +00:00
hlcoord 2, 9
2016-05-11 21:16:03 +00:00
ld c, 3
call Printer_PrintBoxListSegment
2015-11-19 23:07:20 +00:00
ret
; 84865 (21:4865)
2015-11-23 05:21:21 +00:00
.String_PokemonList:
2015-11-19 23:07:20 +00:00
db "#MON LIST@"
; 8486f
2016-05-11 21:16:03 +00:00
PrintPCBox_Page2: ; 8486f (21:486f)
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
2015-11-23 05:21:21 +00:00
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
2016-05-11 21:16:03 +00:00
ld a, [wFinishedPrintingBox]
2015-11-19 23:07:20 +00:00
and a
ret nz
2016-05-11 21:16:03 +00:00
ld a, 4
call Printer_GetBoxMonSpecies
2015-11-19 23:07:20 +00:00
hlcoord 2, 0
2016-05-11 21:16:03 +00:00
ld c, 6
call Printer_PrintBoxListSegment
2015-11-19 23:07:20 +00:00
ret
2016-05-11 21:16:03 +00:00
PrintPCBox_Page3: ; 84893 (21:4893)
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
2015-11-23 05:21:21 +00:00
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
2016-05-11 21:16:03 +00:00
ld a, [wFinishedPrintingBox]
2015-11-19 23:07:20 +00:00
and a
ret nz
2016-05-11 21:16:03 +00:00
ld a, 10
call Printer_GetBoxMonSpecies
2015-11-19 23:07:20 +00:00
hlcoord 2, 0
2016-05-11 21:16:03 +00:00
ld c, 6
call Printer_PrintBoxListSegment
2015-11-19 23:07:20 +00:00
ret
2016-05-11 21:16:03 +00:00
PrintPCBox_Page4: ; 848b7 (21:48b7)
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
2015-11-23 05:21:21 +00:00
call Printer_PlaceEmptyBoxSlotString
2015-11-19 23:07:20 +00:00
hlcoord 1, 15
lb bc, 2, 18
call ClearBox
2015-11-23 05:21:21 +00:00
call Printer_PlaceSideBorders
call Printer_PlaceBottomBorders
2016-05-11 21:16:03 +00:00
ld a, [wFinishedPrintingBox]
2015-11-19 23:07:20 +00:00
and a
ret nz
2016-05-11 21:16:03 +00:00
ld a, 16
call Printer_GetBoxMonSpecies
2015-11-19 23:07:20 +00:00
hlcoord 2, 0
2016-05-11 21:16:03 +00:00
ld c, 5
call Printer_PrintBoxListSegment
2015-11-19 23:07:20 +00:00
ret
2016-05-11 21:16:03 +00:00
Printer_PrintBoxListSegment: ; 848e7 (21:48e7)
ld a, [wBankOfBoxToPrint]
2015-11-19 23:07:20 +00:00
call GetSRAMBank
2016-05-11 21:16:03 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld a, c
and a
2016-05-11 21:16:03 +00:00
jp z, .max_length
2015-11-19 23:07:20 +00:00
dec c
ld a, [de]
cp $ff
2016-05-11 21:16:03 +00:00
jp z, .finish
2015-11-19 23:07:20 +00:00
ld [wd265], a
ld [CurPartySpecies], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push bc
push hl
push de
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
2016-05-11 21:16:03 +00:00
ld bc, 16
2015-11-19 23:07:20 +00:00
ld a, " "
call ByteFill
pop hl
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
call GetBasePokemonName
pop hl
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
call PlaceString
ld a, [CurPartySpecies]
2015-11-23 05:21:21 +00:00
cp EGG
2015-11-19 23:07:20 +00:00
pop hl
jr z, .ok2
2016-05-11 21:16:03 +00:00
ld bc, PKMN_NAME_LENGTH
2015-11-19 23:07:20 +00:00
add hl, bc
2016-05-11 21:16:03 +00:00
call Printer_GetMonGender
ld bc, SCREEN_WIDTH - PKMN_NAME_LENGTH
2015-11-19 23:07:20 +00:00
add hl, bc
2015-11-23 05:21:21 +00:00
ld a, "/"
2015-11-19 23:07:20 +00:00
ld [hli], a
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
2016-05-11 21:16:03 +00:00
ld bc, 14
2015-11-19 23:07:20 +00:00
ld a, " "
call ByteFill
pop hl
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint]
2015-11-19 23:07:20 +00:00
ld l, a
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint + 1]
2015-11-19 23:07:20 +00:00
ld h, a
2016-05-11 21:16:03 +00:00
ld bc, sBoxMonNicknames - sBox
2015-11-19 23:07:20 +00:00
add hl, bc
2016-05-11 21:16:03 +00:00
ld bc, PKMN_NAME_LENGTH
ld a, [wWhichBoxMonToPrint]
2015-11-19 23:07:20 +00:00
call AddNTimes
ld e, l
ld d, h
pop hl
2016-05-11 21:16:03 +00:00
2015-11-19 23:07:20 +00:00
push hl
call PlaceString
pop hl
2016-05-11 21:16:03 +00:00
ld bc, PKMN_NAME_LENGTH
2015-11-19 23:07:20 +00:00
add hl, bc
push hl
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint]
2015-11-19 23:07:20 +00:00
ld l, a
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint + 1]
2015-11-19 23:07:20 +00:00
ld h, a
2016-05-11 21:16:03 +00:00
ld bc, 2 + MONS_PER_BOX + MON_LEVEL
2015-11-19 23:07:20 +00:00
add hl, bc
2016-05-11 21:16:03 +00:00
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
2015-11-19 23:07:20 +00:00
call AddNTimes
ld a, [hl]
pop hl
call PrintLevel_Force3Digits
2015-11-19 23:07:20 +00:00
.ok2
2016-05-11 21:16:03 +00:00
ld hl, wWhichBoxMonToPrint
2015-11-19 23:07:20 +00:00
inc [hl]
pop de
pop hl
2016-05-11 21:16:03 +00:00
ld bc, 3 * SCREEN_WIDTH
2015-11-19 23:07:20 +00:00
add hl, bc
pop bc
inc de
2016-05-11 21:16:03 +00:00
jp .loop
2015-11-19 23:07:20 +00:00
2016-05-11 21:16:03 +00:00
.finish
2015-11-19 23:07:20 +00:00
ld a, $1
2016-05-11 21:16:03 +00:00
ld [wFinishedPrintingBox], a
.max_length
2015-11-19 23:07:20 +00:00
call CloseSRAM
ret
2016-05-11 21:16:03 +00:00
Printer_GetMonGender: ; 8498a (21:498a)
2015-11-19 23:07:20 +00:00
push hl
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint]
2015-11-19 23:07:20 +00:00
ld l, a
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint + 1]
2015-11-19 23:07:20 +00:00
ld h, a
ld bc, $2b
add hl, bc
2016-05-11 21:16:03 +00:00
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
2015-11-19 23:07:20 +00:00
call AddNTimes
ld de, TempMonDVs
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
2016-05-11 21:16:03 +00:00
ld a, [wWhichBoxMonToPrint]
2015-11-19 23:07:20 +00:00
ld [CurPartyMon], a
2016-05-11 21:16:03 +00:00
ld a, TEMPMON
2015-11-19 23:07:20 +00:00
ld [MonType], a
2017-12-24 17:47:30 +00:00
farcall GetGender
2016-05-11 21:16:03 +00:00
ld a, " "
jr c, .got_gender
ld a, "♂"
jr nz, .got_gender
ld a, "♀"
.got_gender
2015-11-19 23:07:20 +00:00
pop hl
ld [hli], a
ret
2016-05-11 21:16:03 +00:00
Printer_GetBoxMonSpecies: ; 849c6 (21:49c6)
2015-11-19 23:07:20 +00:00
push hl
ld e, a
ld d, $0
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint]
2015-11-19 23:07:20 +00:00
ld l, a
2016-05-11 21:16:03 +00:00
ld a, [wAddrOfBoxToPrint + 1]
2015-11-19 23:07:20 +00:00
ld h, a
add hl, de
ld e, l
ld d, h
pop hl
ret
2015-11-23 05:21:21 +00:00
Printer_PlaceTopBorder: ; 849d7 (21:49d7)
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld a, "┌"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
2015-11-23 05:21:21 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld [hli], a
dec c
2015-11-23 05:21:21 +00:00
jr nz, .loop
2015-11-19 23:07:20 +00:00
ld a, "┐"
ld [hl], a
ret
2015-11-23 05:21:21 +00:00
Printer_PlaceSideBorders: ; 849e9 (21:49e9)
2015-11-19 23:07:20 +00:00
hlcoord 0, 0
ld de, SCREEN_WIDTH - 1
ld c, SCREEN_HEIGHT
2015-11-23 05:21:21 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld a, "│"
ld [hl], a
add hl, de
ld a, "│"
ld [hli], a
dec c
2015-11-23 05:21:21 +00:00
jr nz, .loop
2015-11-19 23:07:20 +00:00
ret
2015-11-23 05:21:21 +00:00
Printer_PlaceBottomBorders: ; 849fc (21:49fc)
2015-11-19 23:07:20 +00:00
hlcoord 0, 17
ld a, "└"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
2015-11-23 05:21:21 +00:00
.loop
2015-11-19 23:07:20 +00:00
ld [hli], a
dec c
2015-11-23 05:21:21 +00:00
jr nz, .loop
2015-11-19 23:07:20 +00:00
ld a, "┘"
ld [hl], a
ret
2015-11-23 05:21:21 +00:00
Printer_PlaceEmptyBoxSlotString: ; 84a0e (21:4a0e)
2015-11-19 23:07:20 +00:00
hlcoord 2, 0
ld c, $6
2015-11-23 05:21:21 +00:00
.loop
2015-11-19 23:07:20 +00:00
push bc
push hl
ld de, String84a25
call PlaceString
pop hl
2015-11-23 05:21:21 +00:00
ld bc, 3 * SCREEN_WIDTH
2015-11-19 23:07:20 +00:00
add hl, bc
pop bc
dec c
2015-11-23 05:21:21 +00:00
jr nz, .loop
2015-11-19 23:07:20 +00:00
ret
; 84a25 (21:4a25)
String84a25: ; 84a25
db " ------@"
; 84a2e