GSCats/gscats.s

200 lines
2.7 KiB
ArmAsm
Raw Normal View History

2017-07-28 22:11:25 +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"
.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
; Set up SCBs
2017-07-28 22:11:25 +00:00
jsr initSCBs
SHRVIDEO
lda #basePalette
sta PARAML0
lda #0
jsr setPalette
ldx #$2222
2017-07-28 22:11:25 +00:00
jsr colorFill
2017-08-13 04:25:36 +00:00
jsr generateTerrain
jsr compileTerrain
jsr clipTerrain
2017-08-15 19:40:14 +00:00
ldy #0
jsr renderPlayerHeader
2017-07-30 22:43:55 +00:00
mainGameLoop:
2017-08-13 01:19:17 +00:00
jsr syncVBL
2017-08-10 02:33:52 +00:00
jsr renderTerrain
2017-07-30 22:43:55 +00:00
jsr kbdScan
lda mapScrollRequested
bpl scrollMap
lda angleDeltaRequested
bne changeAngle
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
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
scrollMap:
jsr unclipTerrain
2017-08-13 22:36:12 +00:00
sta mapScrollPos
2017-08-13 22:36:12 +00:00
asl
sta leftScreenEdge
jsr clipTerrain
lda #$ffff
sta mapScrollRequested
jmp mainGameLoop
changeAngle:
ldy #0
tax
jsr playerDeltaAngle
ldy #0
jsr renderPlayerHeader
stz angleDeltaRequested
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 #(' ' + $80)
2017-07-30 22:43:55 +00:00
beq kbdScanSpace
cmp #('a' + $80)
beq kbdScanA
cmp #('z' + $80)
beq kbdScanZ
2017-07-30 22:43:55 +00:00
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
cmp #VISIBLETERRAINWIDTH-VISIBLETERRAINWINDOW
2017-07-30 22:43:55 +00:00
beq kbdScanDone
inc
2017-08-13 01:19:17 +00:00
inc
sta mapScrollRequested
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
dec
2017-08-13 01:19:17 +00:00
dec
sta mapScrollRequested
rts
2017-07-30 22:43:55 +00:00
kbdScanSpace:
NATIVE
lda #1
sta quitRequested
rts
2017-07-30 22:43:55 +00:00
kbdScanA:
NATIVE
lda #1
sta angleDeltaRequested
rts
kbdScanZ:
NATIVE
lda #-1
sta angleDeltaRequested
rts
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
mapScrollRequested:
.word $FFFF
angleDeltaRequested:
.word $0000
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"
.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"
.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"