mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2024-12-13 15:30:04 +00:00
- Quick first pass to reduce code size
This commit is contained in:
parent
6c36f5e627
commit
7249f48d4a
6
.gitignore
vendored
6
.gitignore
vendored
@ -5,3 +5,9 @@
|
||||
/gui.lst
|
||||
|
||||
/guidemo.lst
|
||||
|
||||
/gui
|
||||
|
||||
/guidemo
|
||||
|
||||
/guidemo.o
|
||||
|
5
Makefile
5
Makefile
@ -17,7 +17,8 @@ ADDRDEMO=6000
|
||||
PGM=gui
|
||||
DEMO=guidemo
|
||||
|
||||
all: $(DEMO) $(PGM)
|
||||
#all: $(DEMO) $(PGM)
|
||||
all: $(PGM)
|
||||
|
||||
$(DEMO):
|
||||
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDRDEMO) -l$(DEMO).lst $(DEMO).s
|
||||
@ -30,7 +31,7 @@ $(PGM):
|
||||
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
|
||||
java -jar $(AC) -d $(DEMO).dsk $(PGM)
|
||||
java -jar $(AC) -p $(DEMO).dsk $(PGM) BIN 0x$(ADDR) < $(PGM)
|
||||
rm -f $(PGM)
|
||||
# rm -f $(PGM)
|
||||
rm -f $(PGM).o
|
||||
osascript V2Make.scpt $(PROJECT_DIR) $(DEMO) $(PGM)
|
||||
|
||||
|
187
gui.s
187
gui.s
@ -21,156 +21,6 @@
|
||||
main:
|
||||
jsr WGInit
|
||||
jsr WG80
|
||||
|
||||
rts
|
||||
;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
|
||||
|
||||
|
||||
@ -256,45 +106,10 @@ read80ColSwitch_40:
|
||||
.include "views.s"
|
||||
.include "mouse.s"
|
||||
.include "applesoft.s"
|
||||
.include "unit_test.s"
|
||||
;.include "unit_test.s"
|
||||
.include "memory.s"
|
||||
|
||||
|
||||
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
|
||||
|
BIN
guidemo.dsk
BIN
guidemo.dsk
Binary file not shown.
192
guidemo.s
192
guidemo.s
@ -26,9 +26,199 @@ GUI_MAIN = $4000
|
||||
; Main
|
||||
|
||||
main:
|
||||
;jmp GUI_MAIN
|
||||
|
||||
;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
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
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
|
||||
|
24
macros.s
24
macros.s
@ -16,46 +16,38 @@
|
||||
|
||||
.macro SAVE_AXY ; Saves all registers
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
phx
|
||||
phy
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AXY ; Restores all registers
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
ply
|
||||
plx
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_AY ; Saves accumulator and Y index
|
||||
pha
|
||||
tya
|
||||
pha
|
||||
phy
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AY ; Restores accumulator and Y index
|
||||
pla
|
||||
tay
|
||||
ply
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro SAVE_AX ; Saves accumulator and X index
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
phx
|
||||
.endmacro
|
||||
|
||||
|
||||
.macro RESTORE_AX ; Restores accumulator and X index
|
||||
pla
|
||||
tax
|
||||
plx
|
||||
pla
|
||||
.endmacro
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||
;
|
||||
|
||||
|
||||
.if 0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; delay
|
||||
; Sleeps for ~1 second
|
||||
@ -32,6 +32,7 @@ delayInner:
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
.endif
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -60,7 +61,7 @@ delayShortInner:
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
||||
|
||||
.if 0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; scanHexDigit
|
||||
; Scans a 4 bit hex value from an ASCII character
|
||||
@ -113,7 +114,7 @@ scanHex8:
|
||||
ora SCRATCH0
|
||||
iny ; Be nice and advance Y to end
|
||||
rts
|
||||
|
||||
.endif
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGStrLen
|
||||
|
Loading…
Reference in New Issue
Block a user