mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-12-26 05:31:42 +00:00
Thank to Kelvin Sherlock for pointing out that the source files were not setting the register state directive
This commit is contained in:
parent
9692277677
commit
1f9f2aee0c
@ -12,10 +12,14 @@ _GTEStartUp MAC
|
||||
UserTool $02A0
|
||||
<<<
|
||||
|
||||
mx %00
|
||||
|
||||
; Typical init
|
||||
phk
|
||||
plb
|
||||
|
||||
sta UserId ; GS/OS passed the memory manager user ID for the aoplication into the program
|
||||
|
||||
jsr ToolStartUp ; Start up the basic tools: Locator, Memory Manager, Misc
|
||||
jsr GTEStartUp
|
||||
|
||||
@ -27,19 +31,23 @@ qtRec adrl $0000
|
||||
da $00
|
||||
|
||||
ToolStartUp
|
||||
_TLStartUp ; normal tool initialization
|
||||
pha
|
||||
_MMStartUp
|
||||
pla
|
||||
sta MasterId ; our master handle references the memory allocated to us
|
||||
ora #$0100 ; set auxID = $01 (valid values $01-0f)
|
||||
sta UserId ; any memory we request must use our own id
|
||||
; _TLStartUp ; normal tool initialization
|
||||
; pha
|
||||
; _MMStartUp
|
||||
; pla
|
||||
; sta MasterId ; our master handle references the memory allocated to us
|
||||
; ora #$0100 ; set auxID = $01 (valid values $01-0f)
|
||||
; sta UserId ; any memory we request must use our own id
|
||||
|
||||
_MTStartUp
|
||||
_MTStartUp ; just start up the miscellaneous tools
|
||||
rts
|
||||
|
||||
; Load the GTE User Tool and register it
|
||||
GTEStartUp
|
||||
pea $0000
|
||||
_LoaderStatus
|
||||
pla
|
||||
|
||||
pea $0000
|
||||
pea $0000
|
||||
pea $0000
|
||||
@ -52,9 +60,13 @@ GTEStartUp
|
||||
pea #^ToolPath
|
||||
pea #ToolPath
|
||||
pea $0001 ; do not load into special memory
|
||||
pea $0001 ; GS/OS string for the argument
|
||||
_InitialLoad2
|
||||
; pea $0001 ; GS/OS string for the argument
|
||||
_InitialLoad
|
||||
bcc :ok1
|
||||
brk $01
|
||||
|
||||
|
||||
:ok1
|
||||
ply
|
||||
pla ; Address of the loaded tool
|
||||
plx
|
||||
@ -66,7 +78,10 @@ GTEStartUp
|
||||
phx
|
||||
pha ; Address of function pointer table
|
||||
_SetTSPtr
|
||||
bcc :ok2
|
||||
brk $02
|
||||
|
||||
:ok2
|
||||
clc ; Give GTE a page of direct page memory
|
||||
tdc
|
||||
adc #$0100
|
||||
@ -74,10 +89,12 @@ GTEStartUp
|
||||
lda UserId
|
||||
pha
|
||||
_GTEStartUp
|
||||
bcc :ok3
|
||||
brk $03
|
||||
|
||||
:ok3
|
||||
rts
|
||||
|
||||
|
||||
MasterId ds 2
|
||||
UserId ds 2
|
||||
ToolPath strl '9:GTETool'
|
||||
ToolPath str '1/GTETool'
|
@ -88,10 +88,7 @@ Overlay EXT
|
||||
; A = memory manager userId
|
||||
; X = tool number
|
||||
_CoreStartUp
|
||||
sta UserId ; This is the first thing to do
|
||||
stx ToolNum
|
||||
|
||||
jsr IntStartUp ; Enable certain iterrupts
|
||||
jsr IntStartUp ; Enable certain interrupts
|
||||
|
||||
jsr InitMemory ; Allocate and initialize memory for the engine
|
||||
jsr EngineReset ; All of the resources are allocated, put the engine in a known state
|
||||
|
39
src/Tool.s
39
src/Tool.s
@ -14,6 +14,8 @@
|
||||
|
||||
ToStrip equ $E10184
|
||||
|
||||
mx %00
|
||||
|
||||
_CallTable
|
||||
adrl {_CTEnd-_CallTable}/4
|
||||
adrl _TSBootInit-1
|
||||
@ -42,38 +44,35 @@ _TSBootInit
|
||||
; StartUp(dPageAddr, userId)
|
||||
_TSStartUp
|
||||
|
||||
rtll = 1
|
||||
rtl2 = rtl1+3
|
||||
userId = 7
|
||||
zpToUse = userId+2
|
||||
|
||||
lda zpToUse,s ; Get the direct page address
|
||||
phd ; Save the current direct page
|
||||
tcd ; Set to our working direct page space
|
||||
|
||||
txa
|
||||
and #$00FF ; Get just the tool number
|
||||
tax
|
||||
and #$00FF ; Get just the tool number
|
||||
sta ToolNum
|
||||
|
||||
lda userId,s ; Get the userId for memory allocations
|
||||
tay
|
||||
lda zpToUse,s ; Get the direct page address
|
||||
lda userId+2,s ; Get the userId for memory allocations
|
||||
sta UserId
|
||||
|
||||
phd ; Save the current direct page
|
||||
tcd ; Set to our working direct page space
|
||||
|
||||
tya ; A = memory manager user Id, X = tool number
|
||||
jsr _CoreStartUp ; Initialize the library
|
||||
jsr _CoreStartUp ; Initialize the library
|
||||
|
||||
; SetWAP(userOrSystem, tsNum, waptPtr)
|
||||
|
||||
pea #$8000 ; $8000 = user tool set
|
||||
pei ToolNum ; Push the tool number from the direct page
|
||||
pea $0000 ; High word of WAP is zero (bank 0)
|
||||
phd ; Low word of WAP is the direct page
|
||||
pea #$8000 ; $8000 = user tool set
|
||||
pei ToolNum ; Push the tool number from the direct page
|
||||
pea $0000 ; High word of WAP is zero (bank 0)
|
||||
phd ; Low word of WAP is the direct page
|
||||
_SetWAP
|
||||
|
||||
pld ; Restore the caller's direct page
|
||||
pld ; Restore the caller's direct page
|
||||
|
||||
lda #0
|
||||
clc
|
||||
rtl
|
||||
ldx #0 ; No error
|
||||
ldy #4 ; Remove the 4 input bytes
|
||||
jml ToStrip
|
||||
|
||||
_TSShutDown
|
||||
cmp #0 ; Acc is low word of the WAP (direct page)
|
||||
|
@ -1,3 +1,5 @@
|
||||
; sprite stamp pixel data
|
||||
spritedata ENT
|
||||
ds 65535
|
||||
; ds 65535
|
||||
ds 65536
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; sprite stamp masks
|
||||
spritemask ENT
|
||||
ds 65535
|
||||
; ds 65535
|
||||
ds 65536
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; Bank of memory that holds the 8x8 tile data
|
||||
tiledata ENT
|
||||
ds 65535
|
||||
; ds 65535
|
||||
ds 65536
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
; Bank of memory that holds the core sprite and tile store data structures
|
||||
TileStore ENT
|
||||
ds 65535
|
||||
; ds 65535
|
||||
ds 65536
|
||||
|
Loading…
Reference in New Issue
Block a user