From 4d6f11a9ba49bea6db94d78ae3f0c6e2650a404f Mon Sep 17 00:00:00 2001 From: Lucas Scharenbroich Date: Mon, 25 Apr 2022 17:11:48 -0500 Subject: [PATCH] Initialize the graphics screen via the toolset --- demos/tool/App.Main.s | 34 ++++++++++++++++++++++++++++++++-- demos/tool/package.json | 4 +++- src/Tool.s | 31 +++++++++++++++++++++++++++++-- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/demos/tool/App.Main.s b/demos/tool/App.Main.s index 40a3311..32e0f8f 100644 --- a/demos/tool/App.Main.s +++ b/demos/tool/App.Main.s @@ -11,6 +11,9 @@ mx %00 +ScreenX equ 0 +ScreenY equ 2 + ; Typical init phk plb @@ -20,6 +23,23 @@ jsr GTEStartUp ; Load and install the GTE User Tool +; Initialize the graphics screen to a 256x160 playfield + + pea #256 + pea #160 + _GTESetScreenMode + +; Load a tileset in from an uncompressed $C1 picture. The top-left 256x128 rectangle is used +; to populate the 512 tiles. + + +; Manually fill in the 41x26 tiles of the TileStore with a test pattern. + + +; Set the origin of the screen + stz ScreenX + stz ScreenY + ; Very simple actions :loop pha ; space for result, with pattern @@ -27,9 +47,19 @@ pla and #$00FF cmp #'q' - bne :loop + beq :exit -; Shut down eveything +; pei ScreenX +; pei ScreenY +; _GTESetBG0Origin + +; _GTERender + + inc ScreenX ; Just keep incrementing, it's OK + bra :loop + +; Shut down everything +:exit _GTEShutDown _QuitGS qtRec qtRec adrl $0000 diff --git a/demos/tool/package.json b/demos/tool/package.json index 0c8f1e9..cbf2360 100644 --- a/demos/tool/package.json +++ b/demos/tool/package.json @@ -13,7 +13,9 @@ "scripts": { "test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%", "debug": "%npm_package_config_crossrunner% GTEToolDemo -Source MAINSEG_Output.txt -Debug -CompatibilityLayer", - "build": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s" + "build": "npm run build:tool && npm run build:sys16", + "build:sys16": "%npm_package_config_merlin32% -V %npm_package_config_macros% App.s", + "build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% ../../src/Master.s" }, "repository": { "type": "git", diff --git a/src/Tool.s b/src/Tool.s index 6a66d5e..0bd14fe 100644 --- a/src/Tool.s +++ b/src/Tool.s @@ -46,8 +46,11 @@ _CallTable adrl _TSReserved-1 adrl _TSReserved-1 - adrl _TSReadControl-1 ; Function 9 - adrl _TSSetScreenMode-1 ; Function 10 + adrl _TSReadControl-1 + adrl _TSSetScreenMode-1 + adrl _TSSetTile-1 + adrl _TSSetBG0Origin-1 + adrl _TSRender-1 _CTEnd ; Do nothing when the tool set is installed @@ -175,6 +178,7 @@ width equ FirstParam+2 _TSExit #0;#4 +; ReadControl() _TSReadControl output equ FirstParam @@ -183,8 +187,31 @@ output equ FirstParam jsr _ReadControl sta output,s + _TSExit #0;#0 + +; SetTile(xTile, yTile, tileId) +_TSSetTile +tileId equ FirstParam +yTile equ FirstParam+2 +xTile equ FirstParam+4 + + _TSEntry + _TSExit #0;#6 + +; SetBG0Origin(x, y) +_TSSetBG0Origin +yPos equ FirstParam +xPos equ FirstParam+2 + + _TSEntry + _TSExit #0;#4 + +; Render() +_TSRender + _TSEntry _TSExit #0;#0 + ; Insert the GTE code put Math.s