mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2025-03-03 02:29:01 +00:00
- Implemented most of MLI
- Code cleanup - GUIDEMO is now the demo for the MLI
This commit is contained in:
parent
38da3a2c8e
commit
fd53a53a85
@ -22,6 +22,7 @@
|
||||
70F1DB4B19A56D6300321637 /* switches.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = switches.s; sourceTree = "<group>"; };
|
||||
70F1DB5619A6B02900321637 /* painting.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = painting.s; sourceTree = "<group>"; };
|
||||
70F1DB5D19A7FF8700321637 /* memory.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memory.s; sourceTree = "<group>"; };
|
||||
70FB05F119DF5B0900573690 /* WeeGUI_MLI.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = WeeGUI_MLI.s; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@ -39,6 +40,7 @@
|
||||
70868EE019BD150C00E4B4CB /* rects.s */,
|
||||
709E88E319AC0A5F0069DB55 /* views.s */,
|
||||
70A3A2C219BFE2C3006A2EC4 /* applesoft.s */,
|
||||
70FB05F119DF5B0900573690 /* WeeGUI_MLI.s */,
|
||||
70427F2219D648730031D960 /* mouse.s */,
|
||||
70D435B219A013AF001BFD9B /* gui.s */,
|
||||
709E88E419AC0DC20069DB55 /* unit_test.s */,
|
||||
|
65
WeeGUI_MLI.s
Normal file
65
WeeGUI_MLI.s
Normal file
@ -0,0 +1,65 @@
|
||||
;
|
||||
; WeeGUI_MLI.s
|
||||
; Machine Language API for WeeGUI
|
||||
;
|
||||
; Created by Quinn Dunki on 8/15/14.
|
||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Reserved zero page locations
|
||||
;
|
||||
PARAM0 = $06
|
||||
PARAM1 = $07
|
||||
PARAM2 = $08
|
||||
PARAM3 = $09
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WeeGUI entry point
|
||||
; Set up your call, then do a JSR to this address.
|
||||
;
|
||||
WeeGUI = $4004
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; API call names, to be passed to WeeGUI via X register
|
||||
; e.g.
|
||||
; ldx #WGDesktop
|
||||
; jsr WeeGUI
|
||||
;
|
||||
WGClearScreen = 0
|
||||
WGDesktop = 2
|
||||
WGSetCursor = 4
|
||||
WGSetGlobalCursor = 6
|
||||
WGSyncGlobalCursor = 8
|
||||
WGPlot = 10
|
||||
WGPrint = 12
|
||||
WGFillRect = 14
|
||||
WGStrokeRect = 16
|
||||
WGFancyRect = 18
|
||||
WGPaintView = 20
|
||||
WGViewPaintAll = 22
|
||||
WGEraseView = 24
|
||||
WGEraseViewContents = 26
|
||||
WGCreateView = 28
|
||||
WGCreateCheckbox = 30
|
||||
WGCreateButton = 32
|
||||
WGViewSetTitle = 34
|
||||
WGViewSetAction = 36
|
||||
WGSelectView = 38
|
||||
WGViewFromPoint = 40
|
||||
WGViewFocus = 42
|
||||
WGViewUnfocus = 44
|
||||
WGViewFocusNext = 46
|
||||
WGViewFocusPrev = 48
|
||||
WGViewFocusAction = 50
|
||||
WGPendingViewAction = 52
|
||||
WGPendingView = 54
|
||||
WGScrollX = 56
|
||||
WGScrollXBy = 58
|
||||
WGScrollY = 60
|
||||
WGScrollYBy = 62
|
||||
WGEnableMouse = 64
|
||||
WGDisableMouse = 66
|
32
gui.s
32
gui.s
@ -40,9 +40,38 @@ WGDispatch:
|
||||
WGEntryPointTable:
|
||||
.addr WGClearScreen
|
||||
.addr WGDesktop
|
||||
.addr WGPlot
|
||||
.addr WGSetCursor
|
||||
.addr WGSetGlobalCursor
|
||||
.addr WGSyncGlobalCursor
|
||||
.addr WGPlot
|
||||
.addr WGPrint
|
||||
.addr WGFillRect
|
||||
.addr WGStrokeRect
|
||||
.addr WGFancyRect
|
||||
.addr WGPaintView
|
||||
.addr WGViewPaintAll
|
||||
.addr WGEraseView
|
||||
.addr WGEraseViewContents
|
||||
.addr WGCreateView
|
||||
.addr WGCreateCheckbox
|
||||
.addr WGCreateButton
|
||||
.addr WGViewSetTitle
|
||||
.addr WGViewSetAction
|
||||
.addr WGSelectView
|
||||
.addr WGViewFromPoint
|
||||
.addr WGViewFocus
|
||||
.addr WGViewUnfocus
|
||||
.addr WGViewFocusNext
|
||||
.addr WGViewFocusPrev
|
||||
.addr WGViewFocusAction
|
||||
.addr WGPendingViewAction
|
||||
.addr WGPendingView
|
||||
.addr WGScrollX
|
||||
.addr WGScrollXBy
|
||||
.addr WGScrollY
|
||||
.addr WGScrollYBy
|
||||
.addr WGEnableMouse
|
||||
.addr WGDisableMouse
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -100,7 +129,6 @@ WG80:
|
||||
.include "views.s"
|
||||
.include "mouse.s"
|
||||
.include "applesoft.s"
|
||||
;.include "unit_test.s"
|
||||
.include "memory.s"
|
||||
|
||||
|
||||
|
BIN
guidemo.dsk
BIN
guidemo.dsk
Binary file not shown.
308
guidemo.s
308
guidemo.s
@ -1,52 +1,201 @@
|
||||
;
|
||||
; guidemo.s
|
||||
; AssemblyTest
|
||||
; WeeGUI sample application
|
||||
;
|
||||
; Created by Quinn Dunki on 8/15/14.
|
||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
.include "WeeGUI_MLI.s"
|
||||
|
||||
|
||||
.org $6000
|
||||
|
||||
; Reserved locations
|
||||
PARAM0 = $06
|
||||
PARAM1 = $07
|
||||
PARAM2 = $08
|
||||
PARAM3 = $09
|
||||
INBUF = $0200
|
||||
DOSCMD = $be03
|
||||
KBD = $c000
|
||||
KBDSTRB = $c010
|
||||
|
||||
|
||||
; WeeGUI entry points
|
||||
WeeGUI = $4004
|
||||
|
||||
WGClearScreen = 0
|
||||
WGDesktop = 2
|
||||
WGPlot = 4
|
||||
WGSetCursor = 6
|
||||
WGSetGlobalCursor = 8
|
||||
.macro WGCALL16 func,addr
|
||||
lda #<addr
|
||||
sta PARAM0
|
||||
lda #>addr
|
||||
sta PARAM1
|
||||
ldx #func
|
||||
jsr WeeGUI
|
||||
.endmacro
|
||||
|
||||
|
||||
; Sample code
|
||||
main:
|
||||
|
||||
; BLOAD the GUI library
|
||||
ldx #0
|
||||
ldy #0
|
||||
@0: lda bloadCmdLine,x
|
||||
beq @1
|
||||
sta INBUF,y
|
||||
inx
|
||||
iny
|
||||
bra @0
|
||||
@1: jsr DOSCMD
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Show off some WeeGUI features
|
||||
|
||||
|
||||
ldx #WGClearScreen
|
||||
jsr WeeGUI
|
||||
|
||||
ldx #WGDesktop
|
||||
jsr WeeGUI
|
||||
|
||||
lda #40
|
||||
sta PARAM0
|
||||
lda #12
|
||||
sta PARAM1
|
||||
ldx #WGSetGlobalCursor
|
||||
WGCALL16 WGCreateView,testView
|
||||
WGCALL16 WGViewSetTitle,testTitle0
|
||||
WGCALL16 WGCreateCheckbox,testCheck
|
||||
WGCALL16 WGCreateButton,testButton1
|
||||
WGCALL16 WGCreateButton,testButton2
|
||||
|
||||
ldx #WGViewPaintAll
|
||||
jsr WeeGUI
|
||||
|
||||
lda #'Q'+$80
|
||||
ldx #WGPlot
|
||||
lda #0
|
||||
ldx #WGSelectView
|
||||
jsr WeeGUI
|
||||
|
||||
ldx #WGEnableMouse
|
||||
jsr WeeGUI
|
||||
|
||||
keyLoop:
|
||||
ldx #WGPendingViewAction
|
||||
jsr WeeGUI
|
||||
|
||||
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:
|
||||
ldx #WGViewFocusNext
|
||||
jsr WeeGUI
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_focusPrev:
|
||||
ldx #WGViewFocusPrev
|
||||
jsr WeeGUI
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_toggle:
|
||||
ldx #WGViewFocusAction
|
||||
jsr WeeGUI
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_leftArrow:
|
||||
lda #1
|
||||
ldx #WGScrollXBy
|
||||
jsr WeeGUI
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_rightArrow:
|
||||
lda #-1
|
||||
ldx #WGScrollXBy
|
||||
jsr WeeGUI
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_upArrow:
|
||||
lda #1
|
||||
ldx #WGScrollYBy
|
||||
jsr WeeGUI
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_downArrow:
|
||||
lda #-1
|
||||
ldx #WGScrollYBy
|
||||
jsr WeeGUI
|
||||
jsr testPaintContents
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_focusOkay:
|
||||
lda #2
|
||||
ldx #WGSelectView
|
||||
jsr WeeGUI
|
||||
ldx #WGViewFocus
|
||||
jsr WeeGUI
|
||||
jmp keyLoop
|
||||
|
||||
keyLoop_quit:
|
||||
ldx #WGDisableMouse
|
||||
jsr WeeGUI
|
||||
rts
|
||||
|
||||
testPaintContents:
|
||||
lda #0
|
||||
ldx #WGSelectView
|
||||
jsr WeeGUI
|
||||
ldx #WGEraseViewContents
|
||||
jsr WeeGUI
|
||||
|
||||
ldy #0
|
||||
testPaintContents_loop:
|
||||
ldx #0
|
||||
stx PARAM0
|
||||
sty PARAM1
|
||||
ldx #WGSetCursor
|
||||
jsr WeeGUI
|
||||
|
||||
tya
|
||||
clc
|
||||
adc #'A'
|
||||
sta testStr3
|
||||
|
||||
WGCALL16 WGPrint,testStr3
|
||||
|
||||
iny
|
||||
cpy #25
|
||||
bne testPaintContents_loop
|
||||
|
||||
testPaintContents_done:
|
||||
rts
|
||||
|
||||
|
||||
|
||||
testCallback:
|
||||
jsr $ff3a ; boop!
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
.if 0
|
||||
;jmp tortureTestPrint
|
||||
;jmp tortureTestRects
|
||||
@ -78,90 +227,6 @@ main:
|
||||
|
||||
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
|
||||
@ -176,38 +241,19 @@ testPaintContents:
|
||||
;;
|
||||
|
||||
|
||||
ldy #0
|
||||
testPaintContents_loop:
|
||||
ldx #0
|
||||
stx PARAM0
|
||||
sty PARAM1
|
||||
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
|
||||
|
||||
|
||||
.endif
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
bloadCmdLine:
|
||||
.byte "BRUN gui",$8d,0
|
||||
|
||||
testView:
|
||||
.byte 0,1,7,3,62,18,62,40
|
||||
|
||||
@ -242,10 +288,14 @@ testTitle2:
|
||||
testTitle3:
|
||||
.byte "More Magic",0
|
||||
|
||||
.endif
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
.include "unit_test.s"
|
||||
|
||||
|
||||
|
||||
; Suppress some linker warnings - Must be the last thing in the file
|
||||
.SEGMENT "ZPSAVE"
|
||||
.SEGMENT "EXEHDR"
|
||||
|
55
unit_test.s
55
unit_test.s
@ -8,7 +8,7 @@
|
||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
.if 0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; tortureTestPrint
|
||||
; Prints strings in a range of positions and scrolling offsets
|
||||
@ -126,6 +126,7 @@ tortureTestPrint_reset:
|
||||
tortureTestPrint_lock:
|
||||
jmp tortureTestPrint_lock
|
||||
|
||||
.endif
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; tortureTestRects
|
||||
@ -137,7 +138,8 @@ tortureTestPrint_lock:
|
||||
; Curr Width
|
||||
; Curr Height
|
||||
tortureTestRects:
|
||||
jsr WGClearScreen
|
||||
ldx #WGClearScreen
|
||||
jsr WeeGUI
|
||||
|
||||
tortureTestRectsEven:
|
||||
|
||||
@ -151,7 +153,11 @@ tortureTestRectsEven:
|
||||
pha
|
||||
|
||||
tortureTestRectsEvenLoop:
|
||||
jsr WGClearScreen
|
||||
@0: lda $C019 ; Sync to VBL
|
||||
bmi @0
|
||||
|
||||
ldx #WGClearScreen
|
||||
jsr WeeGUI
|
||||
|
||||
tsx
|
||||
inx
|
||||
@ -189,8 +195,10 @@ tortureTestRectsEvenLoop:
|
||||
sta $0100,x
|
||||
|
||||
ldy #'Q'+$80
|
||||
jsr WGFillRect
|
||||
jsr WGStrokeRect
|
||||
ldx #WGFillRect
|
||||
jsr WeeGUI
|
||||
ldx #WGStrokeRect
|
||||
jsr WeeGUI
|
||||
|
||||
jsr delayShort
|
||||
jsr delayShort
|
||||
@ -216,7 +224,8 @@ tortureTestRectsOdd:
|
||||
pha
|
||||
|
||||
tortureTestRectsOddLoop:
|
||||
jsr WGClearScreen
|
||||
ldx #WGClearScreen
|
||||
jsr WeeGUI
|
||||
|
||||
tsx
|
||||
inx
|
||||
@ -254,8 +263,10 @@ tortureTestRectsOddLoop:
|
||||
sta $0100,x
|
||||
|
||||
ldy #'Q'+$80
|
||||
jsr WGFillRect
|
||||
jsr WGStrokeRect
|
||||
ldx #WGFillRect
|
||||
jsr WeeGUI
|
||||
ldx #WGStrokeRect
|
||||
jsr WeeGUI
|
||||
|
||||
jsr delayShort
|
||||
jsr delayShort
|
||||
@ -273,6 +284,34 @@ tortureTestRectsOddDone:
|
||||
|
||||
|
||||
|
||||
delayShort:
|
||||
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
|
||||
|
||||
|
||||
|
||||
testPrintView:
|
||||
.byte "000F061E0A287E" ; 0, 7,3,62,19,75,126
|
||||
|
||||
|
2
views.s
2
views.s
@ -873,7 +873,7 @@ WGViewFocusAction_knownRTS:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGPendingViewAction
|
||||
; Performs the action of the pending view, if any
|
||||
; OUT V : Set if the caller should perform an Applesoft GOSUB
|
||||
; Global flag set if the caller should perform an Applesoft GOSUB
|
||||
; Side effects: Changes selected view, Repaints some views
|
||||
;
|
||||
WGPendingViewAction:
|
||||
|
Loading…
x
Reference in New Issue
Block a user