WeeGUI/asmdemo.s

172 lines
2.1 KiB
ArmAsm
Raw Normal View History

2014-08-29 19:19:19 +00:00
;
2015-02-09 01:50:44 +00:00
; asmdemo.s
; WeeGUI sample application
2014-08-29 19:19:19 +00:00
;
; Created by Quinn Dunki on 8/15/14.
2015-02-09 01:50:44 +00:00
; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved.
2014-08-29 19:19:19 +00:00
;
.include "WeeGUI_MLI.s"
2014-08-29 19:19:19 +00:00
.org $6000
2014-08-29 19:19:19 +00:00
INBUF = $0200
DOSCMD = $be03
KBD = $c000
KBDSTRB = $c010
2014-08-29 19:19:19 +00:00
main:
2014-10-02 21:59:13 +00:00
; BRUN the GUI library
ldx #0
ldy #0
2015-02-08 01:39:18 +00:00
@0: lda brunCmdLine,x
beq @1
sta INBUF,y
inx
iny
bra @0
@1: jsr DOSCMD
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-02-09 01:50:44 +00:00
; Show off rendering speed with some snazzy rectangle painting
2015-02-08 01:39:18 +00:00
;
; Stack:
; Curr X
; Curr Y
; Curr Width
; Curr Height
2015-02-09 01:50:44 +00:00
2015-02-08 01:39:18 +00:00
ldx #WGClearScreen
jsr WeeGUI
2014-10-02 21:59:13 +00:00
2015-02-09 01:50:44 +00:00
animateRects:
2015-02-08 01:39:18 +00:00
lda #38 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
animateRectsEvenLoop:
@0: lda $C019 ; Sync to VBL
bmi @0
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
ldx #WGClearScreen
jsr WeeGUI
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
tsx
inx
lda $0100,x ; Load Height, then modify
sta PARAM3
inc
inc
sta $0100,x
cmp #25
2015-02-09 01:50:44 +00:00
bcs animateRects
2015-02-08 01:39:18 +00:00
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
2015-02-09 01:50:44 +00:00
ldy #64
2015-02-08 01:39:18 +00:00
ldx #WGFillRect
jsr WeeGUI
2015-02-08 01:39:18 +00:00
ldx #WGStrokeRect
jsr WeeGUI
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
jsr delayShort
jsr delayShort
jsr delayShort
2015-02-09 01:50:44 +00:00
jsr checkKbd
2015-02-09 01:50:44 +00:00
bra animateRectsEvenLoop
2014-10-02 21:59:13 +00:00
2015-02-08 01:39:18 +00:00
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
2015-02-09 01:50:44 +00:00
checkKbd:
lda KBD
bpl checkKbdDone
sta KBDSTRB
2015-02-08 01:39:18 +00:00
2015-02-09 01:50:44 +00:00
cmp #241 ; 'q' with high bit set
bne checkKbdDone
2015-02-08 01:39:18 +00:00
2015-02-09 01:50:44 +00:00
ldx #WGExit
jsr WeeGUI
pla ; Pull our own frame off the stack...
2015-02-08 01:39:18 +00:00
pla
2015-02-09 01:50:44 +00:00
pla
pla
pla ; ...four local variables + return address...
pla
rts ; ...so we can quit to ProDOS from here
2015-02-09 01:50:44 +00:00
checkKbdDone:
rts
2014-10-02 21:59:13 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-02-08 01:39:18 +00:00
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"