mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-13 20:31:09 +00:00
Basic full-height terrain rendering with spans
This commit is contained in:
parent
803fe40679
commit
68c55aee3b
@ -7,7 +7,8 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
700C39C51F2E5CA800C24F9C /* trigtables.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = trigtables.s; sourceTree = "<group>"; };
|
||||
700C39C51F2E5CA800C24F9C /* tables.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = tables.s; sourceTree = "<group>"; };
|
||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
7088096C1F2EA4B200D4C950 /* spanRender.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spanRender.s; sourceTree = "<group>"; };
|
||||
@ -29,10 +30,11 @@
|
||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||
706DF1651F2D4A8100AA6680 /* terrain.s */,
|
||||
7088096C1F2EA4B200D4C950 /* spanRender.s */,
|
||||
700C39C51F2E5CA800C24F9C /* trigtables.s */,
|
||||
700C39C51F2E5CA800C24F9C /* tables.s */,
|
||||
70E9D8611F2BD95400555C19 /* gscats.s */,
|
||||
70E9D8631F2BD95400555C19 /* Makefile */,
|
||||
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */,
|
||||
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys,os,png
|
||||
import argparse
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
def main(argv):
|
||||
|
||||
|
27
GenerateVRAMTable.py
Executable file
27
GenerateVRAMTable.py
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
# Prologue
|
||||
print ("vramRowEnds:",end="")
|
||||
v = 0x20a0
|
||||
rowCount = 19
|
||||
|
||||
for jump in range(0,200):
|
||||
rowCount += 1
|
||||
if (rowCount==20):
|
||||
print ("\n\t.word ", end="")
|
||||
rowCount=0
|
||||
|
||||
print ("$%x" % v, end="")
|
||||
if (rowCount<19):
|
||||
print (",", end="")
|
||||
v += 160
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
4
gscats.s
4
gscats.s
@ -82,6 +82,7 @@ kbdScanLeftArrow:
|
||||
cmp #TERRAINWIDTH/4-80
|
||||
beq kbdScanDone
|
||||
inc
|
||||
inc
|
||||
sta mapScrollPos
|
||||
bra kbdScanDone
|
||||
|
||||
@ -90,6 +91,7 @@ kbdScanRightArrow:
|
||||
lda mapScrollPos
|
||||
beq kbdScanDone
|
||||
dec
|
||||
dec
|
||||
sta mapScrollPos
|
||||
bra kbdScanDone
|
||||
|
||||
@ -111,7 +113,7 @@ quitRequested:
|
||||
|
||||
.include "graphics.s"
|
||||
.include "terrain.s"
|
||||
.include "trigTables.s"
|
||||
.include "tables.s"
|
||||
endMainBank2:
|
||||
|
||||
|
||||
|
@ -31,3 +31,15 @@ sineTable:
|
||||
.byte $39, $3C, $3F, $41, $44, $47, $4A, $4D
|
||||
.byte $4F, $52, $55, $58, $5B, $5E, $61, $64
|
||||
.byte $67, $6A, $6D, $70, $74, $77, $7A, $7D
|
||||
|
||||
vramRowEnds:
|
||||
.word $20a0,$2140,$21e0,$2280,$2320,$23c0,$2460,$2500,$25a0,$2640,$26e0,$2780,$2820,$28c0,$2960,$2a00,$2aa0,$2b40,$2be0,$2c80
|
||||
.word $2d20,$2dc0,$2e60,$2f00,$2fa0,$3040,$30e0,$3180,$3220,$32c0,$3360,$3400,$34a0,$3540,$35e0,$3680,$3720,$37c0,$3860,$3900
|
||||
.word $39a0,$3a40,$3ae0,$3b80,$3c20,$3cc0,$3d60,$3e00,$3ea0,$3f40,$3fe0,$4080,$4120,$41c0,$4260,$4300,$43a0,$4440,$44e0,$4580
|
||||
.word $4620,$46c0,$4760,$4800,$48a0,$4940,$49e0,$4a80,$4b20,$4bc0,$4c60,$4d00,$4da0,$4e40,$4ee0,$4f80,$5020,$50c0,$5160,$5200
|
||||
.word $52a0,$5340,$53e0,$5480,$5520,$55c0,$5660,$5700,$57a0,$5840,$58e0,$5980,$5a20,$5ac0,$5b60,$5c00,$5ca0,$5d40,$5de0,$5e80
|
||||
.word $5f20,$5fc0,$6060,$6100,$61a0,$6240,$62e0,$6380,$6420,$64c0,$6560,$6600,$66a0,$6740,$67e0,$6880,$6920,$69c0,$6a60,$6b00
|
||||
.word $6ba0,$6c40,$6ce0,$6d80,$6e20,$6ec0,$6f60,$7000,$70a0,$7140,$71e0,$7280,$7320,$73c0,$7460,$7500,$75a0,$7640,$76e0,$7780
|
||||
.word $7820,$78c0,$7960,$7a00,$7aa0,$7b40,$7be0,$7c80,$7d20,$7dc0,$7e60,$7f00,$7fa0,$8040,$80e0,$8180,$8220,$82c0,$8360,$8400
|
||||
.word $84a0,$8540,$85e0,$8680,$8720,$87c0,$8860,$8900,$89a0,$8a40,$8ae0,$8b80,$8c20,$8cc0,$8d60,$8e00,$8ea0,$8f40,$8fe0,$9080
|
||||
.word $9120,$91c0,$9260,$9300,$93a0,$9440,$94e0,$9580,$9620,$96c0,$9760,$9800,$98a0,$9940,$99e0,$9a80,$9b20,$9bc0,$9c60,$9d00
|
19
terrain.s
19
terrain.s
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
TERRAINWIDTH = 640 ; In pixels
|
||||
MAXTERRAINHEIGHT = 128 ; In pixels
|
||||
MAXTERRAINHEIGHT = 100 ; In pixels
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; renderTerrainColumn
|
||||
@ -101,16 +101,31 @@ renderTerrainColumnsDone:
|
||||
; No stack operations permitted here!
|
||||
;
|
||||
renderTerrain:
|
||||
lda #199
|
||||
sta spanChainIndex
|
||||
sty <MAPSCROLLPOS
|
||||
|
||||
FASTGRAPHICS
|
||||
|
||||
lda #$9d00-1 ; Point stack to end of VRAM
|
||||
renderTerrainLoop:
|
||||
lda spanChainIndex
|
||||
asl
|
||||
tay
|
||||
lda vramRowEnds,y ;$9d00-1 ; Point stack to end of VRAM row
|
||||
dec
|
||||
tcs
|
||||
|
||||
jmp renderClippedSpanChain
|
||||
|
||||
renderSpanChainComplete:
|
||||
lda spanChainIndex
|
||||
dec
|
||||
cmp #200-MAXTERRAINHEIGHT
|
||||
beq renderTerrainDone
|
||||
sta spanChainIndex
|
||||
bra renderTerrainLoop
|
||||
|
||||
renderTerrainDone:
|
||||
SLOWGRAPHICS
|
||||
rts
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user