Groundwork for gameobject rendering
This commit is contained in:
parent
597c6b750e
commit
ea808cbf9a
|
@ -13,7 +13,8 @@
|
|||
706DF1641F2D39F700AA6680 /* loader.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loader.s; sourceTree = "<group>"; };
|
||||
706DF1651F2D4A8100AA6680 /* terrain.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = terrain.s; sourceTree = "<group>"; };
|
||||
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateRenderSpans.py; sourceTree = "<group>"; };
|
||||
7099E3841F41022100182A82 /* player.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = player.s; sourceTree = "<group>"; };
|
||||
7099E3841F41022100182A82 /* gameobject.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gameobject.s; sourceTree = "<group>"; };
|
||||
7099E3851F4107B100182A82 /* GenerateVRAMYOffset.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMYOffset.py; sourceTree = "<group>"; };
|
||||
70E9D85F1F2BD95400555C19 /* equates.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = equates.s; sourceTree = "<group>"; };
|
||||
70E9D8601F2BD95400555C19 /* graphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = graphics.s; sourceTree = "<group>"; };
|
||||
70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; };
|
||||
|
@ -28,7 +29,7 @@
|
|||
70E9D85F1F2BD95400555C19 /* equates.s */,
|
||||
70E9D8601F2BD95400555C19 /* graphics.s */,
|
||||
70E9D8621F2BD95400555C19 /* macros.s */,
|
||||
7099E3841F41022100182A82 /* player.s */,
|
||||
7099E3841F41022100182A82 /* gameobject.s */,
|
||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||
700FFAFB1F40F3BF00A442DE /* font.s */,
|
||||
706DF1651F2D4A8100AA6680 /* terrain.s */,
|
||||
|
@ -37,6 +38,7 @@
|
|||
70E9D8631F2BD95400555C19 /* Makefile */,
|
||||
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */,
|
||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */,
|
||||
7099E3851F4107B100182A82 /* GenerateVRAMYOffset.py */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
# Prologue
|
||||
print ("vramYOffset:",end="")
|
||||
rowCount = 19
|
||||
|
||||
for jump in range(0,200):
|
||||
rowCount += 1
|
||||
if (rowCount==20):
|
||||
print ("\n\t.word ", end="")
|
||||
rowCount=0
|
||||
|
||||
print ("$%04x" % (jump*160), end="")
|
||||
if (rowCount<19):
|
||||
print (",", end="")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
|
@ -7,7 +7,7 @@ STACKCTL = $e0c068
|
|||
KBD = $e0c000
|
||||
KBDSTROBE = $e0c010
|
||||
COUT = $fded
|
||||
|
||||
VRAM = $e12000
|
||||
|
||||
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
|
||||
PARAM0 = $06
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
;
|
||||
; gameobject
|
||||
; Code and data structures related to the game objects
|
||||
;
|
||||
; Created by Quinn Dunki on 8/13/17
|
||||
;
|
||||
|
||||
GAMEOBJECTWIDTH = 8
|
||||
GAMEOBJECTHEIGHT = 8
|
||||
|
||||
|
||||
gameobjectData:
|
||||
.word 40 ; X pos in pixels (from left terrain edge)
|
||||
.word 38 ; Y pos in pixels (from bottom terrain edge)
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; renderGameobject
|
||||
;
|
||||
; PARAML0 = Pointer to gameobject data
|
||||
;
|
||||
renderGameobject:
|
||||
SAVE_AXY
|
||||
|
||||
; Find gameobject location in video memory
|
||||
ldy #0
|
||||
|
||||
; X
|
||||
lda (PARAML0),y
|
||||
lsr
|
||||
sec
|
||||
sbc leftScreenEdge
|
||||
bmi renderGameobjectDone ; Gameobject is off left edge of screen
|
||||
cmp #320 - GAMEOBJECTWIDTH
|
||||
bpl renderGameobjectDone ; Gameobject is off right edge of screen
|
||||
sta SCRATCHL
|
||||
|
||||
; Y
|
||||
iny
|
||||
iny
|
||||
sec
|
||||
lda #200
|
||||
sbc (PARAML0),y
|
||||
bmi renderGameobjectDone ; Gameobject is off top edge of screen
|
||||
cmp #200 - GAMEOBJECTHEIGHT
|
||||
bpl renderGameobjectDone ; Gameobject is off bottom edge of screen
|
||||
|
||||
asl
|
||||
tax
|
||||
lda vramYOffset,x
|
||||
clc
|
||||
adc SCRATCHL
|
||||
tax
|
||||
|
||||
; X now contains the VRAM offset of the upper left corner
|
||||
lda #$FFFF
|
||||
sta VRAM,x
|
||||
sta VRAM+2,x
|
||||
sta VRAM+160,x
|
||||
sta VRAM+160+2,x
|
||||
sta VRAM+160*2,x
|
||||
sta VRAM+160*2+2,x
|
||||
sta VRAM+160*3,x
|
||||
sta VRAM+160*3+2,x
|
||||
sta VRAM+160*4,x
|
||||
sta VRAM+160*4+2,x
|
||||
sta VRAM+160*5,x
|
||||
sta VRAM+160*5+2,x
|
||||
sta VRAM+160*6,x
|
||||
sta VRAM+160*6+2,x
|
||||
sta VRAM+160*7,x
|
||||
sta VRAM+160*7+2,x
|
||||
|
||||
renderGameobjectDone:
|
||||
RESTORE_AXY
|
||||
rts
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
21
gscats.s
21
gscats.s
|
@ -37,8 +37,6 @@ mainBank2:
|
|||
jsr compileTerrain
|
||||
jsr clipTerrain
|
||||
|
||||
; jsr unclipTerrain
|
||||
; jsr clipTerrain
|
||||
|
||||
mainGameLoop:
|
||||
|
||||
|
@ -70,6 +68,10 @@ render:
|
|||
lda mapScrollRequested
|
||||
bpl scrollMap
|
||||
|
||||
lda #gameobjectData
|
||||
sta PARAML0
|
||||
jsr renderGameobject
|
||||
|
||||
lda quitRequested
|
||||
beq mainGameLoop
|
||||
|
||||
|
@ -79,7 +81,12 @@ quit:
|
|||
|
||||
scrollMap:
|
||||
jsr unclipTerrain
|
||||
|
||||
sta mapScrollPos
|
||||
asl
|
||||
asl
|
||||
sta leftScreenEdge
|
||||
|
||||
jsr clipTerrain
|
||||
lda #$ffff
|
||||
sta mapScrollRequested
|
||||
|
@ -153,8 +160,6 @@ kbdScanSpace:
|
|||
|
||||
basePalette:
|
||||
.word $0000,$0080,$0000,$000F,$0FFF,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0FFF
|
||||
mapScrollPos: ; 4-pixel columns distance from right terrain edge
|
||||
.word 0
|
||||
quitRequested:
|
||||
.word $0000
|
||||
mapScrollRequested:
|
||||
|
@ -162,10 +167,18 @@ mapScrollRequested:
|
|||
string:
|
||||
pstring "HELLO WORLD"
|
||||
|
||||
; 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
|
||||
|
||||
.include "graphics.s"
|
||||
.include "font.s"
|
||||
.include "terrain.s"
|
||||
.include "gameobject.s"
|
||||
.include "tables.s"
|
||||
endMainBank2:
|
||||
|
||||
|
|
7
player.s
7
player.s
|
@ -1,7 +0,0 @@
|
|||
;
|
||||
; player
|
||||
; Code and data structures related to the players
|
||||
;
|
||||
; Created by Quinn Dunki on 8/13/17
|
||||
;
|
||||
|
13
tables.s
13
tables.s
|
@ -43,3 +43,16 @@ vramRowEndsMinusOne:
|
|||
.word $781f,$78bf,$795f,$79ff,$7a9f,$7b3f,$7bdf,$7c7f,$7d1f,$7dbf,$7e5f,$7eff,$7f9f,$803f,$80df,$817f,$821f,$82bf,$835f,$83ff
|
||||
.word $849f,$853f,$85df,$867f,$871f,$87bf,$885f,$88ff,$899f,$8a3f,$8adf,$8b7f,$8c1f,$8cbf,$8d5f,$8dff,$8e9f,$8f3f,$8fdf,$907f
|
||||
.word $911f,$91bf,$925f,$92ff,$939f,$943f,$94df,$957f,$961f,$96bf,$975f,$97ff,$989f,$993f,$99df,$9a7f,$9b1f,$9bbf,$9c5f,$9cff
|
||||
|
||||
vramYOffset:
|
||||
.word $0000,$00a0,$0140,$01e0,$0280,$0320,$03c0,$0460,$0500,$05a0,$0640,$06e0,$0780,$0820,$08c0,$0960,$0a00,$0aa0,$0b40,$0be0
|
||||
.word $0c80,$0d20,$0dc0,$0e60,$0f00,$0fa0,$1040,$10e0,$1180,$1220,$12c0,$1360,$1400,$14a0,$1540,$15e0,$1680,$1720,$17c0,$1860
|
||||
.word $1900,$19a0,$1a40,$1ae0,$1b80,$1c20,$1cc0,$1d60,$1e00,$1ea0,$1f40,$1fe0,$2080,$2120,$21c0,$2260,$2300,$23a0,$2440,$24e0
|
||||
.word $2580,$2620,$26c0,$2760,$2800,$28a0,$2940,$29e0,$2a80,$2b20,$2bc0,$2c60,$2d00,$2da0,$2e40,$2ee0,$2f80,$3020,$30c0,$3160
|
||||
.word $3200,$32a0,$3340,$33e0,$3480,$3520,$35c0,$3660,$3700,$37a0,$3840,$38e0,$3980,$3a20,$3ac0,$3b60,$3c00,$3ca0,$3d40,$3de0
|
||||
.word $3e80,$3f20,$3fc0,$4060,$4100,$41a0,$4240,$42e0,$4380,$4420,$44c0,$4560,$4600,$46a0,$4740,$47e0,$4880,$4920,$49c0,$4a60
|
||||
.word $4b00,$4ba0,$4c40,$4ce0,$4d80,$4e20,$4ec0,$4f60,$5000,$50a0,$5140,$51e0,$5280,$5320,$53c0,$5460,$5500,$55a0,$5640,$56e0
|
||||
.word $5780,$5820,$58c0,$5960,$5a00,$5aa0,$5b40,$5be0,$5c80,$5d20,$5dc0,$5e60,$5f00,$5fa0,$6040,$60e0,$6180,$6220,$62c0,$6360
|
||||
.word $6400,$64a0,$6540,$65e0,$6680,$6720,$67c0,$6860,$6900,$69a0,$6a40,$6ae0,$6b80,$6c20,$6cc0,$6d60,$6e00,$6ea0,$6f40,$6fe0
|
||||
.word $7080,$7120,$71c0,$7260,$7300,$73a0,$7440,$74e0,$7580,$7620,$76c0,$7760,$7800,$78a0,$7940,$79e0,$7a80,$7b20,$7bc0,$7c60
|
||||
|
||||
|
|
Loading…
Reference in New Issue