-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathasmdemo.s
171 lines (138 loc) · 2.08 KB
/
asmdemo.s
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
;
; asmdemo.s
; WeeGUI sample application
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved.
;
.include "WeeGUI_MLI.s"
.org $6000
INBUF = $0200
DOSCMD = $be03
KBD = $c000
KBDSTRB = $c010
main:
; BRUN the GUI library
ldx #0
ldy #0
@0: lda brunCmdLine,x
beq @1
sta INBUF,y
inx
iny
bra @0
@1: jsr DOSCMD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Show off rendering speed with some snazzy rectangle painting
;
; Stack:
; Curr X
; Curr Y
; Curr Width
; Curr Height
ldx #WGClearScreen
jsr WeeGUI
animateRects:
lda #38 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
animateRectsEvenLoop:
@0: lda $C019 ; Sync to VBL
bmi @0
ldx #WGClearScreen
jsr WeeGUI
tsx
inx
lda $0100,x ; Load Height, then modify
sta PARAM3
inc
inc
sta $0100,x
cmp #25
bcs animateRects
inx ; Load Width, then modify
lda $0100,x
sta PARAM2
inc
inc
inc
inc
inc
inc
sta $0100,x
inx ; Load Y, then modify
lda $0100,x
sta PARAM1
dec
sta $0100,x
inx ; Load X, then modify
lda $0100,x
sta PARAM0
dec
dec
dec
sta $0100,x
ldy #64
ldx #WGFillRect
jsr WeeGUI
ldx #WGStrokeRect
jsr WeeGUI
jsr delayShort
jsr delayShort
jsr delayShort
jsr checkKbd
bra animateRectsEvenLoop
delayShort: ; ~1/30 sec
pha
phx
phy
ldy #$06 ; Loop a bit
delayShortOuter:
ldx #$ff
delayShortInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayShortInner
dey
bne delayShortOuter
ply
plx
pla
rts
checkKbd:
lda KBD
bpl checkKbdDone
sta KBDSTRB
cmp #241 ; 'q' with high bit set
bne checkKbdDone
ldx #WGExit
jsr WeeGUI
pla ; Pull our own frame off the stack...
pla
pla
pla
pla ; ...four local variables + return address...
pla
rts ; ...so we can quit to ProDOS from here
checkKbdDone:
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
brunCmdLine:
.byte "BRUN weegui",$8d,0
; Suppress some linker warnings - Must be the last thing in the file
.SEGMENT "ZPSAVE"
.SEGMENT "EXEHDR"
.SEGMENT "STARTUP"
.SEGMENT "INIT"
.SEGMENT "LOWCODE"