WeeGUI/guidemo.s

230 lines
3.1 KiB
ArmAsm
Raw Normal View History

2014-08-29 19:19:19 +00:00
;
; guidemo.s
2014-08-29 19:19:19 +00:00
; AssemblyTest
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
.org $6000
; Reserved locations
; Constants
; ROM entry points
; WeeGUI entry points
GUI_MAIN = $4000
; Main
main:
2014-10-02 21:59:13 +00:00
;jmp tortureTestPrint
;jmp tortureTestRects
jsr WGDesktop
CALL16 WGCreateView,testView
CALL16 WGViewSetTitle,testTitle0
CALL16 WGCreateCheckbox,testCheck
CALL16 WGCreateButton,testButton1
CALL16 WGCreateButton,testButton2
jsr WGViewPaintAll
lda #0
jsr WGSelectView
; ldx #5
; ldy #0
; jsr WGSetCursor
; lda #0
; jsr WGScrollX
; lda #-17
; jsr WGScrollY
; jsr testPaintContents
jsr WGEnableMouse
keyLoop:
jsr WGPendingViewAction
lda KBD
bpl keyLoop
sta KBDSTRB
and #%01111111
cmp #9
beq keyLoop_focusNext
cmp #27
beq keyLoop_focusPrev
cmp #13
beq keyLoop_toggle
cmp #32
beq keyLoop_toggle
cmp #'o'
beq keyLoop_focusOkay
cmp #8
beq keyLoop_leftArrow
cmp #21
beq keyLoop_rightArrow
cmp #11
beq keyLoop_upArrow
cmp #10
beq keyLoop_downArrow
cmp #113
beq keyLoop_quit
jmp keyLoop
keyLoop_focusNext:
jsr WGViewFocusNext
jmp keyLoop
keyLoop_focusPrev:
jsr WGViewFocusPrev
jmp keyLoop
keyLoop_toggle:
jsr WGViewFocusAction
jmp keyLoop
keyLoop_leftArrow:
lda #1
jsr WGScrollXBy
jsr testPaintContents
jmp keyLoop
keyLoop_rightArrow:
lda #-1
jsr WGScrollXBy
jsr testPaintContents
jmp keyLoop
keyLoop_upArrow:
lda #1
jsr WGScrollYBy
jsr testPaintContents
jmp keyLoop
keyLoop_downArrow:
lda #-1
jsr WGScrollYBy
jsr testPaintContents
jmp keyLoop
keyLoop_focusOkay:
lda #2
jsr WGSelectView
jsr WGViewFocus
jmp keyLoop
keyLoop_quit:
jsr WGDisableMouse
rts ; This seems to work for returning to BASIC.SYSTEM, but I don't know if it's right
testPaintContents:
SAVE_AXY
lda #0
jsr WGSelectView
jsr WGEraseViewContents
;;
jsr WGNormal
ldx #10
ldy #15
jsr WGSetCursor
CALL16 WGPrint,testStr
bra testPaintContents_done
;;
ldy #0
testPaintContents_loop:
ldx #0
jsr WGSetCursor
tya
clc
adc #'A'
sta testStr3
CALL16 WGPrint,testStr3
iny
cpy #25
bne testPaintContents_loop
testPaintContents_done:
RESTORE_AXY
rts
testCallback:
jsr $ff3a
rts
rts
2014-08-29 19:19:19 +00:00
2014-10-02 21:59:13 +00:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
testView:
.byte 0,1,7,3,62,18,62,40
testCheck:
.byte 1,16,4
.addr testTitle3
testButton1:
.byte 2,35,10,15
.addr testCallback
.addr testTitle1
testButton2:
.byte 3,35,13,15
.addr 0
.addr testTitle2
testStr:
; .byte "This is a test of the emergency broadcast system.",0; If this had been a real emergency, you would be dead now.",0 ; 107 chars
.byte "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ !",34,"#$%&'()*+,-./0123456789:;<=>?`abcdefghijklmno",0
testStr2:
.byte "pqrstuvwxyz{|}~",$ff,0
testStr3:
.byte "x",0
testTitle0:
.byte "Nifty Window",0
testTitle1:
.byte "Okay",0
testTitle2:
.byte "Cancel",0
testTitle3:
.byte "More Magic",0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Suppress some linker warnings - Must be the last thing in the file
.SEGMENT "ZPSAVE"
.SEGMENT "EXEHDR"
.SEGMENT "STARTUP"
.SEGMENT "INIT"
.SEGMENT "LOWCODE"