Working on standardized API to 2d and 3d engines.

This commit is contained in:
Martin Haye 2015-03-25 11:51:29 -07:00
parent a835321b5f
commit 58da79a805
2 changed files with 67 additions and 22 deletions

View File

@ -197,7 +197,23 @@ avatarX = $9E ; from the tile engine
avatarY = $9F ; ...ditto
end
asm fooFunc
clc
- lda evalStkL,x
sta pTmp
lda evalStkH,x
sta pTmp+1
ldy #0
txa
sta (pTmp),y
bcs +
inx
sec
bcs -
+ rts
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Print a string
asm puts
@ -1005,22 +1021,12 @@ def moveWest()
move2D(-1, 0)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Switch to next map in the current 2D or 3D mode.
def nextMap()
mapNum = mapNum + 1
if mapNum > 20
mapNum = 1
fin
setMap(mapIs3D, mapNum)
end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Jump to a new map location (and point in the given direction)
def teleport(x, y, dir)
nextX = x
nextY = y
nextDir = dir
//nextX = x
//nextY = y
//nextDir = dir
end
///////////////////////////////////////////////////////////////////////////////////////////////////
@ -1106,8 +1112,6 @@ def initCmds3D()
initCmd('M', @strafeLeft)
initCmd('.', @strafeRight)
initCmd('N', @nextMap)
initCmd('Y', @nextSky)
initCmd('G', @nextGround)
end
@ -1127,7 +1131,13 @@ end
///////////////////////////////////////////////////////////////////////////////////////////////////
// Load and display the title screen.
def loadTitle()
word v1
word v2
puts("Loading Lawless Legends.\n")
v1 = 1
v2 = 2
fooFunc(@v1, @v2)
printf2("v1=%d v2=%d\n", v1, v2)
// Load the title screen
puts("Loading title screen.\n")

View File

@ -8,12 +8,19 @@ start:
; This code is written bottom-up. That is, simple routines first,
; then routines that call those to build complexity. The main
; code is at the very end. We jump to it now.
jmp initMap
jmp renderFrame
jmp isBlocked
jmp isScripted
jmp setColor
; code is at the very end.
; jmp initMap ; params: mapNum, x, y, dir
; jmp flipToPage1 ; params: none
; jmp getPos ; params: @x, @y, @dir
; jmp setPos ; params: x (0-255), y (0-255), dir (0-15)
; Old vectors
; jmp initMap
; jmp renderFrame
; jmp isBlocked
; jmp isScripted
; jmp setColor
; Conditional assembly flags
DOUBLE_BUFFER = 1 ; whether to double-buffer
@ -28,6 +35,34 @@ DEBUG_COLUMN = -1
!source "../include/mem.i"
; Font engine
!source "../include/fontEngine.i"
; PLASMA
!source "../include/plasma.i"
; Experimental, possibly unused, code
; Store a single byte number to a pointer on the PLASMA eval stack. Clears hi byte.
; A-reg = offset in PLASMA stack (0=first param, 1=second param, etc.)
; Y-reg = value to store
; (X-reg = PLASMA's stack pointer, unchanged)
setPlasmaVar: !zone {
stx .add+1
sty .val+1
clc
.add adc #0
tay
lda evalStkL,y
sta .sto1+1
sta .sto2+1
lda evalStkH,y
sta .sto1+2
sta .sto2+2
.val lda #0
.sto1 sta $1111
ldy #1
lda #0
.sto2 sta $1111,y
+ rts
}
; Local constants
MAX_SPRITES = 64 ; max # sprites visible at once