Fixed some addressing issues in asmDrawLine. Still very broken.

This commit is contained in:
Scott Duensing 2019-10-03 21:04:26 -05:00
parent 040d99935c
commit ec08f48556
3 changed files with 17 additions and 4 deletions

View file

@ -342,6 +342,15 @@ drawTop phy ; Keep Y for later
; ;
; Draws from (clpx0,clpy0) to (clpx1,clpy1) (output of a clipping routine). ; Draws from (clpx0,clpy0) to (clpx1,clpy1) (output of a clipping routine).
; ;
asmTest start
result equ 1
jsubroutine (4:surface),2
lda surface ; Should be $2000
lda surface+1
sta result
jreturn 2:result
end
asmDrawLine start asmDrawLine start
x0 equ 1 x0 equ 1
@ -359,7 +368,8 @@ odd_c equ 19
; Say surface = $012000... ; Say surface = $012000...
lda #<surface ; Should be $2000 ; lda #<surface ; Should be $2000
lda surface ; Should be $2000
sta __e0 ; set "even" addresses sta __e0 ; set "even" addresses
sta __e1 sta __e1
sta __e2 sta __e2
@ -392,7 +402,8 @@ odd_c equ 19
sta __o13 sta __o13
phb ; keep original bank phb ; keep original bank
lda #>surface ; Should be $0120 ; lda #>surface ; Should be $0120
lda surface+1 ; Should be $0120
pha ; switch to bank we're pointing into pha ; switch to bank we're pointing into
plb ; B is now $20 - bad! plb ; B is now $20 - bad!
plb ; B is now $01 - good! plb ; B is now $01 - good!

View file

@ -256,7 +256,7 @@ bool jlKeyPressed(void);
char jlKeyRead(void); char jlKeyRead(void);
void jlKeyWaitForAny(void); void jlKeyWaitForAny(void);
void jlPaletteDefault(void); void jlPaletteDefault(void); //***TODO*** Treat palettes like we do "surfaces" - allow changing STAs or display
void jlPaletteSet(byte index, byte r, byte g, byte b); void jlPaletteSet(byte index, byte r, byte g, byte b);
void jlPaletteSetFromSta(jlStaT *sta); void jlPaletteSetFromSta(jlStaT *sta);

View file

@ -81,12 +81,14 @@ int main(void) {
printAt(font, 1, y++, "X = %d ", jlGameGetAxis(0)); printAt(font, 1, y++, "X = %d ", jlGameGetAxis(0));
printAt(font, 1, y++, "Y = %d ", jlGameGetAxis(1)); printAt(font, 1, y++, "Y = %d ", jlGameGetAxis(1));
printAt(font, 1, y++, "T = %d ", jlUtilTimer()); printAt(font, 1, y++, "T = %d ", jlUtilTimer());
printAt(font, 1, y++, "R = %d ", asmTest((jlSurfaceT)0x012000));
jlDrawColorSet((byte)color); jlDrawColorSet((byte)color);
jlDrawLine(0, y2, 319, 199-y2); jlDrawLine(0, y2, 319, 199-y2);
//asmDrawLine(_jlDrawTargetActual, _jlDrawColor, 0, y2, 319, 199-y2);
y2 += dy; y2 += dy;
if (y2 == 199 || y2 == 0) dy = -dy; if (y2 == 199 || y2 == 0) dy = -dy;
jlDisplayPresent(); jlDisplayPresent();
jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor)); //jlUtilNibbleSwap((byte *)font->pixels, 32000, (byte)(color), (byte)(nextColor));
color = nextColor; color = nextColor;
nextColor++; nextColor++;
if (nextColor > 15) nextColor = 1; if (nextColor > 15) nextColor = 1;