diff --git a/GenerateTrigTables.py b/GenerateTrigTables.py index 5dde14a..6ebf7c4 100755 --- a/GenerateTrigTables.py +++ b/GenerateTrigTables.py @@ -4,9 +4,22 @@ import sys import math +def twosCompliment(value): + return (value^65535)+1 + +def toFixed(flt): # Floating point to 8.8 fixed point + whole = max(-128, min(127, math.trunc(flt))) # Clamp to signed range + frac = abs(flt)%1 + binary = (abs(whole)<<8) + math.trunc(256*frac) + + if (flt<0 and abs(flt)>0.000001): + binary = twosCompliment(binary) + + return binary + + def main(argv): - # Prologue print ("sineTable:",end="") rowCount = 7 @@ -16,11 +29,40 @@ def main(argv): print ("\n\t.word ", end="") rowCount=0 - print ("$%04x" % (int)(math.sin((2*3.14159)/512 * v)*256+256), end="") + print ("$%04x" % (int)(math.sin((2*3.14159)/256 * v%256)*128+128), end="") if (rowCount<7): print (",", end="") + print ("\n\nangleToVectorX:\t\t; Counterclockwise angle, +x=(1,0)",end="") + rowCount = 11 + + for v in range(0,360): + rowCount += 1 + if (rowCount==12): + print ("\n\t.word ", end="") + rowCount=0 + + print ("$%04x" % toFixed(math.cos(math.radians(v))), end="") + if (rowCount<11): + print (",", end="") + + + print ("\n\nangleToVectorY:\t\t; Counterclockwise angle, +x=(1,0)",end="") + rowCount = 11 + + for v in range(0,360): + rowCount += 1 + if (rowCount==12): + print ("\n\t.word ", end="") + rowCount=0 + + print ("$%04x" % toFixed(math.sin(math.radians(v))), end="") + if (rowCount<11): + print (",", end="") + + print ("\n\n") + if __name__ == "__main__": main(sys.argv[1:]) diff --git a/gamemanager.s b/gamemanager.s index a996cf5..84bc932 100644 --- a/gamemanager.s +++ b/gamemanager.s @@ -47,16 +47,22 @@ gameplayLoopKbd: ; Scroll map if needed lda mapScrollRequested - bmi gameplayLoopPlayers + bmi gameplayLoopAngle jsr scrollMap -gameplayLoopPlayers: +gameplayLoopAngle: - ; Update active player state if needed + ; Update aim angle if needed lda angleDeltaRequested - beq gameplayLoopEndFrame + beq gameplayLoopFire jsr changeAngle +gameplayLoopFire: + + lda fireRequested + beq gameplayLoopEndFrame + jsr fire + gameplayLoopEndFrame: lda quitRequested @@ -103,6 +109,18 @@ changeAngle: rts +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; fire +; +; Handles firing a player's weapon +; +fire: + stz fireRequested + ldy #0 + jsr playerFire + rts + + basePalette: .word $0000,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF quitRequested: @@ -111,6 +129,8 @@ mapScrollRequested: .word $FFFF angleDeltaRequested: .word $0000 +fireRequested: + .word $0000 terrainDirty: .word 1 activePlayer: diff --git a/gscats.2mg b/gscats.2mg index c36176a..6b39d02 100644 Binary files a/gscats.2mg and b/gscats.2mg differ diff --git a/gscats.s b/gscats.s index f63edc2..1d4a4bc 100644 --- a/gscats.s +++ b/gscats.s @@ -19,7 +19,7 @@ mainBank2: ; Set up SCBs jsr initSCBs - SHRVIDEO + ;SHRVIDEO jmp beginGameplay diff --git a/input.s b/input.s index 520599b..b3d7aaf 100644 --- a/input.s +++ b/input.s @@ -22,12 +22,14 @@ kbdScan: beq kbdScanLeftArrow cmp #(21 + $80) beq kbdScanRightArrow - cmp #(' ' + $80) - beq kbdScanSpace + cmp #('q' + $80) + beq kbdScanQ cmp #('a' + $80) beq kbdScanA cmp #('z' + $80) beq kbdScanZ + cmp #(' ' + $80) + beq kbdScanSpace kbdScanDone: BITS16 @@ -53,7 +55,7 @@ kbdScanLeftArrow: sta mapScrollRequested rts -kbdScanSpace: +kbdScanQ: BITS16 lda #1 @@ -72,3 +74,9 @@ kbdScanZ: sta angleDeltaRequested rts +kbdScanSpace: + BITS16 + lda #1 + sta fireRequested + rts + diff --git a/player.s b/player.s index 2791a83..52d255d 100644 --- a/player.s +++ b/player.s @@ -11,10 +11,12 @@ playerData: .word 40 ; X pos in pixels (from left terrain edge) .word 38 ; Y pos in pixels (from bottom terrain edge) - .word 45 ; Angle in degrees from +X + .word 90+45 ; Angle in degrees from +X .word 50 ; Power -PD_ANGLE = 4 ; Byte offsets into player data structure +PD_POSX = 0 ; Byte offsets into player data structure +PD_POSY = 2 +PD_ANGLE = 4 PD_POWER = 6 .macro PLAYERPTR_Y @@ -57,6 +59,29 @@ playerDeltaAngleClampHigh: bra playerDeltaAngleStore +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; playerFire +; +; Y = Player index +; +playerFire: + SAVE_AY + PLAYERPTR_Y + + lda playerData+PD_POSX,y + sta projectileParams + lda playerData+PD_POSY,y + sta projectileParams+2 + lda playerData+PD_ANGLE,y + sta projectileParams+4 + lda playerData+PD_POWER,y + sta projectileParams+6 + jsr fireProjectile + + RESTORE_AY + rts + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; renderPlayers ; diff --git a/projectile.s b/projectile.s index 0e575ec..5cd96bd 100644 --- a/projectile.s +++ b/projectile.s @@ -11,7 +11,8 @@ projectileData: .word 40 ; X pos in pixels (from left terrain edge) .word 38 ; Y pos in pixels (from bottom terrain edge) - .word 0 ; Velocity (8.8 fixed point) + .word 0 ; Velocity X (8.8 fixed point) + .word 0 ; Velocity Y (8.8 fixed point) JD_V = 4 ; Byte offsets into projectile data structure @@ -26,8 +27,6 @@ projectileParams: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; fireProjectile ; -; PARAML0 = Pointer to projectileParams -; ; Trashes SCRATCHL ; fireProjectile: @@ -35,22 +34,34 @@ fireProjectile: ; Set up projectile structure ldy #0 - ldx #0 - lda #projectileData ; Only one active at a tiem for now + lda #projectileData ; Only one active at a time for now sta SCRATCHL -; lda (PARAML0),x ; X pos -; sta (SCRATCHL),y -; inx -; inx -; iny -; iny -; lda (PARAML0),x ; Y pos -; sta (SCRATCHL),y -; inx -; inx -; lda (PARAML0),x ; + lda projectileParams ; X pos + sta (SCRATCHL),y + iny + iny + lda projectileParams+2 ; Y pos + sta (SCRATCHL),y + iny + iny + lda projectileParams+4 ; Convert angle to vector + asl + tax + lda angleToVectorX,x ; Velocity X + + sta (SCRATCHL),y + iny + iny + + lda projectileParams+4 ; Convert angle to vector + asl + tax + lda angleToVectorY,x ; Velocity Y + sta (SCRATCHL),y + + brk fireProjectileLoop: diff --git a/tables.s b/tables.s index 3008950..8f3a3fa 100644 --- a/tables.s +++ b/tables.s @@ -1,68 +1,132 @@ sineTable: - .word $0100,$0103,$0106,$0109,$010c,$010f,$0112,$0115 - .word $0119,$011c,$011f,$0122,$0125,$0128,$012b,$012e - .word $0131,$0135,$0138,$013b,$013e,$0141,$0144,$0147 - .word $014a,$014d,$0150,$0153,$0156,$0159,$015c,$015f - .word $0161,$0164,$0167,$016a,$016d,$0170,$0173,$0175 - .word $0178,$017b,$017e,$0180,$0183,$0186,$0188,$018b - .word $018e,$0190,$0193,$0195,$0198,$019b,$019d,$019f - .word $01a2,$01a4,$01a7,$01a9,$01ab,$01ae,$01b0,$01b2 - .word $01b5,$01b7,$01b9,$01bb,$01bd,$01bf,$01c1,$01c3 - .word $01c5,$01c7,$01c9,$01cb,$01cd,$01cf,$01d1,$01d3 - .word $01d4,$01d6,$01d8,$01d9,$01db,$01dd,$01de,$01e0 - .word $01e1,$01e3,$01e4,$01e6,$01e7,$01e8,$01ea,$01eb - .word $01ec,$01ed,$01ee,$01ef,$01f1,$01f2,$01f3,$01f4 - .word $01f4,$01f5,$01f6,$01f7,$01f8,$01f9,$01f9,$01fa - .word $01fb,$01fb,$01fc,$01fc,$01fd,$01fd,$01fe,$01fe - .word $01fe,$01ff,$01ff,$01ff,$01ff,$01ff,$01ff,$01ff - .word $01ff,$01ff,$01ff,$01ff,$01ff,$01ff,$01ff,$01ff - .word $01fe,$01fe,$01fe,$01fd,$01fd,$01fc,$01fc,$01fb - .word $01fb,$01fa,$01f9,$01f9,$01f8,$01f7,$01f6,$01f5 - .word $01f4,$01f4,$01f3,$01f2,$01f1,$01ef,$01ee,$01ed - .word $01ec,$01eb,$01ea,$01e8,$01e7,$01e6,$01e4,$01e3 - .word $01e1,$01e0,$01de,$01dd,$01db,$01d9,$01d8,$01d6 - .word $01d4,$01d3,$01d1,$01cf,$01cd,$01cb,$01c9,$01c7 - .word $01c5,$01c3,$01c1,$01bf,$01bd,$01bb,$01b9,$01b7 - .word $01b5,$01b2,$01b0,$01ae,$01ab,$01a9,$01a7,$01a4 - .word $01a2,$019f,$019d,$019b,$0198,$0195,$0193,$0190 - .word $018e,$018b,$0188,$0186,$0183,$0180,$017e,$017b - .word $0178,$0175,$0173,$0170,$016d,$016a,$0167,$0164 - .word $0161,$015f,$015c,$0159,$0156,$0153,$0150,$014d - .word $014a,$0147,$0144,$0141,$013e,$013b,$0138,$0135 - .word $0131,$012e,$012b,$0128,$0125,$0122,$011f,$011c - .word $0119,$0115,$0112,$010f,$010c,$0109,$0106,$0103 - .word $0100,$00fc,$00f9,$00f6,$00f3,$00f0,$00ed,$00ea - .word $00e6,$00e3,$00e0,$00dd,$00da,$00d7,$00d4,$00d1 - .word $00ce,$00ca,$00c7,$00c4,$00c1,$00be,$00bb,$00b8 - .word $00b5,$00b2,$00af,$00ac,$00a9,$00a6,$00a3,$00a0 - .word $009e,$009b,$0098,$0095,$0092,$008f,$008c,$008a - .word $0087,$0084,$0081,$007f,$007c,$0079,$0077,$0074 - .word $0071,$006f,$006c,$006a,$0067,$0064,$0062,$0060 - .word $005d,$005b,$0058,$0056,$0054,$0051,$004f,$004d - .word $004a,$0048,$0046,$0044,$0042,$0040,$003e,$003c - .word $003a,$0038,$0036,$0034,$0032,$0030,$002e,$002c - .word $002b,$0029,$0027,$0026,$0024,$0022,$0021,$001f - .word $001e,$001c,$001b,$0019,$0018,$0017,$0015,$0014 - .word $0013,$0012,$0011,$0010,$000e,$000d,$000c,$000b - .word $000b,$000a,$0009,$0008,$0007,$0006,$0006,$0005 - .word $0004,$0004,$0003,$0003,$0002,$0002,$0001,$0001 - .word $0001,$0000,$0000,$0000,$0000,$0000,$0000,$0000 - .word $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 - .word $0001,$0001,$0001,$0002,$0002,$0003,$0003,$0004 - .word $0004,$0005,$0006,$0006,$0007,$0008,$0009,$000a - .word $000b,$000b,$000c,$000d,$000e,$0010,$0011,$0012 - .word $0013,$0014,$0015,$0017,$0018,$0019,$001b,$001c - .word $001e,$001f,$0021,$0022,$0024,$0026,$0027,$0029 - .word $002b,$002c,$002e,$0030,$0032,$0034,$0036,$0038 - .word $003a,$003c,$003e,$0040,$0042,$0044,$0046,$0048 - .word $004a,$004d,$004f,$0051,$0054,$0056,$0058,$005b - .word $005d,$0060,$0062,$0064,$0067,$006a,$006c,$006f - .word $0071,$0074,$0077,$0079,$007c,$007f,$0081,$0084 - .word $0087,$008a,$008c,$008f,$0092,$0095,$0098,$009b - .word $009e,$00a0,$00a3,$00a6,$00a9,$00ac,$00af,$00b2 - .word $00b5,$00b8,$00bb,$00be,$00c1,$00c4,$00c7,$00ca - .word $00ce,$00d1,$00d4,$00d7,$00da,$00dd,$00e0,$00e3 - .word $00e6,$00ea,$00ed,$00f0,$00f3,$00f6,$00f9,$00fc + .word $0080,$0083,$0086,$0089,$008c,$008f,$0092,$0095 + .word $0098,$009c,$009f,$00a2,$00a5,$00a8,$00ab,$00ae + .word $00b0,$00b3,$00b6,$00b9,$00bc,$00bf,$00c1,$00c4 + .word $00c7,$00c9,$00cc,$00ce,$00d1,$00d3,$00d5,$00d8 + .word $00da,$00dc,$00de,$00e0,$00e2,$00e4,$00e6,$00e8 + .word $00ea,$00ec,$00ed,$00ef,$00f0,$00f2,$00f3,$00f5 + .word $00f6,$00f7,$00f8,$00f9,$00fa,$00fb,$00fc,$00fc + .word $00fd,$00fe,$00fe,$00ff,$00ff,$00ff,$00ff,$00ff + .word $00ff,$00ff,$00ff,$00ff,$00ff,$00ff,$00fe,$00fe + .word $00fd,$00fc,$00fc,$00fb,$00fa,$00f9,$00f8,$00f7 + .word $00f6,$00f5,$00f3,$00f2,$00f0,$00ef,$00ed,$00ec + .word $00ea,$00e8,$00e6,$00e4,$00e2,$00e0,$00de,$00dc + .word $00da,$00d8,$00d5,$00d3,$00d1,$00ce,$00cc,$00c9 + .word $00c7,$00c4,$00c1,$00bf,$00bc,$00b9,$00b6,$00b3 + .word $00b0,$00ae,$00ab,$00a8,$00a5,$00a2,$009f,$009c + .word $0098,$0095,$0092,$008f,$008c,$0089,$0086,$0083 + .word $0080,$007c,$0079,$0076,$0073,$0070,$006d,$006a + .word $0067,$0063,$0060,$005d,$005a,$0057,$0054,$0051 + .word $004f,$004c,$0049,$0046,$0043,$0040,$003e,$003b + .word $0038,$0036,$0033,$0031,$002e,$002c,$002a,$0027 + .word $0025,$0023,$0021,$001f,$001d,$001b,$0019,$0017 + .word $0015,$0013,$0012,$0010,$000f,$000d,$000c,$000a + .word $0009,$0008,$0007,$0006,$0005,$0004,$0003,$0003 + .word $0002,$0001,$0001,$0000,$0000,$0000,$0000,$0000 + .word $0000,$0000,$0000,$0000,$0000,$0000,$0001,$0001 + .word $0002,$0003,$0003,$0004,$0005,$0006,$0007,$0008 + .word $0009,$000a,$000c,$000d,$000f,$0010,$0012,$0013 + .word $0015,$0017,$0019,$001b,$001d,$001f,$0021,$0023 + .word $0025,$0027,$002a,$002c,$002e,$0031,$0033,$0036 + .word $0038,$003b,$003e,$0040,$0043,$0046,$0049,$004c + .word $004f,$0051,$0054,$0057,$005a,$005d,$0060,$0063 + .word $0067,$006a,$006d,$0070,$0073,$0076,$0079,$007c + .word $007f,$0083,$0086,$0089,$008c,$008f,$0092,$0095 + .word $0098,$009c,$009f,$00a2,$00a5,$00a8,$00ab,$00ae + .word $00b0,$00b3,$00b6,$00b9,$00bc,$00bf,$00c1,$00c4 + .word $00c7,$00c9,$00cc,$00ce,$00d1,$00d3,$00d5,$00d8 + .word $00da,$00dc,$00de,$00e0,$00e2,$00e4,$00e6,$00e8 + .word $00ea,$00ec,$00ed,$00ef,$00f0,$00f2,$00f3,$00f5 + .word $00f6,$00f7,$00f8,$00f9,$00fa,$00fb,$00fc,$00fc + .word $00fd,$00fe,$00fe,$00ff,$00ff,$00ff,$00ff,$00ff + .word $00ff,$00ff,$00ff,$00ff,$00ff,$00ff,$00fe,$00fe + .word $00fd,$00fc,$00fc,$00fb,$00fa,$00f9,$00f8,$00f7 + .word $00f6,$00f5,$00f3,$00f2,$00f0,$00ef,$00ed,$00ec + .word $00ea,$00e8,$00e6,$00e4,$00e2,$00e0,$00de,$00dc + .word $00da,$00d8,$00d5,$00d3,$00d1,$00ce,$00cc,$00c9 + .word $00c7,$00c4,$00c1,$00bf,$00bc,$00b9,$00b6,$00b3 + .word $00b0,$00ae,$00ab,$00a8,$00a5,$00a2,$009f,$009c + .word $0098,$0095,$0092,$008f,$008c,$0089,$0086,$0083 + .word $0080,$007c,$0079,$0076,$0073,$0070,$006d,$006a + .word $0067,$0063,$0060,$005d,$005a,$0057,$0054,$0051 + .word $004f,$004c,$0049,$0046,$0043,$0040,$003e,$003b + .word $0038,$0036,$0033,$0031,$002e,$002c,$002a,$0027 + .word $0025,$0023,$0021,$001f,$001d,$001b,$0019,$0017 + .word $0015,$0013,$0012,$0010,$000f,$000d,$000c,$000a + .word $0009,$0008,$0007,$0006,$0005,$0004,$0003,$0003 + .word $0002,$0001,$0001,$0000,$0000,$0000,$0000,$0000 + .word $0000,$0000,$0000,$0000,$0000,$0000,$0001,$0001 + .word $0002,$0003,$0003,$0004,$0005,$0006,$0007,$0008 + .word $0009,$000a,$000c,$000d,$000f,$0010,$0012,$0013 + .word $0015,$0017,$0019,$001b,$001d,$001f,$0021,$0023 + .word $0025,$0027,$002a,$002c,$002e,$0031,$0033,$0036 + .word $0038,$003b,$003e,$0040,$0043,$0046,$0049,$004c + .word $004f,$0051,$0054,$0057,$005a,$005d,$0060,$0063 + .word $0067,$006a,$006d,$0070,$0073,$0076,$0079,$007c + +angleToVectorX: ; Counterclockwise angle, +x=(1,0) + .word $0100,$00ff,$00ff,$00ff,$00ff,$00ff,$00fe,$00fe,$00fd,$00fc,$00fc,$00fb + .word $00fa,$00f9,$00f8,$00f7,$00f6,$00f4,$00f3,$00f2,$00f0,$00ee,$00ed,$00eb + .word $00e9,$00e8,$00e6,$00e4,$00e2,$00df,$00dd,$00db,$00d9,$00d6,$00d4,$00d1 + .word $00cf,$00cc,$00c9,$00c6,$00c4,$00c1,$00be,$00bb,$00b8,$00b5,$00b1,$00ae + .word $00ab,$00a7,$00a4,$00a1,$009d,$009a,$0096,$0092,$008f,$008b,$0087,$0083 + .word $0080,$007c,$0078,$0074,$0070,$006c,$0068,$0064,$005f,$005b,$0057,$0053 + .word $004f,$004a,$0046,$0042,$003d,$0039,$0035,$0030,$002c,$0028,$0023,$001f + .word $001a,$0016,$0011,$000d,$0008,$0004,$0000,$fffc,$fff8,$fff3,$ffef,$ffea + .word $ffe6,$ffe1,$ffdd,$ffd8,$ffd4,$ffd0,$ffcb,$ffc7,$ffc3,$ffbe,$ffba,$ffb6 + .word $ffb1,$ffad,$ffa9,$ffa5,$ffa1,$ff9c,$ff98,$ff94,$ff90,$ff8c,$ff88,$ff84 + .word $ff81,$ff7d,$ff79,$ff75,$ff71,$ff6e,$ff6a,$ff66,$ff63,$ff5f,$ff5c,$ff59 + .word $ff55,$ff52,$ff4f,$ff4b,$ff48,$ff45,$ff42,$ff3f,$ff3c,$ff3a,$ff37,$ff34 + .word $ff31,$ff2f,$ff2c,$ff2a,$ff27,$ff25,$ff23,$ff21,$ff1e,$ff1c,$ff1a,$ff18 + .word $ff17,$ff15,$ff13,$ff12,$ff10,$ff0e,$ff0d,$ff0c,$ff0a,$ff09,$ff08,$ff07 + .word $ff06,$ff05,$ff04,$ff04,$ff03,$ff02,$ff02,$ff01,$ff01,$ff01,$ff01,$ff01 + .word $ff00,$ff01,$ff01,$ff01,$ff01,$ff01,$ff02,$ff02,$ff03,$ff04,$ff04,$ff05 + .word $ff06,$ff07,$ff08,$ff09,$ff0a,$ff0c,$ff0d,$ff0e,$ff10,$ff12,$ff13,$ff15 + .word $ff17,$ff18,$ff1a,$ff1c,$ff1e,$ff21,$ff23,$ff25,$ff27,$ff2a,$ff2c,$ff2f + .word $ff31,$ff34,$ff37,$ff3a,$ff3c,$ff3f,$ff42,$ff45,$ff48,$ff4b,$ff4f,$ff52 + .word $ff55,$ff59,$ff5c,$ff5f,$ff63,$ff66,$ff6a,$ff6e,$ff71,$ff75,$ff79,$ff7d + .word $ff80,$ff84,$ff88,$ff8c,$ff90,$ff94,$ff98,$ff9c,$ffa1,$ffa5,$ffa9,$ffad + .word $ffb1,$ffb6,$ffba,$ffbe,$ffc3,$ffc7,$ffcb,$ffd0,$ffd4,$ffd8,$ffdd,$ffe1 + .word $ffe6,$ffea,$ffef,$fff3,$fff8,$fffc,$0000,$0004,$0008,$000d,$0011,$0016 + .word $001a,$001f,$0023,$0028,$002c,$0030,$0035,$0039,$003d,$0042,$0046,$004a + .word $004f,$0053,$0057,$005b,$005f,$0064,$0068,$006c,$0070,$0074,$0078,$007c + .word $0080,$0083,$0087,$008b,$008f,$0092,$0096,$009a,$009d,$00a1,$00a4,$00a7 + .word $00ab,$00ae,$00b1,$00b5,$00b8,$00bb,$00be,$00c1,$00c4,$00c6,$00c9,$00cc + .word $00cf,$00d1,$00d4,$00d6,$00d9,$00db,$00dd,$00df,$00e2,$00e4,$00e6,$00e8 + .word $00e9,$00eb,$00ed,$00ee,$00f0,$00f2,$00f3,$00f4,$00f6,$00f7,$00f8,$00f9 + .word $00fa,$00fb,$00fc,$00fc,$00fd,$00fe,$00fe,$00ff,$00ff,$00ff,$00ff,$00ff + +angleToVectorY: ; Counterclockwise angle, +x=(1,0) + .word $0000,$0004,$0008,$000d,$0011,$0016,$001a,$001f,$0023,$0028,$002c,$0030 + .word $0035,$0039,$003d,$0042,$0046,$004a,$004f,$0053,$0057,$005b,$005f,$0064 + .word $0068,$006c,$0070,$0074,$0078,$007c,$007f,$0083,$0087,$008b,$008f,$0092 + .word $0096,$009a,$009d,$00a1,$00a4,$00a7,$00ab,$00ae,$00b1,$00b5,$00b8,$00bb + .word $00be,$00c1,$00c4,$00c6,$00c9,$00cc,$00cf,$00d1,$00d4,$00d6,$00d9,$00db + .word $00dd,$00df,$00e2,$00e4,$00e6,$00e8,$00e9,$00eb,$00ed,$00ee,$00f0,$00f2 + .word $00f3,$00f4,$00f6,$00f7,$00f8,$00f9,$00fa,$00fb,$00fc,$00fc,$00fd,$00fe + .word $00fe,$00ff,$00ff,$00ff,$00ff,$00ff,$0100,$00ff,$00ff,$00ff,$00ff,$00ff + .word $00fe,$00fe,$00fd,$00fc,$00fc,$00fb,$00fa,$00f9,$00f8,$00f7,$00f6,$00f4 + .word $00f3,$00f2,$00f0,$00ee,$00ed,$00eb,$00e9,$00e8,$00e6,$00e4,$00e2,$00df + .word $00dd,$00db,$00d9,$00d6,$00d4,$00d1,$00cf,$00cc,$00c9,$00c6,$00c4,$00c1 + .word $00be,$00bb,$00b8,$00b5,$00b1,$00ae,$00ab,$00a7,$00a4,$00a1,$009d,$009a + .word $0096,$0092,$008f,$008b,$0087,$0083,$007f,$007c,$0078,$0074,$0070,$006c + .word $0068,$0064,$005f,$005b,$0057,$0053,$004f,$004a,$0046,$0042,$003d,$0039 + .word $0035,$0030,$002c,$0028,$0023,$001f,$001a,$0016,$0011,$000d,$0008,$0004 + .word $0000,$fffc,$fff8,$fff3,$ffef,$ffea,$ffe6,$ffe1,$ffdd,$ffd8,$ffd4,$ffd0 + .word $ffcb,$ffc7,$ffc3,$ffbe,$ffba,$ffb6,$ffb1,$ffad,$ffa9,$ffa5,$ffa1,$ff9c + .word $ff98,$ff94,$ff90,$ff8c,$ff88,$ff84,$ff80,$ff7d,$ff79,$ff75,$ff71,$ff6e + .word $ff6a,$ff66,$ff63,$ff5f,$ff5c,$ff59,$ff55,$ff52,$ff4f,$ff4b,$ff48,$ff45 + .word $ff42,$ff3f,$ff3c,$ff3a,$ff37,$ff34,$ff31,$ff2f,$ff2c,$ff2a,$ff27,$ff25 + .word $ff23,$ff21,$ff1e,$ff1c,$ff1a,$ff18,$ff17,$ff15,$ff13,$ff12,$ff10,$ff0e + .word $ff0d,$ff0c,$ff0a,$ff09,$ff08,$ff07,$ff06,$ff05,$ff04,$ff04,$ff03,$ff02 + .word $ff02,$ff01,$ff01,$ff01,$ff01,$ff01,$ff00,$ff01,$ff01,$ff01,$ff01,$ff01 + .word $ff02,$ff02,$ff03,$ff04,$ff04,$ff05,$ff06,$ff07,$ff08,$ff09,$ff0a,$ff0c + .word $ff0d,$ff0e,$ff10,$ff12,$ff13,$ff15,$ff17,$ff18,$ff1a,$ff1c,$ff1e,$ff21 + .word $ff23,$ff25,$ff27,$ff2a,$ff2c,$ff2f,$ff31,$ff34,$ff37,$ff3a,$ff3c,$ff3f + .word $ff42,$ff45,$ff48,$ff4b,$ff4f,$ff52,$ff55,$ff59,$ff5c,$ff5f,$ff63,$ff66 + .word $ff6a,$ff6e,$ff71,$ff75,$ff79,$ff7d,$ff80,$ff84,$ff88,$ff8c,$ff90,$ff94 + .word $ff98,$ff9c,$ffa1,$ffa5,$ffa9,$ffad,$ffb1,$ffb6,$ffba,$ffbe,$ffc3,$ffc7 + .word $ffcb,$ffd0,$ffd4,$ffd8,$ffdd,$ffe1,$ffe6,$ffea,$ffef,$fff3,$fff8,$fffc vramRowEndsMinusOne: .word $209f,$213f,$21df,$227f,$231f,$23bf,$245f,$24ff,$259f,$263f,$26df,$277f,$281f,$28bf,$295f,$29ff,$2a9f,$2b3f,$2bdf,$2c7f diff --git a/terrain.s b/terrain.s index f9ae7a1..1467fa9 100644 --- a/terrain.s +++ b/terrain.s @@ -242,7 +242,6 @@ generateTerrainLoop: lda sineTable,x - lsr lsr lsr @@ -253,11 +252,13 @@ generateTerrainLoop: iny iny - clc - txa - adc #12 - tax - + inx + inx + inx + inx + inx + inx + txa and #$03ff tax