-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_adr.inc
169 lines (139 loc) · 5.22 KB
/
s_adr.inc
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
; =============================================================================
; Address screen
; (C) by Jens Ch. Restemeier, <XXXXXXXXXXXX>
; =============================================================================
drw_adr:
; hide cursor
ld hl,0c000h ; sprite-table
ld a, 0 ; Y
ld (hl),a
call display_off
call default_init
; init color-palette for GB-Color
ld a,0
ld hl,gray_pal
call set_bg_pal
ld a,1
ld hl,red_pal
call set_bg_pal
ld a,0
ld hl,red_pal
call set_ob_pal
ldh a, (EN_COLOR & 0FFh)
or a
call z, set_gray
ld hl, 09800h
ld b,20-4
ld c,18-4
call draw_border
ld hl, adr_title
ld de, 09800h + 6 + (2*32)
call copy_z
ld hl, adr_nam1
ld de, 09800h + 2 + (5*32)
call copy_z
ld hl, adr_nam2
ld de, 09800h + 4 + (6*32)
call copy_z
ld hl, adr_street
ld de, 09800h + 2 + (7*32)
call copy_z
ld hl, adr_town
ld de, 09800h + 2 + (9*32)
call copy_z
ld hl, adr_country
ld de, 09800h + 2 + (10*32)
call copy_z
ld hl, adr_email
ld de, 09800h + 2 + (12*32)
call copy_z
ld hl, adr_print
ld de, 09800h + 2 + (14*32)
call copy_z
ld hl, gen_exit
ld de, 09800h + 2 + (15*32)
call copy_z
ldh a,(EN_COLOR & 0FFh)
or a
jr z, ad_no_col
; init CGB palettes
ld hl, 09800h
ld b, 20
ld c, 18
ld d,2 ; set to palette 1
call set_atr_box
ld hl, 09800h + 1 + (3*32)
ld b, 18
ld c, 14
ld d,0 ; set to palette 0
call set_atr_box
ld hl, 09800h + 1 + (2*32)
ld b, 18
ld c, 1
ld d, 1 ; set to palette 2
call set_atr_box
ad_no_col:
call display_on
ld a,5
ldh (SCREEN & 0FFh),a
ret
; menu-item: exit
s1_adr:
; show cursor
ld hl,0c000h ; sprite-table
ld a, 16+120 ; Y
ldi (hl),a
ld a, 8+6 ; X
ldi (hl),a
ld a, 0 ; Pattern nr.
ldi (hl),a
ld a, 01000000b ; attributes
ldi (hl),a
ld a,21
ldh (SCREEN & 0FFh),a
ldh a,(JOY_TIPP & 0FFh)
and 044h ; if "select" or up
ret nz
ld a,0
ldh (SCREEN & 0FFh),a
ldh a,(JOY_TIPP & 0FFh)
and 00Bh ; if "start", 'A' or 'B'
ret nz
ld a,5 ; otherwise stay at this state
ldh (SCREEN & 0FFh),a
ret
; menu-item: print
s2_adr:
; show cursor
ld hl,0c000h ; sprite-table
ld a, 16+112 ; Y
ldi (hl),a
ld a, 8+6 ; X
ldi (hl),a
ld a, 0 ; Pattern nr.
ldi (hl),a
ld a, 01000000b ; attributes
ldi (hl),a
ld a,0
ldh (SCREEN & 0FFh),a
ldh a,(JOY_TIPP & 0FFh)
and 002h ; if 'B'
ret nz
ld a,5
ldh (SCREEN & 0FFh),a
ldh a,(JOY_TIPP & 0FFh)
and 084h ; if "select" or down
ret nz
ld a,0 ; print...
ldh (SCREEN & 0FFh),a
ldh a,(JOY_TIPP & 0FFh)
and 009h ; if "start", 'A'
call nz, print_address
ld a,21 ; otherwise stay at this state
ldh (SCREEN & 0FFh),a
ret
print_address:
ld hl, adr_text
call prn_prtbuf
ret
; Yes, there should be some error-handling...