More efficient even/odd checking

This commit is contained in:
Quinn Dunki
2015-02-12 08:00:41 -08:00
parent a76e961f61
commit 97be525f28
7 changed files with 58 additions and 43 deletions

View File

@@ -44,7 +44,7 @@ Place the WeeGUI library in the same ProDOS folder as your program. Then, at the
10 PRINT CHR$ (4)"BRUN WEEGUI" 10 PRINT CHR$ (4)"BRUN WEEGUI"
That's it! WeeGUI will load itself at address $7E00 of main memory, just below ProDOS. That's it! WeeGUI will load itself into memory and it's ready for use.
####Assembly Language ####Assembly Language
@@ -65,12 +65,29 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
.byte "BRUN WEEGUI",$8d,0 .byte "BRUN WEEGUI",$8d,0
If you load the library some other way, make sure you load it at $7E00, and perform a JSR to that address in order to prepare the library for use. If you load the library some other way, make sure you load it at the base address specified in the memory map below, and perform a JSR to that address in order to prepare the library for use.
You also need to include the file *WeeGUI_MLI.s* in your program. This is the WeeGUI Machine Language Interface, and it provides all the constants, entry points, etc that you'll need for WeeGUI. You also need to include the file *WeeGUI_MLI.s* in your program. This is the WeeGUI Machine Language Interface, and it provides all the constants, entry points, etc that you'll need for WeeGUI.
With either language, WeeGUI protects itself using ProDOS's memory page reservation scheme. This prevents it from being overwritten by ProDOS file operations, or Applesoft BASIC. With either language, WeeGUI protects itself using ProDOS's memory page reservation scheme, and Applesoft's HIMEM. This prevents it from being overwritten by ProDOS file operations, or Applesoft code/variables.
####Memory Map
WeeGUI is 6k in size, and lives at the top of main memory, right under ProDOS. For an experimental version that lives primarily in the auxiliary memory bank, see Appendix A.
<table align="center">
<tr><td>$FFFF</td><td></td></tr>
<tr><td></td><td>...</td></tr>
<tr><td>$BFFF</td><td>ProDOS</td></tr>
<tr><td>$9600</td><td>ProDOS</td></tr>
<tr><td>$95FF</td><td>WeeGUI</td></tr>
<tr><td>$7D00</td><td>WeeGUI</td></tr>
<tr><td>$7CFF</td><td>HIMEM</td></tr>
<tr><td></td><td>...</td></tr>
<tr><td>$0000</td><td></td></tr>
</table>
<br> <br>

View File

@@ -9,6 +9,4 @@ Known issues
To Do: To Do:
------ ------
- Document final memory map
- Remove references to ORG in docs (except in memory map)
- Put sample code in docs - Put sample code in docs

View File

@@ -442,8 +442,8 @@ renderPointer:
sta BASH sta BASH
lda WG_MOUSEPOS_X ; X even? lda WG_MOUSEPOS_X ; X even?
and #$01 ror
bne renderPointer_xOdd bcs renderPointer_xOdd
SETSWITCH PAGE2ON SETSWITCH PAGE2ON

View File

@@ -105,8 +105,8 @@ WGPlot:
sta BASH sta BASH
lda WG_CURSORX ; X even? lda WG_CURSORX ; X even?
and #$01 ror
bne WGPlot_xOdd bcs WGPlot_xOdd
SETSWITCH PAGE2ON ; Plot the character SETSWITCH PAGE2ON ; Plot the character
pla pla

60
rects.s
View File

@@ -45,8 +45,8 @@ WGFillRect_vertLoop:
sta BASH sta BASH
lda PARAM0 ; Left edge even? lda PARAM0 ; Left edge even?
and #$01 ror
bne WGFillRect_horzLoopOdd bcs WGFillRect_horzLoopOdd
lda PARAM2 lda PARAM2
cmp #1 ; Width==1 is a special case cmp #1 ; Width==1 is a special case
@@ -81,8 +81,8 @@ WGFillRect_horzLoopEvenAligned1: ; Draw odd columns
bpl WGFillRect_horzLoopEvenAligned1 ; Loop for w/2 bpl WGFillRect_horzLoopEvenAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGFillRect_horzLoopEvenAlignedEvenWidth bcc WGFillRect_horzLoopEvenAlignedEvenWidth
WGFillRect_horzLoopEvenAlignedOddWidth: WGFillRect_horzLoopEvenAlignedOddWidth:
; CASE 1a: Left edge even aligned, odd width ; CASE 1a: Left edge even aligned, odd width
@@ -129,8 +129,8 @@ WGFillRect_horzLoopOddAligned1: ; Draw even columns
bpl WGFillRect_horzLoopOddAligned1 ; Loop for w/2 bpl WGFillRect_horzLoopOddAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGFillRect_horzLoopOddAlignedEvenWidth bcc WGFillRect_horzLoopOddAlignedEvenWidth
WGFillRect_horzLoopOddAlignedOddWidth: WGFillRect_horzLoopOddAlignedOddWidth:
; CASE 2a: Left edge odd aligned, odd width ; CASE 2a: Left edge odd aligned, odd width
@@ -220,8 +220,8 @@ WGStrokeRect_horzEdge:
sta BASH sta BASH
lda PARAM0 ; Left edge even? lda PARAM0 ; Left edge even?
and #$01 ror
beq WGStrokeRect_horzEdgeEven bcc WGStrokeRect_horzEdgeEven
jmp WGStrokeRect_horzLoopOdd jmp WGStrokeRect_horzLoopOdd
WGStrokeRect_horzEdgeEven: WGStrokeRect_horzEdgeEven:
@@ -253,8 +253,8 @@ WGStrokeRect_horzLoopEvenAligned1: ; Draw odd columns
bpl WGStrokeRect_horzLoopEvenAligned1 ; Loop for w/2 bpl WGStrokeRect_horzLoopEvenAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGStrokeRect_horzLoopEvenAlignedEvenWidth bcc WGStrokeRect_horzLoopEvenAlignedEvenWidth
WGStrokeRect_horzLoopEvenAlignedOddWidth: WGStrokeRect_horzLoopEvenAlignedOddWidth:
; CASE 1a: Left edge even aligned, odd width ; CASE 1a: Left edge even aligned, odd width
@@ -310,8 +310,8 @@ WGStrokeRect_horzLoopOddAligned1: ; Draw even columns
bpl WGStrokeRect_horzLoopOddAligned1 ; Loop for w/2 bpl WGStrokeRect_horzLoopOddAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGStrokeRect_horzLoopOddAlignedEvenWidth bcc WGStrokeRect_horzLoopOddAlignedEvenWidth
WGStrokeRect_horzLoopOddAlignedOddWidth: WGStrokeRect_horzLoopOddAlignedOddWidth:
; CASE 2a: Left edge odd aligned, odd width ; CASE 2a: Left edge odd aligned, odd width
@@ -368,8 +368,8 @@ WGStrokeRect_vertLoop:
lda PARAM0 ; Left edge even? lda PARAM0 ; Left edge even?
dec dec
and #$01 ror
bne WGStrokeRect_vertLoopOdd bcs WGStrokeRect_vertLoopOdd
; CASE 1: Left edge even-aligned, even width ; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2ON SETSWITCH PAGE2ON
@@ -380,8 +380,8 @@ WGStrokeRect_vertLoop:
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
inc inc
inc inc
and #$01 ror
bne WGStrokeRect_vertLoopEvenAlignedOddWidth bcs WGStrokeRect_vertLoopEvenAlignedOddWidth
lda PARAM2 ; Calculate right edge lda PARAM2 ; Calculate right edge
inc inc
@@ -423,8 +423,8 @@ WGStrokeRect_vertLoopOdd:
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
inc inc
inc inc
and #$01 ror
bne WGStrokeRect_vertLoopOddAlignedOddWidth bcs WGStrokeRect_vertLoopOddAlignedOddWidth
lda PARAM2 ; Calculate right edge lda PARAM2 ; Calculate right edge
inc inc
@@ -512,8 +512,8 @@ WGFancyRect_horzEdge:
sta BASH sta BASH
lda PARAM0 ; Left edge even? lda PARAM0 ; Left edge even?
and #$01 ror
bne WGFancyRect_horzLoopOdd bcs WGFancyRect_horzLoopOdd
; CASE 1: Left edge even-aligned, even width ; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2OFF SETSWITCH PAGE2OFF
@@ -539,8 +539,8 @@ WGFancyRect_horzLoopEvenAligned1: ; Draw odd columns
bpl WGFancyRect_horzLoopEvenAligned1 ; Loop for w/2 bpl WGFancyRect_horzLoopEvenAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGFancyRect_horzLoopEvenAlignedEvenWidth bcc WGFancyRect_horzLoopEvenAlignedEvenWidth
WGFancyRect_horzLoopEvenAlignedOddWidth: WGFancyRect_horzLoopEvenAlignedOddWidth:
; CASE 1a: Left edge even aligned, odd width ; CASE 1a: Left edge even aligned, odd width
@@ -588,8 +588,8 @@ WGFancyRect_horzLoopOddAligned1: ; Draw even columns
bpl WGFancyRect_horzLoopOddAligned1 ; Loop for w/2 bpl WGFancyRect_horzLoopOddAligned1 ; Loop for w/2
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
and #$01 ror
beq WGFancyRect_horzLoopOddAlignedEvenWidth bcc WGFancyRect_horzLoopOddAlignedEvenWidth
WGFancyRect_horzLoopOddAlignedOddWidth: WGFancyRect_horzLoopOddAlignedOddWidth:
; CASE 2a: Left edge odd aligned, odd width ; CASE 2a: Left edge odd aligned, odd width
@@ -643,8 +643,8 @@ WGFancyRect_vertLoop:
lda PARAM0 ; Left edge even? lda PARAM0 ; Left edge even?
dec dec
and #$01 ror
bne WGFancyRect_vertLoopOdd bcs WGFancyRect_vertLoopOdd
; CASE 1: Left edge even-aligned, even width ; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2ON SETSWITCH PAGE2ON
@@ -655,8 +655,8 @@ WGFancyRect_vertLoop:
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
inc inc
inc inc
and #$01 ror
bne WGFancyRect_vertLoopEvenAlignedOddWidth bcs WGFancyRect_vertLoopEvenAlignedOddWidth
lda PARAM2 ; Calculate right edge lda PARAM2 ; Calculate right edge
inc inc
@@ -698,8 +698,8 @@ WGFancyRect_vertLoopOdd:
lda PARAM2 ; Is width even? lda PARAM2 ; Is width even?
inc inc
inc inc
and #$01 ror
bne WGFancyRect_vertLoopOddAlignedOddWidth bcs WGFancyRect_vertLoopOddAlignedOddWidth
lda PARAM2 ; Calculate right edge lda PARAM2 ; Calculate right edge
inc inc

View File

@@ -324,8 +324,8 @@ paintCheck:
bne paintCheck_selected bne paintCheck_selected
lda WG_VIEWRECORDS+9,y lda WG_VIEWRECORDS+9,y
and #$01 ror
beq paintCheck_unselectedUnchecked bcc paintCheck_unselectedUnchecked
lda #'D' lda #'D'
bra paintCheck_plot bra paintCheck_plot
@@ -336,8 +336,8 @@ paintCheck_unselectedUnchecked:
paintCheck_selected: paintCheck_selected:
lda WG_VIEWRECORDS+9,y lda WG_VIEWRECORDS+9,y
and #$01 ror
beq paintCheck_selectedUnchecked bcc paintCheck_selectedUnchecked
lda #'E' lda #'E'
bra paintCheck_plot bra paintCheck_plot

Binary file not shown.