- More code size optimization
- Reimplemented Print unit test - Made it easier to exclude AppleSoft API if desired
This commit is contained in:
parent
fd53a53a85
commit
5d00c3286c
|
@ -6,6 +6,8 @@ Known issues
|
||||||
- Positive scroll values unsupported
|
- Positive scroll values unsupported
|
||||||
- Hitting Reset in app that uses windows and desktop (no mouse needed) seems to mess up screen holes for Disk II
|
- Hitting Reset in app that uses windows and desktop (no mouse needed) seems to mess up screen holes for Disk II
|
||||||
- Mashing a button with mouse in Applesoft will cause Undefined Statement error
|
- Mashing a button with mouse in Applesoft will cause Undefined Statement error
|
||||||
|
- Repainting a view while the mouse cursor is on it will cause artifacts when mouse moves
|
||||||
|
- Quitting sometimes leaves BASIC in inverted text mode
|
||||||
|
|
||||||
|
|
||||||
To Do:
|
To Do:
|
||||||
|
|
43
WeeGUI_MLI.s
43
WeeGUI_MLI.s
|
@ -41,25 +41,24 @@ WGStrokeRect = 16
|
||||||
WGFancyRect = 18
|
WGFancyRect = 18
|
||||||
WGPaintView = 20
|
WGPaintView = 20
|
||||||
WGViewPaintAll = 22
|
WGViewPaintAll = 22
|
||||||
WGEraseView = 24
|
WGEraseViewContents = 24
|
||||||
WGEraseViewContents = 26
|
WGCreateView = 26
|
||||||
WGCreateView = 28
|
WGCreateCheckbox = 28
|
||||||
WGCreateCheckbox = 30
|
WGCreateButton = 30
|
||||||
WGCreateButton = 32
|
WGViewSetTitle = 32
|
||||||
WGViewSetTitle = 34
|
WGViewSetAction = 34
|
||||||
WGViewSetAction = 36
|
WGSelectView = 36
|
||||||
WGSelectView = 38
|
WGViewFromPoint = 38
|
||||||
WGViewFromPoint = 40
|
WGViewFocus = 40
|
||||||
WGViewFocus = 42
|
WGViewUnfocus = 42
|
||||||
WGViewUnfocus = 44
|
WGViewFocusNext = 44
|
||||||
WGViewFocusNext = 46
|
WGViewFocusPrev = 46
|
||||||
WGViewFocusPrev = 48
|
WGViewFocusAction = 48
|
||||||
WGViewFocusAction = 50
|
WGPendingViewAction = 50
|
||||||
WGPendingViewAction = 52
|
WGPendingView = 52
|
||||||
WGPendingView = 54
|
WGScrollX = 54
|
||||||
WGScrollX = 56
|
WGScrollXBy = 56
|
||||||
WGScrollXBy = 58
|
WGScrollY = 58
|
||||||
WGScrollY = 60
|
WGScrollYBy = 60
|
||||||
WGScrollYBy = 62
|
WGEnableMouse = 62
|
||||||
WGEnableMouse = 64
|
WGDisableMouse = 64
|
||||||
WGDisableMouse = 66
|
|
||||||
|
|
18
applesoft.s
18
applesoft.s
|
@ -395,7 +395,7 @@ WGAmpersand_WINDW:
|
||||||
|
|
||||||
CALL16 WGCreateView,WGAmpersandCommandBuffer
|
CALL16 WGCreateView,WGAmpersandCommandBuffer
|
||||||
|
|
||||||
jsr WGEraseView
|
jsr WGEraseViewContents
|
||||||
jsr WGPaintView
|
jsr WGPaintView
|
||||||
jsr WGBottomCursor
|
jsr WGBottomCursor
|
||||||
rts
|
rts
|
||||||
|
@ -809,16 +809,6 @@ WGAmpersand_PNT:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; WGAmpersand_UNPNT
|
|
||||||
; Erases the selected view
|
|
||||||
; &UNPNT
|
|
||||||
WGAmpersand_UNPNT:
|
|
||||||
jsr WGEraseView
|
|
||||||
jsr WGBottomCursor
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; WGAmpersand_PNTA
|
; WGAmpersand_PNTA
|
||||||
; Repaints all views
|
; Repaints all views
|
||||||
|
@ -1028,9 +1018,6 @@ WG_STACKPTR: ; A place to save the stack pointer for tricky Applesoft manipulati
|
||||||
WG_KEYBUFFER: ; A phony string buffer for non-blocking GET
|
WG_KEYBUFFER: ; A phony string buffer for non-blocking GET
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
WG_GOSUB: ; Set if a gosub was generated by a view action
|
|
||||||
.byte 0
|
|
||||||
|
|
||||||
|
|
||||||
; Jump table for ampersand commands.
|
; Jump table for ampersand commands.
|
||||||
; Each row is 8 bytes (5 for name, NULL terminator, 2 for address)
|
; Each row is 8 bytes (5 for name, NULL terminator, 2 for address)
|
||||||
|
@ -1107,9 +1094,6 @@ WGAmpersandCommandTable:
|
||||||
.byte "PNT",0,0,0
|
.byte "PNT",0,0,0
|
||||||
.addr WGAmpersand_PNT
|
.addr WGAmpersand_PNT
|
||||||
|
|
||||||
.byte "UNPNT",0
|
|
||||||
.addr WGAmpersand_UNPNT
|
|
||||||
|
|
||||||
.byte "PNTA",0,0
|
.byte "PNTA",0,0
|
||||||
.addr WGAmpersand_PNTA
|
.addr WGAmpersand_PNTA
|
||||||
|
|
||||||
|
|
5
gui.s
5
gui.s
|
@ -50,7 +50,6 @@ WGEntryPointTable:
|
||||||
.addr WGFancyRect
|
.addr WGFancyRect
|
||||||
.addr WGPaintView
|
.addr WGPaintView
|
||||||
.addr WGViewPaintAll
|
.addr WGViewPaintAll
|
||||||
.addr WGEraseView
|
|
||||||
.addr WGEraseViewContents
|
.addr WGEraseViewContents
|
||||||
.addr WGCreateView
|
.addr WGCreateView
|
||||||
.addr WGCreateCheckbox
|
.addr WGCreateCheckbox
|
||||||
|
@ -81,7 +80,7 @@ WGInit:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
|
|
||||||
jsr WG80
|
jsr WG80
|
||||||
jsr WGInitApplesoft
|
; jsr WGInitApplesoft
|
||||||
|
|
||||||
ldy #15 ; Clear our block allocators
|
ldy #15 ; Clear our block allocators
|
||||||
WGInit_clearMemLoop:
|
WGInit_clearMemLoop:
|
||||||
|
@ -128,7 +127,7 @@ WG80:
|
||||||
.include "rects.s"
|
.include "rects.s"
|
||||||
.include "views.s"
|
.include "views.s"
|
||||||
.include "mouse.s"
|
.include "mouse.s"
|
||||||
.include "applesoft.s"
|
;.include "applesoft.s"
|
||||||
.include "memory.s"
|
.include "memory.s"
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
guidemo.dsk
BIN
guidemo.dsk
Binary file not shown.
57
guidemo.s
57
guidemo.s
|
@ -46,6 +46,8 @@ main:
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Show off some WeeGUI features
|
; Show off some WeeGUI features
|
||||||
|
|
||||||
|
;jmp tortureTestPrint
|
||||||
|
;jmp tortureTestRects
|
||||||
|
|
||||||
ldx #WGClearScreen
|
ldx #WGClearScreen
|
||||||
jsr WeeGUI
|
jsr WeeGUI
|
||||||
|
@ -194,61 +196,6 @@ testCallback:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
.if 0
|
|
||||||
;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
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
jsr WGNormal
|
|
||||||
lda #10
|
|
||||||
sta PARAM0
|
|
||||||
lda #15
|
|
||||||
sta PARAM1
|
|
||||||
jsr WGSetCursor
|
|
||||||
CALL16 WGPrint,testStr
|
|
||||||
|
|
||||||
bra testPaintContents_done
|
|
||||||
;;
|
|
||||||
|
|
||||||
|
|
||||||
testCallback:
|
|
||||||
jsr $ff3a
|
|
||||||
rts
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
.endif
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
bloadCmdLine:
|
bloadCmdLine:
|
||||||
|
|
3
memory.s
3
memory.s
|
@ -57,6 +57,9 @@ WG_FOCUSVIEW:
|
||||||
WG_PENDINGACTIONVIEW:
|
WG_PENDINGACTIONVIEW:
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
|
WG_GOSUB: ; Set if an Applesoft gosub was generated by a view action
|
||||||
|
.byte 0
|
||||||
|
|
||||||
WG_VIEWCLIP:
|
WG_VIEWCLIP:
|
||||||
; X0,Y0,X1,Y1. Edges of current window, in view space, right span
|
; X0,Y0,X1,Y1. Edges of current window, in view space, right span
|
||||||
.byte 0,0,0,0,0
|
.byte 0,0,0,0,0
|
||||||
|
|
|
@ -84,11 +84,11 @@ WGDesktop_charLoop:
|
||||||
; WGPlot
|
; WGPlot
|
||||||
; Plots a character at global cursor position (assumes 80 cols)
|
; Plots a character at global cursor position (assumes 80 cols)
|
||||||
; A: Character to plot (Apple format)
|
; A: Character to plot (Apple format)
|
||||||
; Side effects: Clobbers S0, BASL,BASH
|
; Side effects: Clobbers BASL,BASH
|
||||||
;
|
;
|
||||||
WGPlot:
|
WGPlot:
|
||||||
sta SCRATCH0
|
|
||||||
SAVE_XY
|
SAVE_XY
|
||||||
|
pha
|
||||||
|
|
||||||
ldx WG_CURSORY
|
ldx WG_CURSORY
|
||||||
lda TEXTLINES_L,x ; Compute video memory address of point
|
lda TEXTLINES_L,x ; Compute video memory address of point
|
||||||
|
@ -110,13 +110,13 @@ WGPlot:
|
||||||
bne WGPlot_xOdd
|
bne WGPlot_xOdd
|
||||||
|
|
||||||
SETSWITCH PAGE2ON ; Plot the character
|
SETSWITCH PAGE2ON ; Plot the character
|
||||||
lda SCRATCH0
|
pla
|
||||||
sta (BASL)
|
sta (BASL)
|
||||||
jmp WGPlot_done
|
jmp WGPlot_done
|
||||||
|
|
||||||
WGPlot_xOdd:
|
WGPlot_xOdd:
|
||||||
SETSWITCH PAGE2OFF ; Plot the character
|
SETSWITCH PAGE2OFF ; Plot the character
|
||||||
lda SCRATCH0
|
pla
|
||||||
sta (BASL)
|
sta (BASL)
|
||||||
|
|
||||||
WGPlot_done:
|
WGPlot_done:
|
||||||
|
|
85
unit_test.s
85
unit_test.s
|
@ -8,7 +8,7 @@
|
||||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||||
;
|
;
|
||||||
|
|
||||||
.if 0
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; tortureTestPrint
|
; tortureTestPrint
|
||||||
; Prints strings in a range of positions and scrolling offsets
|
; Prints strings in a range of positions and scrolling offsets
|
||||||
|
@ -19,18 +19,25 @@
|
||||||
; Delta X
|
; Delta X
|
||||||
; Delta Y
|
; Delta Y
|
||||||
tortureTestPrint:
|
tortureTestPrint:
|
||||||
jsr WGClearScreen
|
ldx #WGClearScreen
|
||||||
|
jsr WeeGUI
|
||||||
|
|
||||||
lda #0 ; Initialize
|
lda #0 ; Initialize
|
||||||
jsr WGScrollX
|
ldx #WGScrollX
|
||||||
jsr WGScrollY
|
jsr WeeGUI
|
||||||
|
|
||||||
|
ldx #WGScrollY
|
||||||
|
jsr WeeGUI
|
||||||
|
|
||||||
tortureTestPrint_init:
|
tortureTestPrint_init:
|
||||||
CALL16 WGCreateView,testPrintView
|
WGCALL16 WGCreateView,testPrintView
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
jsr WGSelectView
|
ldx #WGSelectView
|
||||||
jsr WGPaintView
|
jsr WeeGUI
|
||||||
|
|
||||||
|
ldx #WGPaintView
|
||||||
|
jsr WeeGUI
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
pha
|
pha
|
||||||
|
@ -47,7 +54,8 @@ tortureTestPrint_loop:
|
||||||
lda #0 ; Initialize
|
lda #0 ; Initialize
|
||||||
sta PARAM0
|
sta PARAM0
|
||||||
sta PARAM1
|
sta PARAM1
|
||||||
jsr WGSetCursor
|
ldx #WGSetCursor
|
||||||
|
jsr WeeGUI
|
||||||
plx
|
plx
|
||||||
|
|
||||||
inx ; Grab current delta X
|
inx ; Grab current delta X
|
||||||
|
@ -73,8 +81,11 @@ tortureTestPrint_flipDeltaX:
|
||||||
inx
|
inx
|
||||||
|
|
||||||
tortureTestPrint_continueX:
|
tortureTestPrint_continueX:
|
||||||
|
phx
|
||||||
lda $0100,x
|
lda $0100,x
|
||||||
jsr WGScrollX ; Apply current X scroll
|
ldx #WGScrollX ; Apply current X scroll
|
||||||
|
jsr WeeGUI
|
||||||
|
plx
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
|
@ -101,21 +112,29 @@ tortureTestPrint_flipDeltaY:
|
||||||
inx
|
inx
|
||||||
|
|
||||||
tortureTestPrint_continueY:
|
tortureTestPrint_continueY:
|
||||||
|
phx
|
||||||
lda $0100,x
|
lda $0100,x
|
||||||
jsr WGScrollY
|
ldx #WGScrollY
|
||||||
|
jsr WeeGUI
|
||||||
|
plx
|
||||||
dex
|
dex
|
||||||
dex
|
dex
|
||||||
|
|
||||||
tortureTestPrint_print:
|
tortureTestPrint_print:
|
||||||
VBL_SYNC
|
; VBL_SYNC
|
||||||
jsr WGEraseViewContents
|
phx
|
||||||
|
ldx #WGEraseViewContents
|
||||||
|
jsr WeeGUI
|
||||||
|
|
||||||
CALL16 WGPrint,unitTestStr
|
WGCALL16 WGPrint,unitTestStr
|
||||||
|
|
||||||
jsr WGPrint ; Do it again
|
ldx #WGPrint ; Do it again
|
||||||
|
jsr WeeGUI
|
||||||
|
|
||||||
; jmp tortureTestPrint_lock
|
; jmp tortureTestPrint_lock
|
||||||
jsr delayShort
|
jsr delay
|
||||||
|
|
||||||
|
plx
|
||||||
jmp tortureTestPrint_loop
|
jmp tortureTestPrint_loop
|
||||||
|
|
||||||
tortureTestPrint_reset:
|
tortureTestPrint_reset:
|
||||||
|
@ -126,7 +145,7 @@ tortureTestPrint_reset:
|
||||||
tortureTestPrint_lock:
|
tortureTestPrint_lock:
|
||||||
jmp tortureTestPrint_lock
|
jmp tortureTestPrint_lock
|
||||||
|
|
||||||
.endif
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; tortureTestRects
|
; tortureTestRects
|
||||||
|
@ -284,7 +303,7 @@ tortureTestRectsOddDone:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
delayShort:
|
delayShort: ; ~1/30 sec
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
phy
|
phy
|
||||||
|
@ -312,8 +331,38 @@ delayShortInner:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
delay: ; ~1 sec
|
||||||
|
pha
|
||||||
|
phx
|
||||||
|
phy
|
||||||
|
|
||||||
|
ldy #$ce ; Loop a bunch
|
||||||
|
delayOuter:
|
||||||
|
ldx #$ff
|
||||||
|
delayInner:
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
nop
|
||||||
|
dex
|
||||||
|
bne delayInner
|
||||||
|
dey
|
||||||
|
bne delayOuter
|
||||||
|
|
||||||
|
ply
|
||||||
|
plx
|
||||||
|
pla
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
testPrintView:
|
testPrintView:
|
||||||
.byte "000F061E0A287E" ; 0, 7,3,62,19,75,126
|
.byte 0,0,15,6,30,10,40,126
|
||||||
|
|
||||||
unitTestStr:
|
unitTestStr:
|
||||||
.byte "This is a test of the emergency broadcast system. If this had been a real emergency, you would be dead now. Amusingly, it can be noted that if this had been a real emergency, and you were now a steaming pile of ash, there would of course be nobody.",0; to read this message. That begs any number",0; of extistential questions about this very text.",0
|
.byte "This is a test of the emergency broadcast system. If this had been a real emergency, you would be dead now. Amusingly, it can be noted that if this had been a real emergency, and you were now a steaming pile of ash, there would of course be nobody.",0; to read this message. That begs any number",0; of extistential questions about this very text.",0
|
||||||
|
|
28
utility.s
28
utility.s
|
@ -6,34 +6,6 @@
|
||||||
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
||||||
;
|
;
|
||||||
|
|
||||||
.if 0
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; delay
|
|
||||||
; Sleeps for ~1 second
|
|
||||||
;
|
|
||||||
delay:
|
|
||||||
SAVE_AXY
|
|
||||||
|
|
||||||
ldy #$ce ; Loop a bunch
|
|
||||||
delayOuter:
|
|
||||||
ldx #$ff
|
|
||||||
delayInner:
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
nop
|
|
||||||
dex
|
|
||||||
bne delayInner
|
|
||||||
dey
|
|
||||||
bne delayOuter
|
|
||||||
|
|
||||||
RESTORE_AXY
|
|
||||||
rts
|
|
||||||
.endif
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; delayShort
|
; delayShort
|
||||||
|
|
434
views.s
434
views.s
|
@ -26,8 +26,7 @@
|
||||||
;
|
;
|
||||||
WGCreateView:
|
WGCreateView:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (PARAM0),y ; Find our new view record
|
lda (PARAM0),y ; Find our new view record
|
||||||
pha ; Cache view ID so we can select when we're done
|
pha ; Cache view ID so we can select when we're done
|
||||||
|
@ -44,60 +43,44 @@ WGCreateView:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen X
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen Y
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen Width
|
sta WG_VIEWRECORDS+2,x ; Screen Width
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen Height
|
sta WG_VIEWRECORDS+3,x ; Screen Height
|
||||||
inx
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
sta WG_VIEWRECORDS,x ; Style
|
sta WG_VIEWRECORDS+4,x ; Style
|
||||||
inx
|
|
||||||
|
|
||||||
lda #0 ; Initialize scrolling
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||||
sta WG_VIEWRECORDS,x
|
stz WG_VIEWRECORDS+6,x
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; View Width
|
sta WG_VIEWRECORDS+7,x ; View Width
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; View Height
|
sta WG_VIEWRECORDS+8,x ; View Height
|
||||||
|
|
||||||
lda #0
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||||
inx ; Initialize state
|
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||||
sta WG_VIEWRECORDS,x
|
stz WG_VIEWRECORDS+11,x
|
||||||
inx
|
stz WG_VIEWRECORDS+12,x ; Initialize title
|
||||||
sta WG_VIEWRECORDS,x ; Initialize callback
|
stz WG_VIEWRECORDS+13,x
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x ; Initialize title
|
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
jsr WGSelectView ; Leave this as the active view
|
jsr WGSelectView ; Leave this as the active view
|
||||||
|
|
||||||
WGCreateView_done:
|
WGCreateView_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -118,7 +101,6 @@ WGCreateView_done:
|
||||||
;
|
;
|
||||||
WGCreateCheckbox:
|
WGCreateCheckbox:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (PARAM0),y ; Find our new view record
|
lda (PARAM0),y ; Find our new view record
|
||||||
|
@ -132,58 +114,39 @@ WGCreateCheckbox:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen X
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen Y
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||||
inx
|
|
||||||
|
|
||||||
lda #1
|
lda #1
|
||||||
sta WG_VIEWRECORDS,x ; Initialize screen width
|
sta WG_VIEWRECORDS+2,x ; Initialize screen width
|
||||||
inx
|
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||||
sta WG_VIEWRECORDS,x ; Initialize screen height
|
sta WG_VIEWRECORDS+7,x ; Initialize view width
|
||||||
inx
|
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||||
|
|
||||||
lda #VIEW_STYLE_CHECK
|
lda #VIEW_STYLE_CHECK
|
||||||
sta WG_VIEWRECORDS,x ; Style
|
sta WG_VIEWRECORDS+4,x ; Style
|
||||||
inx
|
|
||||||
|
|
||||||
lda #0 ; Initialize scrolling
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||||
sta WG_VIEWRECORDS,x
|
stz WG_VIEWRECORDS+6,x
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
|
|
||||||
lda #0
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||||
sta WG_VIEWRECORDS,x ; Initialize view width
|
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||||
inx
|
stz WG_VIEWRECORDS+11,x
|
||||||
sta WG_VIEWRECORDS,x ; Initialize view height
|
|
||||||
inx
|
|
||||||
|
|
||||||
lda #%00000000 ; Initialize state
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x ; Initialize callback
|
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Title
|
sta WG_VIEWRECORDS+12,x ; Title
|
||||||
inx
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x
|
sta WG_VIEWRECORDS+13,x
|
||||||
inx
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
jsr WGSelectView ; Leave this as the active view
|
jsr WGSelectView ; Leave this as the active view
|
||||||
|
|
||||||
WGCreateCheckbox_done:
|
WGCreateCheckbox_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -206,7 +169,6 @@ WGCreateCheckbox_done:
|
||||||
; SH: Title string pointer (MSB)
|
; SH: Title string pointer (MSB)
|
||||||
WGCreateButton:
|
WGCreateButton:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (PARAM0),y ; Find our new view record
|
lda (PARAM0),y ; Find our new view record
|
||||||
|
@ -220,66 +182,46 @@ WGCreateButton:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen X
|
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen Y
|
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Screen width
|
sta WG_VIEWRECORDS+2,x ; Screen width
|
||||||
inx
|
sta WG_VIEWRECORDS+7,x ; View width
|
||||||
|
|
||||||
lda #1
|
lda #1
|
||||||
sta WG_VIEWRECORDS,x ; Initialize screen height
|
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||||
inx
|
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||||
|
|
||||||
lda #VIEW_STYLE_BUTTON
|
lda #VIEW_STYLE_BUTTON
|
||||||
sta WG_VIEWRECORDS,x ; Style
|
sta WG_VIEWRECORDS+4,x ; Style
|
||||||
inx
|
|
||||||
|
|
||||||
lda #0 ; Initialize scrolling
|
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||||
sta WG_VIEWRECORDS,x
|
stz WG_VIEWRECORDS+6,x
|
||||||
inx
|
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
sta WG_VIEWRECORDS,x ; Initialize view width
|
|
||||||
inx
|
|
||||||
sta WG_VIEWRECORDS,x ; Initialize view height
|
|
||||||
inx
|
|
||||||
|
|
||||||
lda #%00000000 ; Initialize state
|
|
||||||
sta WG_VIEWRECORDS,x
|
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Callback
|
sta WG_VIEWRECORDS+10,x ; Callback
|
||||||
inx
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x
|
sta WG_VIEWRECORDS+11,x
|
||||||
inx
|
|
||||||
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x ; Title
|
sta WG_VIEWRECORDS+12,x ; Title
|
||||||
inx
|
|
||||||
iny
|
iny
|
||||||
lda (PARAM0),y
|
lda (PARAM0),y
|
||||||
sta WG_VIEWRECORDS,x
|
sta WG_VIEWRECORDS+13,x
|
||||||
inx
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
jsr WGSelectView ; Leave this as the active view
|
jsr WGSelectView ; Leave this as the active view
|
||||||
|
|
||||||
WGCreateButton_done:
|
WGCreateButton_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -290,15 +232,14 @@ WGCreateButton_done:
|
||||||
; Paints the current view
|
; Paints the current view
|
||||||
;
|
;
|
||||||
WGPaintView:
|
WGPaintView:
|
||||||
SAVE_AY
|
SAVE_AXY
|
||||||
SAVE_ZPP
|
SAVE_ZPP
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+4,y ; Cache style information
|
lda WG_VIEWRECORDS+4,y ; Cache style information
|
||||||
and #$f ; Mask off flag bits
|
and #$f ; Mask off flag bits
|
||||||
sta SCRATCH0
|
pha
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+0,y ; Fetch the geometry
|
lda WG_VIEWRECORDS+0,y ; Fetch the geometry
|
||||||
sta PARAM0
|
sta PARAM0
|
||||||
|
@ -309,13 +250,12 @@ WGPaintView:
|
||||||
lda WG_VIEWRECORDS+3,y
|
lda WG_VIEWRECORDS+3,y
|
||||||
sta PARAM3
|
sta PARAM3
|
||||||
|
|
||||||
lda SCRATCH0 ; Draw outline
|
pla ; Draw outline
|
||||||
cmp #VIEW_STYLE_FANCY
|
cmp #VIEW_STYLE_FANCY
|
||||||
beq WGPaintView_decorated
|
beq WGPaintView_decorated
|
||||||
|
|
||||||
jsr WGStrokeRect
|
jsr WGStrokeRect
|
||||||
|
|
||||||
lda SCRATCH0
|
|
||||||
cmp #VIEW_STYLE_CHECK
|
cmp #VIEW_STYLE_CHECK
|
||||||
beq WGPaintView_check
|
beq WGPaintView_check
|
||||||
cmp #VIEW_STYLE_BUTTON
|
cmp #VIEW_STYLE_BUTTON
|
||||||
|
@ -335,9 +275,8 @@ WGPaintView_button:
|
||||||
jsr paintButton
|
jsr paintButton
|
||||||
|
|
||||||
WGPaintView_done:
|
WGPaintView_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_ZPP
|
RESTORE_ZPP
|
||||||
RESTORE_AY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,7 +284,7 @@ WGPaintView_done:
|
||||||
; paintCheck
|
; paintCheck
|
||||||
; Paints the contents of a checkbox
|
; Paints the contents of a checkbox
|
||||||
; Y: Index into view records of checkbox to paint
|
; Y: Index into view records of checkbox to paint
|
||||||
; Side effects: Clobbers S0,P0,P1, all registers
|
; Side effects: Clobbers all registers,P0,P1
|
||||||
paintCheck:
|
paintCheck:
|
||||||
lda WG_VIEWRECORDS+0,y ; Position cursor
|
lda WG_VIEWRECORDS+0,y ; Position cursor
|
||||||
sta WG_CURSORX
|
sta WG_CURSORX
|
||||||
|
@ -409,11 +348,8 @@ paintCheck_done:
|
||||||
; paintButton
|
; paintButton
|
||||||
; Paints the contents of a button
|
; Paints the contents of a button
|
||||||
; Y: Index into view records of button to paint
|
; Y: Index into view records of button to paint
|
||||||
;
|
; Side effects: Clobbers all registers,P0,P1,S1
|
||||||
paintButton:
|
paintButton:
|
||||||
SAVE_AX
|
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
||||||
sta PARAM0
|
sta PARAM0
|
||||||
lda WG_VIEWRECORDS+13,y
|
lda WG_VIEWRECORDS+13,y
|
||||||
|
@ -475,8 +411,6 @@ paintButton_titleMarginRightLoop:
|
||||||
jmp paintButton_titleMarginRightLoop
|
jmp paintButton_titleMarginRightLoop
|
||||||
|
|
||||||
paintButton_done:
|
paintButton_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_AX
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -484,11 +418,8 @@ paintButton_done:
|
||||||
; paintWindowTitle
|
; paintWindowTitle
|
||||||
; Paints the title of a fancy window
|
; Paints the title of a fancy window
|
||||||
; Y: Index into view records of view title to paint
|
; Y: Index into view records of view title to paint
|
||||||
;
|
; Side effects: Clobbers all registers,P0,P1,S1
|
||||||
paintWindowTitle:
|
paintWindowTitle:
|
||||||
SAVE_AX
|
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
lda WG_VIEWRECORDS+12,y ; Prep the title string
|
||||||
sta PARAM0
|
sta PARAM0
|
||||||
lda WG_VIEWRECORDS+13,y
|
lda WG_VIEWRECORDS+13,y
|
||||||
|
@ -523,55 +454,15 @@ paintWindowTitleLoop:
|
||||||
bra paintWindowTitleLoop
|
bra paintWindowTitleLoop
|
||||||
|
|
||||||
paintWindowTitle_done:
|
paintWindowTitle_done:
|
||||||
RESTORE_ZPS
|
|
||||||
RESTORE_AX
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
; WGEraseView
|
|
||||||
; Erases the current view (including decoration)
|
|
||||||
;
|
|
||||||
WGEraseView:
|
|
||||||
SAVE_AXY
|
|
||||||
SAVE_ZPP
|
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+0,y
|
|
||||||
dec
|
|
||||||
sta PARAM0
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+1,y
|
|
||||||
dec
|
|
||||||
sta PARAM1
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+2,y
|
|
||||||
inc
|
|
||||||
inc
|
|
||||||
sta PARAM2
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+3,y
|
|
||||||
inc
|
|
||||||
inc
|
|
||||||
sta PARAM3
|
|
||||||
|
|
||||||
ldy #' '+$80
|
|
||||||
jsr WGFillRect
|
|
||||||
|
|
||||||
WGEraseView_done:
|
|
||||||
RESTORE_ZPP
|
|
||||||
RESTORE_AXY
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; WGEraseViewContents
|
; WGEraseViewContents
|
||||||
; Erases the contents of the current view (interior contents only)
|
; Erases the contents of the current view (interior contents only)
|
||||||
;
|
;
|
||||||
WGEraseViewContents:
|
WGEraseViewContents:
|
||||||
SAVE_AXY
|
SAVE_AY
|
||||||
SAVE_ZPP
|
SAVE_ZPP
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
@ -593,7 +484,7 @@ WGEraseViewContents:
|
||||||
|
|
||||||
WGEraseViewContents_done:
|
WGEraseViewContents_done:
|
||||||
RESTORE_ZPP
|
RESTORE_ZPP
|
||||||
RESTORE_AXY
|
RESTORE_AY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -605,17 +496,14 @@ WGEraseViewContents_done:
|
||||||
;
|
;
|
||||||
WGSelectView:
|
WGSelectView:
|
||||||
sta WG_ACTIVEVIEW
|
sta WG_ACTIVEVIEW
|
||||||
pha
|
|
||||||
|
|
||||||
; Initialize cursor to local origin
|
; Initialize cursor to local origin
|
||||||
lda #0
|
stz WG_LOCALCURSORX
|
||||||
sta WG_LOCALCURSORX
|
stz WG_LOCALCURSORY
|
||||||
sta WG_LOCALCURSORY
|
|
||||||
|
|
||||||
jsr cacheClipPlanes ; View changed, so clipping cache is stale
|
jsr cacheClipPlanes ; View changed, so clipping cache is stale
|
||||||
|
|
||||||
WGSelectView_done:
|
WGSelectView_done:
|
||||||
pla
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -630,30 +518,11 @@ WGViewFocus:
|
||||||
lda WG_ACTIVEVIEW ; Stash current selection
|
lda WG_ACTIVEVIEW ; Stash current selection
|
||||||
pha
|
pha
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
jsr unfocusCurrent
|
||||||
bmi WGViewFocus_noCurrent
|
|
||||||
|
|
||||||
LDY_FOCUSVIEW ; Unfocus current view
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
|
||||||
and #%01111111
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
|
||||||
jsr WGSelectView
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
WGViewFocus_noCurrent:
|
|
||||||
pla
|
pla
|
||||||
sta WG_FOCUSVIEW ; Focus on our original selection
|
sta WG_FOCUSVIEW ; Focus on our current selection
|
||||||
jsr WGSelectView
|
jsr focusCurrent
|
||||||
|
|
||||||
LDY_FOCUSVIEW
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+9,y ; Change state and repaint to reflect it
|
|
||||||
ora #%10000000
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
RESTORE_AY
|
RESTORE_AY
|
||||||
rts
|
rts
|
||||||
|
@ -667,17 +536,7 @@ WGViewFocus_noCurrent:
|
||||||
WGViewUnfocus:
|
WGViewUnfocus:
|
||||||
pha
|
pha
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
jsr unfocusCurrent
|
||||||
bmi WGViewUnfocus_done
|
|
||||||
|
|
||||||
LDY_FOCUSVIEW ; Unfocus current view
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
|
||||||
and #%01111111
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
|
||||||
jsr WGSelectView
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta WG_FOCUSVIEW
|
sta WG_FOCUSVIEW
|
||||||
|
@ -695,17 +554,7 @@ WGViewUnfocus_done:
|
||||||
WGViewFocusNext:
|
WGViewFocusNext:
|
||||||
SAVE_AY
|
SAVE_AY
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
jsr unfocusCurrent
|
||||||
bmi WGViewFocusNext_loop
|
|
||||||
|
|
||||||
LDY_FOCUSVIEW ; Unfocus current view
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
|
||||||
and #%01111111
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
|
||||||
jsr WGSelectView
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
WGViewFocusNext_loop:
|
WGViewFocusNext_loop:
|
||||||
inc WG_FOCUSVIEW ; Increment and wrap
|
inc WG_FOCUSVIEW ; Increment and wrap
|
||||||
|
@ -723,14 +572,7 @@ WGViewFocusNext_wantFocus: ; Does this view accept focus?
|
||||||
bcc WGViewFocusNext_loop
|
bcc WGViewFocusNext_loop
|
||||||
|
|
||||||
WGViewFocusNext_focus:
|
WGViewFocusNext_focus:
|
||||||
lda WG_FOCUSVIEW ; Change state and repaint to reflect it
|
jsr focusCurrent
|
||||||
jsr WGSelectView
|
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
|
||||||
ora #%10000000
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
RESTORE_AY
|
RESTORE_AY
|
||||||
rts
|
rts
|
||||||
|
@ -744,17 +586,7 @@ WGViewFocusNext_focus:
|
||||||
WGViewFocusPrev:
|
WGViewFocusPrev:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
jsr unfocusCurrent
|
||||||
bmi WGViewFocusPrev_hadNone
|
|
||||||
|
|
||||||
LDY_FOCUSVIEW ; Unfocus current view
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
|
||||||
and #%01111111
|
|
||||||
sta WG_VIEWRECORDS+9,y
|
|
||||||
|
|
||||||
lda WG_FOCUSVIEW
|
|
||||||
jsr WGSelectView
|
|
||||||
jsr WGPaintView
|
|
||||||
|
|
||||||
WGViewFocusPrev_loop:
|
WGViewFocusPrev_loop:
|
||||||
dec WG_FOCUSVIEW ; Decrement and wrap
|
dec WG_FOCUSVIEW ; Decrement and wrap
|
||||||
|
@ -778,18 +610,48 @@ WGViewFocusPrev_wantFocus: ; Does this view accept focus?
|
||||||
bcc WGViewFocusPrev_loop
|
bcc WGViewFocusPrev_loop
|
||||||
|
|
||||||
WGViewFocusPrev_focus:
|
WGViewFocusPrev_focus:
|
||||||
lda WG_FOCUSVIEW ; Change state and repaint to reflect it
|
jsr focusCurrent
|
||||||
jsr WGSelectView
|
|
||||||
|
|
||||||
LDY_FOCUSVIEW
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; unfocusCurrent
|
||||||
|
; Unfocuses current view, if any
|
||||||
|
; Side effects: Clobbers A,
|
||||||
|
; Leaves Y pointed at current focus view record
|
||||||
|
; Changes active view selection
|
||||||
|
unfocusCurrent:
|
||||||
|
lda WG_FOCUSVIEW
|
||||||
|
bmi unfocusCurrentDone ; No current focus
|
||||||
|
|
||||||
|
LDY_FOCUSVIEW ; Unfocus current view
|
||||||
|
lda WG_VIEWRECORDS+9,y
|
||||||
|
and #%01111111
|
||||||
|
sta WG_VIEWRECORDS+9,y
|
||||||
|
|
||||||
|
lda WG_FOCUSVIEW
|
||||||
|
jsr WGSelectView
|
||||||
|
jsr WGPaintView
|
||||||
|
|
||||||
|
unfocusCurrentDone:
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; focusCurrent
|
||||||
|
; Sets focus to desired view, and repaints
|
||||||
|
; Side effects: Clobbers A
|
||||||
|
focusCurrent:
|
||||||
|
lda WG_FOCUSVIEW
|
||||||
|
jsr WGSelectView
|
||||||
|
|
||||||
lda WG_VIEWRECORDS+9,y
|
lda WG_VIEWRECORDS+9,y
|
||||||
ora #%10000000
|
ora #%10000000
|
||||||
sta WG_VIEWRECORDS+9,y
|
sta WG_VIEWRECORDS+9,y
|
||||||
|
|
||||||
jsr WGPaintView
|
jsr WGPaintView
|
||||||
|
|
||||||
RESTORE_AXY
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -916,7 +778,7 @@ WGPendingView:
|
||||||
; PARAM0: Null-terminated string pointer (LSB)
|
; PARAM0: Null-terminated string pointer (LSB)
|
||||||
; PARAM1: Null-terminated string pointer (MSB)
|
; PARAM1: Null-terminated string pointer (MSB)
|
||||||
WGViewSetTitle:
|
WGViewSetTitle:
|
||||||
SAVE_AXY
|
SAVE_AY
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
lda PARAM0
|
lda PARAM0
|
||||||
|
@ -925,7 +787,7 @@ WGViewSetTitle:
|
||||||
sta WG_VIEWRECORDS+13,y
|
sta WG_VIEWRECORDS+13,y
|
||||||
|
|
||||||
WGViewSetTitle_done:
|
WGViewSetTitle_done:
|
||||||
RESTORE_AXY
|
RESTORE_AY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -995,37 +857,24 @@ WGSetGlobalCursor:
|
||||||
WGSyncGlobalCursor:
|
WGSyncGlobalCursor:
|
||||||
SAVE_AY
|
SAVE_AY
|
||||||
|
|
||||||
; X
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
|
; Sync X
|
||||||
clc ; Transform to viewspace
|
clc ; Transform to viewspace
|
||||||
lda WG_LOCALCURSORX
|
lda WG_LOCALCURSORX
|
||||||
adc WG_VIEWRECORDS,y
|
adc WG_VIEWRECORDS+0,y
|
||||||
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS,y ; Transform to scrollspace
|
adc WG_VIEWRECORDS+5,y ; Transform to scrollspace
|
||||||
sta WG_CURSORX
|
sta WG_CURSORX
|
||||||
|
|
||||||
; Y
|
; Sync Y
|
||||||
LDY_ACTIVEVIEW
|
|
||||||
iny
|
|
||||||
|
|
||||||
clc ; Transform to viewspace
|
clc ; Transform to viewspace
|
||||||
lda WG_LOCALCURSORY
|
lda WG_LOCALCURSORY
|
||||||
adc WG_VIEWRECORDS,y
|
adc WG_VIEWRECORDS+1,y
|
||||||
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS,y ; Transform to scrollspace
|
adc WG_VIEWRECORDS+6,y ; Transform to scrollspace
|
||||||
sta WG_CURSORY
|
sta WG_CURSORY
|
||||||
|
|
||||||
WGSyncGlobalCursor_done:
|
WGSyncGlobalCursor_done:
|
||||||
|
@ -1043,14 +892,10 @@ WGSyncGlobalCursor_done:
|
||||||
WGScrollX:
|
WGScrollX:
|
||||||
phy
|
phy
|
||||||
pha
|
pha
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
pla
|
pla
|
||||||
sta WG_VIEWRECORDS,y
|
sta WG_VIEWRECORDS+5,y
|
||||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||||
|
|
||||||
WGScrollX_done:
|
WGScrollX_done:
|
||||||
|
@ -1062,15 +907,12 @@ WGScrollX_done:
|
||||||
; WGScrollXBy
|
; WGScrollXBy
|
||||||
; Scrolls the current view horizontally by a delta
|
; Scrolls the current view horizontally by a delta
|
||||||
; A: Scroll delta
|
; A: Scroll delta
|
||||||
; Side effects: Clobbers A
|
; Side effects: Clobbers A,S0
|
||||||
;
|
;
|
||||||
WGScrollXBy:
|
WGScrollXBy:
|
||||||
phy
|
SAVE_XY
|
||||||
phx
|
|
||||||
tax
|
tax
|
||||||
|
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
txa
|
txa
|
||||||
|
@ -1097,8 +939,7 @@ WGScrollXBy_clampLeft:
|
||||||
WGScrollXBy_contentRight:
|
WGScrollXBy_contentRight:
|
||||||
clc ; Compute new scroll value
|
clc ; Compute new scroll value
|
||||||
adc WG_VIEWRECORDS+5,y
|
adc WG_VIEWRECORDS+5,y
|
||||||
cmp #0 ; Clamp if needed
|
beq @0 ; Clamp if needed
|
||||||
beq @0
|
|
||||||
bpl WGScrollXBy_clampRight
|
bpl WGScrollXBy_clampRight
|
||||||
@0: sta WG_VIEWRECORDS+5,y
|
@0: sta WG_VIEWRECORDS+5,y
|
||||||
bra WGScrollXBy_done
|
bra WGScrollXBy_done
|
||||||
|
@ -1108,9 +949,7 @@ WGScrollXBy_clampRight:
|
||||||
sta WG_VIEWRECORDS+5,y
|
sta WG_VIEWRECORDS+5,y
|
||||||
|
|
||||||
WGScrollXBy_done:
|
WGScrollXBy_done:
|
||||||
RESTORE_ZPS
|
RESTORE_XY
|
||||||
plx
|
|
||||||
ply
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -1123,16 +962,10 @@ WGScrollXBy_done:
|
||||||
WGScrollY:
|
WGScrollY:
|
||||||
phy
|
phy
|
||||||
pha
|
pha
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
pla
|
pla
|
||||||
iny
|
sta WG_VIEWRECORDS+6,y
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
sta WG_VIEWRECORDS,y
|
|
||||||
|
|
||||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||||
|
|
||||||
WGScrollY_done:
|
WGScrollY_done:
|
||||||
|
@ -1145,15 +978,12 @@ WGScrollY_done:
|
||||||
; WGScrollYBy
|
; WGScrollYBy
|
||||||
; Scrolls the current view horizontally by a delta
|
; Scrolls the current view horizontally by a delta
|
||||||
; A: Scroll delta
|
; A: Scroll delta
|
||||||
; Side effects: Clobbers A
|
; Side effects: Clobbers A,S0
|
||||||
;
|
;
|
||||||
WGScrollYBy:
|
WGScrollYBy:
|
||||||
phy
|
SAVE_XY
|
||||||
phx
|
|
||||||
tax
|
tax
|
||||||
|
|
||||||
SAVE_ZPS
|
|
||||||
|
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
txa
|
txa
|
||||||
|
@ -1180,9 +1010,8 @@ WGScrollYBy_clampTop:
|
||||||
WGScrollYBy_contentDown:
|
WGScrollYBy_contentDown:
|
||||||
clc ; Compute new scroll value
|
clc ; Compute new scroll value
|
||||||
adc WG_VIEWRECORDS+6,y
|
adc WG_VIEWRECORDS+6,y
|
||||||
cmp #0 ; Clamp if needed
|
beq @0 ; Clamp if needed
|
||||||
beq @0
|
bpl WGScrollYBy_clampBottom
|
||||||
bpl WGScrollYBy_clampBottom
|
|
||||||
@0: sta WG_VIEWRECORDS+6,y
|
@0: sta WG_VIEWRECORDS+6,y
|
||||||
bra WGScrollYBy_done
|
bra WGScrollYBy_done
|
||||||
|
|
||||||
|
@ -1191,9 +1020,7 @@ WGScrollYBy_clampBottom:
|
||||||
sta WG_VIEWRECORDS+6,y
|
sta WG_VIEWRECORDS+6,y
|
||||||
|
|
||||||
WGScrollYBy_done:
|
WGScrollYBy_done:
|
||||||
RESTORE_ZPS
|
RESTORE_XY
|
||||||
plx
|
|
||||||
ply
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
@ -1290,44 +1117,27 @@ cacheClipPlanes:
|
||||||
; Compute clip planes in view space
|
; Compute clip planes in view space
|
||||||
LDY_ACTIVEVIEW
|
LDY_ACTIVEVIEW
|
||||||
|
|
||||||
iny ; Left edge
|
lda WG_VIEWRECORDS+5,y ; Left edge
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
lda WG_VIEWRECORDS,y
|
|
||||||
eor #$ff
|
eor #$ff
|
||||||
inc
|
inc
|
||||||
sta WG_VIEWCLIP+0
|
sta WG_VIEWCLIP+0
|
||||||
|
|
||||||
dey ; Right edge
|
|
||||||
dey
|
|
||||||
dey
|
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS,y
|
adc WG_VIEWRECORDS+2,y ; Right edge
|
||||||
sta WG_VIEWCLIP+2
|
sta WG_VIEWCLIP+2
|
||||||
|
|
||||||
iny ; Right span (distance from window edge to view edge, in viewspace
|
lda WG_VIEWRECORDS+7,y ; Right span (distance from window edge to view edge, in viewspace
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
iny
|
|
||||||
lda WG_VIEWRECORDS,y
|
|
||||||
sec
|
sec
|
||||||
sbc WG_VIEWCLIP+2
|
sbc WG_VIEWCLIP+2
|
||||||
sta WG_VIEWCLIP+4
|
sta WG_VIEWCLIP+4
|
||||||
|
|
||||||
dey ; Top edge
|
lda WG_VIEWRECORDS+6,y ; Top edge
|
||||||
lda WG_VIEWRECORDS,y
|
|
||||||
eor #$ff
|
eor #$ff
|
||||||
inc
|
inc
|
||||||
sta WG_VIEWCLIP+1
|
sta WG_VIEWCLIP+1
|
||||||
|
|
||||||
dey ; Bottom edge
|
|
||||||
dey
|
|
||||||
dey
|
|
||||||
clc
|
clc
|
||||||
adc WG_VIEWRECORDS,y
|
adc WG_VIEWRECORDS+3,y ; Bottom edge
|
||||||
sta WG_VIEWCLIP+3
|
sta WG_VIEWCLIP+3
|
||||||
|
|
||||||
RESTORE_AY
|
RESTORE_AY
|
||||||
|
|
Loading…
Reference in New Issue