From 1f9f2aee0c607d2685b81e0ba12d746e8e0da0b4 Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Sat, 23 Apr 2022 15:41:25 -0500 Subject: [PATCH] Thank to Kelvin Sherlock for pointing out that the source files were not setting the register state directive --- demos/tool/App.Main.s | 41 +++++++++++++++++++++++++++++------------ src/CoreImpl.s | 5 +---- src/Tool.s | 39 +++++++++++++++++++-------------------- src/static/SprData.s | 4 +++- src/static/SprMask.s | 4 +++- src/static/TileData.s | 4 +++- src/static/TileStore.s | 3 ++- 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/demos/tool/App.Main.s b/demos/tool/App.Main.s index 7f89d59..6809c62 100644 --- a/demos/tool/App.Main.s +++ b/demos/tool/App.Main.s @@ -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' \ No newline at end of file +ToolPath str '1/GTETool' \ No newline at end of file diff --git a/src/CoreImpl.s b/src/CoreImpl.s index b4708ed..e901ef0 100644 --- a/src/CoreImpl.s +++ b/src/CoreImpl.s @@ -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 diff --git a/src/Tool.s b/src/Tool.s index 2fdf11e..4743867 100644 --- a/src/Tool.s +++ b/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) diff --git a/src/static/SprData.s b/src/static/SprData.s index fa143cf..8c9150b 100644 --- a/src/static/SprData.s +++ b/src/static/SprData.s @@ -1,3 +1,5 @@ ; sprite stamp pixel data spritedata ENT - ds 65535 \ No newline at end of file +; ds 65535 + ds 65536 + diff --git a/src/static/SprMask.s b/src/static/SprMask.s index c444d27..d8e2f9b 100644 --- a/src/static/SprMask.s +++ b/src/static/SprMask.s @@ -1,3 +1,5 @@ ; sprite stamp masks spritemask ENT - ds 65535 \ No newline at end of file +; ds 65535 + ds 65536 + diff --git a/src/static/TileData.s b/src/static/TileData.s index 596afce..aa77f32 100644 --- a/src/static/TileData.s +++ b/src/static/TileData.s @@ -1,3 +1,5 @@ ; Bank of memory that holds the 8x8 tile data tiledata ENT - ds 65535 \ No newline at end of file +; ds 65535 + ds 65536 + diff --git a/src/static/TileStore.s b/src/static/TileStore.s index b768a45..7182fb3 100644 --- a/src/static/TileStore.s +++ b/src/static/TileStore.s @@ -1,3 +1,4 @@ ; Bank of memory that holds the core sprite and tile store data structures TileStore ENT - ds 65535 \ No newline at end of file +; ds 65535 + ds 65536