more consistent formatting
This commit is contained in:
parent
0f28ef8960
commit
a81df445d3
12
applesoft.s
12
applesoft.s
|
@ -478,7 +478,7 @@ WGAmpersand_CHKBX:
|
|||
jsr WGAmpersandNextArgument
|
||||
|
||||
jsr WGAmpersandStrArgument
|
||||
stx WGAmpersandCommandBuffer+3
|
||||
stx WGAmpersandCommandBuffer+3
|
||||
sty WGAmpersandCommandBuffer+4
|
||||
|
||||
jsr WGAmpersandEndArguments
|
||||
|
@ -640,12 +640,12 @@ WGAmpersand_BUTTN:
|
|||
jsr WGAmpersandNextArgument
|
||||
|
||||
jsr WGAmpersandAddrArgument
|
||||
stx WGAmpersandCommandBuffer+4
|
||||
stx WGAmpersandCommandBuffer+4
|
||||
sty WGAmpersandCommandBuffer+5
|
||||
jsr WGAmpersandNextArgument
|
||||
|
||||
jsr WGAmpersandStrArgument
|
||||
stx WGAmpersandCommandBuffer+6
|
||||
stx WGAmpersandCommandBuffer+6
|
||||
sty WGAmpersandCommandBuffer+7
|
||||
|
||||
jsr WGAmpersandEndArguments
|
||||
|
@ -736,7 +736,7 @@ WGAmpersand_STACT:
|
|||
jsr WGAmpersandBeginArguments
|
||||
|
||||
jsr WGAmpersandAddrArgument
|
||||
stx PARAM0
|
||||
stx PARAM0
|
||||
sty PARAM1
|
||||
|
||||
jsr WGAmpersandEndArguments
|
||||
|
@ -753,7 +753,7 @@ WGAmpersand_TITLE:
|
|||
jsr WGAmpersandBeginArguments
|
||||
|
||||
jsr WGAmpersandStrArgument
|
||||
stx PARAM0
|
||||
stx PARAM0
|
||||
sty PARAM1
|
||||
|
||||
jsr WGAmpersandEndArguments
|
||||
|
@ -798,7 +798,7 @@ WGAmpersand_PRINT:
|
|||
bne WGAmpersand_NotLiteral
|
||||
|
||||
jsr WGAmpersandTempStrArgument
|
||||
stx PARAM0
|
||||
stx PARAM0
|
||||
sty PARAM1
|
||||
pha
|
||||
|
||||
|
|
158
painting.s
158
painting.s
|
@ -13,10 +13,10 @@
|
|||
;
|
||||
WGDesktop:
|
||||
pha
|
||||
lda #'W'
|
||||
sta WGClearScreen_charPage1+1
|
||||
lda #'V'
|
||||
bra WGClearScreen_common
|
||||
lda #'W'
|
||||
sta WGClearScreen_charPage1+1
|
||||
lda #'V'
|
||||
bra WGClearScreen_common
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGClearScreen
|
||||
|
@ -24,38 +24,38 @@ WGDesktop:
|
|||
;
|
||||
WGClearScreen:
|
||||
pha
|
||||
lda #' ' + $80
|
||||
sta WGClearScreen_charPage1+1
|
||||
lda #' ' + $80
|
||||
sta WGClearScreen_charPage1+1
|
||||
WGClearScreen_common:
|
||||
sta WGClearScreen_charPage2+1
|
||||
sta WGClearScreen_charPage2+1
|
||||
SAVE_XY
|
||||
SETSWITCH PAGE2OFF
|
||||
ldx #23
|
||||
ldx #23
|
||||
WGClearScreen_lineLoop:
|
||||
lda TEXTLINES_L,x ; Compute video memory address of line
|
||||
sta WGClearScreen_charLoop1+1
|
||||
sta WGClearScreen_charLoop2+1
|
||||
lda TEXTLINES_H,x
|
||||
sta WGClearScreen_charLoop1+2
|
||||
sta WGClearScreen_charLoop2+2
|
||||
ldy #39
|
||||
lda TEXTLINES_L,x ; Compute video memory address of line
|
||||
sta WGClearScreen_charLoop1+1
|
||||
sta WGClearScreen_charLoop2+1
|
||||
lda TEXTLINES_H,x
|
||||
sta WGClearScreen_charLoop1+2
|
||||
sta WGClearScreen_charLoop2+2
|
||||
ldy #39
|
||||
WGClearScreen_charPage1:
|
||||
lda #$FF ; Self-modifying code!
|
||||
lda #$FF ; Self-modifying code!
|
||||
WGClearScreen_charLoop1:
|
||||
sta $FFFF,y ; Self-modifying code!
|
||||
sta $FFFF,y ; Self-modifying code!
|
||||
dey
|
||||
bpl WGClearScreen_charLoop1
|
||||
bpl WGClearScreen_charLoop1
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #39
|
||||
ldy #39
|
||||
WGClearScreen_charPage2:
|
||||
lda #$FF ; Self-modifying code!
|
||||
lda #$FF ; Self-modifying code!
|
||||
WGClearScreen_charLoop2:
|
||||
sta $FFFF,y ; Self-modifying code!
|
||||
sta $FFFF,y ; Self-modifying code!
|
||||
dey
|
||||
bpl WGClearScreen_charLoop2
|
||||
bpl WGClearScreen_charLoop2
|
||||
SETSWITCH PAGE2OFF
|
||||
dex
|
||||
bpl WGClearScreen_lineLoop
|
||||
bpl WGClearScreen_lineLoop
|
||||
RESTORE_XY
|
||||
pla
|
||||
rts
|
||||
|
@ -71,37 +71,37 @@ WGPlot:
|
|||
SAVE_XY
|
||||
pha
|
||||
|
||||
ldx WG_CURSORY
|
||||
ldx WG_CURSORY
|
||||
lda TEXTLINES_L,x ; Compute video memory address of point
|
||||
sta BASL
|
||||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda WG_CURSORX
|
||||
lda WG_CURSORX
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda WG_CURSORX ; X even?
|
||||
lda WG_CURSORX ; X even?
|
||||
ror
|
||||
bcs WGPlot_xOdd
|
||||
bcs WGPlot_xOdd
|
||||
|
||||
SETSWITCH PAGE2ON ; Plot the character
|
||||
SETSWITCH PAGE2ON ; Plot the character
|
||||
pla
|
||||
sta (BASL)
|
||||
sta (BASL)
|
||||
jmp WGPlot_done
|
||||
|
||||
WGPlot_xOdd:
|
||||
SETSWITCH PAGE2OFF ; Plot the character
|
||||
SETSWITCH PAGE2OFF ; Plot the character
|
||||
pla
|
||||
sta (BASL)
|
||||
sta (BASL)
|
||||
|
||||
WGPlot_done:
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
RESTORE_XY
|
||||
rts
|
||||
|
||||
|
@ -132,11 +132,11 @@ WGPrint_setupMask:
|
|||
|
||||
; Start checking clipping boundaries
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+3
|
||||
bcs WGPrint_leapDone ; Entire string is below the clip box
|
||||
cmp WG_VIEWCLIP+3
|
||||
bcs WGPrint_leapDone ; Entire string is below the clip box
|
||||
|
||||
jsr WGStrLen ; We'll need the length of the string
|
||||
sta SCRATCH1
|
||||
jsr WGStrLen ; We'll need the length of the string
|
||||
sta SCRATCH1
|
||||
|
||||
LDX_ACTIVEVIEW ; Cache view width for later
|
||||
lda WG_VIEWRECORDS+7,x
|
||||
|
@ -145,20 +145,20 @@ WGPrint_setupMask:
|
|||
ldy #0
|
||||
|
||||
WGPrint_lineLoopFirst: ; Calculating start of first line is slightly different
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+1
|
||||
bcc WGPrint_skipToEndFirst ; This line is above the clip box
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+1
|
||||
bcc WGPrint_skipToEndFirst ; This line is above the clip box
|
||||
|
||||
lda WG_LOCALCURSORX ; Find start of line within clip box
|
||||
lda WG_LOCALCURSORX ; Find start of line within clip box
|
||||
cmp WG_VIEWCLIP+0
|
||||
bcs WGPrint_visibleChars
|
||||
|
||||
lda WG_VIEWCLIP+0 ; Line begins before left clip plane
|
||||
lda WG_VIEWCLIP+0 ; Line begins before left clip plane
|
||||
sec ; Advance string index and advance cursor into clip box
|
||||
sbc WG_LOCALCURSORX
|
||||
tay
|
||||
lda WG_VIEWCLIP+0
|
||||
sta WG_LOCALCURSORX
|
||||
sta WG_LOCALCURSORX
|
||||
bra WGPrint_visibleChars
|
||||
|
||||
WGPrint_leapDone:
|
||||
|
@ -168,11 +168,11 @@ WGPrint_skipToEndFirst:
|
|||
lda WG_SCRATCHA ; Skip string index ahead by distance to EOL
|
||||
sec
|
||||
sbc WG_LOCALCURSORX
|
||||
cmp SCRATCH1
|
||||
bcs WGPrint_done ; EOL is past the end of the string, so we're done
|
||||
cmp SCRATCH1
|
||||
bcs WGPrint_done ; EOL is past the end of the string, so we're done
|
||||
tay
|
||||
|
||||
lda WG_SCRATCHA ; Skip cursor ahead to EOL
|
||||
lda WG_SCRATCHA ; Skip cursor ahead to EOL
|
||||
sta WG_LOCALCURSORX
|
||||
bra WGPrint_nextLine
|
||||
|
||||
|
@ -184,49 +184,49 @@ WGPrint_skipToEnd:
|
|||
bcs WGPrint_done ; EOL is past the end of the string, so we're done
|
||||
tay
|
||||
|
||||
lda WG_SCRATCHA ; Skip cursor ahead to EOL
|
||||
lda WG_SCRATCHA ; Skip cursor ahead to EOL
|
||||
sta WG_LOCALCURSORX
|
||||
bra WGPrint_nextLine
|
||||
|
||||
WGPrint_lineLoop:
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+1
|
||||
bcc WGPrint_skipToEnd ; This line is above the clip box
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+1
|
||||
bcc WGPrint_skipToEnd ; This line is above the clip box
|
||||
|
||||
lda WG_LOCALCURSORX ; Find start of line within clip box
|
||||
lda WG_LOCALCURSORX ; Find start of line within clip box
|
||||
cmp WG_VIEWCLIP+0
|
||||
bcs WGPrint_visibleChars
|
||||
|
||||
tya
|
||||
clc
|
||||
adc WG_VIEWCLIP+0 ; Jump ahead by left span
|
||||
adc WG_VIEWCLIP+0 ; Jump ahead by left span
|
||||
tay
|
||||
|
||||
lda WG_VIEWCLIP+0 ; Set cursor to left edge of visible area
|
||||
sta WG_LOCALCURSORX
|
||||
sta WG_LOCALCURSORX
|
||||
|
||||
WGPrint_visibleChars:
|
||||
jsr WGSyncGlobalCursor
|
||||
jsr WGSyncGlobalCursor
|
||||
|
||||
lda INVERSE
|
||||
cmp #CHAR_INVERSE
|
||||
beq WGPrint_charLoopInverse
|
||||
|
||||
WGPrint_charLoopNormal:
|
||||
lda (PARAM0),y ; Draw current character
|
||||
lda (PARAM0),y ; Draw current character
|
||||
beq WGPrint_done
|
||||
ora WGPrint_specialMask
|
||||
jsr WGPlot
|
||||
jsr WGPlot
|
||||
iny
|
||||
|
||||
inc WG_CURSORX ; Advance cursors
|
||||
inc WG_LOCALCURSORX
|
||||
|
||||
lda WG_LOCALCURSORX
|
||||
cmp WG_SCRATCHA ; Check for wrap boundary
|
||||
beq WGPrint_nextLine
|
||||
cmp WG_VIEWCLIP+2 ; Check for right clip plane
|
||||
beq WGPrint_endVisible
|
||||
cmp WG_SCRATCHA ; Check for wrap boundary
|
||||
beq WGPrint_nextLine
|
||||
cmp WG_VIEWCLIP+2 ; Check for right clip plane
|
||||
beq WGPrint_endVisible
|
||||
bra WGPrint_charLoopNormal
|
||||
|
||||
WGPrint_done: ; This is in the middle here to keep local branches in range
|
||||
|
@ -237,27 +237,27 @@ WGPrint_done: ; This is in the middle here to keep local branches in range
|
|||
WGPrint_endVisible:
|
||||
tya
|
||||
clc
|
||||
adc WG_VIEWCLIP+4 ; Advance string index by right span
|
||||
cmp SCRATCH1
|
||||
bcs WGPrint_done
|
||||
adc WG_VIEWCLIP+4 ; Advance string index by right span
|
||||
cmp SCRATCH1
|
||||
bcs WGPrint_done
|
||||
tay
|
||||
|
||||
WGPrint_nextLine:
|
||||
inc WG_LOCALCURSORY ; Advance cursor
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+3 ; Check for bottom clip plane
|
||||
beq WGPrint_done
|
||||
cmp WG_VIEWRECORDS+8,x ; Check for bottom of view
|
||||
beq WGPrint_done
|
||||
lda (PARAM0),y ; Check for end string landing exactly at line end
|
||||
beq WGPrint_done
|
||||
inc WG_LOCALCURSORY ; Advance cursor
|
||||
lda WG_LOCALCURSORY
|
||||
cmp WG_VIEWCLIP+3 ; Check for bottom clip plane
|
||||
beq WGPrint_done
|
||||
cmp WG_VIEWRECORDS+8,x ; Check for bottom of view
|
||||
beq WGPrint_done
|
||||
lda (PARAM0),y ; Check for end string landing exactly at line end
|
||||
beq WGPrint_done
|
||||
|
||||
lda #0 ; Wrap to next line
|
||||
sta WG_LOCALCURSORX
|
||||
sta WG_LOCALCURSORX
|
||||
bra WGPrint_lineLoop
|
||||
|
||||
WGPrint_charLoopInverse:
|
||||
lda (PARAM0),y ; Draw current character
|
||||
lda (PARAM0),y ; Draw current character
|
||||
beq WGPrint_done
|
||||
cmp #$60
|
||||
bcc WGPrint_charLoopInverseLow
|
||||
|
@ -268,17 +268,17 @@ WGPrint_charLoopInverseLow:
|
|||
and WGPrint_setupMaskInverse ; Normal inverse
|
||||
|
||||
WGPrint_charLoopInversePlot:
|
||||
jsr WGPlot
|
||||
jsr WGPlot
|
||||
iny
|
||||
|
||||
inc WG_CURSORX ; Advance cursors
|
||||
inc WG_LOCALCURSORX
|
||||
|
||||
lda WG_LOCALCURSORX
|
||||
cmp WG_SCRATCHA ; Check for wrap boundary
|
||||
beq WGPrint_nextLine
|
||||
cmp WG_VIEWCLIP+2 ; Check for right clip plane
|
||||
beq WGPrint_endVisible
|
||||
cmp WG_SCRATCHA ; Check for wrap boundary
|
||||
beq WGPrint_nextLine
|
||||
cmp WG_VIEWCLIP+2 ; Check for right clip plane
|
||||
beq WGPrint_endVisible
|
||||
bra WGPrint_charLoopInverse
|
||||
|
||||
WGPrint_specialMask:
|
||||
|
|
482
rects.s
482
rects.s
|
@ -19,10 +19,10 @@
|
|||
;
|
||||
WGFillRect:
|
||||
SAVE_AX
|
||||
sty SCRATCH0
|
||||
sty SCRATCH0
|
||||
|
||||
clc ; Compute bottom edge
|
||||
lda PARAM1
|
||||
lda PARAM1
|
||||
adc PARAM3
|
||||
dec
|
||||
tax
|
||||
|
@ -35,18 +35,18 @@ WGFillRect_vertLoop:
|
|||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda PARAM0
|
||||
lda PARAM0
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda PARAM0 ; Left edge even?
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcs WGFillRect_horzLoopOdd
|
||||
bcs WGFillRect_horzLoopOdd
|
||||
|
||||
lda PARAM2
|
||||
cmp #1 ; Width==1 is a special case
|
||||
|
@ -54,51 +54,51 @@ WGFillRect_vertLoop:
|
|||
jmp WGFillRect_horzLoopEvenAlignedOneWidth
|
||||
|
||||
WGFillRect_horzLoopEvenAlignedOneWidth:
|
||||
SETSWITCH PAGE2ON
|
||||
SETSWITCH PAGE2ON
|
||||
bra WGFillRect_horzLoopEvenAlignedOddWidth
|
||||
|
||||
WGFillRect_horzLoopEvenAlignedNormalWidth:
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Iterate w/2
|
||||
dey
|
||||
phy ; We'll reuse this calculation for the odd columns
|
||||
|
||||
lda SCRATCH0 ; Prepare to plot
|
||||
lda SCRATCH0 ; Prepare to plot
|
||||
WGFillRect_horzLoopEvenAligned0: ; Draw even columns
|
||||
sta (BASL),y ; Plot the character
|
||||
sta (BASL),y ; Plot the character
|
||||
dey
|
||||
bpl WGFillRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
bpl WGFillRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
ply ; Iterate w/2 again
|
||||
|
||||
WGFillRect_horzLoopEvenAligned1: ; Draw odd columns
|
||||
sta (BASL),y ; Plot the character
|
||||
sta (BASL),y ; Plot the character
|
||||
dey
|
||||
bpl WGFillRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
bpl WGFillRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGFillRect_horzLoopEvenAlignedEvenWidth
|
||||
bcc WGFillRect_horzLoopEvenAlignedEvenWidth
|
||||
|
||||
WGFillRect_horzLoopEvenAlignedOddWidth:
|
||||
; CASE 1a: Left edge even aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
|
||||
WGFillRect_horzLoopEvenAlignedEvenWidth:
|
||||
plx ; Prepare for next row
|
||||
dex
|
||||
bmi WGFillRect_done ; If we were at zero, we'll wrap dangerously
|
||||
cpx PARAM1
|
||||
bcs WGFillRect_vertLoop
|
||||
bra WGFillRect_done
|
||||
cpx PARAM1
|
||||
bcs WGFillRect_vertLoop
|
||||
bra WGFillRect_done
|
||||
|
||||
WGFillRect_horzLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
|
@ -107,54 +107,54 @@ WGFillRect_horzLoopOdd:
|
|||
cmp #1 ; Width==1 is a special case
|
||||
beq WGFillRect_horzLoopOddAlignedOneWidth
|
||||
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Iterate w/2
|
||||
phy ; We'll reuse this calculation for the even columns
|
||||
|
||||
lda SCRATCH0 ; Prepare to plot
|
||||
lda SCRATCH0 ; Prepare to plot
|
||||
WGFillRect_horzLoopOddAligned0: ; Draw even columns
|
||||
sta (BASL),y ; Plot the character
|
||||
sta (BASL),y ; Plot the character
|
||||
dey
|
||||
bne WGFillRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
bne WGFillRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
ply ; Iterate w/2 again, shift left 1
|
||||
dey
|
||||
|
||||
WGFillRect_horzLoopOddAligned1: ; Draw even columns
|
||||
sta (BASL),y ; Plot the character
|
||||
sta (BASL),y ; Plot the character
|
||||
dey
|
||||
bpl WGFillRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
bpl WGFillRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGFillRect_horzLoopOddAlignedEvenWidth
|
||||
bcc WGFillRect_horzLoopOddAlignedEvenWidth
|
||||
|
||||
WGFillRect_horzLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
|
||||
WGFillRect_horzLoopOddAlignedEvenWidth:
|
||||
plx ; Prepare for next row
|
||||
dex
|
||||
bmi WGFillRect_done ; If we were at zero, we'll wrap dangerously
|
||||
cpx PARAM1
|
||||
cpx PARAM1
|
||||
bcc WGFillRect_done
|
||||
jmp WGFillRect_vertLoop
|
||||
|
||||
WGFillRect_done:
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
RESTORE_AX
|
||||
rts
|
||||
|
||||
WGFillRect_horzLoopOddAlignedOneWidth:
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
bra WGFillRect_horzLoopOddAlignedOddWidth
|
||||
|
||||
|
||||
|
@ -196,28 +196,28 @@ CH_DOUBLE = '\'
|
|||
|
||||
|
||||
WGStrokeRect:
|
||||
pha
|
||||
lda #CH_LEFT
|
||||
sta SCRATCH1
|
||||
lda #CH_RIGHT
|
||||
bra WGStrokeRect_common
|
||||
pha
|
||||
lda #CH_LEFT
|
||||
sta SCRATCH1
|
||||
lda #CH_RIGHT
|
||||
bra WGStrokeRect_common
|
||||
WGStrokeRoundRect:
|
||||
pha
|
||||
lda #CH_ROUND_LEFT
|
||||
sta SCRATCH1
|
||||
lda #CH_ROUND_RIGHT
|
||||
pha
|
||||
lda #CH_ROUND_LEFT
|
||||
sta SCRATCH1
|
||||
lda #CH_ROUND_RIGHT
|
||||
WGStrokeRect_common:
|
||||
sta SCRATCH2
|
||||
pla
|
||||
SAVE_AXY
|
||||
SAVE_ZPS
|
||||
sta SCRATCH2
|
||||
pla
|
||||
SAVE_AXY
|
||||
SAVE_ZPS
|
||||
|
||||
; Top and bottom edges
|
||||
;
|
||||
ldx PARAM1 ; Start with top edge
|
||||
ldx PARAM1 ; Start with top edge
|
||||
dex
|
||||
lda #CH_TOP
|
||||
sta SCRATCH0
|
||||
lda #CH_TOP
|
||||
sta SCRATCH0
|
||||
|
||||
WGStrokeRect_horzEdge:
|
||||
lda TEXTLINES_L,x ; Compute video memory address of left edge of rect
|
||||
|
@ -225,30 +225,30 @@ WGStrokeRect_horzEdge:
|
|||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda PARAM0
|
||||
lda PARAM0
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda PARAM0 ; Left edge even?
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcc WGStrokeRect_horzEdgeEven
|
||||
bcc WGStrokeRect_horzEdgeEven
|
||||
jmp WGStrokeRect_horzLoopOdd
|
||||
|
||||
WGStrokeRect_horzEdgeEven:
|
||||
lda PARAM2
|
||||
lda PARAM2
|
||||
cmp #1 ; Width==1 is a special case
|
||||
bne WGStrokeRect_horzLoopEvenAlignedNormalWidth
|
||||
jmp WGStrokeRect_horzLoopEvenAlignedOneWidth
|
||||
|
||||
WGStrokeRect_horzLoopEvenAlignedNormalWidth:
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Start at right edge
|
||||
dey
|
||||
|
@ -257,30 +257,30 @@ WGStrokeRect_horzLoopEvenAlignedNormalWidth:
|
|||
WGStrokeRect_horzLoopEvenAligned0: ; Draw even columns
|
||||
PLOTHLINE ; Plot the character
|
||||
dey
|
||||
bpl WGStrokeRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
bpl WGStrokeRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
ply ; Start at right edge again
|
||||
|
||||
WGStrokeRect_horzLoopEvenAligned1: ; Draw odd columns
|
||||
PLOTHLINE ; Plot the character
|
||||
dey
|
||||
bpl WGStrokeRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
bpl WGStrokeRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGStrokeRect_horzLoopEvenAlignedEvenWidth
|
||||
bcc WGStrokeRect_horzLoopEvenAlignedEvenWidth
|
||||
|
||||
WGStrokeRect_horzLoopEvenAlignedOddWidth:
|
||||
; CASE 1a: Left edge even aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lsr
|
||||
tay
|
||||
PLOTHLINE ; Plot the character
|
||||
|
||||
WGStrokeRect_horzLoopEvenAlignedEvenWidth:
|
||||
inx
|
||||
cpx PARAM1
|
||||
cpx PARAM1
|
||||
beq WGStrokeRect_horzLoopEvenAlignedEvenWidthBottom
|
||||
jmp WGStrokeRect_vertEdge
|
||||
|
||||
|
@ -289,23 +289,23 @@ WGStrokeRect_horzLoopEvenAlignedEvenWidthBottom:
|
|||
lda PARAM1
|
||||
adc PARAM3
|
||||
tax
|
||||
lda #CH_BOTTOM
|
||||
lda #CH_BOTTOM
|
||||
sta SCRATCH0
|
||||
jmp WGStrokeRect_horzEdge
|
||||
jmp WGStrokeRect_horzEdge
|
||||
|
||||
WGStrokeRect_horzLoopEvenAlignedOneWidth:
|
||||
SETSWITCH PAGE2ON
|
||||
SETSWITCH PAGE2ON
|
||||
bra WGStrokeRect_horzLoopEvenAlignedOddWidth
|
||||
|
||||
WGStrokeRect_horzLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
|
||||
lda PARAM2
|
||||
lda PARAM2
|
||||
cmp #1 ; Width==1 is a special case
|
||||
beq WGStrokeRect_horzLoopOddAlignedOneWidth
|
||||
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Iterate w/2
|
||||
phy ; We'll reuse this calculation for the even columns
|
||||
|
@ -313,24 +313,24 @@ WGStrokeRect_horzLoopOdd:
|
|||
WGStrokeRect_horzLoopOddAligned0: ; Draw even columns
|
||||
PLOTHLINE ; Plot the character
|
||||
dey
|
||||
bne WGStrokeRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
bne WGStrokeRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
ply ; Iterate w/2 again, shift left 1
|
||||
dey
|
||||
|
||||
WGStrokeRect_horzLoopOddAligned1: ; Draw even columns
|
||||
PLOTHLINE ; Plot the character
|
||||
dey
|
||||
bpl WGStrokeRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
bpl WGStrokeRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGStrokeRect_horzLoopOddAlignedEvenWidth
|
||||
bcc WGStrokeRect_horzLoopOddAlignedEvenWidth
|
||||
|
||||
WGStrokeRect_horzLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
dec
|
||||
lsr
|
||||
tay
|
||||
|
@ -338,7 +338,7 @@ WGStrokeRect_horzLoopOddAlignedOddWidth:
|
|||
|
||||
WGStrokeRect_horzLoopOddAlignedEvenWidth:
|
||||
inx
|
||||
cpx PARAM1
|
||||
cpx PARAM1
|
||||
bne WGStrokeRect_vertEdge
|
||||
clc ; Prepare for bottom edge
|
||||
lda PARAM1
|
||||
|
@ -346,21 +346,21 @@ WGStrokeRect_horzLoopOddAlignedEvenWidth:
|
|||
tax
|
||||
lda #CH_BOTTOM
|
||||
sta SCRATCH0
|
||||
jmp WGStrokeRect_horzEdge
|
||||
jmp WGStrokeRect_horzEdge
|
||||
|
||||
WGStrokeRect_horzLoopOddAlignedOneWidth:
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
bra WGStrokeRect_horzLoopOddAlignedOddWidth
|
||||
|
||||
WGStrokeRect_vertEdge:
|
||||
; Left and right edges
|
||||
;
|
||||
clc
|
||||
lda PARAM1 ; Compute bottom edge
|
||||
lda PARAM1 ; Compute bottom edge
|
||||
adc PARAM3
|
||||
sta SCRATCH0
|
||||
sta SCRATCH0
|
||||
|
||||
ldx PARAM1 ; Start with top edge
|
||||
ldx PARAM1 ; Start with top edge
|
||||
|
||||
WGStrokeRect_vertLoop:
|
||||
|
||||
|
@ -371,32 +371,32 @@ WGStrokeRect_vertLoop:
|
|||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda PARAM0
|
||||
lda PARAM0
|
||||
dec
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda PARAM0 ; Left edge even?
|
||||
lda PARAM0 ; Left edge even?
|
||||
dec
|
||||
ror
|
||||
bcs WGStrokeRect_vertLoopOdd
|
||||
bcs WGStrokeRect_vertLoopOdd
|
||||
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
inc
|
||||
ror
|
||||
bcs WGStrokeRect_vertLoopEvenAlignedOddWidth
|
||||
bcs WGStrokeRect_vertLoopEvenAlignedOddWidth
|
||||
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
|
@ -404,75 +404,75 @@ WGStrokeRect_vertLoop:
|
|||
lsr
|
||||
dec
|
||||
tay
|
||||
SETSWITCH PAGE2OFF
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGStrokeRect_vertLoopEvenAlignedNextRow
|
||||
SETSWITCH PAGE2OFF
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGStrokeRect_vertLoopEvenAlignedNextRow
|
||||
|
||||
WGStrokeRect_vertLoopEvenAlignedOddWidth:
|
||||
; CASE 1a: Left edge even-aligned, odd width
|
||||
SETSWITCH PAGE2ON
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
|
||||
WGStrokeRect_vertLoopEvenAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGStrokeRect_vertLoop
|
||||
jmp WGStrokeRect_done
|
||||
cpx SCRATCH0
|
||||
bne WGStrokeRect_vertLoop
|
||||
jmp WGStrokeRect_done
|
||||
|
||||
|
||||
WGStrokeRect_vertLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda SCRATCH1 ; Plot the left edge
|
||||
sta (BASL),y
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
inc
|
||||
ror
|
||||
bcs WGStrokeRect_vertLoopOddAlignedOddWidth
|
||||
bcs WGStrokeRect_vertLoopOddAlignedOddWidth
|
||||
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
SETSWITCH PAGE2ON
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGStrokeRect_vertLoopOddAlignedNextRow
|
||||
SETSWITCH PAGE2ON
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGStrokeRect_vertLoopOddAlignedNextRow
|
||||
|
||||
WGStrokeRect_vertLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd-aligned, odd width
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
lda SCRATCH2 ; Plot the right edge
|
||||
sta (BASL),y
|
||||
|
||||
WGStrokeRect_vertLoopOddAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGStrokeRect_vertLoopJmp
|
||||
cpx SCRATCH0
|
||||
bne WGStrokeRect_vertLoopJmp
|
||||
jmp WGStrokeRect_done
|
||||
WGStrokeRect_vertLoopJmp:
|
||||
jmp WGStrokeRect_vertLoop
|
||||
|
||||
WGStrokeRect_done:
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
RESTORE_ZPS
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
@ -506,10 +506,10 @@ WGFancyRect:
|
|||
|
||||
; Top and bottom edges
|
||||
;
|
||||
ldx PARAM1 ; Start with top edge
|
||||
ldx PARAM1 ; Start with top edge
|
||||
dex
|
||||
lda #FR_TOP
|
||||
sta SCRATCH0
|
||||
lda #FR_TOP
|
||||
sta SCRATCH0
|
||||
|
||||
WGFancyRect_horzEdge:
|
||||
lda TEXTLINES_L,x ; Compute video memory address of left edge of rect
|
||||
|
@ -517,107 +517,57 @@ WGFancyRect_horzEdge:
|
|||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda PARAM0
|
||||
lda PARAM0
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda PARAM0 ; Left edge even?
|
||||
lda PARAM0 ; Left edge even?
|
||||
ror
|
||||
bcs WGFancyRect_horzLoopOdd
|
||||
bcs WGFancyRect_horzLoopOdd
|
||||
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Start at right edge
|
||||
dey
|
||||
phy ; We'll reuse this calculation for the odd columns
|
||||
|
||||
WGFancyRect_horzLoopEvenAligned0: ; Draw even columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bpl WGFancyRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
bpl WGFancyRect_horzLoopEvenAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
SETSWITCH PAGE2ON ; Prepare for odd columns
|
||||
ply ; Start at right edge again
|
||||
|
||||
WGFancyRect_horzLoopEvenAligned1: ; Draw odd columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bpl WGFancyRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
bpl WGFancyRect_horzLoopEvenAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGFancyRect_horzLoopEvenAlignedEvenWidth
|
||||
bcc WGFancyRect_horzLoopEvenAlignedEvenWidth
|
||||
|
||||
WGFancyRect_horzLoopEvenAlignedOddWidth:
|
||||
; CASE 1a: Left edge even aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
|
||||
WGFancyRect_horzLoopEvenAlignedEvenWidth:
|
||||
inx
|
||||
cpx PARAM1
|
||||
bne WGFancyRect_vertEdge
|
||||
clc ; Prepare for bottom edge
|
||||
lda PARAM1
|
||||
adc PARAM3
|
||||
tax
|
||||
lda #FR_BOTTOM
|
||||
sta SCRATCH0
|
||||
jmp WGFancyRect_horzEdge
|
||||
|
||||
WGFancyRect_horzLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Iterate w/2
|
||||
phy ; We'll reuse this calculation for the even columns
|
||||
|
||||
WGFancyRect_horzLoopOddAligned0: ; Draw even columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bne WGFancyRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
ply ; Iterate w/2 again, shift left 1
|
||||
dey
|
||||
|
||||
WGFancyRect_horzLoopOddAligned1: ; Draw even columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bpl WGFancyRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGFancyRect_horzLoopOddAlignedEvenWidth
|
||||
|
||||
WGFancyRect_horzLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
dec
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
|
||||
WGFancyRect_horzLoopOddAlignedEvenWidth:
|
||||
inx
|
||||
cpx PARAM1
|
||||
cpx PARAM1
|
||||
bne WGFancyRect_vertEdge
|
||||
clc ; Prepare for bottom edge
|
||||
lda PARAM1
|
||||
|
@ -625,17 +575,67 @@ WGFancyRect_horzLoopOddAlignedEvenWidth:
|
|||
tax
|
||||
lda #FR_BOTTOM
|
||||
sta SCRATCH0
|
||||
jmp WGFancyRect_horzEdge
|
||||
jmp WGFancyRect_horzEdge
|
||||
|
||||
WGFancyRect_horzLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2
|
||||
lsr
|
||||
tay ; Iterate w/2
|
||||
phy ; We'll reuse this calculation for the even columns
|
||||
|
||||
WGFancyRect_horzLoopOddAligned0: ; Draw even columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bne WGFancyRect_horzLoopOddAligned0 ; Loop for w/2
|
||||
|
||||
SETSWITCH PAGE2OFF ; Prepare for odd columns
|
||||
ply ; Iterate w/2 again, shift left 1
|
||||
dey
|
||||
|
||||
WGFancyRect_horzLoopOddAligned1: ; Draw even columns
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
dey
|
||||
bpl WGFancyRect_horzLoopOddAligned1 ; Loop for w/2
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
ror
|
||||
bcc WGFancyRect_horzLoopOddAlignedEvenWidth
|
||||
|
||||
WGFancyRect_horzLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd aligned, odd width
|
||||
lda PARAM2 ; Fill in extra last column
|
||||
dec
|
||||
lsr
|
||||
tay
|
||||
lda SCRATCH0 ; Plot the character
|
||||
sta (BASL),y
|
||||
|
||||
WGFancyRect_horzLoopOddAlignedEvenWidth:
|
||||
inx
|
||||
cpx PARAM1
|
||||
bne WGFancyRect_vertEdge
|
||||
clc ; Prepare for bottom edge
|
||||
lda PARAM1
|
||||
adc PARAM3
|
||||
tax
|
||||
lda #FR_BOTTOM
|
||||
sta SCRATCH0
|
||||
jmp WGFancyRect_horzEdge
|
||||
|
||||
WGFancyRect_vertEdge:
|
||||
; Left and right edges
|
||||
;
|
||||
clc
|
||||
lda PARAM1 ; Compute bottom edge
|
||||
lda PARAM1 ; Compute bottom edge
|
||||
adc PARAM3
|
||||
sta SCRATCH0
|
||||
sta SCRATCH0
|
||||
|
||||
ldx PARAM1 ; Start with top edge
|
||||
ldx PARAM1 ; Start with top edge
|
||||
|
||||
WGFancyRect_vertLoop:
|
||||
|
||||
|
@ -646,32 +646,32 @@ WGFancyRect_vertLoop:
|
|||
lda TEXTLINES_H,x
|
||||
sta BASH
|
||||
|
||||
lda PARAM0
|
||||
lda PARAM0
|
||||
dec
|
||||
lsr
|
||||
clc
|
||||
adc BASL
|
||||
adc BASL
|
||||
sta BASL
|
||||
lda #$0
|
||||
lda #$0
|
||||
adc BASH
|
||||
sta BASH
|
||||
|
||||
lda PARAM0 ; Left edge even?
|
||||
lda PARAM0 ; Left edge even?
|
||||
dec
|
||||
ror
|
||||
bcs WGFancyRect_vertLoopOdd
|
||||
bcs WGFancyRect_vertLoopOdd
|
||||
|
||||
; CASE 1: Left edge even-aligned, even width
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
SETSWITCH PAGE2ON
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
inc
|
||||
ror
|
||||
bcs WGFancyRect_vertLoopEvenAlignedOddWidth
|
||||
bcs WGFancyRect_vertLoopEvenAlignedOddWidth
|
||||
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
|
@ -679,75 +679,75 @@ WGFancyRect_vertLoop:
|
|||
lsr
|
||||
dec
|
||||
tay
|
||||
SETSWITCH PAGE2OFF
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGFancyRect_vertLoopEvenAlignedNextRow
|
||||
SETSWITCH PAGE2OFF
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGFancyRect_vertLoopEvenAlignedNextRow
|
||||
|
||||
WGFancyRect_vertLoopEvenAlignedOddWidth:
|
||||
; CASE 1a: Left edge even-aligned, odd width
|
||||
SETSWITCH PAGE2ON
|
||||
SETSWITCH PAGE2ON
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
|
||||
WGFancyRect_vertLoopEvenAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGFancyRect_vertLoop
|
||||
jmp WGFancyRect_corners
|
||||
cpx SCRATCH0
|
||||
bne WGFancyRect_vertLoop
|
||||
jmp WGFancyRect_corners
|
||||
|
||||
|
||||
WGFancyRect_vertLoopOdd:
|
||||
; CASE 2: Left edge odd-aligned, even width
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
SETSWITCH PAGE2OFF
|
||||
ldy #$0
|
||||
lda #FR_LEFT ; Plot the left edge
|
||||
sta (BASL),y
|
||||
|
||||
lda PARAM2 ; Is width even?
|
||||
lda PARAM2 ; Is width even?
|
||||
inc
|
||||
inc
|
||||
ror
|
||||
bcs WGFancyRect_vertLoopOddAlignedOddWidth
|
||||
bcs WGFancyRect_vertLoopOddAlignedOddWidth
|
||||
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
SETSWITCH PAGE2ON
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGFancyRect_vertLoopOddAlignedNextRow
|
||||
SETSWITCH PAGE2ON
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
jmp WGFancyRect_vertLoopOddAlignedNextRow
|
||||
|
||||
WGFancyRect_vertLoopOddAlignedOddWidth:
|
||||
; CASE 2a: Left edge odd-aligned, odd width
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH PAGE2OFF
|
||||
lda PARAM2 ; Calculate right edge
|
||||
inc
|
||||
inc
|
||||
lsr
|
||||
tay
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
lda #FR_RIGHT ; Plot the right edge
|
||||
sta (BASL),y
|
||||
|
||||
WGFancyRect_vertLoopOddAlignedNextRow:
|
||||
plx ; Prepare for next row
|
||||
inx
|
||||
cpx SCRATCH0
|
||||
bne WGFancyRect_vertLoopJmp
|
||||
cpx SCRATCH0
|
||||
bne WGFancyRect_vertLoopJmp
|
||||
jmp WGFancyRect_corners
|
||||
WGFancyRect_vertLoopJmp:
|
||||
jmp WGFancyRect_vertLoop
|
||||
|
||||
WGFancyRect_corners:
|
||||
lda PARAM0 ; Top left corner
|
||||
lda PARAM0 ; Top left corner
|
||||
dec
|
||||
sta WG_CURSORX
|
||||
lda PARAM1
|
||||
|
@ -756,7 +756,7 @@ WGFancyRect_corners:
|
|||
lda #FR_TOPLEFT
|
||||
jsr WGPlot
|
||||
|
||||
lda PARAM0 ; Top right corner
|
||||
lda PARAM0 ; Top right corner
|
||||
clc
|
||||
adc PARAM2
|
||||
sta WG_CURSORX
|
||||
|
|
10
utility.s
10
utility.s
|
@ -100,10 +100,10 @@ WGStrLen:
|
|||
|
||||
ldy #0
|
||||
WGStrLen_loop:
|
||||
lda (PARAM0),y
|
||||
beq WGStrLen_done
|
||||
lda (PARAM0),y
|
||||
beq WGStrLen_done
|
||||
iny
|
||||
bra WGStrLen_loop
|
||||
bra WGStrLen_loop
|
||||
|
||||
WGStrLen_done:
|
||||
tya
|
||||
|
@ -164,7 +164,7 @@ WGStoreStr:
|
|||
phx ; Remember the start of our string
|
||||
|
||||
WGStoreStr_copyLoop:
|
||||
lda (PARAM0),y
|
||||
lda (PARAM0),y
|
||||
cmp WG_SCRATCHA
|
||||
beq WGStoreStr_terminate
|
||||
sta WG_STRINGS,x
|
||||
|
@ -214,7 +214,7 @@ WGStorePascalStr:
|
|||
WGStorePascalStr_copyLoop:
|
||||
cpy WG_SCRATCHA
|
||||
beq WGStorePascalStr_terminate
|
||||
lda (PARAM0),y
|
||||
lda (PARAM0),y
|
||||
sta WG_STRINGS,x
|
||||
inx
|
||||
iny
|
||||
|
|
278
views.s
278
views.s
|
@ -48,33 +48,33 @@ WGCreateView:
|
|||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+2,x ; Screen Width
|
||||
sta WG_VIEWRECORDS+2,x ; Screen Width
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+3,x ; Screen Height
|
||||
sta WG_VIEWRECORDS+3,x ; Screen Height
|
||||
|
||||
pla
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+7,x ; View Width
|
||||
sta WG_VIEWRECORDS+7,x ; View Width
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+8,x ; View Height
|
||||
sta WG_VIEWRECORDS+8,x ; View Height
|
||||
|
||||
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||
|
@ -106,8 +106,8 @@ WGCreateView_done:
|
|||
;
|
||||
WGCreateCheckbox:
|
||||
pha
|
||||
lda #VIEW_STYLE_CHECK
|
||||
bra WGCreate1x1_common
|
||||
lda #VIEW_STYLE_CHECK
|
||||
bra WGCreate1x1_common
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; WGCreateRadio
|
||||
|
@ -124,13 +124,13 @@ WGCreateCheckbox:
|
|||
;
|
||||
WGCreateRadio:
|
||||
pha
|
||||
lda #VIEW_STYLE_RADIO
|
||||
lda #VIEW_STYLE_RADIO
|
||||
WGCreate1x1_common:
|
||||
sta WGCreate1x1_style+1
|
||||
sta WGCreate1x1_style+1
|
||||
SAVE_XY
|
||||
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
ldy #0
|
||||
lda (PARAM0),y ; Find our new view record
|
||||
pha ; Cache view ID so we can select when we're done
|
||||
|
||||
asl
|
||||
|
@ -140,39 +140,39 @@ WGCreate1x1_common:
|
|||
tax
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
|
||||
lda #1
|
||||
sta WG_VIEWRECORDS+2,x ; Initialize screen width
|
||||
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||
sta WG_VIEWRECORDS+7,x ; Initialize view width
|
||||
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||
lda #1
|
||||
sta WG_VIEWRECORDS+2,x ; Initialize screen width
|
||||
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||
sta WG_VIEWRECORDS+7,x ; Initialize view width
|
||||
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||
|
||||
WGCreate1x1_style:
|
||||
lda #$FF ; Self-modifying code!
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
lda #$FF ; Self-modifying code!
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
|
||||
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||
stz WG_VIEWRECORDS+11,x
|
||||
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||
stz WG_VIEWRECORDS+11,x
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
|
||||
pla
|
||||
jsr WGSelectView ; Leave this as the active view
|
||||
jsr WGSelectView ; Leave this as the active view
|
||||
|
||||
RESTORE_XY
|
||||
pla
|
||||
|
@ -207,26 +207,26 @@ WGCreateProgress:
|
|||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+2,x ; Screen width
|
||||
sta WG_VIEWRECORDS+7,x ; View width
|
||||
sta WG_VIEWRECORDS+2,x ; Screen width
|
||||
sta WG_VIEWRECORDS+7,x ; View width
|
||||
|
||||
lda #1
|
||||
sta WG_VIEWRECORDS+3,x ; Screen height
|
||||
sta WG_VIEWRECORDS+8,x ; View height
|
||||
lda #1
|
||||
sta WG_VIEWRECORDS+3,x ; Screen height
|
||||
sta WG_VIEWRECORDS+8,x ; View height
|
||||
|
||||
lda #VIEW_STYLE_PROGRESS
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
|
||||
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||
stz WG_VIEWRECORDS+10,x ; Initialize callback
|
||||
|
@ -234,10 +234,10 @@ WGCreateProgress:
|
|||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
|
||||
pla
|
||||
jsr WGSelectView ; Leave this as the active view
|
||||
|
@ -263,8 +263,8 @@ WGSetState:
|
|||
sta SCRATCH0
|
||||
lda PARAM0
|
||||
and #$7F
|
||||
ora SCRATCH0
|
||||
sta WG_VIEWRECORDS+9,y ; State (preserving bit 7)
|
||||
ora SCRATCH0
|
||||
sta WG_VIEWRECORDS+9,y ; State (preserving bit 7)
|
||||
|
||||
WGSetState_done:
|
||||
RESTORE_AXY
|
||||
|
@ -302,41 +302,41 @@ WGCreateButton:
|
|||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
sta WG_VIEWRECORDS+0,x ; Screen X
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
sta WG_VIEWRECORDS+1,x ; Screen Y
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+2,x ; Screen width
|
||||
sta WG_VIEWRECORDS+7,x ; View width
|
||||
sta WG_VIEWRECORDS+2,x ; Screen width
|
||||
sta WG_VIEWRECORDS+7,x ; View width
|
||||
|
||||
lda #1
|
||||
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||
sta WG_VIEWRECORDS+3,x ; Initialize screen height
|
||||
sta WG_VIEWRECORDS+8,x ; Initialize view height
|
||||
|
||||
lda #VIEW_STYLE_BUTTON
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
sta WG_VIEWRECORDS+4,x ; Style
|
||||
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
stz WG_VIEWRECORDS+5,x ; Initialize scrolling
|
||||
stz WG_VIEWRECORDS+6,x
|
||||
stz WG_VIEWRECORDS+9,x ; Initialize state
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+10,x ; Callback
|
||||
sta WG_VIEWRECORDS+10,x ; Callback
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+11,x
|
||||
sta WG_VIEWRECORDS+11,x
|
||||
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
sta WG_VIEWRECORDS+12,x ; Title
|
||||
iny
|
||||
lda (PARAM0),y
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
sta WG_VIEWRECORDS+13,x
|
||||
|
||||
pla
|
||||
jsr WGSelectView ; Leave this as the active view
|
||||
|
@ -385,13 +385,13 @@ WGPaintView:
|
|||
beq WGPaintView_done ; If it's a stealth view, we're done
|
||||
pha
|
||||
|
||||
lda WG_VIEWRECORDS+0,y ; Fetch the geometry
|
||||
lda WG_VIEWRECORDS+0,y ; Fetch the geometry
|
||||
sta PARAM0
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
sta PARAM1
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
sta PARAM2
|
||||
lda WG_VIEWRECORDS+3,y
|
||||
lda WG_VIEWRECORDS+3,y
|
||||
sta PARAM3
|
||||
|
||||
pla ; Draw outline
|
||||
|
@ -405,7 +405,7 @@ WGPaintView:
|
|||
cmp #VIEW_STYLE_CHECK
|
||||
beq WGPaintView_check
|
||||
cmp #VIEW_STYLE_BUTTON
|
||||
beq WGPaintView_button
|
||||
beq WGPaintView_button
|
||||
cmp #VIEW_STYLE_PROGRESS
|
||||
beq WGPaintView_progress
|
||||
bra WGPaintView_done
|
||||
|
@ -427,7 +427,7 @@ WGPaintView_progress:
|
|||
bra WGPaintView_done
|
||||
|
||||
WGPaintView_button:
|
||||
jsr paintButton
|
||||
jsr paintButton
|
||||
|
||||
WGPaintView_done:
|
||||
jsr WGPointerDirty ; The pointer BG may now be stale
|
||||
|
@ -444,15 +444,15 @@ WGPaintView_done:
|
|||
; Side effects: Clobbers all registers,P0,P1
|
||||
paintCheck:
|
||||
lda WG_VIEWRECORDS+0,y ; Position cursor
|
||||
sta WG_CURSORX
|
||||
sta WG_CURSORX
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
sta WG_CURSORY
|
||||
sta WG_CURSORY
|
||||
|
||||
lda WG_VIEWRECORDS+9,y ; Determine our visual state
|
||||
lda WG_VIEWRECORDS+9,y ; Determine our visual state
|
||||
and #$80
|
||||
bne paintCheck_selected
|
||||
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
ror
|
||||
bcc paintCheck_unselectedUnchecked
|
||||
|
||||
|
@ -464,7 +464,7 @@ paintCheck_unselectedUnchecked:
|
|||
bra paintCheck_plot
|
||||
|
||||
paintCheck_selected:
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
lda WG_VIEWRECORDS+9,y
|
||||
ror
|
||||
bcc paintCheck_selectedUnchecked
|
||||
|
||||
|
@ -490,7 +490,7 @@ paintCheck_plot: ; Paint our state
|
|||
lda WG_VIEWRECORDS+4,y ; Raw or Apple format title?
|
||||
and #VIEW_STYLE_RAWTITLE
|
||||
asl
|
||||
eor #$80 ; becomes #$80 for Apple format, 0 for raw
|
||||
eor #$80 ; becomes #$80 for Apple format, 0 for raw
|
||||
sta paintCheck_mask+1
|
||||
|
||||
ldy #0
|
||||
|
@ -515,12 +515,12 @@ paintCheck_done:
|
|||
; Side effects: Clobbers all registers,P0,P1
|
||||
paintProgress:
|
||||
lda WG_VIEWRECORDS+1,y ; Top edge
|
||||
sta PARAM1
|
||||
sta PARAM1
|
||||
|
||||
lda #1
|
||||
sta PARAM3
|
||||
|
||||
lda WG_VIEWRECORDS+9,y ; Progress value as width
|
||||
lda WG_VIEWRECORDS+9,y ; Progress value as width
|
||||
sta PARAM2
|
||||
beq paintProgress_noFill ; skip if nothing to draw
|
||||
|
||||
|
@ -574,9 +574,9 @@ paintButton:
|
|||
sta SCRATCH1 ; Cache this for left margin rendering
|
||||
|
||||
lda #0 ; Position and print title
|
||||
sta WG_LOCALCURSORX
|
||||
sta WG_LOCALCURSORX
|
||||
lda #0
|
||||
sta WG_LOCALCURSORY
|
||||
sta WG_LOCALCURSORY
|
||||
jsr WGSyncGlobalCursor
|
||||
|
||||
lda WG_VIEWRECORDS+9,y ; Is button highlighted?
|
||||
|
@ -596,7 +596,7 @@ paintButton_titleMarginLeft:
|
|||
ldx #0
|
||||
|
||||
paintButton_titleMarginLeftLoop:
|
||||
cpx SCRATCH1
|
||||
cpx SCRATCH1
|
||||
bcs paintButton_title ; Left margin finished
|
||||
jsr WGPlot
|
||||
inc WG_CURSORX
|
||||
|
@ -619,7 +619,7 @@ paintButton_titleApple:
|
|||
ldx WG_LOCALCURSORX
|
||||
|
||||
paintButton_titleMarginRightLoop:
|
||||
cpx SCRATCH1
|
||||
cpx SCRATCH1
|
||||
bcs paintButton_done ; Right margin finished
|
||||
jsr WGPlot
|
||||
inc WG_CURSORX
|
||||
|
@ -661,7 +661,7 @@ paintWindowTitle_compute:
|
|||
sbc SCRATCH1
|
||||
clc
|
||||
adc WG_VIEWRECORDS+0,y
|
||||
sta WG_CURSORX ; Position cursor
|
||||
sta WG_CURSORX ; Position cursor
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
dec
|
||||
sta WG_CURSORY
|
||||
|
@ -669,7 +669,7 @@ paintWindowTitle_compute:
|
|||
lda WG_VIEWRECORDS+4,y ; Raw or Apple format title?
|
||||
and #VIEW_STYLE_RAWTITLE
|
||||
asl
|
||||
eor #$80 ; becomes #$80 for Apple format, 0 for raw
|
||||
eor #$80 ; becomes #$80 for Apple format, 0 for raw
|
||||
sta paintWindowTitle_mask+1
|
||||
|
||||
ldy #0
|
||||
|
@ -678,7 +678,7 @@ paintWindowTitleLoop:
|
|||
beq paintWindowTitle_done
|
||||
paintWindowTitle_mask:
|
||||
ora #$FF ; Self-modifying code!
|
||||
jsr WGPlot ; Draw the character
|
||||
jsr WGPlot ; Draw the character
|
||||
iny
|
||||
inc WG_CURSORX ; Advance cursors
|
||||
bra paintWindowTitleLoop
|
||||
|
@ -697,25 +697,25 @@ WGEraseView:
|
|||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda WG_VIEWRECORDS+0,y
|
||||
lda WG_VIEWRECORDS+0,y
|
||||
dec
|
||||
sta PARAM0
|
||||
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
lda WG_VIEWRECORDS+1,y
|
||||
dec
|
||||
sta PARAM1
|
||||
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
lda WG_VIEWRECORDS+2,y
|
||||
inc
|
||||
inc
|
||||
sta PARAM2
|
||||
|
||||
lda WG_VIEWRECORDS+3,y
|
||||
lda WG_VIEWRECORDS+3,y
|
||||
inc
|
||||
inc
|
||||
sta PARAM3
|
||||
|
||||
ldy #' '+$80
|
||||
ldy #' '+$80
|
||||
jsr WGFillRect
|
||||
|
||||
WGEraseView_done:
|
||||
|
@ -734,19 +734,19 @@ WGEraseViewContents:
|
|||
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda WG_VIEWRECORDS,y ; Fetch the record
|
||||
lda WG_VIEWRECORDS,y ; Fetch the record
|
||||
sta PARAM0
|
||||
iny
|
||||
lda WG_VIEWRECORDS,y
|
||||
lda WG_VIEWRECORDS,y
|
||||
sta PARAM1
|
||||
iny
|
||||
lda WG_VIEWRECORDS,y
|
||||
lda WG_VIEWRECORDS,y
|
||||
sta PARAM2
|
||||
iny
|
||||
lda WG_VIEWRECORDS,y
|
||||
lda WG_VIEWRECORDS,y
|
||||
sta PARAM3
|
||||
|
||||
ldy #' '+$80
|
||||
ldy #' '+$80
|
||||
jsr WGFillRect
|
||||
|
||||
WGEraseViewContents_done:
|
||||
|
@ -762,13 +762,13 @@ WGEraseViewContents_done:
|
|||
; A: ID
|
||||
;
|
||||
WGSelectView:
|
||||
sta WG_ACTIVEVIEW
|
||||
sta WG_ACTIVEVIEW
|
||||
|
||||
; Initialize cursor to local origin
|
||||
stz WG_LOCALCURSORX
|
||||
stz WG_LOCALCURSORY
|
||||
|
||||
jsr cacheClipPlanes ; View changed, so clipping cache is stale
|
||||
jsr cacheClipPlanes ; View changed, so clipping cache is stale
|
||||
|
||||
WGSelectView_done:
|
||||
rts
|
||||
|
@ -839,7 +839,7 @@ WGViewFocusNext:
|
|||
jsr unfocusCurrent
|
||||
|
||||
WGViewFocusNext_loop:
|
||||
lda WG_FOCUSVIEW ; Increment and wrap
|
||||
lda WG_FOCUSVIEW ; Increment and wrap
|
||||
inc
|
||||
cmp #16
|
||||
beq WGViewFocusNext_wrap
|
||||
|
@ -863,7 +863,7 @@ WGViewFocusNext_focus:
|
|||
rts
|
||||
|
||||
WGViewFocusNext_wrap:
|
||||
stz WG_FOCUSVIEW
|
||||
stz WG_FOCUSVIEW
|
||||
bra WGViewFocusNext_loop
|
||||
|
||||
|
||||
|
@ -878,7 +878,7 @@ WGViewFocusPrev:
|
|||
jsr unfocusCurrent
|
||||
|
||||
WGViewFocusPrev_loop:
|
||||
ldx WG_FOCUSVIEW ; Decrement and wrap
|
||||
ldx WG_FOCUSVIEW ; Decrement and wrap
|
||||
dex
|
||||
bmi WGViewFocusPrev_wrap
|
||||
|
||||
|
@ -934,7 +934,7 @@ unfocusCurrentDone:
|
|||
; Sets focus to desired view, and repaints
|
||||
; Side effects: Clobbers A
|
||||
focusCurrent:
|
||||
lda WG_FOCUSVIEW
|
||||
lda WG_FOCUSVIEW
|
||||
jsr WGSelectView
|
||||
|
||||
LDY_ACTIVEVIEW
|
||||
|
@ -964,7 +964,7 @@ WGViewFocusAction:
|
|||
SAVE_AXY
|
||||
|
||||
lda WG_FOCUSVIEW
|
||||
bpl WGViewFocusAction_do
|
||||
bpl WGViewFocusAction_do
|
||||
jmp WGViewFocusAction_done
|
||||
|
||||
WGViewFocusAction_do:
|
||||
|
@ -974,7 +974,7 @@ WGViewFocusAction_do:
|
|||
|
||||
cmp #VIEW_STYLE_CHECK
|
||||
beq WGViewFocusAction_toggleCheckbox
|
||||
cmp #VIEW_STYLE_RADIO
|
||||
cmp #VIEW_STYLE_RADIO
|
||||
beq WGViewFocusAction_toggleRadio
|
||||
bra WGViewFocusAction_buttonClick ; Everything else treated like a button
|
||||
|
||||
|
@ -982,21 +982,21 @@ WGViewFocusAction_toggleRadio:
|
|||
lda #15
|
||||
WGViewFocusAction_toggleRadioLoop:
|
||||
pha
|
||||
cmp WG_FOCUSVIEW
|
||||
cmp WG_FOCUSVIEW
|
||||
beq WGViewFocusAction_toggleRadioLoopNext
|
||||
LDY_AVIEW
|
||||
lda WG_VIEWRECORDS+4,y
|
||||
and #$f
|
||||
cmp #VIEW_STYLE_RADIO
|
||||
bne WGViewFocusAction_toggleRadioLoopNext
|
||||
lda WG_VIEWRECORDS+9,y ; check if this radio button is selected
|
||||
lda WG_VIEWRECORDS+4,y
|
||||
and #$f
|
||||
cmp #VIEW_STYLE_RADIO
|
||||
bne WGViewFocusAction_toggleRadioLoopNext
|
||||
lda WG_VIEWRECORDS+9,y ; check if this radio button is selected
|
||||
beq WGViewFocusAction_toggleRadioLoopNext
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+9,y ; if so, deselect it and repaint
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+9,y ; if so, deselect it and repaint
|
||||
pla
|
||||
pha
|
||||
jsr WGSelectView
|
||||
jsr WGPaintView
|
||||
jsr WGSelectView
|
||||
jsr WGPaintView
|
||||
WGViewFocusAction_toggleRadioLoopNext:
|
||||
pla
|
||||
dec
|
||||
|
@ -1250,13 +1250,13 @@ WGSetCursor:
|
|||
lda #0 ; Prevent negatives
|
||||
|
||||
WGSetCursor_StoreX:
|
||||
sta WG_LOCALCURSORX
|
||||
sta WG_LOCALCURSORX
|
||||
lda PARAM1
|
||||
bpl WGSetCursor_StoreY
|
||||
lda #0 ; Prevent negatives
|
||||
|
||||
WGSetCursor_StoreY:
|
||||
sta WG_LOCALCURSORY
|
||||
sta WG_LOCALCURSORY
|
||||
|
||||
pla
|
||||
rts
|
||||
|
@ -1272,9 +1272,9 @@ WGSetGlobalCursor:
|
|||
pha
|
||||
|
||||
lda PARAM0
|
||||
sta WG_CURSORX
|
||||
sta WG_CURSORX
|
||||
lda PARAM1
|
||||
sta WG_CURSORY
|
||||
sta WG_CURSORY
|
||||
|
||||
pla
|
||||
rts
|
||||
|
@ -1294,19 +1294,19 @@ WGSyncGlobalCursor:
|
|||
; Sync X
|
||||
clc ; Transform to viewspace
|
||||
lda WG_LOCALCURSORX
|
||||
adc WG_VIEWRECORDS+0,y
|
||||
adc WG_VIEWRECORDS+0,y
|
||||
|
||||
clc
|
||||
adc WG_VIEWRECORDS+5,y ; Transform to scrollspace
|
||||
adc WG_VIEWRECORDS+5,y ; Transform to scrollspace
|
||||
sta WG_CURSORX
|
||||
|
||||
; Sync Y
|
||||
clc ; Transform to viewspace
|
||||
lda WG_LOCALCURSORY
|
||||
adc WG_VIEWRECORDS+1,y
|
||||
adc WG_VIEWRECORDS+1,y
|
||||
|
||||
clc
|
||||
adc WG_VIEWRECORDS+6,y ; Transform to scrollspace
|
||||
adc WG_VIEWRECORDS+6,y ; Transform to scrollspace
|
||||
sta WG_CURSORY
|
||||
|
||||
WGSyncGlobalCursor_done:
|
||||
|
@ -1331,8 +1331,8 @@ WGScrollX:
|
|||
lda #0 ; Prevent positive scroll values
|
||||
|
||||
WGScrollX_Store:
|
||||
sta WG_VIEWRECORDS+5,y
|
||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||
sta WG_VIEWRECORDS+5,y
|
||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||
|
||||
WGScrollX_done:
|
||||
ply
|
||||
|
@ -1405,8 +1405,8 @@ WGScrollY:
|
|||
lda #0 ; Prevent positive scroll values
|
||||
|
||||
WGScrollY_Store:
|
||||
sta WG_VIEWRECORDS+6,y
|
||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||
sta WG_VIEWRECORDS+6,y
|
||||
jsr cacheClipPlanes ; Scroll offset changed, so clipping cache is stale
|
||||
|
||||
WGScrollY_done:
|
||||
ply
|
||||
|
@ -1476,8 +1476,8 @@ WGSetContentWidth:
|
|||
LDY_ACTIVEVIEW
|
||||
pla
|
||||
|
||||
sta WG_VIEWRECORDS+7,y
|
||||
jsr cacheClipPlanes ; Content width changed, so clipping cache is stale
|
||||
sta WG_VIEWRECORDS+7,y
|
||||
jsr cacheClipPlanes ; Content width changed, so clipping cache is stale
|
||||
|
||||
ply
|
||||
rts
|
||||
|
@ -1495,8 +1495,8 @@ WGSetContentHeight:
|
|||
LDY_ACTIVEVIEW
|
||||
pla
|
||||
|
||||
sta WG_VIEWRECORDS+8,y
|
||||
jsr cacheClipPlanes ; Content height changed, so clipping cache is stale
|
||||
sta WG_VIEWRECORDS+8,y
|
||||
jsr cacheClipPlanes ; Content height changed, so clipping cache is stale
|
||||
|
||||
ply
|
||||
rts
|
||||
|
@ -1692,28 +1692,28 @@ cacheClipPlanes:
|
|||
; Compute clip planes in view space
|
||||
LDY_ACTIVEVIEW
|
||||
|
||||
lda WG_VIEWRECORDS+5,y ; Left edge
|
||||
lda WG_VIEWRECORDS+5,y ; Left edge
|
||||
eor #$ff
|
||||
inc
|
||||
sta WG_VIEWCLIP+0
|
||||
sta WG_VIEWCLIP+0
|
||||
|
||||
clc
|
||||
adc WG_VIEWRECORDS+2,y ; Right edge
|
||||
sta WG_VIEWCLIP+2
|
||||
adc WG_VIEWRECORDS+2,y ; Right edge
|
||||
sta WG_VIEWCLIP+2
|
||||
|
||||
lda WG_VIEWRECORDS+7,y ; 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
|
||||
sec
|
||||
sbc WG_VIEWCLIP+2
|
||||
sta WG_VIEWCLIP+4
|
||||
sbc WG_VIEWCLIP+2
|
||||
sta WG_VIEWCLIP+4
|
||||
|
||||
lda WG_VIEWRECORDS+6,y ; Top edge
|
||||
lda WG_VIEWRECORDS+6,y ; Top edge
|
||||
eor #$ff
|
||||
inc
|
||||
sta WG_VIEWCLIP+1
|
||||
sta WG_VIEWCLIP+1
|
||||
|
||||
clc
|
||||
adc WG_VIEWRECORDS+3,y ; Bottom edge
|
||||
sta WG_VIEWCLIP+3
|
||||
adc WG_VIEWRECORDS+3,y ; Bottom edge
|
||||
sta WG_VIEWCLIP+3
|
||||
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
|
38
weegui.s
38
weegui.s
|
@ -92,12 +92,12 @@ WGInit:
|
|||
; sta LINNUML
|
||||
; jsr SETHI
|
||||
|
||||
jsr WG80 ; Enter 80-col text mode
|
||||
jsr WGInitApplesoft ; Set up Applesoft API
|
||||
jsr WG80 ; Enter 80-col text mode
|
||||
jsr WGInitApplesoft ; Set up Applesoft API
|
||||
|
||||
RESTORE_AXY
|
||||
|
||||
jmp WGReset
|
||||
jmp WGReset
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -109,7 +109,7 @@ WGInit:
|
|||
WGReset:
|
||||
SAVE_AXY
|
||||
|
||||
ldy #15 ; Clear our block allocators
|
||||
ldy #15 ; Clear our block allocators
|
||||
WGInit_clearMemLoop:
|
||||
tya
|
||||
asl
|
||||
|
@ -118,14 +118,14 @@ WGInit_clearMemLoop:
|
|||
asl
|
||||
tax
|
||||
lda #0
|
||||
sta WG_VIEWRECORDS+2,x
|
||||
sta WG_STRINGS,x
|
||||
sta WG_VIEWRECORDS+2,x
|
||||
sta WG_STRINGS,x
|
||||
dey
|
||||
bpl WGInit_clearMemLoop
|
||||
|
||||
lda #$ff
|
||||
sta WG_PENDINGACTIONVIEW
|
||||
sta WG_FOCUSVIEW
|
||||
lda #$ff
|
||||
sta WG_PENDINGACTIONVIEW
|
||||
sta WG_FOCUSVIEW
|
||||
|
||||
RESTORE_AXY
|
||||
rts
|
||||
|
@ -147,12 +147,12 @@ WGExit:
|
|||
|
||||
; Remove ourselves from ProDOS memory map
|
||||
; lda #%00001111
|
||||
; trb MEMBITMAP + $0f
|
||||
; trb MEMBITMAP + $0f
|
||||
; lda #$ff
|
||||
; trb MEMBITMAP + $10
|
||||
; trb MEMBITMAP + $11
|
||||
; trb MEMBITMAP + $10
|
||||
; trb MEMBITMAP + $11
|
||||
; lda #%11111100
|
||||
; trb MEMBITMAP + $12
|
||||
; trb MEMBITMAP + $12
|
||||
|
||||
pla
|
||||
rts
|
||||
|
@ -164,13 +164,13 @@ WGExit:
|
|||
WG80:
|
||||
pha
|
||||
|
||||
lda #$a0
|
||||
jsr $c300
|
||||
lda #$a0
|
||||
jsr $c300
|
||||
|
||||
SETSWITCH TEXTON
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH COL80ON
|
||||
SETSWITCH STORE80ON
|
||||
SETSWITCH TEXTON
|
||||
SETSWITCH PAGE2OFF
|
||||
SETSWITCH COL80ON
|
||||
SETSWITCH STORE80ON
|
||||
|
||||
pla
|
||||
rts
|
||||
|
|
Loading…
Reference in New Issue