-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample02.asm
More file actions
266 lines (251 loc) · 5.73 KB
/
example02.asm
File metadata and controls
266 lines (251 loc) · 5.73 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
*=$0801
!byte $0C,$08,$0A,$00,$9E,' ','2','0','6','4',$00,$00,$00
*=$0810
r0 = $02
r0l = r0
r0h = r0+1
r1 = $04
r1l = r1
r1h = r1+1
r2 = $06
r2l = r2
r2h = r2+1
r3 = $08
r3l = r3
r3h = r3+1
r4 = $0A
r4l = r4
r4h = r4+1
r5 = $0C
r5l = r5
r5h = r5+1
; Append library to the source code (remember to add 2 to the library start)
LIBSTART=VTUI+2
; Library references
VTUI_initialize = LIBSTART+0
VTUI_screen_set = LIBSTART+2
VTUI_set_bank = LIBSTART+5
VTUI_set_stride = LIBSTART+8
VTUI_set_decr = LIBSTART+11
VTUI_clr_scr = LIBSTART+14
VTUI_gotoxy = LIBSTART+17
VTUI_plot_char = LIBSTART+20
VTUI_scan_char = LIBSTART+23
VTUI_hline = LIBSTART+26
VTUI_vline = LIBSTART+29
VTUI_print_str = LIBSTART+32
VTUI_fill_box = LIBSTART+35
VTUI_pet2scr = LIBSTART+38
VTUI_scr2pet = LIBSTART+41
VTUI_border = LIBSTART+44
VTUI_save_rect = LIBSTART+47
VTUI_rest_rect = LIBSTART+50
VTUI_input_str = LIBSTART+53
VTUI_get_bank = LIBSTART+56
vtui_get_stride = LIBSTART+59
vtui_get_decr = LIBSTART+62
main:
; Initialize the library
jsr VTUI_initialize
; Set screen mode to 40x30
lda #$03
jsr VTUI_screen_set
; Set stride to 1, most functions rely on stride being 1
lda #$01
jsr VTUI_set_stride
; Set decrement to 0, most functions rely on VERA incrementing
clc
jsr VTUI_set_decr
; Clear screen with white background and black foreground
ldx #$10
lda #' '
jsr VTUI_clr_scr
; gotoxy 11, 2
lda #11
ldy #2
jsr VTUI_gotoxy
; Write a blue heart on screen
ldx #$16 ; Blue on white
lda #$53 ; Character to print
jsr VTUI_plot_char
; gotoxy 28, 2
lda #28
ldy #2
jsr VTUI_gotoxy
; Write a blue heart on screen
ldx #$16 ; Blue on white
lda #$53 ; Character to print
jsr VTUI_plot_char
; gotoxy 14, 3
lda #14
ldy #3
jsr VTUI_gotoxy
; Print string
lda #<Libname ; Low byte of string start address
sta r0l
lda #>Libname ; High byte of string start address
sta r0h
ldx #$01 ; White text on black background
lda #0
ldy #Verstr-Libname
jsr VTUI_print_str
; gotoxy 11, 5
lda #11
ldy #5
jsr VTUI_gotoxy
; Draw horizontal line
ldy #18 ; Line length
ldx #$20 ; Red background / black foreground
lda #$3D ; Character to use for drawing line
jsr VTUI_hline
; gotoxy 3, 9
lda #3
ldy #9
jsr VTUI_gotoxy
; Draw a border
lda #34
sta r1l ; Width
lda #18
sta r2l ; Height
lda #3 ; Bordermode
ldx #$74 ; Yellow background, purple foreground
jsr VTUI_border
; gotoxy 4, 10
lda #4
ldy #10
jsr VTUI_gotoxy
; Draw a filled box
lda #32
sta r1l ; Width
lda #16
sta r2l ; Height
ldx #$74 ; Yellow background, purple foreground
lda #' ' ; Character used for filling box
jsr VTUI_fill_box
; gotoxy 13, 9
lda #13
ldy #9
jsr VTUI_gotoxy
; Plot a character to create a header for our box
lda #$73 ; Character
ldx #$74 ; Color
jsr VTUI_plot_char
; Print string to create a header for our box
lda #<Verstr ; Low byte of string start address
sta r0l
lda #>Verstr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Boxstr-Verstr
jsr VTUI_print_str
; Plot a character to create a header for our box
lda #$6B ; Character
ldx #$74 ; Color
jsr VTUI_plot_char
; gotoxy 3, 17
lda #3
ldy #17
jsr VTUI_gotoxy
; Plot a character to create a dividing line in the box
lda #$6B ; Character
ldx #$74 ; Color
jsr VTUI_plot_char
; Draw horizontal line to create a dividing line in the box
ldy #32 ; Line length
ldx #$74 ; Yellow background, purple foreground
lda #$43 ; Character to use for drawing line
jsr VTUI_hline
; Plot a character to create a dividing line in the box
lda #$73 ; Character
ldx #$74 ; Color
jsr VTUI_plot_char
; gotoxy 5, 11
lda #5
ldy #11
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Boxstr ; Low byte of string start address
sta r0l
lda #>Boxstr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Hlinestr-Boxstr
jsr VTUI_print_str
; gotoxy 5, 13
lda #5
ldy #13
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Hlinestr ; Low byte of string start address
sta r0l
lda #>Hlinestr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Vlinestr-Hlinestr
jsr VTUI_print_str
; gotoxy 5, 15
lda #5
ldy #15
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Vlinestr ; Low byte of string start address
sta r0l
lda #>Vlinestr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Plotstr-Vlinestr
jsr VTUI_print_str
; gotoxy 5, 19
lda #5
ldy #19
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Plotstr ; Low byte of string start address
sta r0l
lda #>Plotstr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Dramstr-Plotstr
jsr VTUI_print_str
; gotoxy 5, 21
lda #5
ldy #21
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Dramstr ; Low byte of string start address
sta r0l
lda #>Dramstr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #Morestr-Dramstr
jsr VTUI_print_str
; gotoxy 5, 23
lda #5
ldy #23
jsr VTUI_gotoxy
; Print string with info about boxes
lda #<Morestr ; Low byte of string start address
sta r0l
lda #>Morestr ; High byte of string start address
sta r0h
ldx #$74 ; Yellow background, purple foreground
lda #0
ldy #VTUI-Morestr
jsr VTUI_print_str
jsr $FFCF ; Wait for enter key
rts
Libname !text "VTUI LIBRARY"
Verstr !text "VERSION 1.2"
Boxstr !text "BOXES WITH OR WITHOUT BORDERS"
Hlinestr !text "HORIZONTAL LINES"
Vlinestr !text "VERTICAL LINES"
Plotstr !text "PLOT OR SCAN CHARACTERS"
Dramstr !text "DIRECTLY TO/FROM SCREEN RAM"
Morestr !text "***** WITH CC65 SUPPORT *****"
VTUI !bin "VTUI1.2.BIN"