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"
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
@ -65,12 +65,29 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
.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.
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>

View File

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

View File

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

View File

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

60
rects.s
View File

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

View File

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

Binary file not shown.