diff --git a/gscats.2mg b/gscats.2mg index 97ee450..c67e948 100644 Binary files a/gscats.2mg and b/gscats.2mg differ diff --git a/gscats.s b/gscats.s index 38801ea..2ddd52b 100644 --- a/gscats.s +++ b/gscats.s @@ -29,27 +29,25 @@ mainBank2: ldx #$2222 jsr colorFill - jsr generateTerrain +; jsr generateTerrain + jsr compileTerrain + jsr clipTerrain + jsr unclipTerrain + jsr clipTerrain mainGameLoop: - jsr syncVBL +; jsr syncVBL -; ldx #$2222 -; jsr bottomFill +; lda scrollV +; bmi negV -; ldx #$1111 -; jsr bottomFill - - lda scrollV - bmi negV - - clc - lda mapScrollPos - adc scrollV - cmp #TERRAINWIDTH/4-80 - beq reverseScroll - sta mapScrollPos +; clc +; lda mapScrollPos +; adc scrollV +; cmp #TERRAINWIDTH/4-80 +; beq reverseScroll +; sta mapScrollPos bra render negV: @@ -62,16 +60,24 @@ negV: render: tay jsr renderTerrain - jsr kbdScan + lda mapScrollRequested + bne scrollMap + lda quitRequested beq mainGameLoop - CLASSICVIDEO jml (proDOSLongJump) +scrollMap: + jsr unclipTerrain + sta mapScrollPos + jsr clipTerrain + stz mapScrollRequested + jmp mainGameLoop + reverseScroll: lda scrollV eor #$ffff @@ -116,8 +122,7 @@ kbdScanLeftArrow: cmp #TERRAINWIDTH/4-80 beq kbdScanDone inc - inc - sta mapScrollPos + sta mapScrollRequested bra kbdScanDone kbdScanRightArrow: @@ -125,8 +130,7 @@ kbdScanRightArrow: lda mapScrollPos beq kbdScanDone dec - dec - sta mapScrollPos + sta mapScrollRequested bra kbdScanDone kbdScanSpace: @@ -141,9 +145,11 @@ kbdScanSpace: basePalette: .word $0800,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 mapScrollPos: ; 4-pixel columns distance from right terrain edge - .word 79 + .word 5 quitRequested: .word $0000 +mapScrollRequested: + .word $0000 .include "graphics.s" .include "terrain.s" diff --git a/loader.s b/loader.s index d4c35b4..3838fdf 100644 --- a/loader.s +++ b/loader.s @@ -38,6 +38,7 @@ mainCopyDest: sta proDOSLongJump lda #mainBank2 sta mainLongJump + jml (mainLongJump) returnToProDOS: diff --git a/terrain.s b/terrain.s index 02905ca..b08112b 100644 --- a/terrain.s +++ b/terrain.s @@ -6,138 +6,224 @@ TERRAINWIDTH = 640 ; In pixels -MAXTERRAINHEIGHT = 20 ; In pixels +MAXTERRAINHEIGHT = 100 ; In pixels ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; renderTerrain ; ; No stack operations permitted here! ; -; Current implementation: 525 cycles per row +; Current implementation: X cycles per row +; Trashes all registers ; renderTerrain: - lda #199*2 - sta