From 53c3be089c61966b088cb7a4251a91f616bb8199 Mon Sep 17 00:00:00 2001 From: smnjameson Date: Mon, 25 Jul 2022 23:01:11 +0100 Subject: [PATCH] helloworld.s demo in teh root of the project now has a make.bat that demonstrates how to deploy assets to SDCard --- main.s | 60 +++++++++++++++++++++++++++++++++++++++++++++++--------- make.bat | 2 ++ 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/main.s b/main.s index 61fac8a..9514b86 100644 --- a/main.s +++ b/main.s @@ -1,36 +1,78 @@ //Comment this next line out to get memory report and border debug colors #define NODEBUG + //Start the S65 library by importing includes/s65/start.s #import "includes/s65/start.s" jmp Start + //Import to $18000 thereby forcing the SDcard preloader, Make sure to deploy assets firs twith SHIFT+F8 + Asset_ImportCharset("map", "tests/assets/bin/test7/tileset2", $18000) + .const MapChars = Asset_GetCharset("map") + + //Safest to define all the data before your code to avoid assembler pass errors + palette: + Asset_ImportCharsetPalette("map") message: //Generate a text string of 16bit indices S65_Text16("hello world!") + testScreenChars: + .fill 10 * 8, [<[MapChars.indices.get(0) + i], >[MapChars.indices.get(0)+ i]] + + Start: + .const BRICK = MapChars.indices.get(6) + //Resolution 42x30 chars with scaling - Layer_DefineResolution(42, 30, true) + Layer_DefineResolution(40, 25, false) + + //define a layer 21 chars wide at X position 0 using NCM + .const LYR_BG= Layer_GetLayerCount() + Layer_DefineScreenLayer(21, 0, true) - //stores the current layer count (0) - .const BGLayer = Layer_GetLayerCount() //define a layer 42 chars wide at X position 0 using FCM - Layer_DefineScreenLayer(42, 0, false) + .const LYR_LV = Layer_GetLayerCount() + Layer_DefineScreenLayer(42, 0, false) + //Initialize layers with screen ram at $4000 - Layer_InitScreen($4000) + Layer_InitScreen($10000) //Black border - lda #$00 + lda #$ff sta $d020 + //Set the active layer - Layer_Get #BGLayer - //Clear the layer with char $20 in color #$01 + Layer_Get #LYR_BG + Layer_ClearLayer #BRICK : #$30 + Layer_Get #LYR_LV Layer_ClearLayer #$0020 : #$01 + + //set the palette + Palette_Assign #$01: #$01 : #$01 + Palette_Set #$01 + Palette_LoadFromMem palette : #$100 + + + //Now draw the char set + //Charset FCM + Layer_Get #LYR_BG + Layer_SetScreenPointersXY #0: #3 + ldy #$00 //Source offset + ldx #$00 + !rowloop: + Layer_WriteToScreen testScreenChars,y : MapChars.colorAddress,y : #10 + Layer_AdvanceScreenPointers + inx + cpx #$08 //How many rows to draw + bne !rowloop- + + //Draw a message to screen at 15,10 in color $04 - Layer_AddText #15 : #10 : message : #$04 + Layer_Get #LYR_LV + Layer_AddText #15 : #15 : message : #$05 //Call a layer update to set all the layer data Layer_Update diff --git a/make.bat b/make.bat index 0145f75..dacc719 100644 --- a/make.bat +++ b/make.bat @@ -32,3 +32,5 @@ IF [%1]==[] GOTO NO_ARGUMENT echo Deploy Without Assets %DEPLOY% .\bin\main.prg :DONE + +echo IF THINGS LOOK WRONG BE SURE TO LOAD YOUR ASSETS TO THE SDCARD FIRST USING SHIFT+F8!!! \ No newline at end of file