From 1c008fa2a9b9e9dd9865791629f8aefb1f0d6194 Mon Sep 17 00:00:00 2001 From: Artrios Date: Fri, 9 Sep 2022 22:03:00 +0800 Subject: [PATCH] Add disassembled regi decoration card --- decoration/08-O001.asm | 1145 +++++++++++++++++ decoration/08-O002.asm | 1181 ++++++++++++++++++ decoration/Makefile | 64 + decoration/decoration-tickets.asm | 132 ++ decoration/decoration.asm | 123 ++ decoration/prologue.asm | 14 + decoration/sprites/arrow-ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/arrow.4bpp | Bin 0 -> 32 bytes decoration/sprites/arrow.gbapal | Bin 0 -> 32 bytes decoration/sprites/aurora_ticket.4bpp | Bin 0 -> 288 bytes decoration/sprites/aurora_ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/eon_ticket.4bpp | Bin 0 -> 288 bytes decoration/sprites/eon_ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/mystic_ticket.4bpp | Bin 0 -> 288 bytes decoration/sprites/mystic_ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/pokeball_bg-ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/pokeball_bg.4bpp | 1 + decoration/sprites/pokeball_bg.gbapal | Bin 0 -> 32 bytes decoration/sprites/pokeball_bg.tilemap | Bin 0 -> 2048 bytes decoration/sprites/regi.gbapal | 1 + decoration/sprites/regice.4bpp | Bin 0 -> 512 bytes decoration/sprites/regirock.4bpp | Bin 0 -> 512 bytes decoration/sprites/registeel.4bpp | Bin 0 -> 512 bytes decoration/sprites/text.gbapal | Bin 0 -> 12 bytes decoration/sprites/textbox_main.tilemap | Bin 0 -> 1280 bytes decoration/sprites/textboxes-ticket.gbapal | Bin 0 -> 32 bytes decoration/sprites/textboxes.4bpp | Bin 0 -> 320 bytes decoration/sprites/textboxes.gbapal | Bin 0 -> 32 bytes decoration/sprites/textboxes.tilemap | Bin 0 -> 1280 bytes macros.asm | 69 + scripts/checksum_regi.py | 105 ++ 31 files changed, 2835 insertions(+) create mode 100644 decoration/08-O001.asm create mode 100644 decoration/08-O002.asm create mode 100644 decoration/Makefile create mode 100644 decoration/decoration-tickets.asm create mode 100644 decoration/decoration.asm create mode 100644 decoration/prologue.asm create mode 100644 decoration/sprites/arrow-ticket.gbapal create mode 100644 decoration/sprites/arrow.4bpp create mode 100644 decoration/sprites/arrow.gbapal create mode 100644 decoration/sprites/aurora_ticket.4bpp create mode 100644 decoration/sprites/aurora_ticket.gbapal create mode 100644 decoration/sprites/eon_ticket.4bpp create mode 100644 decoration/sprites/eon_ticket.gbapal create mode 100644 decoration/sprites/mystic_ticket.4bpp create mode 100644 decoration/sprites/mystic_ticket.gbapal create mode 100644 decoration/sprites/pokeball_bg-ticket.gbapal create mode 100644 decoration/sprites/pokeball_bg.4bpp create mode 100644 decoration/sprites/pokeball_bg.gbapal create mode 100644 decoration/sprites/pokeball_bg.tilemap create mode 100644 decoration/sprites/regi.gbapal create mode 100644 decoration/sprites/regice.4bpp create mode 100644 decoration/sprites/regirock.4bpp create mode 100644 decoration/sprites/registeel.4bpp create mode 100644 decoration/sprites/text.gbapal create mode 100644 decoration/sprites/textbox_main.tilemap create mode 100644 decoration/sprites/textboxes-ticket.gbapal create mode 100644 decoration/sprites/textboxes.4bpp create mode 100644 decoration/sprites/textboxes.gbapal create mode 100644 decoration/sprites/textboxes.tilemap create mode 100644 scripts/checksum_regi.py diff --git a/decoration/08-O001.asm b/decoration/08-O001.asm new file mode 100644 index 0000000..95832e4 --- /dev/null +++ b/decoration/08-O001.asm @@ -0,0 +1,1145 @@ +INCLUDE "../macros.asm" +SECTION "decoration",ROM0[$100] +jp Start +db $00 + +;memory structs for deco card, don't touch +RegionHandlePtr0104: db 0,0 +RegionHandlePtr0106: + REPT 14 + db 0 + ENDR +RegionHandlePtr0114: + REPT 32 + db 0 + ENDR + +;Also don't touch +Prologue: + INCBIN "prologue-{REGION_NAME}.bin" + +; The data chunks from decoration.asm +DataPacket: + INCBIN "decoration-{REGION_NAME}.mev" + +; Pointers to the data chunks found in decoration.asm +; Currently needs to be changed manually +DataPointers: + db $70,$01 ; DataStartRegirock + db $F7,$01 ; DataStartRegice + db $7E,$02 ; DataStartRegisteel + +; Transfer data +sub_02D2: + LD_IND_HL RegionHandlePtr283D + push de + ld hl,$bbbb + LD_IND_HL RegionHandlePtr0104 + EX_DE_HL + LD_IND_HL RegionHandlePtr0106 + API_0C7 RegionHandlePtr0104 + wait $01 + pop hl + inc hl + ld b,$01 + call sub_2817 + LD_IND_HL RegionHandlePtr283B + +label_27: + LD_HL_IND RegionHandlePtr283B + ld a,l + or h + jr z,label_28 + ld hl,$8888 + LD_IND_HL RegionHandlePtr0104 + ld e,$01 + +label_29: + ld a,e + cp $08 + jr nc,label_30 + push de + LD_HL_IND RegionHandlePtr283D + ld c, [hl] + inc hl + ld b, [hl] + inc hl + LD_IND_HL RegionHandlePtr283D + ld l,e + ld h,$00 + add hl,hl + ld de, RegionHandlePtr0104 + add hl,de + ld [hl], c + inc hl + ld [hl], b + pop de + LD_HL_IND RegionHandlePtr283B + dec hl + LD_IND_HL RegionHandlePtr283B + ld a,l + or h + jr z,label_30 + inc e + jr label_29 + +label_30: + API_0C7 RegionHandlePtr0104 + API $0CA + cp $02 + jr nc,label_31 + xor a + ret + +label_31: + ld hl,RegionHandlePtr0114 + API $0C8 + or a + jr nz,label_32 + xor a + ret + +label_32: + wait $01 + jr label_27 + +label_28: + ld a,$01 + ret + +sub_0348: + ld hl,$5fff + LD_IND_HL RegionHandlePtr0104 + API_0C7 RegionHandlePtr0104 + wait $01 + ret + +sub_0356: + API $0EB + wait $01 + API $0C6 + wait $01 + ld l,$02 + push hl + ld bc,$b9a0 + ld de,$0076 + ld a,$08 + API $0C4 + pop bc + API $0C5 +label_19: + wait $01 + API $0DB + cp $01 + jr z,label_19 + API $0DB + or a + jr z,label_19 +label_20: + wait $01 + LD_HL_IND $00C2 + ld a,l + and $02 + jr z,label_21 + API $0EB + xor a + ret +label_21: + API $0CA + cp $02 + jr c,label_20 + ld a,$01 + ret + +sub_0392: + wait $01 + API $0CA + cp $02 + jr nc,label_23 + API $0EB + xor a + ret +label_23: + API $0DB + cp $04 + jr z,label_24 + API $0DB + cp $03 + jr nz,sub_0392 +label_24: + ld a,$01 + ret + +sub_03AD: + wait $01 + ld hl,RegionHandlePtr0114 + API $0C8 + or a + jr nz,label_26 + API $0EB + xor a + ret +label_26: + LD_HL_IND RegionHandlePtr0114 + ld a,l + cp $22 + jr nz,sub_03AD + ld a,h + cp $22 + jr nz,sub_03AD + ld a,$01 + ret + +sub_03CB: + LD_IND_A RegionHandlePtr283F + ld de,$003c + ld hl,$0134 + call sub_02D2 ; TransferData + or a + jr nz,label_33 + API $0EB + xor a + ret +label_33: + ld hl,RegionHandlePtr283F + ld l,[hl] + ld h,$00 + add hl,hl + ld de,DataPointers ;02CC + add hl,de + ld e,[hl] + inc hl + ld d,[hl] + EX_DE_HL + ld de,$0800 + call sub_02D2 ; TransferData + or a + jp nz,sub_0348 + API $0EB + xor a + ret + db $00 + +;Text Section +;Has Japanese text bytes if you want. Just uncomment tehm and comment the english text + +TitleText: + db "Decoration Gift\0" + ;db $82,$E0,$82,$E6,$82,$A4,$82,$AA,$82,$A6,$83,$4F,$83,$62,$83,$59,$81,$40,$83,$76,$83,$8C,$83,$5B,$83,$93,$83,$67,$00 + +FrontPageText: ; 1872 + db "Decorate your secret base!\0" + ;db $81,$75,$82,$D0,$82,$DD,$82,$C2,$82,$AB,$82,$BF,$82,$F0,$82,$A9,$82,$B4,$82,$EB,$82,$A4,$81,$49,$81,$76,$83,$4C,$83,$83,$83,$93,$83,$79,$81,$5B,$83,$93,$82,$C9,$00 +FrontPageTextLine2: + db "Thank you for participating.\0" + ;db $82,$B2,$82,$A8,$82,$A4,$82,$DA,$82,$A2,$82,$BD,$82,$BE,$82,$AB,$81,$40,$82,$A0,$82,$E8,$82,$AA,$82,$C6,$82,$A4,$82,$B2,$82,$B4,$82,$A2,$82,$DC,$82,$B5,$82,$BD,$00 +FrontPageTextLine3: + db "Please press the A Button.\0" + ;db $82,$60,$83,$7B,$83,$5E,$83,$93,$82,$F0,$81,$40,$82,$A8,$82,$B5,$82,$C4,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 + +FirstPage: + db "Please select the gift you would\0" + ;db $82,$C2,$82,$AC,$82,$CC,$82,$C8,$82,$A9,$82,$A9,$82,$E7,$81,$40,$82,$A8,$82,$AD,$82,$E8,$82,$BD,$82,$A2,$81,$40,$82,$E0,$82,$E6,$82,$A4,$82,$AA,$82,$A6,$83,$4F,$83,$62,$83,$59,$82,$F0,$00 +FirstPageLine2: + db "like to send from the list and\0" + ;db $82,$A6,$82,$E7,$82,$F1,$82,$C5,$81,$40,$82,$60,$83,$7B,$83,$5E,$83,$93,$82,$F0,$81,$40,$82,$A8,$82,$B5,$82,$C4,$81,$40,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 +FirstPageLine3: + db "press the A Button.\0" + ;db $00 + + +SecondPage: + db "Connect the eReader and Pokemon\0" + ;db $82,$C2,$82,$A4,$82,$B5,$82,$F1,$83,$50,$81,$5B,$83,$75,$83,$8B,$82,$C5,$81,$40,$83,$4A,$81,$5B,$83,$68,$82,$85,$83,$8A,$81,$5B,$83,$5F,$81,$5B,$81,$7B,$82,$C6,$00 +SecondPageLine2: + db "Emerald with the link cable and\0" + ;db $83,$7C,$83,$50,$83,$82,$83,$93,$81,$40,$83,$8B,$83,$72,$81,$5B,$81,$40,$82,$A9,$81,$40,$83,$54,$83,$74,$83,$40,$83,$43,$83,$41,$82,$F0,$81,$40,$82,$C2,$82,$C8,$82,$AC,$00 +SecondPageLine3: + db "select Mystery Event.\0" + ;db $81,$75,$82,$D3,$82,$B5,$82,$AC,$82,$C8,$81,$40,$82,$C5,$82,$AB,$82,$B2,$82,$C6,$81,$76,$82,$F0,$81,$40,$82,$A6,$82,$E7,$82,$F1,$82,$C5,$81,$40,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 + + +ThirdPage: + db "will be sent to\0" + ;db $82,$F0,$81,$40,$82,$A8,$82,$AD,$82,$E8,$82,$DC,$82,$B7,$00 +ThirdPageLine2: + db "Pokemon Emerald. Please press\0" + ;db $83,$7C,$83,$50,$83,$82,$83,$93,$81,$40,$83,$8B,$83,$72,$81,$5B,$81,$40,$82,$A9,$81,$40,$83,$54,$83,$74,$83,$40,$83,$43,$83,$41,$82,$CC,$00 +ThirdPageLine3: + db "the A Button.\0" + ;db $82,$60,$83,$7B,$83,$5E,$83,$93,$82,$F0,$81,$40,$82,$A8,$82,$B5,$82,$C4,$81,$40,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 + + +FourthPage: + db "is being sent. Please\0" + ;db $82,$F0,$81,$40,$82,$A8,$82,$AD,$82,$C1,$82,$C4,$81,$40,$82,$A2,$82,$DC,$82,$B7,$00 +FourthPageLine2: + db "do not remove the link cable.\0" + ;db $82,$C2,$82,$A4,$82,$B5,$82,$F1,$83,$50,$81,$5B,$83,$75,$83,$8B,$82,$F0,$81,$40,$82,$CA,$82,$A9,$82,$C8,$82,$A2,$82,$C5,$81,$40,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 +FourthPageLine3: + db $00 + ;db $82,$C5,$82,$F1,$82,$B0,$82,$F1,$82,$F0,$81,$40,$82,$AB,$82,$E7,$82,$C8,$82,$A2,$82,$C5,$81,$40,$82,$AD,$82,$BE,$82,$B3,$82,$A2,$00 + + +FifthPage: + db "has been sent.\0" + ;db $82,$AA,$81,$40,$82,$A8,$82,$AD,$82,$E7,$82,$EA,$81,$40,$82,$DC,$82,$B5,$82,$BD,$00 +FifthPageLine2: + db "Press A to start over.\0" + ;db $82,$60,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$CD,$82,$B6,$82,$DF,$82,$A9,$82,$E7,$81,$40,$82,$E2,$82,$E8,$82,$C8,$82,$A8,$82,$B5,$82,$DC,$82,$B7,$00 +FifthPageLine3: + db "Press B to finish.\0" + ;db $82,$61,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$B5,$82,$E3,$82,$A4,$82,$E8,$82,$E5,$82,$A4,$81,$40,$82,$B5,$82,$DC,$82,$B7,$00 + + +TransferFailed: + db "Transfer Failed.\0" + ;db $82,$C4,$82,$F1,$82,$BB,$82,$A4,$82,$C9,$81,$40,$82,$B5,$82,$C1,$82,$CF,$82,$A2,$82,$B5,$82,$DC,$82,$B5,$82,$BD,$00 + +PressA: + db "Press A to start over.\0" + ;db $82,$60,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$CD,$82,$B6,$82,$DF,$82,$A9,$82,$E7,$81,$40,$82,$E2,$82,$E8,$82,$C8,$82,$A8,$82,$B5,$82,$DC,$82,$B7,$00 + +FinishB: + db "Press B to finish.\0" + ;db $82,$61,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$B5,$82,$E3,$82,$A4,$82,$E8,$82,$E5,$82,$A4,$82,$B5,$82,$DC,$82,$B7,$00 + +TransferCancelled: + db "Transfer cancelled.\0" + ;db $82,$C4,$82,$F1,$82,$BB,$82,$A4,$82,$F0,$81,$40,$83,$4C,$83,$83,$83,$93,$83,$5A,$83,$8B,$82,$B5,$82,$DC,$82,$B5,$82,$BD,$00 + +;idk why there's two of these +PressA2: + db "Press A to start over.\0" + ;db $82,$60,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$CD,$82,$B6,$82,$DF,$82,$A9,$82,$E7,$81,$40,$82,$E2,$82,$E8,$82,$C8,$82,$A8,$82,$B5,$82,$DC,$82,$B7,$00 + +FinishB2: + db "Press B to finish.\0" + ;db $82,$61,$83,$7B,$83,$5E,$83,$93,$82,$C5,$81,$40,$82,$B5,$82,$E3,$82,$A4,$82,$E8,$82,$E5,$82,$A4,$82,$B5,$82,$DC,$82,$B7,$00 + +;The items in order that they'll appear +;Second and third options may need spaces at the start +;My guess as to why is in Japanese the regi dolls have the same length and so moves ahead a certain amount instead of using pointers +RegirockDollText: + db "Regirock Doll \0" + ;db $83,$8C,$83,$57,$83,$8D,$83,$62,$83,$4E,$83,$68,$81,$5B,$83,$8B,$00 + +RegiceDollText: + db " Regice Doll \0" + ;db $83,$8C,$83,$57,$83,$41,$83,$43,$83,$58,$83,$68,$81,$5B,$83,$8B,$00 + +RegisteelDollText: + db " Registeel Doll \0" + ;db $83,$8C,$83,$57,$83,$58,$83,$60,$83,$8B,$83,$68,$81,$5B,$83,$8B,$00 + + + +;Graphics Section + +ArrowSprite: + INCBIN "sprites/arrow.4bpp" +ArrowPalette: + INCBIN "sprites/arrow.gbapal" + +;Sprites are in order of 1-3-2 +RegirockSprite: + INCBIN "sprites/regirock.4bpp" +RegisteelSprite: + INCBIN "sprites/registeel.4bpp" +RegiceSprite: + INCBIN "sprites/regice.4bpp" + +;All 3 regi dolls share the same palette +RegiPalette: + INCBIN "sprites/regi.gbapal" + +TextboxesTiles: + INCBIN "sprites/textboxes.4bpp" +TextboxesPalette: + INCBIN "sprites/textboxes.gbapal" +TextboxesTilemap: + INCBIN "sprites/textboxes.tilemap" + +PokeballBgTiles: + INCBIN "sprites/pokeball_bg.4bpp" +PokeballBgPalette: + INCBIN "sprites/pokeball_bg.gbapal" +PokeballBgTilemap: + INCBIN "sprites/pokeball_bg.tilemap" + +;This tilemap is just for the first large textbox +TextboxMainTilemap: + INCBIN "sprites/textbox_main.tilemap" + + +;Pointers to graphics + +ArrowSpriteData: + dw ArrowSprite + dw ArrowPalette + db $01,$01,$01,$01,$00,$00,$01 ;byte 1&2=width and height of sprite in tiles,3=No. of frames? 4=Starting Frame? 5&6=Unk 7=Unk + +RegirockSpriteData: + dw RegirockSprite + dw RegiPalette + db $04,$04,$03,$01,$00,$00,$03 ;first 2 bytes are 4 because the sprites are 32x32px, 3rd byte is 3 because of 3 frames (I think) + +TextboxesData: + dw TextboxesTiles + dw TextboxesPalette + dw TextboxesTilemap + db $0A,$00,$01,$00 + +PokeballBgData: + dw PokeballBgTiles + dw PokeballBgPalette + dw PokeballBgTilemap + db $0A,$00,$01,$00 + +TextboxMainData: + dw TextboxesTiles + dw TextboxesPalette + dw TextboxMainTilemap + db $0A,$00,$01,$00 + +;Not exactly sure what this is but I think it's setting up layer stuff +BGSetUpStuffIThink: + db $03,$03,$66,$15 +stuff_229C: + db $00,$18,$F0,$88,$29,$21,$27,$37 +stuff_22A4: + db $00,$18,$F0,$88,$29,$21,$27,$37 +stuff_22AC: + db $00,$00,$F0,$23,$2F,$20,$3F,$00 + +;Don't know why but the byte before this palette is used a couple of times +TextPaletteBefore: + db $00 +TextPalette: + INCBIN "sprites/text.gbapal" + + + +;Starting function, sets everything up +Start: + SetBackgroundMode 0 + + ld e, $10 + ld a, $32 + API $01a + + LoadCustomBackground TextboxesData, 1 + LoadCustomBackground PokeballBgData, 0 + SetBackgroundAutoScroll $ff80, $0080 + LoadCustomBackground TextboxMainData, 3 + SetBackgroundPalette 6, $00f0, TextPalette + CreateRegion RegionHandlePtr2847, 26, 3, 2, 0, 2, 15 + CreateRegion RegionHandlePtr2844, 13, 7, 3, 5, 2, 15 + CreateRegion RegionHandlePtr2841, 30, 6, 0, 14, 2, 15 + + LD_A_IND RegionHandlePtr2847 + ld hl,$0002 + or h + ld h,a + SetTextSize + + LD_A_IND RegionHandlePtr2844 + ld hl,$0002 + or h + ld h,a + SetTextSize + + LD_A_IND RegionHandlePtr2841 + ld hl,$0001 + or h + ld h,a + SetTextSize + + SetTextColor RegionHandlePtr2847, 1, 0 + SetTextColor RegionHandlePtr2844, 1, 0 + SetTextColor RegionHandlePtr2841, 1, 0 + SetRegionColor RegionHandlePtr2841, 0 ;This isn't in the original, the japanese ereader sets the text background to be transparent automatically + + call sub_270D ; WriteText + call sub_273C ; RegiSelectText + ld bc,FirstPageLine3 + ld de,FirstPageLine2 + ld hl,FirstPage + call sub_2796 + + CreateCustomSprite RegionHandlePtr2842, $80, ArrowSpriteData + CreateCustomSprite RegionHandlePtr2845, $02, RegirockSpriteData + SetSpritePos RegionHandlePtr2845, $00b8, $0044 + SpriteAutoScaleUntilSize RegionHandlePtr2845, $01, $0100 + SpriteShow RegionHandlePtr2845 + + ld c, $06 + ld e, $14 + ld hl, $00f0 + API $11A ; Unknown API call + API $08d + add a,c + nop + pop de + push de + ld a,e + call sub_2463 + call sub_247C + + SpriteAutoScaleUntilSize RegionHandlePtr2845, $01, $0f00 + + call sub_25ED + ld de, stuff_22AC + ld a, $20 + API $08e + call sub_26E0 + pop de +sub_23C2: + LD_HL_IND $00C2 + ld a, l + and $40 + jr z, label_1 + inc e + dec e + jr nz, label_2 + ld e, $02 + jr label_3 +label_2: + dec e +label_3: + push de + API $08d + nop + nop + pop de + push de + ld a, e + call sub_2463 + LD_HL_IND RegionHandlePtr2845 + API $034 + pop de +label_1: + LD_HL_IND $00C2 + ld a,l + and $80 + jr z,label_4 + ld a,e + cp $02 + jr nz,label_5 + ld e,$00 + jr label_6 +label_5: + inc e +label_6: + push de + API $08d + nop + nop + pop de + push de + ld a,e + call sub_2463 + LD_HL_IND RegionHandlePtr2845 + API $035 + pop de +label_4: + LD_HL_IND $00C2 + ld a,l + and $01 + jr z,label_7 + push de + call sub_248C + API $08D + dec b + nop + pop de + push de + ld a,e + call sub_249C + wait $01 + pop de +label_8: + LD_HL_IND $00C2 + ld a,l + and $01 + jr z,label_9 + push de + API $08D + dec b + nop + call sub_247C + LD_A_IND TextPaletteBefore + or a + call z,sub_26E0 + ld bc,FirstPageLine3 + ld de,FirstPageLine2 + ld hl,FirstPage + call sub_2796 + API $08D + add a,c + nop + pop de + jr label_7 +label_9: + push de + LD_HL_IND $00C2 + ld a,l + and $02 + jr z,label_10 + ld a,$02 + EXIT +label_10: + wait $01 + pop de + jr label_8 +label_7: + push de + wait $01 + pop de + jp sub_23C2 + + +sub_2463: + ld l,a + ld h,$00 + add hl,hl + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,$0031 + add hl,de + ld c,l + ld b,h + ld de,$0012 + LD_HL_IND RegionHandlePtr2842 + API $032 + ret + +sub_247C: + ld l,$41 + push hl + ld bc,$0002 + ld de,$0600 + LD_HL_IND RegionHandlePtr2842 + API $059 + pop bc + ret + +sub_248C: + ld l,$41 + push hl + ld bc,$0000 + ld de,$0000 + LD_HL_IND RegionHandlePtr2842 + API $059 + pop bc + ret + +sub_249C: + LD_IND_A RegionHandlePtr2840 + API_106 $0040,$0081 + API_121 + ld bc,SecondPageLine3 + ld de,SecondPageLine2 + ld hl,SecondPage + call sub_2796 + call sub_0356 + or a + jr nz,label_11 + wait $01 + API $08D + inc b + nop + ld bc,FinishB2 + ld de,PressA2 + ld hl,TransferCancelled + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_11: + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,RegirockDollText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,ThirdPage + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,ThirdPageLine3 + ld de,ThirdPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + call sub_0392 + or a + jr nz,label_12 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_12: + call sub_03AD + or a + jr nz,label_13 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_13: + call sub_26B6 + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,RegirockDollText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,FourthPage ; $05ad + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,FourthPageLine3 + ld de,FourthPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + wait $01 + LD_A_IND RegionHandlePtr2840 + call sub_03CB + or a + jr nz,label_14 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_14: + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,RegirockDollText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,FifthPage + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,FifthPageLine3 + ld de,FifthPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + API $08D + db $FA,$00,$3E,$01 ; idk what instructions these bytes are, if you know tell me + ret + +sub_25ED: + ld de,stuff_229C + ld a,$20 + API $08E + ld de, stuff_22A4 + ld a, $40 + API $08E + ld a,$03 + API $020 + ld bc,$1a07 + ld de,$0205 + ld hl,$030f + API $090 ; CreateRegion + ld c,a + push bc + ld a,c + ld e,$02 + API $091 ; SetRegionColor + pop bc + push bc + ld a,c + API $092 ; Clear region + pop bc + push bc + ld hl,$0001 + ld a,c + or h + ld h,a + SetTextSize + pop bc + push bc + ld a,c + ld de,$0102 + API $098 ; SetTextColor + pop bc + push bc + ld a,c + ld de,FrontPageText + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + push bc + LD_A_IND RegionHandlePtr2848 + ld de,$000a + or d + ld d,a + ld a,c + ld bc,FrontPageText + API $099 ; DrawText + pop bc + push bc + ld a,c + ld de,FrontPageTextLine2 + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + push bc + LD_A_IND RegionHandlePtr2848 + ld de,$0014 + or d + ld d,a + ld a,c + ld bc,FrontPageTextLine2 + API $099 ; DrawText + pop bc + push bc + ld a,c + ld de,FrontPageTextLine3 + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de,$0028 + or d + ld d,a + ld a,c + ld bc,FrontPageTextLine3 + API $099 ; DrawText + FadeIn $20 + +label_15: + LD_HL_IND $00C2 + ld a,l + and $01 + jr nz,label_16 + wait $01 + jr label_15 + +label_16: + API $08D + dec b + nop + ld a,$03 + API $021 ; LayerHide + ld a,$20 + API $08F ; WindowHide + ld a,$40 + API $08F ; WindowHide + wait $01 + ret + +sub_26B6: + API $08D + inc d + nop + ld c,$30 + ld de,$0180 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + wait $60 + API $08D + ld l,b + nop + ld l,$20 + push hl + ld bc,$ffe0 + ld de,$00b8 + LD_HL_IND RegionHandlePtr2845 + API $03B + pop bc + wait $10 + xor a + LD_IND_A TextPaletteBefore + ret + + +sub_26E0: + ld c,$01 + ld de,$0f00 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + ld bc,$0044 + ld de,$00b8 + LD_HL_IND RegionHandlePtr2845 + API $032 ; SetSpritePos + ld c,$40 + ld de,$0100 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + wait $20 + API $08D + ld l,b + nop + wait $40 + ld a,$01 + LD_IND_A TextPaletteBefore + ret + + +sub_270D: ; WriteText + CLEAR_REGION RegionHandlePtr2847 + GetTextWidth RegionHandlePtr2847, TitleText + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + ld a, $06 + LD_IND_A RegionHandlePtr2849 + ld bc, TitleText + LD_A_IND RegionHandlePtr2849 + ld e, a + LD_A_IND RegionHandlePtr2848 + ld d, a + LD_A_IND RegionHandlePtr2847 + API $099 ; DrawText + ret + +sub_273C: ; RegiSelectText + DrawText RegionHandlePtr2844, RegirockText2, 0, 4 + ld bc, RegiceText2 + ld de, $0016 + LD_A_IND RegionHandlePtr2844 + API $099 ;DrawText + ld bc, RegisteelText2 + ld de, $0028 + LD_A_IND RegionHandlePtr2844 + API $099 ;DrawText + ret + + +;This is the text you see on the menu select textbox, in order they appear + +RegirockText2: + db "Regirock Doll\0" + ;db $83,$8C,$83,$57,$83,$8D,$83,$62,$83,$4E,$83,$68,$81,$5B,$83,$8B,$00 + +RegiceText2: + db "Regice Doll\0" + ;db $83,$8C,$83,$57,$83,$41,$83,$43,$83,$58,$83,$68,$81,$5B,$83,$8B,$00 + +RegisteelText2: + db "Registeel Doll\0" + ;db $83,$8C,$83,$57,$83,$58,$83,$60,$83,$8B,$83,$68,$81,$5B,$83,$8B,$00 + + +sub_2796: ; RegiChangeText (I think) + push bc + push de + push hl + CLEAR_REGION RegionHandlePtr2841 + pop hl + push hl + EX_DE_HL + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $000A + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + pop de + push de + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $2 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $0014 + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + pop bc + push bc + ld e, c + ld d, b + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $2 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $001E + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + ret + +sub_2805: + LD_IND_A_HL + or a + jr z,label_18 + inc hl + jr sub_2805 +label_18: + LD_IND_A_DE + inc de + LD_IND_HL_A + inc hl + or a + jr nz,label_18 + xor a + LD_IND_HL_A + inc hl + ret + +sub_2817: ;is word shift right + inc b +label_2818: + dec b + ret z + and a + ld a,h + rra + ld h,a + ld a,l + rra + ld l,a + jp label_2818 + + +sub_2824: + push hl + ld l,a + ld h,$00 + ld c,$08 +label_282A: + add hl,hl + ld a,h + cp b + jp c,label_2833 + sub b + inc l + ld h,a +label_2833: + dec c + jp nz,label_282A + ld a,l + ld b,h + pop hl + ret + + + +;Bytes that come after the program in memory for storing data + +RegionHandlePtr283B: db $FF,0 ; marks EOF +RegionHandlePtr283D: db 0,0 +RegionHandlePtr283F: db 0 +RegionHandlePtr2840: db 0 +RegionHandlePtr2841: db 0 +RegionHandlePtr2842: db 0,0 +RegionHandlePtr2844: db 0 +RegionHandlePtr2845: db 0,0 +RegionHandlePtr2847: db 0 +RegionHandlePtr2848: db 0 +RegionHandlePtr2849: db 0 +RegionHandlePtr284A: db 0 diff --git a/decoration/08-O002.asm b/decoration/08-O002.asm new file mode 100644 index 0000000..5778155 --- /dev/null +++ b/decoration/08-O002.asm @@ -0,0 +1,1181 @@ +INCLUDE "../macros.asm" +SECTION "decoration",ROM0[$100] +jp Start +db $00 + +;memory structs for deco card, don't touch +RegionHandlePtr0104: db 0,0 +RegionHandlePtr0106: + REPT 14 + db 0 + ENDR +RegionHandlePtr0114: + REPT 32 + db 0 + ENDR + +Prologue: + INCBIN "prologue-{REGION_NAME}.bin" + +; The data chunks from decoration-tickets.asm +DataPacket: + INCBIN "decoration-tickets-{REGION_NAME}.mev" + +; Pointers to the data chunks found in decoration.asm +; Currently needs to be changed manually +DataPointers: + db $70,$01 ; DataStartEonTicket + db $FB,$01 ; DataStartAuroraTicket + db $86,$02 ; DataStartMysticTicket + +; Transfer data +sub_02D2: + LD_IND_HL RegionHandlePtr283D + push de + ld hl,$bbbb + LD_IND_HL RegionHandlePtr0104 + EX_DE_HL + LD_IND_HL RegionHandlePtr0106 + API_0C7 RegionHandlePtr0104 + wait $01 + pop hl + inc hl + ld b,$01 + call sub_2817 + + LD_IND_HL RegionHandlePtr283B +label_27: + LD_HL_IND RegionHandlePtr283B + ld a,l + or h + jr z,label_28 + + ld hl,$8888 + LD_IND_HL RegionHandlePtr0104 + ld e,$01 + +label_29: + ld a,e + cp $08 + jr nc,label_30 + + push de + LD_HL_IND RegionHandlePtr283D + ld c, [hl] + inc hl + ld b, [hl] + inc hl + LD_IND_HL RegionHandlePtr283D + ld l,e + ld h,$00 + add hl,hl + ld de, RegionHandlePtr0104 + add hl,de + ld [hl], c + inc hl + ld [hl], b + pop de + LD_HL_IND RegionHandlePtr283B + dec hl + LD_IND_HL RegionHandlePtr283B + ld a,l + or h + jr z,label_30 + + inc e + jr label_29 + +label_30: + API_0C7 RegionHandlePtr0104 + API $0CA + cp $02 + jr nc,label_31 + xor a + ret + +label_31: + ld hl,RegionHandlePtr0114 + API $0C8 + or a + jr nz,label_32 + xor a + ret +label_32: + wait $01 + jr label_27 +label_28: + ld a,$01 + ret + +sub_0348: + ld hl,$5fff + LD_IND_HL RegionHandlePtr0104 + API_0C7 RegionHandlePtr0104 + wait $01 + ret + +sub_0356: + API $0EB + wait $01 + API $0C6 + wait $01 + ld l,$02 + push hl + ld bc,$b9a0 + ld de,$0076 + ld a,$08 + API $0C4 + pop bc + API $0C5 +label_19: + wait $01 + API $0DB + cp $01 + jr z,label_19 + API $0DB + or a + jr z,label_19 +label_20: + wait $01 + LD_HL_IND $00C2 + ld a,l + and $02 + jr z,label_21 + API $0EB + xor a + ret +label_21: + API $0CA + cp $02 + jr c,label_20 + ld a,$01 + ret + +sub_0392: + wait $01 + API $0CA + cp $02 + jr nc,label_23 + API $0EB + xor a + ret +label_23: + API $0DB + cp $04 + jr z,label_24 + API $0DB + cp $03 + jr nz,sub_0392 +label_24: + ld a,$01 + ret + +sub_03AD: + wait $01 + ld hl,RegionHandlePtr0114 + API $0C8 + or a + jr nz,label_26 + API $0EB + xor a + ret +label_26: + LD_HL_IND RegionHandlePtr0114 + ld a,l + cp $22 + jr nz,sub_03AD + ld a,h + cp $22 + jr nz,sub_03AD + ld a,$01 + ret + +sub_03CB: + LD_IND_A RegionHandlePtr283F + ld de,$003c + ld hl,$0134 + call sub_02D2 ; TransferData + or a + jr nz,label_33 + API $0EB + xor a + ret +label_33: + ld hl,RegionHandlePtr283F + ld l,[hl] + ld h,$00 + add hl,hl + ld de,DataPointers + add hl,de + ld e,[hl] + inc hl + ld d,[hl] + EX_DE_HL + ld de,$0800 + call sub_02D2 ; TransferData + or a + jp nz,sub_0348 + API $0EB + xor a + ret + db $00 + + +;Text Section + +TitleText: + db "Ticket Gifts\0" + + + +FrontPageText: + db "Travel to exotic islands!\0" + +FrontPageTextLine2: + db "Thank you for participating.\0" + +FrontPageTextLine3: + db "Please press the A Button.\0" + + + +FirstPage: + db "Please select the gift you would\0" + +FirstPageLine2: + db "like to send from the list and\0" + +FirstPageLine3: + db "press the A Button.\0" + + +SecondPage: + db "Connect the eReader and Pokemon\0" + +SecondPageLine2: + db "Emerald with the link cable and\0" + +SecondPageLine3: + db "select Mystery Event.\0" + + +ThirdPage: + db "will be sent to\0" + +ThirdPageLine2: + db "Pokemon Emerald. Please press\0" + +ThirdPageLine3: + db "the A Button.\0" + + +FourthPage: + db "is being sent. Please\0" + +FourthPageLine2: + db "do not remove the link cable.\0" + +FourthPageLine3: + db $00 + + +FifthPage: + db "has been sent.\0" + +FifthPageLine2: + db "Press A to start over.\0" + +FifthPageLine3: + db "Press B to finish.\0" + + +TransferFailed: + db "Transfer Failed.\0" + +PressA: + db "Press A to start over.\0" + +FinishB: + db "Press B to finish.\0" + +TransferCancelled: + db "Transfer cancelled.\0" + +;idk why there's two of these +PressA2: + db "Press A to start over.\0" + +FinishB2: + db "Press B to finish.\0" + + +;The items in order that they'll appear +;Second and third options may need spaces at the start +;My guess as to why is in Japanese the regi dolls have the same length and so they just skip ahead a certain amount instead of using pointers +EonTicketText: + db "Eon Ticket \0" + +AuroraTicketText: + db " Aurora Ticket \0" + +MysticTicketText: + db " Mystic Ticket \0" + + +;Graphics Section + +ArrowSprite: + INCBIN "sprites/arrow.4bpp" +ArrowPalette: + INCBIN "sprites/arrow-ticket.gbapal" + +;Sprites are in order of 1-3-2, same with palettes +EonTicketSprite: + INCBIN "sprites/eon_ticket.4bpp" +MysticTicketSprite: + INCBIN "sprites/mystic_ticket.4bpp" +AuroraTicketSprite: + INCBIN "sprites/aurora_ticket.4bpp" + +EonTicketPalette: + INCBIN "sprites/eon_ticket.gbapal" +MysticTicketPalette: + INCBIN "sprites/mystic_ticket.gbapal" +AuroraTicketPalette: + INCBIN "sprites/aurora_ticket.gbapal" + +TextboxesTiles: + INCBIN "sprites/textboxes.4bpp" +TextboxesPalette: + INCBIN "sprites/textboxes-ticket.gbapal" +TextboxesTilemap: + INCBIN "sprites/textboxes.tilemap" + +PokeballBgTiles: + INCBIN "sprites/pokeball_bg.4bpp" +PokeballBgPalette: + INCBIN "sprites/pokeball_bg-ticket.gbapal" +PokeballBgTilemap: + INCBIN "sprites/pokeball_bg.tilemap" + +TextboxeMainTilemap: + INCBIN "sprites/textbox_main.tilemap" + + +;Pointers to graphics + +ArrowSpriteData: + dw ArrowSprite + dw ArrowPalette + db $01,$01,$01,$01,$00,$00,$01 ;byte 1&2=width and height of sprite in tiles,3=No. of frames? 4=Starting Frame? 5&6=Unk 7=Unk + +EonTicketSpriteData: + dw EonTicketSprite + dw EonTicketPalette + db $03,$03,$03,$01,$00,$00,$03 ;first 2 bytes are 3 because the sprites are 24x24px, 3rd byte is 3 because of 3 frames (I think) + +TextboxesData: + dw TextboxesTiles + dw TextboxesPalette + dw TextboxesTilemap + db $0A,$00,$01,$00 + +PokeballBgData: + dw PokeballBgTiles + dw PokeballBgPalette + dw PokeballBgTilemap + db $0A,$00,$01,$00 + +TextboxMainData: + dw TextboxesTiles + dw TextboxesPalette + dw TextboxeMainTilemap + db $0A,$00,$01,$00 + +;Not exactly sure what this is but I think it's setting up layer stuff +BGSetUpStuffIThink: + db $03,$03,$66,$15 +stuff_229C: + db $00,$18,$F0,$88,$29,$21,$27,$37 +stuff_22A4: + db $00,$18,$F0,$88,$29,$21,$27,$37 +stuff_22AC: + db $00,$00,$F0,$23,$2F,$20,$3F,$00 + + +TextPaletteBefore: + db $00 +TextPalette: + INCBIN "sprites/text.gbapal" + + + +;Starting function, sets everything up +Start: + SetBackgroundMode 0 + + ld e, $10 + ld a, $32 + API $01a + + LoadCustomBackground TextboxesData, 1 + LoadCustomBackground PokeballBgData, 0 + SetBackgroundAutoScroll $ff80, $0080 + LoadCustomBackground TextboxMainData, 3 + SetBackgroundPalette 6, $00f0, TextPalette + CreateRegion RegionHandlePtr2847, 26, 3, 2, 0, 2, 15 + CreateRegion RegionHandlePtr2844, 13, 7, 3, 5, 2, 15 + CreateRegion RegionHandlePtr2841, 30, 6, 0, 14, 2, 15 + + LD_A_IND RegionHandlePtr2847 + ld hl,$0002 + or h + ld h,a + SetTextSize + + LD_A_IND RegionHandlePtr2844 + ld hl,$0002 + or h + ld h,a + SetTextSize + + LD_A_IND RegionHandlePtr2841 + ld hl,$0001 + or h + ld h,a + SetTextSize + + SetTextColor RegionHandlePtr2847, 1, 0 + SetTextColor RegionHandlePtr2844, 1, 0 + SetTextColor RegionHandlePtr2841, 1, 0 + SetRegionColor RegionHandlePtr2841, 0 + + call sub_270D ; WriteText + call sub_273C ; MenuSelectText + ld bc,FirstPageLine3 + ld de,FirstPageLine2 + ld hl,FirstPage + call sub_2796 + + CreateCustomSprite RegionHandlePtr2842, $80, ArrowSpriteData + CreateCustomSprite RegionHandlePtr2845, $02, EonTicketSpriteData + SetSpritePos RegionHandlePtr2845, $00b8, $0044 + SpriteAutoScaleUntilSize RegionHandlePtr2845, $01, $0100 + SpriteShow RegionHandlePtr2845 + + ld c, $06 + ld e, $14 + ld hl, $00f0 + API $11A ; Unknown API call + API $08d + add a,c + nop + pop de + push de + ld a,e + call sub_2463 + call sub_247C + + SpriteAutoScaleUntilSize RegionHandlePtr2845, $01, $0f00 + + call sub_25ED + ld de, stuff_22AC + ld a, $20 + API $08e + call sub_26E0 + pop de +sub_23C2: + LD_HL_IND $00C2 + ld a, l + and $40 + jr z, label_1 + inc e + dec e + jr nz, label_2 + ld e, $02 + jr label_3 +label_2: + dec e +label_3: + push de + API $08d + nop + nop + pop de + push de + ld a, e + call sub_2463 + LD_HL_IND RegionHandlePtr2845 + API $034 + ld hl,EonTicketPalette + LD_A_IND PaletteCounter ;Change palette when changing sprite + cp $40 + jr z,skip_add + cp $20 + jr z,add_twice +add_once: + ld a,$20 + ld de,$0020 + jr skip_min +add_twice: + ld a,$40 + ld de,$0040 + jr skip_min +skip_add: + ld a,$00 + ld de,$0000 +skip_min: + LD_IND_A PaletteCounter + add hl, de + ld de,$20 + ld c,$10 + API $080 + pop de +label_1: + LD_HL_IND $00C2 + ld a,l + and $80 + jr z,label_4 + ld a,e + cp $02 + jr nz,label_5 + ld e,$00 + jr label_6 +label_5: + inc e +label_6: + push de + API $08d + nop + nop + pop de + push de + ld a,e + call sub_2463 + LD_HL_IND RegionHandlePtr2845 + API $035 + ld hl,EonTicketPalette + LD_A_IND PaletteCounter ;Change palette when changing sprite + cp $00 + jr z,skip_sub + cp $20 + jr z,sub_twice +sub_once: + ld a,$20 + ld de,$0020 + jr skip_max +sub_twice: + ld a,$00 + ld de,$0000 + jr skip_max +skip_sub: + ld a,$40 + ld de,$0040 +skip_max: + LD_IND_A PaletteCounter + add hl, de + ld de,$20 + ld c,$10 + API $080 + pop de +label_4: + LD_HL_IND $00C2 + ld a,l + and $01 + jr z,label_7 + push de + call sub_248C + API $08D + dec b + nop + pop de + push de + ld a,e + call sub_249C + wait $01 + pop de +label_8: + LD_HL_IND $00C2 + ld a,l + and $01 + jr z,label_9 + push de + API $08D + dec b + nop + call sub_247C + LD_A_IND TextPaletteBefore + or a + call z,sub_26E0 + ld bc,FirstPageLine3 + ld de,FirstPageLine2 + ld hl,FirstPage + call sub_2796 + API $08D + add a,c + nop + pop de + jr label_7 +label_9: + push de + LD_HL_IND $00C2 + ld a,l + and $02 + jr z,label_10 + ld a,$02 + EXIT +label_10: + wait $01 + pop de + jr label_8 +label_7: + push de + wait $01 + pop de + jp sub_23C2 + + +sub_2463: + ld l,a + ld h,$00 + add hl,hl + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,$0031 + add hl,de + ld c,l + ld b,h + ld de,$0012 + LD_HL_IND RegionHandlePtr2842 + API $032 + ret + +sub_247C: + ld l,$41 + push hl + ld bc,$0002 + ld de,$0600 + LD_HL_IND RegionHandlePtr2842 + API $059 + pop bc + ret + +sub_248C: + ld l,$41 + push hl + ld bc,$0000 + ld de,$0000 + LD_HL_IND RegionHandlePtr2842 + API $059 + pop bc + ret + + +sub_249C: + LD_IND_A RegionHandlePtr2840 + API_106 $0040,$0081 + API_121 + ld bc,SecondPageLine3 + ld de,SecondPageLine2 + ld hl,SecondPage + call sub_2796 + call sub_0356 + or a + jr nz,label_11 + wait $01 + API $08D + inc b + nop + ld bc,FinishB2 + ld de,PressA2 + ld hl,TransferCancelled + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_11: + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,EonTicketText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,ThirdPage + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,ThirdPageLine3 + ld de,ThirdPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + call sub_0392 + or a + jr nz,label_12 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_12: + call sub_03AD + or a + jr nz,label_13 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_13: + call sub_26B6 + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,EonTicketText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,FourthPage + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,FourthPageLine3 + ld de,FourthPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + wait $01 + LD_A_IND RegionHandlePtr2840 + call sub_03CB + or a + jr nz,label_14 + wait $01 + API $08D + inc b + nop + ld bc,FinishB + ld de,PressA + ld hl,TransferFailed + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + xor a + ret + +label_14: + xor a + LD_IND_A RegionHandlePtr284A + ld hl,RegionHandlePtr2840 + LD_IND_L_HL + ld h,$00 + ld e,l + ld d,h + add hl,hl + add hl,hl + add hl,hl + add hl,hl + add hl,de + ld de,EonTicketText + add hl,de + EX_DE_HL + ld hl,RegionHandlePtr284A + call sub_2805 + ld de,FifthPage + ld hl,RegionHandlePtr284A + call sub_2805 + ld bc,FifthPageLine3 + ld de,FifthPageLine2 + ld hl,RegionHandlePtr284A + call sub_2796 + ld de,$0000 + ld hl,$0008 + API $121 + API $08D + db $FA,$00,$3E,$01 ; idk what instructions these bytes are, if you know tell me + ret + +sub_25ED: + ld de,stuff_229C + ld a,$20 + API $08E + ld de, stuff_22A4 + ld a, $40 + API $08E + ld a,$03 + API $020 ; LayerShow + ld bc,$1a07 + ld de,$0205 + ld hl,$030f + API $090 ; CreateRegion + ld c,a + push bc + ld a,c + ld e,$02 + API $091 ; SetRegionColor + pop bc + push bc + ld a,c + API $092 ; Clear region + pop bc + push bc + ld hl,$0001 + ld a,c + or h + ld h,a + SetTextSize + pop bc + push bc + ld a,c + ld de,$0102 + API $098 ; SetTextColor + pop bc + push bc + ld a,c + ld de,FrontPageText + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + push bc + LD_A_IND RegionHandlePtr2848 + ld de,$000a + or d + ld d,a + ld a,c + ld bc,FrontPageText + API $099 ; DrawText + pop bc + push bc + ld a,c + ld de,FrontPageTextLine2 + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + push bc + LD_A_IND RegionHandlePtr2848 + ld de,$0014 + or d + ld d,a + ld a,c + ld bc,FrontPageTextLine2 + API $099 ; DrawText + pop bc + push bc + ld a,c + ld de,FrontPageTextLine3 + API $0C0 ; GetTextWidth + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de,$0028 + or d + ld d,a + ld a,c + ld bc,FrontPageTextLine3 + API $099 ; DrawText + FadeIn $20 + +label_15: + LD_HL_IND $00C2 + ld a,l + and $01 + jr nz,label_16 + wait $01 + jr label_15 + +label_16: + API $08D + dec b + nop + ld a,$03 + API $021 ; LayerHide + ld a,$20 + API $08F ; WindowHide + ld a,$40 + API $08F ; WindowHide + wait $01 + ret + +sub_26B6: + API $08D + inc d + nop + ld c,$30 + ld de,$0180 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + wait $60 + API $08D + ld l,b + nop + ld l,$20 + push hl + ld bc,$ffe0 + ld de,$00b8 + LD_HL_IND RegionHandlePtr2845 + API $03B + pop bc + wait $10 + xor a + LD_IND_A TextPaletteBefore + ret + + +sub_26E0: + ld c,$01 + ld de,$0f00 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + ld bc,$0044 + ld de,$00b8 + LD_HL_IND RegionHandlePtr2845 + API $032 ; SetSpritePos + ld c,$40 + ld de,$0100 + LD_HL_IND RegionHandlePtr2845 + API $05B ; SpriteAutoScaleUntilSize + wait $20 + API $08D + ld l,b + nop + wait $40 + ld a,$01 + LD_IND_A TextPaletteBefore + ret + + +sub_270D: ; WriteText + CLEAR_REGION RegionHandlePtr2847 + GetTextWidth RegionHandlePtr2847, TitleText + ld l,a + ld a,$d0 + sub l + ld b,$02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + ld a, $06 + LD_IND_A RegionHandlePtr2849 + ld bc, TitleText + LD_A_IND RegionHandlePtr2849 + ld e, a + LD_A_IND RegionHandlePtr2848 + ld d, a + LD_A_IND RegionHandlePtr2847 + API $099 ; DrawText + ret + +sub_273C: ; MenuSelectText + DrawText RegionHandlePtr2844, EonTicketText2, 0, 4 + ld bc, AuroraTicketText2 + ld de, $0016 + LD_A_IND RegionHandlePtr2844 + API $099 ;DrawText + ld bc, MysticTicketText2 + ld de, $0028 + LD_A_IND RegionHandlePtr2844 + API $099 ;DrawText + ret + + +;This is the text you see on the menu select textbox, in order they appear + +EonTicketText2: + db "Eon Ticket\0" + +AuroraTicketText2: + db "Aurora Ticket\0" + +MysticTicketText2: + db "Mystic Ticket\0" + + +sub_2796: + push bc + push de + push hl + CLEAR_REGION RegionHandlePtr2841 + pop hl + push hl + EX_DE_HL + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $02 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $000A + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + pop de + push de + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $2 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $0014 + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + pop bc + push bc + ld e, c + ld d, b + LD_A_IND RegionHandlePtr2841 + API $0C0 ;GetTextWidth + ld l, a + ld a, $f0 + sub l + ld b, $2 + call sub_2824 + LD_IND_A RegionHandlePtr2848 + pop bc + LD_A_IND RegionHandlePtr2848 + ld de, $001E + or d + ld d, a + LD_A_IND RegionHandlePtr2841 + API $099 ;DrawText + ret + +sub_2805: + LD_IND_A_HL + or a + jr z,label_18 + inc hl + jr sub_2805 +label_18: + LD_IND_A_DE + inc de + LD_IND_HL_A + inc hl + or a + jr nz,label_18 + xor a + LD_IND_HL_A + inc hl + ret + +sub_2817: ;is word shift right + inc b +label_2818: + dec b + ret z + and a + ld a,h + rra + ld h,a + ld a,l + rra + ld l,a + jp label_2818 + + +sub_2824: + push hl + ld l,a + ld h,$00 + ld c,$08 +label_282A: + add hl,hl + ld a,h + cp b + jp c,label_2833 + sub b + inc l + ld h,a +label_2833: + dec c + jp nz,label_282A + ld a,l + ld b,h + pop hl + ret + + + +;Bytes that come after the program in memory for storing data + +RegionHandlePtr283B: db $FF,0 ; marks EOF +RegionHandlePtr283D: db 0,0 +RegionHandlePtr283F: db 0 +RegionHandlePtr2840: db 0 +RegionHandlePtr2841: db 0 +RegionHandlePtr2842: db 0,0 +RegionHandlePtr2844: db 0 +RegionHandlePtr2845: db 0,0 +RegionHandlePtr2847: db 0 +RegionHandlePtr2848: db 0 +RegionHandlePtr2849: db 0 +PaletteCounter: db 0 ;An extra one to keep track of which palette to use +RegionHandlePtr284A: db 0 + diff --git a/decoration/Makefile b/decoration/Makefile new file mode 100644 index 0000000..9f45fd8 --- /dev/null +++ b/decoration/Makefile @@ -0,0 +1,64 @@ +all: 08-O001-EN.raw 08-O002-EN.raw +.SECONDARY: 08-O002-EN.z80 + +decoration-%.tx: decoration.asm + python ../scripts/regionalize.py $< $@ $* $* +decoration-%.o: decoration-%.tx + ./rgbasm -o $@ $< +decoration-%.gbc: decoration-%.o + ./rgblink -o $@ $< +decoration-%.bin: decoration-%.gbc + python ../scripts/stripgbc.py $< $@ +decoration-%.mev: decoration-%.bin + python ../scripts/checksum_regi.py $< $@ + +prologue-%.tx: prologue.asm + python ../scripts/regionalize.py $< $@ $* $* +prologue-%.o: prologue-%.tx + ./rgbasm -o $@ $< +prologue-%.gbc: prologue-%.o + ./rgblink -o $@ $< +prologue-%.bin: prologue-%.gbc + python ../scripts/stripgbc.py $< $@ + +08-O001-%.tx: 08-O001.asm decoration-%.mev prologue-%.bin + python ../scripts/ereadertext.py $< $@ $* +08-O001-%.o: 08-O001-%.tx + ./rgbasm -o $@ $< +08-O001-%.gbc: 08-O001-%.o + ./rgblink -o $@ $< +08-O001-%.z80: 08-O001-%.gbc + python ../scripts/stripgbc.py $< $@ +08-O001-%.vpk: 08-O001-%.z80 + ./nevpk -c -i $< -o $@ +08-O001-%.raw: 08-O001-%.vpk + ./nedcmake -i $< -o $@ -type 1 -region 1 + mv $@-01.raw $@ + +decoration-tickets-%.tx: decoration-tickets.asm + python ../scripts/regionalize.py $< $@ $* $* +decoration-tickets-%.o: decoration-tickets-%.tx + ./rgbasm -o $@ $< +decoration-tickets-%.gbc: decoration-tickets-%.o + ./rgblink -o $@ $< +decoration-tickets-%.bin: decoration-tickets-%.gbc + python ../scripts/stripgbc.py $< $@ +decoration-tickets-%.mev: decoration-tickets-%.bin + python ../scripts/checksum_regi.py $< $@ + +08-O002-%.tx: 08-O002.asm decoration-tickets-%.mev prologue-%.bin + python ../scripts/ereadertext.py $< $@ $* +08-O002-%.o: 08-O002-%.tx + ./rgbasm -o $@ $< +08-O002-%.gbc: 08-O002-%.o + ./rgblink -o $@ $< +08-O002-%.z80: 08-O002-%.gbc + python ../scripts/stripgbc.py $< $@ +08-O002-%.vpk: 08-O002-%.z80 + ./nevpk -c -i $< -o $@ +08-O002-%.raw: 08-O002-%.vpk + ./nedcmake -i $< -o $@ -type 1 -region 1 + mv $@-01.raw $@ + +clean: + rm -f *.tx *.o *.gbc *.z80 *.bin *.mev *.vpk *.raw \ No newline at end of file diff --git a/decoration/decoration-tickets.asm b/decoration/decoration-tickets.asm new file mode 100644 index 0000000..2b91d4a --- /dev/null +++ b/decoration/decoration-tickets.asm @@ -0,0 +1,132 @@ +INCLUDE "../macros.asm" +INCLUDE "../constants/items.asm" +INCLUDE "../constants/scriptcommands.asm" + +DataStartEonTicket: + Mystery_Event + db CHECKSUM_CRC + dd 0 ; checksum placeholder + GBAPTR ScriptStartEonTicket + GBAPTR EonTicketEnd + +ScriptStartEonTicket: ; 008E + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartEonTicket + db END_OF_CHUNKS + +PreloadScriptStartEonTicket: ; 0094 + setvirtualaddress PreloadScriptStartEonTicket + bufferitemname $01, EON_TICKET + checkitem EON_TICKET, $0001 + compare $800D, $0001 + virtualgotoif $01, TransferFailEonTicket + additem EON_TICKET, $0001 + setflag $08B3 + setflag $08B3 + virtualloadpointer TransferSuccessEonTicket + setbyte $02 + end + +TransferFailEonTicket: ; 00B3 + virtualloadpointer TransferFailTextEonTicket + setbyte $03 + end + +TransferSuccessEonTicket: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextEonTicket: + Text_EN "\v2 has already been\n" + Text_EN "received.@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +EonTicketEnd: + db $00,$00,$00 + + +DataStartAuroraTicket: + db $01,$00,$00,$00,$02,$02,$00,$02,$00,$00,$00,$04,$00,$80,$01,$00,$00 ; Mystery_Event + db CHECKSUM_CRC + dd 0 ; checksum placeholder + GBAPTR ScriptStartEonTicket + GBAPTR EonTicketEnd + +ScriptStartAuroraTicket: + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartEonTicket + db END_OF_CHUNKS + +PreloadScriptStartAuroraTicket: + setvirtualaddress PreloadScriptStartEonTicket + bufferitemname $01, AURORA_TICKET + checkitem AURORA_TICKET, $0001 + compare $800D, $0001 + virtualgotoif $01, TransferFailEonTicket + additem AURORA_TICKET, $0001 + setflag $013A + setflag $08F0 + virtualloadpointer TransferSuccessEonTicket + setbyte $02 + end + +TransferFailAuroraTicket: + virtualloadpointer TransferFailTextEonTicket + setbyte $03 + end + +TransferSuccessAuroraTicket: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextAuroraTicket: + Text_EN "\v2 has already been\n" + Text_EN "received.@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +AuroraTicketEnd: + db $00,$00,$00 + +DataStartMysticTicket: + db $01,$00,$00,$00,$02,$02,$00,$02,$00,$00,$00,$04,$00,$80,$01,$00,$00 ; Mystery_Event + db CHECKSUM_CRC + dd 0 ; checksum placeholder + GBAPTR ScriptStartEonTicket + GBAPTR EonTicketEnd + +ScriptStartMysticTicket: + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartEonTicket + db END_OF_CHUNKS + +PreloadScriptStartMysticTicket: + setvirtualaddress PreloadScriptStartEonTicket + bufferitemname $01, MYSTIC_TICKET + checkitem MYSTIC_TICKET, $0001 + compare $800D, $0001 + virtualgotoif $01, TransferFailEonTicket + additem MYSTIC_TICKET, $0001 + setflag $013B + setflag $08D5 + virtualloadpointer TransferSuccessEonTicket + setbyte $02 + end + +TransferFailMysticTicket: + virtualloadpointer TransferFailTextEonTicket + setbyte $03 + end + +TransferSuccessMysticTicket: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextMysticTicket: + Text_EN "\v2 has already been\n" + Text_EN "received.@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +MysticTicketEnd: + db $00,$00,$00 + +EndofTicketChunks: + +DataEnd: + EOF \ No newline at end of file diff --git a/decoration/decoration.asm b/decoration/decoration.asm new file mode 100644 index 0000000..20553ad --- /dev/null +++ b/decoration/decoration.asm @@ -0,0 +1,123 @@ +INCLUDE "../macros.asm" +INCLUDE "../constants/items.asm" +INCLUDE "../constants/scriptcommands.asm" + +DataStartRegirock: ; 0070 + Mystery_Event + db CHECKSUM_CRC ; 0081 + dd 0 ; checksum placeholder 0082 + GBAPTR ScriptStartRegirock ; 0086 + GBAPTR RegirockEnd ; 008A + +ScriptStartRegirock: ; 008E + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartRegirock + db END_OF_CHUNKS + +PreloadScriptStartRegirock: ; 0094 + setvirtualaddress PreloadScriptStartRegirock + bufferdecorationname $00, $0076 ;Regirock doll + adddecoration $0076 + compare $800D, $0000 + virtualgotoif $01, TransferFailRegirock + virtualloadpointer TransferSuccessRegirock + setbyte $02 + end + +TransferFailRegirock: ; 00B3 + virtualloadpointer TransferFailTextRegirock + setbyte $03 + end + +TransferSuccessRegirock: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextRegirock: + Text_EN "There is not enough room for the\n" + Text_EN "\v2...@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +RegirockEnd: + db $00,$00,$00 + + +DataStartRegice: + db $01,$00,$00,$00,$02,$02,$00,$02,$00,$00,$00,$04,$00,$80,$01,$00,$00 ; Mystery_Event + db CHECKSUM_CRC + dd 0 ; checksum placeholder + GBAPTR ScriptStartRegirock + GBAPTR RegirockEnd + +ScriptStartRegice: + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartRegirock + db END_OF_CHUNKS + +PreloadScriptStartRegice: + setvirtualaddress PreloadScriptStartRegirock + bufferdecorationname $00, $0077 ;Regice doll + adddecoration $0077 + compare $800D, $0000 + virtualgotoif $01, TransferFailRegirock + virtualloadpointer TransferSuccessRegirock + setbyte $02 + end + +TransferFailRegice: + virtualloadpointer TransferFailTextRegirock + setbyte $03 + end + +TransferSuccessRegice: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextRegice: + Text_EN "There is not enough room for the\n" + Text_EN "\v2...@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +RegiceEnd: + db $00,$00,$00 + +DataStartRegisteel: + db $01,$00,$00,$00,$02,$02,$00,$02,$00,$00,$00,$04,$00,$80,$01,$00,$00 ; Mystery_Event + db CHECKSUM_CRC + dd 0 ; checksum placeholder + GBAPTR ScriptStartRegirock + GBAPTR RegirockEnd + +ScriptStartRegisteel: + db PRELOAD_SCRIPT + GBAPTR PreloadScriptStartRegirock + db END_OF_CHUNKS + +PreloadScriptStartRegisteel: + setvirtualaddress PreloadScriptStartRegirock + bufferdecorationname $00, $0078 ;Registeel doll + adddecoration $0078 + compare $800D, $0000 + virtualgotoif $01, TransferFailRegirock + virtualloadpointer TransferSuccessRegirock + setbyte $02 + end + +TransferFailRegisteel: + virtualloadpointer TransferFailTextRegirock + setbyte $03 + end + +TransferSuccessRegisteel: + Text_EN "\v2 has been sent!@" + ;db $FD,$02,$37,$00,$05,$08,$27,$2A,$13,$00,$07,$10,$AB,$FF + +TransferFailTextRegisteel: + Text_EN "There is not enough room for the\n" + Text_EN "\v2...@" + ;db $FD,$02,$2D,$00,$02,$2A,$29,$FE,$46,$0C,$36,$37,$00,$01,$02,$13,$00,$02,$15,$06,$50,$10,$B0,$FF +RegisteelEnd: + db $00,$00,$00 + +EndofRegiChunks: + +DataEnd: + EOF \ No newline at end of file diff --git a/decoration/prologue.asm b/decoration/prologue.asm new file mode 100644 index 0000000..8e65726 --- /dev/null +++ b/decoration/prologue.asm @@ -0,0 +1,14 @@ +INCLUDE "../macros.asm" +SECTION "prologue", ROM0[$100] + + db "GameFreak inc." + db 0,0,0,0,0,0 + db $78,$56,$34,$12,$56,$AD,$95,$BF,$FF + db 0,0,0,0,0,0,0,$01,$55 + db 0,0,0,0 + db REGION + db 0 + db "GameFreak inc." + db 0,0 + + EOF \ No newline at end of file diff --git a/decoration/sprites/arrow-ticket.gbapal b/decoration/sprites/arrow-ticket.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..4e29ab0e1a3beced70f19471540b4e844a388e1b GIT binary patch literal 32 Qcmexg&%m(0oB<~Q08bJEr2qf` literal 0 HcmV?d00001 diff --git a/decoration/sprites/arrow.4bpp b/decoration/sprites/arrow.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..c4d311b903fa5ce81167667659cfb26484701a52 GIT binary patch literal 32 bcmZP&WMp7a6ar!;Mj#e~VjvqR29yH;9HIfe literal 0 HcmV?d00001 diff --git a/decoration/sprites/arrow.gbapal b/decoration/sprites/arrow.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..4ad8063b0ab28e74ee1488311e5c9e9ad457d89f GIT binary patch literal 32 Scmexg&%hwhQ0&Km0{{R<5dvQT literal 0 HcmV?d00001 diff --git a/decoration/sprites/aurora_ticket.4bpp b/decoration/sprites/aurora_ticket.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..21e90f1c2c7b1e6c3136f0172270a6bdf488b067 GIT binary patch literal 288 zcmZQzAPWdGFbFC!2%0OQ>jp|NC^15@5L_0d-k3qq(?np(Ocw!{$WR8yP!LWPEH_s* zE-zO$E-nvtF)nv^HYqN52{kDW4Rtk63kwxh0-B)&G!Tqe2{9}M3MdOPGDrgL03rqk jfzVVSPGevQ1mZ+7pa57HW^-Da7$Xodq`}m~B#5K|uO%0r literal 0 HcmV?d00001 diff --git a/decoration/sprites/aurora_ticket.gbapal b/decoration/sprites/aurora_ticket.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..6371027bd35d5f62848ebd0c08b4ce88894e3b1c GIT binary patch literal 32 gcmbPYcT8fhy+(O@o_64KjWyNZ>YvB@hcUnb0M*C}F#rGn literal 0 HcmV?d00001 diff --git a/decoration/sprites/eon_ticket.4bpp b/decoration/sprites/eon_ticket.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..87dbb2cedd4200b5e60641ae4a61c933c56d2069 GIT binary patch literal 288 zcmbVF!41MN5OX$2qAXCOEYJ;5LH$QEkNzvf08M9L07l@$lw2zc5--Hb)=BoA4g56$ z2t*LSzs&&Mi}CF)_d*y(e}7C~Lq$`xFi1Ozc{;J3&$(Qcc@wEi?Z&xJvgl7vhM_`{!Smmv`_Q@GO_nYzKegYA<6>k6l literal 0 HcmV?d00001 diff --git a/decoration/sprites/eon_ticket.gbapal b/decoration/sprites/eon_ticket.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..c51e7598fc2b103711f7e033a0a84a3e73f4049f GIT binary patch literal 32 gcmcZ>bxh)JwT7Qox?%Z8qim^LZdYXQ88W~D0M^F|-T(jq literal 0 HcmV?d00001 diff --git a/decoration/sprites/mystic_ticket.4bpp b/decoration/sprites/mystic_ticket.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..a5a4e495060c5ee62e55f80560fed1c68345dd09 GIT binary patch literal 288 zcmbV_!3o1K3`M^;unk^7kS>rz2S`HBJ_wD_b7_q>C>^^$Ns~iQp+XPA|6daDS0x|` zlFIKk4M_Ns4|mBo<~^#;3#fWUHBXaWv{~n_x8Z5p_hi@@A6A4nga=pN87~T54k-M= a2BJ2^$$&elg~BTDpWRDPhL8MioSYx3W*0XA literal 0 HcmV?d00001 diff --git a/decoration/sprites/mystic_ticket.gbapal b/decoration/sprites/mystic_ticket.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..80c5321ce17039fcb03def3d81f26a4f11d932a2 GIT binary patch literal 32 ccmbPYcTA$J{D1wNJi|~u!|RFuVGJk$0KP>B=l}o! literal 0 HcmV?d00001 diff --git a/decoration/sprites/pokeball_bg-ticket.gbapal b/decoration/sprites/pokeball_bg-ticket.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..05158af4cbd09529b1d18c61f50715803e26778b GIT binary patch literal 32 UcmZQzay34p*5^IRngJ^S08nWI3jhEB literal 0 HcmV?d00001 diff --git a/decoration/sprites/pokeball_bg.4bpp b/decoration/sprites/pokeball_bg.4bpp new file mode 100644 index 0000000..9969296 --- /dev/null +++ b/decoration/sprites/pokeball_bg.4bpp @@ -0,0 +1 @@ +3333DDDD3333DDDD3333DDDD3333DDDD3333DDDD333DDD33DD3D333DDDD13DD13"D$"3""DD""3333""""""""""""#"""$"""#"""D"""33"""D"""3#""BD"""33""BD""""""""3"""D$""33""DD$"333"DDD$3333DDDD""""""""""""""""""""""""#"""DD"" \ No newline at end of file diff --git a/decoration/sprites/pokeball_bg.gbapal b/decoration/sprites/pokeball_bg.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..2855643c52a98aed1d74654ac45844dab6181b58 GIT binary patch literal 32 UcmZQz`kyvG%09oom;oyQ0BkA*0RR91 literal 0 HcmV?d00001 diff --git a/decoration/sprites/pokeball_bg.tilemap b/decoration/sprites/pokeball_bg.tilemap new file mode 100644 index 0000000000000000000000000000000000000000..fb4000244fc1542db56bec9fbd569b665bc5c301 GIT binary patch literal 2048 zcmajcF%Ez*3XoavT|IL3$kik7p8lu2_th&`uUx%y c^|q@=t{%C1fdBvi literal 0 HcmV?d00001 diff --git a/decoration/sprites/regi.gbapal b/decoration/sprites/regi.gbapal new file mode 100644 index 0000000..bba785f --- /dev/null +++ b/decoration/sprites/regi.gbapal @@ -0,0 +1 @@ +€%0Fö^ZkÙM)9rZ9kKÇ ¯!•2)¹9ÿ \ No newline at end of file diff --git a/decoration/sprites/regice.4bpp b/decoration/sprites/regice.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..ca6e966476fd2914d6a48e6b5beda7ae86b085a8 GIT binary patch literal 512 zcmZ9Iv62KK2t#|aTSuB>fu668cKF(bNryI=vBHhb=K0G6mGQyo{e!x7ZO81 yF(=_kB1%txM0`yCnL4vvKo8n*2HPV-XPb>p4F!@=&5A!iUwFF|>OcYi^M3&Bbi;)J literal 0 HcmV?d00001 diff --git a/decoration/sprites/regirock.4bpp b/decoration/sprites/regirock.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..60a0f20dcea06df1895d6518c59fb8f0c5f1847c GIT binary patch literal 512 zcmZ8e!HvT(4Aa~D58$`tW&qP&z~%%wI0F<(W;iBj4~GVzWr&hUIcDFVyXAS>>p1gy zoNw06oR-Pd2Ob?G{}t zK9*sxrCF9%A2k!9VI=nb3WK|#h{2!v#Q-D129L(X;&4bG1oaCWzHJzaG>^zU_p$6^{KlDI^cv-LIt|l zARkIqA{8L9j>KR>6hox@9b~~QH&~YD2Uek^U~*{&`oxg%h1-Cc%-wH(@$+6l>X!qV Rv;5Vse{yZ}2WkHA{{>=22~q$6 literal 0 HcmV?d00001 diff --git a/decoration/sprites/registeel.4bpp b/decoration/sprites/registeel.4bpp new file mode 100644 index 0000000000000000000000000000000000000000..3454477250b349a2561f33de22eb7294f5b1b4c2 GIT binary patch literal 512 zcmYk3!D_=W42Eq6JLh-2UV}t)Udv#2713*HpI~Jp?;prr`<-@Sg3pp7$&!_nHaXDh zh*5b;JuyN-P7*_k7!U!C5M78@)xUTb??(oQGRH+9xE6oZuSt(1Q`N>xO5PmUz7ILg zVQyhCuNQ*eW$dAG}L;HvICb0XD$V%M^Yf;D0bZI?g#Z8m literal 0 HcmV?d00001 diff --git a/decoration/sprites/text.gbapal b/decoration/sprites/text.gbapal new file mode 100644 index 0000000000000000000000000000000000000000..caa323942e9bbb257ebcefb1c99fa73d61de0b74 GIT binary patch literal 12 TcmaEF%fRrzUY_9rGeZpk9uEX5 literal 0 HcmV?d00001 diff --git a/decoration/sprites/textbox_main.tilemap b/decoration/sprites/textbox_main.tilemap new file mode 100644 index 0000000000000000000000000000000000000000..b9b92efb9e85bfbdaaff7a1d8a4fbbd7be10e4b8 GIT binary patch literal 1280 zcmZQz7}voSCL0Nz>)YXATM literal 0 HcmV?d00001 diff --git a/decoration/sprites/textboxes.tilemap b/decoration/sprites/textboxes.tilemap new file mode 100644 index 0000000000000000000000000000000000000000..2b15ffb01527e7ce2266832035beb82bff19bcef GIT binary patch literal 1280 zcmeH`!3qE&2t=ncHSqtxck$5Dp^RYnu&~V~kP#f8fDlu~k%%GauaOerOp4a+5M!%) zBx4o58@&9PuMFF|(Y_iyt{nwLtp&wq!{jL+xzi|AQ% 0x11: + print "Unknown chunk {0:X}".format(chunk_type) + raise TypeError + i += chunk_lengths[chunk_type] + + + +# calculate and insert all wordwise checksums +for wordwise in wordwises: + sum = 0 + for i in range(wordwise[1], wordwise[2], 4): + sum = (sum + struct.unpack('> 1) ^ 0x8408 + else: + sum >>= 1 + sum = ~sum & 0xFFFF + crc_results.append(sum) + +i = 0 +for crc in crcs: + data = data[0:crc[0]] + struct.pack('