2017-07-28 22:11:25 +00:00
|
|
|
;
|
2017-07-30 18:54:37 +00:00
|
|
|
; gscats
|
2017-07-28 22:11:25 +00:00
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 7/9/17
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
.include "macros.s"
|
|
|
|
.include "equates.s"
|
2017-07-30 18:54:37 +00:00
|
|
|
.include "loader.s"
|
2017-07-29 21:47:17 +00:00
|
|
|
|
|
|
|
mainBank2:
|
|
|
|
SYNCDBR
|
|
|
|
|
|
|
|
BITS8
|
2017-07-28 22:11:25 +00:00
|
|
|
lda #$f0
|
|
|
|
sta TEXTCOLOR
|
2017-07-29 21:47:17 +00:00
|
|
|
BITS16
|
2017-07-28 22:11:25 +00:00
|
|
|
|
2017-07-30 18:54:37 +00:00
|
|
|
; Set up SCBs
|
2017-07-28 22:11:25 +00:00
|
|
|
jsr initSCBs
|
|
|
|
SHRVIDEO
|
|
|
|
|
|
|
|
lda #basePalette
|
|
|
|
sta PARAML0
|
|
|
|
lda #0
|
|
|
|
jsr setPalette
|
|
|
|
|
2017-07-30 18:54:37 +00:00
|
|
|
ldx #$2222
|
2017-07-28 22:11:25 +00:00
|
|
|
jsr colorFill
|
|
|
|
|
2017-08-13 04:25:36 +00:00
|
|
|
jsr generateTerrain
|
2017-08-12 22:41:25 +00:00
|
|
|
jsr compileTerrain
|
|
|
|
jsr clipTerrain
|
2017-08-13 01:17:14 +00:00
|
|
|
|
2017-08-15 19:40:14 +00:00
|
|
|
ldy #0
|
|
|
|
jsr renderPlayerHeader
|
2017-07-30 22:43:55 +00:00
|
|
|
|
|
|
|
mainGameLoop:
|
2017-07-31 03:23:32 +00:00
|
|
|
|
2017-08-13 01:19:17 +00:00
|
|
|
jsr syncVBL
|
2017-08-10 02:33:52 +00:00
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
; lda scrollV
|
|
|
|
; bmi negV
|
2017-08-10 02:33:52 +00:00
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
; clc
|
|
|
|
; lda mapScrollPos
|
|
|
|
; adc scrollV
|
2017-08-13 01:17:14 +00:00
|
|
|
; cmp #COMPILEDTERRAINROW-80
|
2017-08-12 22:41:25 +00:00
|
|
|
; beq reverseScroll
|
|
|
|
; sta mapScrollPos
|
2017-08-10 02:33:52 +00:00
|
|
|
bra render
|
|
|
|
|
|
|
|
negV:
|
|
|
|
clc
|
|
|
|
lda mapScrollPos
|
|
|
|
adc scrollV
|
|
|
|
beq reverseScroll
|
|
|
|
sta mapScrollPos
|
|
|
|
|
|
|
|
render:
|
|
|
|
tay
|
2017-07-31 03:23:32 +00:00
|
|
|
jsr renderTerrain
|
2017-07-30 22:43:55 +00:00
|
|
|
jsr kbdScan
|
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
lda mapScrollRequested
|
2017-08-13 01:17:14 +00:00
|
|
|
bpl scrollMap
|
2017-08-12 22:41:25 +00:00
|
|
|
|
2017-08-13 22:36:12 +00:00
|
|
|
lda #gameobjectData
|
|
|
|
sta PARAML0
|
|
|
|
jsr renderGameobject
|
|
|
|
|
2017-07-30 22:43:55 +00:00
|
|
|
lda quitRequested
|
|
|
|
beq mainGameLoop
|
|
|
|
|
2017-08-13 01:17:14 +00:00
|
|
|
quit:
|
2017-07-30 22:43:55 +00:00
|
|
|
CLASSICVIDEO
|
2017-07-29 21:47:17 +00:00
|
|
|
jml (proDOSLongJump)
|
2017-07-28 22:11:25 +00:00
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
scrollMap:
|
|
|
|
jsr unclipTerrain
|
2017-08-13 22:36:12 +00:00
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
sta mapScrollPos
|
2017-08-13 22:36:12 +00:00
|
|
|
asl
|
|
|
|
asl
|
|
|
|
sta leftScreenEdge
|
|
|
|
|
2017-08-12 22:41:25 +00:00
|
|
|
jsr clipTerrain
|
2017-08-13 01:17:14 +00:00
|
|
|
lda #$ffff
|
|
|
|
sta mapScrollRequested
|
2017-08-12 22:41:25 +00:00
|
|
|
jmp mainGameLoop
|
|
|
|
|
2017-08-10 02:33:52 +00:00
|
|
|
reverseScroll:
|
|
|
|
lda scrollV
|
|
|
|
eor #$ffff
|
|
|
|
inc
|
|
|
|
sta scrollV
|
|
|
|
jmp mainGameLoop
|
2017-07-28 22:11:25 +00:00
|
|
|
|
2017-08-10 02:33:52 +00:00
|
|
|
scrollV:
|
|
|
|
.word 1
|
2017-07-28 22:11:25 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2017-07-30 22:43:55 +00:00
|
|
|
; kbdScan
|
|
|
|
; Processes keyboard input
|
|
|
|
;
|
|
|
|
; Trashes A
|
2017-07-28 22:11:25 +00:00
|
|
|
;
|
2017-07-30 22:43:55 +00:00
|
|
|
|
|
|
|
kbdScan:
|
2017-07-28 22:11:25 +00:00
|
|
|
EMULATION
|
|
|
|
|
2017-07-30 22:43:55 +00:00
|
|
|
kbdScanLoop:
|
2017-07-28 22:11:25 +00:00
|
|
|
lda KBD
|
2017-08-10 02:33:52 +00:00
|
|
|
bpl kbdScanDone
|
2017-07-28 22:11:25 +00:00
|
|
|
sta KBDSTROBE
|
|
|
|
|
2017-07-30 22:43:55 +00:00
|
|
|
cmp #(8 + $80)
|
|
|
|
beq kbdScanLeftArrow
|
|
|
|
|
|
|
|
cmp #(21 + $80)
|
|
|
|
beq kbdScanRightArrow
|
|
|
|
|
|
|
|
cmp #(32 + $80)
|
|
|
|
beq kbdScanSpace
|
|
|
|
|
|
|
|
kbdScanDone:
|
2017-08-10 02:33:52 +00:00
|
|
|
NATIVE
|
2017-07-28 22:11:25 +00:00
|
|
|
rts
|
|
|
|
|
2017-08-13 01:19:17 +00:00
|
|
|
kbdScanRightArrow:
|
2017-07-30 22:43:55 +00:00
|
|
|
NATIVE
|
|
|
|
lda mapScrollPos
|
2017-08-13 01:17:14 +00:00
|
|
|
cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW
|
2017-07-30 22:43:55 +00:00
|
|
|
beq kbdScanDone
|
2017-08-06 19:05:19 +00:00
|
|
|
inc
|
2017-08-13 01:19:17 +00:00
|
|
|
inc
|
2017-08-12 22:41:25 +00:00
|
|
|
sta mapScrollRequested
|
2017-08-13 01:17:14 +00:00
|
|
|
rts
|
2017-07-30 22:43:55 +00:00
|
|
|
|
2017-08-13 01:19:17 +00:00
|
|
|
kbdScanLeftArrow:
|
2017-07-30 22:43:55 +00:00
|
|
|
NATIVE
|
|
|
|
lda mapScrollPos
|
|
|
|
beq kbdScanDone
|
2017-08-06 19:05:19 +00:00
|
|
|
dec
|
2017-08-13 01:19:17 +00:00
|
|
|
dec
|
2017-08-12 22:41:25 +00:00
|
|
|
sta mapScrollRequested
|
2017-08-13 01:17:14 +00:00
|
|
|
rts
|
2017-07-30 22:43:55 +00:00
|
|
|
|
|
|
|
kbdScanSpace:
|
|
|
|
NATIVE
|
|
|
|
lda #1
|
|
|
|
sta quitRequested
|
2017-08-13 01:17:14 +00:00
|
|
|
rts
|
2017-07-30 22:43:55 +00:00
|
|
|
|
2017-07-28 22:11:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basePalette:
|
2017-08-13 21:54:18 +00:00
|
|
|
.word $0000,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF
|
2017-07-30 22:43:55 +00:00
|
|
|
quitRequested:
|
|
|
|
.word $0000
|
2017-08-12 22:41:25 +00:00
|
|
|
mapScrollRequested:
|
2017-08-13 01:17:14 +00:00
|
|
|
.word $FFFF
|
2017-08-15 19:40:14 +00:00
|
|
|
|
2017-08-13 21:54:18 +00:00
|
|
|
|
2017-08-13 22:36:12 +00:00
|
|
|
; Position of map viewing window. Can be visualized in two ways:
|
|
|
|
; a) Word-distance from right edge of terrain data (which is in memory right-to-left) to left edge of visible screen
|
|
|
|
; b) Word-distance from left edge of logical terrain to left edge of visible screen
|
|
|
|
mapScrollPos:
|
|
|
|
.word 0
|
|
|
|
leftScreenEdge:
|
|
|
|
.word 0 ; In pixels
|
2017-07-28 22:11:25 +00:00
|
|
|
|
|
|
|
.include "graphics.s"
|
2017-08-13 21:54:18 +00:00
|
|
|
.include "font.s"
|
2017-07-30 18:54:37 +00:00
|
|
|
.include "terrain.s"
|
2017-08-13 22:36:12 +00:00
|
|
|
.include "gameobject.s"
|
2017-08-15 19:40:14 +00:00
|
|
|
.include "player.s"
|
|
|
|
.include "utility.s"
|
2017-08-06 19:52:21 +00:00
|
|
|
.include "tables.s"
|
2017-07-29 21:47:17 +00:00
|
|
|
endMainBank2:
|
|
|
|
|
2017-07-28 22:11:25 +00:00
|
|
|
|
|
|
|
; Suppress some linker warnings - Must be the last thing in the file
|
|
|
|
; This is because Quinn doesn't really know how to use ca65 properly
|
|
|
|
.SEGMENT "ZPSAVE"
|
|
|
|
.SEGMENT "EXEHDR"
|
|
|
|
.SEGMENT "STARTUP"
|
|
|
|
.SEGMENT "INIT"
|
|
|
|
.SEGMENT "LOWCODE"
|