mirror of
https://github.com/blondie7575/WeeGUI.git
synced 2024-12-04 18:49:34 +00:00
a bit smaller code
This commit is contained in:
parent
a81df445d3
commit
258987b04f
198
applesoft.s
198
applesoft.s
@ -84,24 +84,22 @@ WGAmpersand:
|
||||
|
||||
sta SCRATCH0
|
||||
|
||||
ldy #0
|
||||
ldx SCRATCH0
|
||||
ldx #0
|
||||
|
||||
WGAmpersand_parseLoop:
|
||||
txa
|
||||
tay
|
||||
beq WGAmpersand_matchStart ; Check for end-of-statement (CHRGET handles : and EOL)
|
||||
cmp #'('
|
||||
beq WGAmpersand_matchStart
|
||||
cmp #':'
|
||||
beq WGAmpersand_matchStart
|
||||
|
||||
sta WGAmpersandCommandBuffer,y
|
||||
sta WGAmpersandCommandBuffer,x
|
||||
|
||||
jsr CHRGET
|
||||
tax
|
||||
|
||||
iny
|
||||
cpy #MAXCMDLEN+1
|
||||
inx
|
||||
cpx #MAXCMDLEN+1
|
||||
bne WGAmpersand_parseLoop
|
||||
|
||||
WGAmpersand_parseFail:
|
||||
@ -110,27 +108,25 @@ WGAmpersand_parseFail:
|
||||
bra WGAmpersand_done
|
||||
|
||||
WGAmpersand_matchStart:
|
||||
lda #0
|
||||
sta WGAmpersandCommandBuffer,y ; Null terminate the buffer for matching
|
||||
stz WGAmpersandCommandBuffer,x ; Null terminate the buffer for matching
|
||||
|
||||
ldy #0
|
||||
ldx #0 ; Command buffer now contains our API call
|
||||
phx ; We stash the current command number on the stack
|
||||
|
||||
WGAmpersand_matchReset:
|
||||
ldy #0
|
||||
|
||||
WGAmpersand_matchLoop:
|
||||
lda WGAmpersandCommandBuffer,y
|
||||
beq WGAmpersand_matchPossible
|
||||
cmp WGAmpersandCommandTable,x
|
||||
bne WGAmpersand_matchNext ; Not this one
|
||||
cmp #0
|
||||
beq WGAmpersand_matchFound ; Got one!
|
||||
|
||||
iny
|
||||
inx
|
||||
bra WGAmpersand_matchLoop
|
||||
|
||||
WGAmpersand_matchPossible:
|
||||
lda WGAmpersandCommandTable,x
|
||||
beq WGAmpersand_matchFound ; Got one!
|
||||
|
||||
WGAmpersand_matchNext:
|
||||
pla ; Advance index to next commmand in table
|
||||
inc
|
||||
@ -141,27 +137,7 @@ WGAmpersand_matchNext:
|
||||
tax
|
||||
|
||||
cpx #WGAmpersandCommandTableEnd-WGAmpersandCommandTable
|
||||
beq WGAmpersand_matchFail ; Hit the end of the table
|
||||
|
||||
ldy #0
|
||||
bra WGAmpersand_matchLoop
|
||||
|
||||
WGAmpersand_matchFound:
|
||||
pla ; This is now the matching command number
|
||||
inc
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
tay
|
||||
lda WGAmpersandCommandTable-2,y ; Prepare an indirect JSR to our command
|
||||
sta WGAmpersand_commandJSR+1 ; Self-modifying code!
|
||||
lda WGAmpersandCommandTable-1,y
|
||||
sta WGAmpersand_commandJSR+2
|
||||
|
||||
; Self-modifying code!
|
||||
WGAmpersand_commandJSR:
|
||||
jsr WGAmpersand_done ; Address here overwritten with command
|
||||
bra WGAmpersand_done
|
||||
bne WGAmpersand_matchReset ; Continue until hit the end of the table
|
||||
|
||||
WGAmpersand_matchFail:
|
||||
pla ; We left command number on the stack while matching
|
||||
@ -171,6 +147,19 @@ WGAmpersand_matchFail:
|
||||
WGAmpersand_done:
|
||||
rts
|
||||
|
||||
WGAmpersand_matchFound:
|
||||
pla ; This is now the matching command number
|
||||
inc
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
tax
|
||||
jsr WGAmpersand_commandJMP
|
||||
bra WGAmpersand_done
|
||||
|
||||
WGAmpersand_commandJMP:
|
||||
jmp (WGAmpersandCommandTable-2,x)
|
||||
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -249,6 +238,14 @@ WGAmpersandAddrArgument:
|
||||
rts
|
||||
|
||||
|
||||
WGIncTXTPTR:
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGIncTXTPTRRet
|
||||
inc TXTPTRH
|
||||
|
||||
WGIncTXTPTRRet:
|
||||
rts
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGAmpersandStrArgument
|
||||
; Reads a string argument for the current command in PARAM0/1.
|
||||
@ -257,16 +254,12 @@ WGAmpersandAddrArgument:
|
||||
; OUT Y : Pointer to a stored copy of the string (MSB)
|
||||
; Side effects: Clobbers P0/P1 and all registers
|
||||
WGAmpersandStrArgument:
|
||||
ldy #0
|
||||
lda #'"' ; Expect opening quote
|
||||
cmp (TXTPTRL),y ; Can't use SYNERR here because it skips whitespace
|
||||
cmp (TXTPTRL) ; Can't use SYNERR here because it skips whitespace
|
||||
bne WGAmpersandStr_NotLiteral
|
||||
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandStrArgument_loop_inc0
|
||||
inc TXTPTRH
|
||||
jsr WGIncTXTPTR
|
||||
|
||||
WGAmpersandStrArgument_loop_inc0:
|
||||
lda TXTPTRL ; Allocate for, and copy the string at TXTPTR
|
||||
sta PARAM0
|
||||
lda TXTPTRH
|
||||
@ -275,26 +268,21 @@ WGAmpersandStrArgument_loop_inc0:
|
||||
jsr WGStoreStr
|
||||
|
||||
WGAmpersandStrArgument_loop:
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandStrArgument_loop_inc1
|
||||
inc TXTPTRH
|
||||
jsr WGIncTXTPTR
|
||||
|
||||
WGAmpersandStrArgument_loop_inc1:
|
||||
lda (TXTPTRL),y
|
||||
lda (TXTPTRL)
|
||||
beq WGAmpersandStrArgument_done
|
||||
cmp #'"' ; Check for closing quote
|
||||
bne WGAmpersandStrArgument_loop
|
||||
|
||||
WGAmpersandStrArgument_done:
|
||||
lda #'"' ; Expect closing quote
|
||||
cmp (TXTPTRL),y ; Can't use SYNERR here because it skips whitespace
|
||||
cmp (TXTPTRL) ; Can't use SYNERR here because it skips whitespace
|
||||
bne WGAmpersandStrArgument_error
|
||||
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandStrArgument_loop_inc2
|
||||
inc TXTPTRH
|
||||
jsr WGIncTXTPTR
|
||||
|
||||
WGAmpersandStrArgument_loop_inc2:
|
||||
WGAmpersandStrArgument_load:
|
||||
ldx PARAM0
|
||||
ldy PARAM1
|
||||
rts
|
||||
@ -304,17 +292,16 @@ WGAmpersandStrArgument_error:
|
||||
|
||||
WGAmpersandStr_NotLiteral:
|
||||
jsr PTRGET ; Assume string variable
|
||||
ldy #0
|
||||
lda (VARPNT),y ; Grab length
|
||||
lda (VARPNT) ; Grab length
|
||||
tax
|
||||
iny
|
||||
ldy #1
|
||||
lda (VARPNT),y ; Get string pointer out of Applesoft record
|
||||
sta PARAM0 ; Allocate for, and copy the string
|
||||
iny
|
||||
lda (VARPNT),y
|
||||
sta PARAM1
|
||||
jsr WGStorePascalStr
|
||||
bra WGAmpersandStrArgument_loop_inc2
|
||||
bra WGAmpersandStrArgument_load
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -326,15 +313,11 @@ WGAmpersandStr_NotLiteral:
|
||||
; OUT A : String length
|
||||
; Side effects: Clobbers P0/P1 and all registers
|
||||
WGAmpersandTempStrArgument:
|
||||
ldy #0
|
||||
lda #'"' ; Expect opening quote
|
||||
cmp (TXTPTRL),y ; Can't use SYNERR here because it skips whitespace
|
||||
cmp (TXTPTRL) ; Can't use SYNERR here because it skips whitespace
|
||||
bne WGAmpersandTempStrArgument_error
|
||||
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandTempStrArgument_loop_inc0
|
||||
inc TXTPTRH
|
||||
WGAmpersandTempStrArgument_loop_inc0:
|
||||
jsr WGIncTXTPTR
|
||||
|
||||
lda TXTPTRL ; Grab current TXTPTR
|
||||
sta PARAM0
|
||||
@ -342,24 +325,18 @@ WGAmpersandTempStrArgument_loop_inc0:
|
||||
sta PARAM1
|
||||
|
||||
WGAmpersandTempStrArgument_loop:
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandTempStrArgument_loop_inc1
|
||||
inc TXTPTRH
|
||||
WGAmpersandTempStrArgument_loop_inc1:
|
||||
lda (TXTPTRL),y
|
||||
jsr WGIncTXTPTR
|
||||
lda (TXTPTRL)
|
||||
beq WGAmpersandTempStrArgument_done
|
||||
cmp #'"' ; Check for closing quote
|
||||
bne WGAmpersandTempStrArgument_loop
|
||||
|
||||
WGAmpersandTempStrArgument_done:
|
||||
lda #'"' ; Expect closing quote
|
||||
cmp (TXTPTRL),y ; Can't use SYNERR here because it skips whitespace
|
||||
cmp (TXTPTRL) ; Can't use SYNERR here because it skips whitespace
|
||||
bne WGAmpersandTempStrArgument_error
|
||||
|
||||
inc TXTPTRL ; Can't use CHRGET here, because it skips leading whitespace (among other issues)
|
||||
bne WGAmpersandTempStrArgument_loop_inc2
|
||||
inc TXTPTRH
|
||||
WGAmpersandTempStrArgument_loop_inc2:
|
||||
jsr WGIncTXTPTR
|
||||
|
||||
; Compute the 8-bit distance TXTPTR moved. Note that we can't simply
|
||||
; count in the above loop, because CHRGET will skip ahead unpredictable
|
||||
@ -485,6 +462,7 @@ WGAmpersand_CHKBX:
|
||||
|
||||
CALL16 WGCreateCheckbox,WGAmpersandCommandBuffer
|
||||
|
||||
WGFlagView:
|
||||
LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view
|
||||
lda #VIEW_STYLE_APPLESOFT
|
||||
ora WG_VIEWRECORDS+4,y
|
||||
@ -523,16 +501,7 @@ WGAmpersand_RADIO:
|
||||
|
||||
CALL16 WGCreateRadio,WGAmpersandCommandBuffer
|
||||
|
||||
LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view
|
||||
lda #VIEW_STYLE_APPLESOFT
|
||||
ora WG_VIEWRECORDS+4,y
|
||||
sta WG_VIEWRECORDS+4,y
|
||||
|
||||
jsr WGPaintView
|
||||
jsr WGBottomCursor
|
||||
|
||||
rts
|
||||
|
||||
jmp WGFlagView
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -561,15 +530,7 @@ WGAmpersand_PROG:
|
||||
|
||||
CALL16 WGCreateProgress,WGAmpersandCommandBuffer
|
||||
|
||||
LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view
|
||||
lda #VIEW_STYLE_APPLESOFT
|
||||
ora WG_VIEWRECORDS+4,y
|
||||
sta WG_VIEWRECORDS+4,y
|
||||
|
||||
jsr WGPaintView
|
||||
jsr WGBottomCursor
|
||||
|
||||
rts
|
||||
jmp WGFlagView
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -652,15 +613,7 @@ WGAmpersand_BUTTN:
|
||||
|
||||
CALL16 WGCreateButton,WGAmpersandCommandBuffer
|
||||
|
||||
LDY_ACTIVEVIEW ; Flag this as an Applesoft-created view
|
||||
lda #VIEW_STYLE_APPLESOFT
|
||||
ora WG_VIEWRECORDS+4,y
|
||||
sta WG_VIEWRECORDS+4,y
|
||||
|
||||
jsr WGPaintView
|
||||
jsr WGBottomCursor
|
||||
|
||||
rts
|
||||
jmp WGFlagView
|
||||
|
||||
|
||||
|
||||
@ -809,8 +762,7 @@ WGAmpersand_PrintStrPtrAndLen:
|
||||
; source, so we need to NULL-terminate it for printing. In
|
||||
; order to avoid copying the whole thing, we'll do something
|
||||
; kinda dirty here.
|
||||
pla
|
||||
tay
|
||||
ply
|
||||
lda (PARAM0),y ; Cache the byte at the end of the string
|
||||
pha
|
||||
|
||||
@ -829,10 +781,9 @@ WGAmpersand_NotLiteral:
|
||||
bmi WGAmpersand_PRINTint
|
||||
|
||||
jsr PTRGET ; Non-numeric, so assume string variable
|
||||
ldy #0
|
||||
lda (VARPNT),y
|
||||
lda (VARPNT)
|
||||
pha ; Length goes on stack
|
||||
iny
|
||||
ldy #1
|
||||
lda (VARPNT),y ; Get string pointer out of Applesoft record
|
||||
sta PARAM0
|
||||
iny
|
||||
@ -1107,25 +1058,19 @@ WGAmpersand_GET:
|
||||
jsr WGAmpersandBeginArguments
|
||||
|
||||
jsr PTRGET
|
||||
lda #0
|
||||
sta (VARPNT)
|
||||
lda KBD
|
||||
bpl WGAmpersand_GETnone ; No key pending
|
||||
|
||||
sta KBDSTRB ; Clear strobe and high bit
|
||||
and #%01111111
|
||||
pha
|
||||
bra WGAmpersand_GETstore
|
||||
|
||||
.byte $2C ; Mask LDA
|
||||
WGAmpersand_GETnone:
|
||||
lda #0
|
||||
pha
|
||||
|
||||
WGAmpersand_GETstore:
|
||||
ldy #0
|
||||
|
||||
lda #0
|
||||
sta (VARPNT),y
|
||||
iny
|
||||
pla
|
||||
ldy #1
|
||||
sta (VARPNT),y
|
||||
|
||||
; String version:
|
||||
@ -1168,11 +1113,10 @@ WGAmpersand_EXIT:
|
||||
; Leave the cursor state in a place that Applesoft is happy with
|
||||
;
|
||||
WGBottomCursor:
|
||||
SAVE_AY
|
||||
pha
|
||||
|
||||
lda #0
|
||||
sta CH
|
||||
sta OURCH
|
||||
stz CH
|
||||
stz OURCH
|
||||
lda #23
|
||||
sta CV
|
||||
sta OURCV
|
||||
@ -1182,7 +1126,7 @@ WGBottomCursor:
|
||||
lda TEXTLINES_L+23
|
||||
sta BASL
|
||||
|
||||
RESTORE_AY
|
||||
pla
|
||||
rts
|
||||
|
||||
|
||||
@ -1197,14 +1141,11 @@ WGAmpersand_GTSEL:
|
||||
|
||||
jsr PTRGET
|
||||
|
||||
lda WG_ACTIVEVIEW
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
lda #0
|
||||
sta (VARPNT),y
|
||||
iny
|
||||
pla
|
||||
sta (VARPNT)
|
||||
lda WG_ACTIVEVIEW
|
||||
|
||||
ldy #1
|
||||
sta (VARPNT),y
|
||||
|
||||
jsr WGAmpersandEndArguments
|
||||
@ -1218,8 +1159,7 @@ WGAmpersand_GTSEL:
|
||||
; WG_GOSUBLINE+1: Line number (MSB)
|
||||
;
|
||||
WGGosub:
|
||||
lda #0
|
||||
sta WG_GOSUB ; Clear the flag
|
||||
stz WG_GOSUB ; Clear the flag
|
||||
|
||||
; Can't come back from what we're about to do, so cleanup from the
|
||||
; original Ampersand entry point now! This is some seriously voodoo
|
||||
|
@ -82,9 +82,9 @@ WGPlot:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGPlot_SkipInc
|
||||
inc BASH
|
||||
WGPlot_SkipInc:
|
||||
|
||||
lda WG_CURSORX ; X even?
|
||||
ror
|
||||
@ -252,8 +252,7 @@ WGPrint_nextLine:
|
||||
lda (PARAM0),y ; Check for end string landing exactly at line end
|
||||
beq WGPrint_done
|
||||
|
||||
lda #0 ; Wrap to next line
|
||||
sta WG_LOCALCURSORX
|
||||
stz WG_LOCALCURSORX
|
||||
bra WGPrint_lineLoop
|
||||
|
||||
WGPrint_charLoopInverse:
|
||||
|
52
rects.s
52
rects.s
@ -40,10 +40,10 @@ WGFillRect_vertLoop:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGFillRect_SkipInc
|
||||
inc BASH
|
||||
|
||||
WGFillRect_SkipInc:
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcs WGFillRect_horzLoopOdd
|
||||
@ -51,7 +51,6 @@ WGFillRect_vertLoop:
|
||||
lda PARAM2
|
||||
cmp #1 ; Width==1 is a special case
|
||||
bne WGFillRect_horzLoopEvenAlignedNormalWidth
|
||||
jmp WGFillRect_horzLoopEvenAlignedOneWidth
|
||||
|
||||
WGFillRect_horzLoopEvenAlignedOneWidth:
|
||||
SETSWITCH PAGE2ON
|
||||
@ -230,10 +229,10 @@ WGStrokeRect_horzEdge:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGStrokeRect_SkipInc1
|
||||
inc BASH
|
||||
|
||||
WGStrokeRect_SkipInc1:
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcc WGStrokeRect_horzEdgeEven
|
||||
@ -242,8 +241,7 @@ WGStrokeRect_horzEdge:
|
||||
WGStrokeRect_horzEdgeEven:
|
||||
lda PARAM2
|
||||
cmp #1 ; Width==1 is a special case
|
||||
bne WGStrokeRect_horzLoopEvenAlignedNormalWidth
|
||||
jmp WGStrokeRect_horzLoopEvenAlignedOneWidth
|
||||
beq WGStrokeRect_horzLoopEvenAlignedOneWidth
|
||||
|
||||
WGStrokeRect_horzLoopEvenAlignedNormalWidth:
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
@ -377,10 +375,10 @@ WGStrokeRect_vertLoop:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGStrokeRect_SkipInc2
|
||||
inc BASH
|
||||
|
||||
WGStrokeRect_SkipInc2:
|
||||
lda PARAM0 ; Left edge even?
|
||||
dec
|
||||
ror
|
||||
@ -388,9 +386,8 @@ WGStrokeRect_vertLoop:
|
||||
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
sta (BASL)
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
@ -431,9 +428,8 @@ WGStrokeRect_vertLoopEvenAlignedNextRow:
|
||||
WGStrokeRect_vertLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
sta (BASL)
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
@ -466,8 +462,7 @@ WGStrokeRect_vertLoopOddAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGStrokeRect_vertLoopJmp
|
||||
jmp WGStrokeRect_done
|
||||
beq WGStrokeRect_done
|
||||
WGStrokeRect_vertLoopJmp:
|
||||
jmp WGStrokeRect_vertLoop
|
||||
|
||||
@ -522,10 +517,10 @@ WGFancyRect_horzEdge:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGFancyRect_SkipInc1
|
||||
inc BASH
|
||||
|
||||
WGFancyRect_SkipInc1:
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcs WGFancyRect_horzLoopOdd
|
||||
@ -652,10 +647,10 @@ WGFancyRect_vertLoop:
|
||||
clc
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
bcc WGFancyRect_SkipInc2
|
||||
inc BASH
|
||||
|
||||
WGFancyRect_SkipInc2:
|
||||
lda PARAM0 ; Left edge even?
|
||||
dec
|
||||
ror
|
||||
@ -663,9 +658,8 @@ WGFancyRect_vertLoop:
|
||||
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
sta (BASL)
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
@ -706,9 +700,8 @@ WGFancyRect_vertLoopEvenAlignedNextRow:
|
||||
WGFancyRect_vertLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
sta (BASL)
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
@ -741,8 +734,7 @@ WGFancyRect_vertLoopOddAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGFancyRect_vertLoopJmp
|
||||
jmp WGFancyRect_corners
|
||||
beq WGFancyRect_corners
|
||||
WGFancyRect_vertLoopJmp:
|
||||
jmp WGFancyRect_vertLoop
|
||||
|
||||
|
13
utility.s
13
utility.s
@ -98,12 +98,11 @@ scanHex8:
|
||||
WGStrLen:
|
||||
phy
|
||||
|
||||
ldy #0
|
||||
ldy #$ff
|
||||
WGStrLen_loop:
|
||||
lda (PARAM0),y
|
||||
beq WGStrLen_done
|
||||
iny
|
||||
bra WGStrLen_loop
|
||||
lda (PARAM0),y
|
||||
bne WGStrLen_loop
|
||||
|
||||
WGStrLen_done:
|
||||
tya
|
||||
@ -174,8 +173,7 @@ WGStoreStr_copyLoop:
|
||||
bne WGStoreStr_copyLoop
|
||||
|
||||
WGStoreStr_terminate:
|
||||
lda #0 ; Terminate the stored string
|
||||
sta WG_STRINGS,x
|
||||
stz WG_STRINGS,x ; Terminate the stored string
|
||||
|
||||
pla ; Return pointer to the start of the block
|
||||
clc
|
||||
@ -222,8 +220,7 @@ WGStorePascalStr_copyLoop:
|
||||
bne WGStorePascalStr_copyLoop
|
||||
|
||||
WGStorePascalStr_terminate:
|
||||
lda #0 ; Terminate the stored string
|
||||
sta WG_STRINGS,x
|
||||
stz WG_STRINGS,x ; Terminate the stored string
|
||||
|
||||
pla ; Return pointer to the start of the block
|
||||
clc
|
||||
|
78
views.s
78
views.s
@ -32,8 +32,7 @@ WG_FEATURE_RT = %01000000
|
||||
WGCreateView:
|
||||
SAVE_AXY
|
||||
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
lda (PARAM0) ; Find our new view record
|
||||
pha ; Cache view ID so we can select when we're done
|
||||
|
||||
asl
|
||||
@ -42,7 +41,7 @@ WGCreateView:
|
||||
asl ; Records are 8 bytes wide
|
||||
tax
|
||||
|
||||
iny
|
||||
ldy #1
|
||||
lda (PARAM0),y
|
||||
pha ; Cache style byte for later
|
||||
|
||||
@ -129,8 +128,7 @@ WGCreate1x1_common:
|
||||
sta WGCreate1x1_style+1
|
||||
SAVE_XY
|
||||
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
lda (PARAM0) ; Find our new view record
|
||||
pha ; Cache view ID so we can select when we're done
|
||||
|
||||
asl
|
||||
@ -139,7 +137,7 @@ WGCreate1x1_common:
|
||||
asl ; Records are 16 bytes wide
|
||||
tax
|
||||
|
||||
iny
|
||||
ldy #1
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
@ -195,8 +193,7 @@ WGCreate1x1_style:
|
||||
WGCreateProgress:
|
||||
SAVE_AXY
|
||||
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
lda (PARAM0) ; Find our new view record
|
||||
pha ; Cache view ID so we can select when we're done
|
||||
|
||||
asl
|
||||
@ -205,7 +202,7 @@ WGCreateProgress:
|
||||
asl ; Records are 16 bytes wide
|
||||
tax
|
||||
|
||||
iny
|
||||
ldy #1
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
@ -254,20 +251,21 @@ WGCreateProgress_done:
|
||||
; PARAM0: Value
|
||||
;
|
||||
WGSetState:
|
||||
SAVE_AXY
|
||||
SAVE_AY
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
and #$80
|
||||
sta SCRATCH0
|
||||
asl
|
||||
php
|
||||
lda PARAM0
|
||||
and #$7F
|
||||
ora SCRATCH0
|
||||
asl
|
||||
plp
|
||||
ror
|
||||
sta WG_VIEWRECORDS+9,y ; State (preserving bit 7)
|
||||
|
||||
WGSetState_done:
|
||||
RESTORE_AXY
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
|
||||
@ -290,8 +288,7 @@ WGSetState_done:
|
||||
WGCreateButton:
|
||||
SAVE_AXY
|
||||
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
lda (PARAM0) ; Find our new view record
|
||||
pha ; Cache view ID so we can select when we're done
|
||||
|
||||
asl
|
||||
@ -300,7 +297,7 @@ WGCreateButton:
|
||||
asl ; Records are 16 bytes wide
|
||||
tax
|
||||
|
||||
iny
|
||||
ldy #1
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
@ -449,10 +446,8 @@ paintCheck:
|
||||
sta WG_CURSORY
|
||||
|
||||
lda WG_VIEWRECORDS+9,y ; Determine our visual state
|
||||
and #$80
|
||||
bne paintCheck_selected
|
||||
bmi paintCheck_selected
|
||||
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
ror
|
||||
bcc paintCheck_unselectedUnchecked
|
||||
|
||||
@ -464,7 +459,6 @@ paintCheck_unselectedUnchecked:
|
||||
bra paintCheck_plot
|
||||
|
||||
paintCheck_selected:
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
ror
|
||||
bcc paintCheck_selectedUnchecked
|
||||
|
||||
@ -573,10 +567,8 @@ paintButton:
|
||||
sbc SCRATCH1
|
||||
sta SCRATCH1 ; Cache this for left margin rendering
|
||||
|
||||
lda #0 ; Position and print title
|
||||
sta WG_LOCALCURSORX
|
||||
lda #0
|
||||
sta WG_LOCALCURSORY
|
||||
stz WG_LOCALCURSORX ; Position and print title
|
||||
stz WG_LOCALCURSORY
|
||||
jsr WGSyncGlobalCursor
|
||||
|
||||
lda WG_VIEWRECORDS+9,y ; Is button highlighted?
|
||||
@ -843,8 +835,9 @@ WGViewFocusNext_loop:
|
||||
inc
|
||||
cmp #16
|
||||
beq WGViewFocusNext_wrap
|
||||
sta WG_FOCUSVIEW
|
||||
|
||||
WGViewFocusNext_findLoop:
|
||||
sta WG_FOCUSVIEW
|
||||
LDY_FOCUSVIEW
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
beq WGViewFocusNext_loop
|
||||
@ -863,8 +856,8 @@ WGViewFocusNext_focus:
|
||||
rts
|
||||
|
||||
WGViewFocusNext_wrap:
|
||||
stz WG_FOCUSVIEW
|
||||
bra WGViewFocusNext_loop
|
||||
lda #1
|
||||
bra WGViewFocusNext_findLoop
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -873,17 +866,17 @@ WGViewFocusNext_wrap:
|
||||
; Side effects: Changes selected view, repaints some views
|
||||
;
|
||||
WGViewFocusPrev:
|
||||
SAVE_AXY
|
||||
SAVE_AY
|
||||
|
||||
jsr unfocusCurrent
|
||||
|
||||
WGViewFocusPrev_loop:
|
||||
ldx WG_FOCUSVIEW ; Decrement and wrap
|
||||
dex
|
||||
lda WG_FOCUSVIEW ; Decrement and wrap
|
||||
dec
|
||||
bmi WGViewFocusPrev_wrap
|
||||
|
||||
WGViewFocusPrev_findLoop:
|
||||
stx WG_FOCUSVIEW
|
||||
sta WG_FOCUSVIEW
|
||||
LDY_FOCUSVIEW
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
beq WGViewFocusPrev_loop
|
||||
@ -898,11 +891,11 @@ WGViewFocusPrev_wantFocus: ; Does this view accept focus?
|
||||
WGViewFocusPrev_focus:
|
||||
jsr focusCurrent
|
||||
|
||||
RESTORE_AXY
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
WGViewFocusPrev_wrap:
|
||||
ldx #$f
|
||||
lda #$f
|
||||
bra WGViewFocusPrev_findLoop
|
||||
|
||||
|
||||
@ -1021,17 +1014,16 @@ WGViewFocusAction_buttonClick:
|
||||
|
||||
lda WG_VIEWRECORDS+11,y ; Do we have a callback?
|
||||
beq WGViewFocusAction_done
|
||||
sta WGViewFocusAction_userJSR+2 ; Modify code below so we can JSR to user's code
|
||||
lda WG_VIEWRECORDS+10,y
|
||||
sta WGViewFocusAction_userJSR+1
|
||||
|
||||
WGViewFocusAction_userJSR:
|
||||
jsr WGViewFocusAction_done ; Overwritten with user's function pointer
|
||||
tya
|
||||
tax
|
||||
jsr WGViewFocusAction_userJMP
|
||||
bra WGViewFocusAction_done
|
||||
|
||||
WGViewFocusAction_userJMP:
|
||||
jmp (WG_VIEWRECORDS+10,x)
|
||||
|
||||
WGViewFocusAction_buttonClickApplesoft:
|
||||
lda #0
|
||||
sta WG_GOSUB
|
||||
stz WG_GOSUB
|
||||
lda WG_VIEWRECORDS+10,y ; Do we have a callback?
|
||||
beq WGViewFocusAction_mightBeZero
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user