summaryrefslogtreecommitdiff
path: root/engine/events
diff options
context:
space:
mode:
authorentrpntr <12521136+entrpntr@users.noreply.github.com>2020-06-05 17:54:54 -0400
committerGitHub <noreply@github.com>2020-06-05 17:54:54 -0400
commit41aed88e16a138293971d63e7facfceb8f612c60 (patch)
tree214be900e6128abe76d6d1b599068da02abfc40a /engine/events
parente28325211cfc584ebed4389ab242014cc80ab2c9 (diff)
parent13eb43eb1b14d227b73ccfc6ba000ff982189425 (diff)
Merge pull request #44 from libjet/bank38
Disassemble bank $38
Diffstat (limited to 'engine/events')
-rwxr-xr-xengine/events/diploma.asm93
-rwxr-xr-xengine/events/print_unown_2.asm111
2 files changed, 204 insertions, 0 deletions
diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm
new file mode 100755
index 00000000..22cbcdd7
--- /dev/null
+++ b/engine/events/diploma.asm
@@ -0,0 +1,93 @@
+ret_e0000:
+ ret
+
+ ret ; unused
+
+_Diploma:
+ call PlaceDiplomaOnScreen
+ call WaitPressAorB_BlinkCursor
+ ret
+
+PlaceDiplomaOnScreen:
+ call ClearBGPalettes
+ call ClearTilemap
+ call ClearSprites
+ call DisableLCD
+ ld hl, DiplomaGFX
+ ld de, vTiles2
+ call Decompress
+ ld hl, DiplomaPage1Tilemap
+ decoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ call CopyBytes
+ ld de, .Player
+ hlcoord 2, 5
+ call PlaceString
+ ld de, .EmptyString
+ hlcoord 15, 5
+ call PlaceString
+ ld de, wPlayerName
+ hlcoord 9, 5
+ call PlaceString
+ ld de, .Certification
+ hlcoord 2, 8
+ call PlaceString
+ call EnableLCD
+ call WaitBGMap
+ ld b, SCGB_DIPLOMA
+ call GetSGBLayout
+ call SetPalettes
+ call DelayFrame
+ ret
+
+.Player:
+ db "PLAYER@"
+
+.EmptyString:
+ db "@"
+
+.Certification:
+ db "This certifies"
+ next "that you have"
+ next "completed the"
+ next "new #DEX."
+ next "Congratulations!"
+ db "@"
+
+PrintDiplomaPage2:
+ hlcoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, " "
+ call ByteFill
+ ld hl, DiplomaPage2Tilemap
+ decoord 0, 0
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ call CopyBytes
+ ld de, .GameFreak
+ hlcoord 8, 0
+ call PlaceString
+ ld de, .PlayTime
+ hlcoord 3, 15
+ call PlaceString
+ hlcoord 12, 15
+ ld de, wGameTimeHours
+ lb bc, 2, 4
+ call PrintNum
+ ld [hl], $67 ; colon
+ inc hl
+ ld de, wGameTimeMinutes
+ lb bc, PRINTNUM_LEADINGZEROS | 1, 2
+ call PrintNum
+ ret
+
+.PlayTime: db "PLAY TIME@"
+.GameFreak: db "GAME FREAK@"
+
+DiplomaGFX:
+INCBIN "gfx/diploma/diploma.2bpp.lz"
+
+DiplomaPage1Tilemap:
+INCBIN "gfx/diploma/page1.tilemap"
+
+DiplomaPage2Tilemap:
+INCBIN "gfx/diploma/page2.tilemap"
diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm
new file mode 100755
index 00000000..aaeeec76
--- /dev/null
+++ b/engine/events/print_unown_2.asm
@@ -0,0 +1,111 @@
+RotateUnownFrontpic:
+; something to do with Unown printer
+ push de
+ xor a ; BANK(sScratch)
+ call OpenSRAM
+ ld hl, sScratch
+ ld bc, 0
+.loop
+ push bc
+ push hl
+ push bc
+ ld de, wceed
+ call .Copy
+ call .Rotate
+ ld hl, UnownPrinter_GBPrinterRectangle
+ pop bc
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ ld hl, wcefd
+ call .Copy
+ pop hl
+ ld bc, $10
+ add hl, bc
+ pop bc
+ inc c
+ ld a, c
+ cp 7 * 7
+ jr c, .loop
+
+ ld hl, wGameboyPrinterRAM
+ ld de, sScratch
+ ld bc, 7 * 7 tiles
+ call CopyBytes
+ pop hl
+ ld de, sScratch
+ ld c, 7 * 7
+ ldh a, [hROMBank]
+ ld b, a
+ call Get2bpp
+ call CloseSRAM
+ ret
+
+.Copy:
+ ld c, $10
+.loop_copy
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .loop_copy
+ ret
+
+.Rotate:
+ ld hl, wcefd
+ ld e, %10000000
+ ld d, 8
+.loop_decompress
+ push hl
+ ld hl, wceed
+ call .CountSetBit
+ pop hl
+ ld a, b
+ ld [hli], a
+ push hl
+ ld hl, wceee
+ call .CountSetBit
+ pop hl
+ ld a, b
+ ld [hli], a
+ srl e
+ dec d
+ jr nz, .loop_decompress
+ ret
+
+.CountSetBit:
+ 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
+
+gbprinterrect: MACRO
+y = 0
+rept \1
+x = \1 * (\2 - 1) + y
+rept \2
+ dw wGameboyPrinterRAM tile x
+x = x - \2
+endr
+y = y + 1
+endr
+ENDM
+
+UnownPrinter_GBPrinterRectangle:
+ gbprinterrect 7, 7