mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-05-28 15:41:28 +00:00
Working angle display
This commit is contained in:
parent
ea808cbf9a
commit
252abc2a55
|
@ -20,6 +20,8 @@
|
||||||
70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; };
|
70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; };
|
||||||
70E9D8621F2BD95400555C19 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = "<group>"; };
|
70E9D8621F2BD95400555C19 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = "<group>"; };
|
||||||
70E9D8631F2BD95400555C19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
70E9D8631F2BD95400555C19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||||
|
70F0869F1F413A89002446C3 /* player.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = player.s; sourceTree = "<group>"; };
|
||||||
|
70F086A01F4230CB002446C3 /* utility.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = utility.s; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
@ -33,7 +35,9 @@
|
||||||
706DF1641F2D39F700AA6680 /* loader.s */,
|
706DF1641F2D39F700AA6680 /* loader.s */,
|
||||||
700FFAFB1F40F3BF00A442DE /* font.s */,
|
700FFAFB1F40F3BF00A442DE /* font.s */,
|
||||||
706DF1651F2D4A8100AA6680 /* terrain.s */,
|
706DF1651F2D4A8100AA6680 /* terrain.s */,
|
||||||
|
70F086A01F4230CB002446C3 /* utility.s */,
|
||||||
700C39C51F2E5CA800C24F9C /* tables.s */,
|
700C39C51F2E5CA800C24F9C /* tables.s */,
|
||||||
|
70F0869F1F413A89002446C3 /* player.s */,
|
||||||
70E9D8611F2BD95400555C19 /* gscats.s */,
|
70E9D8611F2BD95400555C19 /* gscats.s */,
|
||||||
70E9D8631F2BD95400555C19 /* Makefile */,
|
70E9D8631F2BD95400555C19 /* Makefile */,
|
||||||
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */,
|
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */,
|
||||||
|
|
18
graphics.s
18
graphics.s
|
@ -112,7 +112,6 @@ setPaletteColor:
|
||||||
; PARAML0 = Pointer to 32 color bytes
|
; PARAML0 = Pointer to 32 color bytes
|
||||||
; A = Palette index
|
; A = Palette index
|
||||||
;
|
;
|
||||||
|
|
||||||
setPalette:
|
setPalette:
|
||||||
SAVE_XY
|
SAVE_XY
|
||||||
|
|
||||||
|
@ -139,6 +138,23 @@ setPaletteLoop:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; drawNumber
|
||||||
|
;
|
||||||
|
; A = Number to render
|
||||||
|
; X = VRAM position to render at
|
||||||
|
;
|
||||||
|
; Trashes PARAML0
|
||||||
|
;
|
||||||
|
drawNumber:
|
||||||
|
sta PARAML0
|
||||||
|
jsr intToString
|
||||||
|
lda #intToStringResult
|
||||||
|
|
||||||
|
jsr DrawString
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Vertical blank checkers
|
; Vertical blank checkers
|
||||||
;
|
;
|
||||||
|
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
11
gscats.s
11
gscats.s
|
@ -29,14 +29,12 @@ mainBank2:
|
||||||
ldx #$2222
|
ldx #$2222
|
||||||
jsr colorFill
|
jsr colorFill
|
||||||
|
|
||||||
ldx #2560
|
|
||||||
lda #string
|
|
||||||
jsr DrawString
|
|
||||||
|
|
||||||
jsr generateTerrain
|
jsr generateTerrain
|
||||||
jsr compileTerrain
|
jsr compileTerrain
|
||||||
jsr clipTerrain
|
jsr clipTerrain
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
jsr renderPlayerHeader
|
||||||
|
|
||||||
mainGameLoop:
|
mainGameLoop:
|
||||||
|
|
||||||
|
@ -164,8 +162,7 @@ quitRequested:
|
||||||
.word $0000
|
.word $0000
|
||||||
mapScrollRequested:
|
mapScrollRequested:
|
||||||
.word $FFFF
|
.word $FFFF
|
||||||
string:
|
|
||||||
pstring "HELLO WORLD"
|
|
||||||
|
|
||||||
; Position of map viewing window. Can be visualized in two ways:
|
; 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
|
; a) Word-distance from right edge of terrain data (which is in memory right-to-left) to left edge of visible screen
|
||||||
|
@ -179,6 +176,8 @@ leftScreenEdge:
|
||||||
.include "font.s"
|
.include "font.s"
|
||||||
.include "terrain.s"
|
.include "terrain.s"
|
||||||
.include "gameobject.s"
|
.include "gameobject.s"
|
||||||
|
.include "player.s"
|
||||||
|
.include "utility.s"
|
||||||
.include "tables.s"
|
.include "tables.s"
|
||||||
endMainBank2:
|
endMainBank2:
|
||||||
|
|
||||||
|
|
11
macros.s
11
macros.s
|
@ -180,3 +180,14 @@
|
||||||
plx
|
plx
|
||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
.macro SAVE_P0 ; Saves PARAML0
|
||||||
|
lda PARAML0
|
||||||
|
pha
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
.macro RESTORE_P0 ; Restores PARAML0
|
||||||
|
pla
|
||||||
|
sta PARAML0
|
||||||
|
.endmacro
|
||||||
|
|
44
player.s
Normal file
44
player.s
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
;
|
||||||
|
; players
|
||||||
|
; Code and data structures related to the players
|
||||||
|
;
|
||||||
|
; Created by Quinn Dunki on 8/13/17
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
playerData:
|
||||||
|
; gameobject data
|
||||||
|
.word 40 ; X pos in pixels (from left terrain edge)
|
||||||
|
.word 38 ; Y pos in pixels (from bottom terrain edge)
|
||||||
|
|
||||||
|
.word 45 ; Angle in degrees from +X
|
||||||
|
.word 50 ; Power
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; renderPlayerHeader
|
||||||
|
;
|
||||||
|
; Y = Player index to render
|
||||||
|
;
|
||||||
|
renderPlayerHeader:
|
||||||
|
SAVE_AXY
|
||||||
|
|
||||||
|
tya ; Index to player structure
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
asl
|
||||||
|
tay
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
lda #angleStr
|
||||||
|
jsr DrawString
|
||||||
|
|
||||||
|
lda playerData+4,y
|
||||||
|
ldx #24
|
||||||
|
jsr drawNumber
|
||||||
|
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
angleStr:
|
||||||
|
pstring "ANGLE:"
|
95
utility.s
Normal file
95
utility.s
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
;
|
||||||
|
; utility
|
||||||
|
; Helper routines
|
||||||
|
;
|
||||||
|
; Created by Quinn Dunki on 8/14/17
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; intToString
|
||||||
|
;
|
||||||
|
; PARAML0 = Number to convert
|
||||||
|
; Returns result as pascal string in intToStringResult
|
||||||
|
;
|
||||||
|
intToString:
|
||||||
|
SAVE_AXY
|
||||||
|
|
||||||
|
; Convert value to BCD digits
|
||||||
|
; This section courtesy of John Brooks
|
||||||
|
sep #9
|
||||||
|
tdc
|
||||||
|
rol PARAML0
|
||||||
|
intToStringLoop:
|
||||||
|
sta SCRATCHL
|
||||||
|
adc SCRATCHL
|
||||||
|
rol intToStringBCD
|
||||||
|
asl PARAML0
|
||||||
|
bne intToStringLoop
|
||||||
|
cld
|
||||||
|
xba
|
||||||
|
sta intToStringBCD+1
|
||||||
|
|
||||||
|
; Convert digits to characters
|
||||||
|
BITS8
|
||||||
|
|
||||||
|
; Skip leading double zeros
|
||||||
|
ldx #0
|
||||||
|
ldy #1
|
||||||
|
|
||||||
|
intToStringSkipLoop:
|
||||||
|
lda intToStringBCD,x
|
||||||
|
bne intToStringSkipSingle
|
||||||
|
inx
|
||||||
|
cpx #3
|
||||||
|
bne intToStringSkipLoop
|
||||||
|
|
||||||
|
; Special case for full zero
|
||||||
|
sty intToStringResult
|
||||||
|
lda #'0'
|
||||||
|
sta intToStringResult+1
|
||||||
|
bra intToStringDone
|
||||||
|
|
||||||
|
intToStringSkipSingle:
|
||||||
|
; Process transition from leading-zero nibble
|
||||||
|
lda intToStringBCD,x
|
||||||
|
and #$f0
|
||||||
|
bne intToStringFullDigitsLoop
|
||||||
|
lda intToStringBCD,x
|
||||||
|
clc
|
||||||
|
adc #'0'
|
||||||
|
sta intToStringResult,y
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
|
||||||
|
intToStringFullDigitsLoop:
|
||||||
|
; Remaining bytes all contain two digits
|
||||||
|
lda intToStringBCD,x
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
adc #'0'
|
||||||
|
sta intToStringResult,y
|
||||||
|
iny
|
||||||
|
lda intToStringBCD,x
|
||||||
|
and #$0f
|
||||||
|
clc
|
||||||
|
adc #'0'
|
||||||
|
sta intToStringResult,y
|
||||||
|
iny
|
||||||
|
inx
|
||||||
|
cpx #3
|
||||||
|
bne intToStringFullDigitsLoop
|
||||||
|
|
||||||
|
; Store final length and we're done
|
||||||
|
dey
|
||||||
|
sty intToStringResult
|
||||||
|
|
||||||
|
intToStringDone:
|
||||||
|
BITS16
|
||||||
|
RESTORE_AXY
|
||||||
|
rts
|
||||||
|
|
||||||
|
intToStringBCD: .byte 0,0,0
|
||||||
|
intToStringResult: .byte 0,0,0,0,0,0
|
Loading…
Reference in New Issue
Block a user