summaryrefslogtreecommitdiff
path: root/eonticket/00-C000.asm
blob: 32a66bf7cdc0ead02f6ef746ca876fc5b8740d86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
INCLUDE "../macros.asm"
SECTION "eonticket",ROM0[$100]
jp Start
db $00

TicketSprite: ; 104
	INCBIN "ticket.4bpp"
TicketPalette: ; 1604
	INCLUDE "ticket.pal"

Prologue:
	INCBIN "prologue-{REGION_NAME}.bin"

DataPacket: ; 164a
	INCBIN "eonticket-{REGION_NAME}.mev"
	db 0,0,0 ; padding

INCLUDE "../common/mem_struct.asm"

SpriteData:
	dw TicketSprite,TicketPalette
	db $15,$08,$01,$01,$01,$01,$01 ; width 15, height 8

Instructions1: ; 1921
	db "Link e-Reader to Pokémon Ruby or \n"
	db "Sapphire and select MYSTERY EVENTS\n"
	db "on the game's main menu.\n"
	db "Press the B Button to cancel.\0"

Instructions2: ; 199d
	db "Press the A Button on the Game Boy\n"
	db "Advance containing Pokémon Ruby or\n"
	db "Sapphire to begin sending the EON\n"
	db "TICKET.\0"

DeliveryInProcess: ; 1a0d
	db "EON TICKET delivery in Process...\0"

TicketDelivered: ; 1a2f
	db "EON TICKET delivered!\n"
	db "\n"
	db "Press the A Button to resend.\n"
	db "Press the B Button to cancel.\0"

; this function is subtly different than the one
; on the Battle e cards, for no apparent reason
TransferData:
	LD_IND_HL SomeVar1
	push de
	ld hl, $bbbb
	LD_IND_HL Space_1
	EX_DE_HL
	LD_IND_HL Space_2
	API_0C7 Space_1

	wait $01
	pop hl
	inc hl
	ld b, $01
	call WordShiftRight

	LD_IND_HL SomeVar2
.asm_1aa1
	LD_HL_IND SomeVar2
	ld a, l
	or h
	ret z

	ld hl, $8888
	LD_IND_HL Space_1
	ld e, $01

.asm_1aaf
	ld a, e
	cp $08
	jr nc, .asm_1ad9

	push de
	LD_HL_IND SomeVar1
	ld c, [hl]
	inc hl
	ld b, [hl]
	inc hl
	LD_IND_HL SomeVar1
	ld l, e
	ld h, $00
	add hl, hl
	ld de, Space_1
	add hl, de
	ld [hl], c
	inc hl
	ld [hl], b
	pop de
	LD_HL_IND SomeVar2
	dec hl
	LD_IND_HL SomeVar2
	ld a, l
	or h
	jr z, .asm_1ad9

	inc e
	jr .asm_1aaf

.asm_1ad9
	API_0C7 Space_1
	wait $01
	jr .asm_1aa1

Start: ; 1ae2
	API_121

	CreateCustomSprite SpriteHandlePtr, $80, SpriteData
	SetSpritePos SpriteHandlePtr, 120, 64
	SpriteHide SpriteHandlePtr

	CreateRegion RegionHandlePtr, 30, 6, 0, 14, 0, 4

	ld h, a
	ld l, $00
	SetTextSize

	API_09B RegionHandlePtr, $0102
	SetTextColor RegionHandlePtr, 2, 0
	SetRegionColor RegionHandlePtr, 0
	SetBackgroundPalette 16, $0040, TicketPalette

	FadeIn 16
	wait 16

	API $0C6

	DrawText RegionHandlePtr, Instructions1, 8, 4
	API $08D

INCLUDE "../common/wait_for_link.asm"

	SpriteShow SpriteHandlePtr

	DrawText RegionHandlePtr, Instructions2, 8, 4
	API $08D

	ld a, b
	nop

UNKNOWN_VALUE EQU $0078
INCLUDE "../common/wait_for_ready.asm"

	DrawText RegionHandlePtr, DeliveryInProcess, 8, 4

DATA_TRANSFER_LENGTH EQU 6144
INCLUDE "../common/transfer_data.asm"
	ld hl, $5fff
	LD_IND_HL Space_1
	API_0C7 Space_1

	wait $80

	SpriteHide SpriteHandlePtr

	DrawText RegionHandlePtr, TicketDelivered, 8, 4

	API $08D
	ld c, a
	nop

INCLUDE "../common/wrap_up.asm"

INCLUDE "../common/word_shift_right.asm"

SomeVar1: ; 1CA2
	db $FF,0 ; mark EOF
RegionHandlePtr: db 0 ; 1CA4
SpriteHandlePtr: db 0,0 ; 1CA5
SomeVar2: db 0,0 ; 1CA7