mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-12 14:31:00 +00:00
Update skeleon to show a pictire on-screen
This commit is contained in:
parent
3ba1564719
commit
30cb545e5e
21
.vscode/settings.json
vendored
Normal file
21
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"emeraldwalk.runonsave": {
|
||||
"commands": [
|
||||
{
|
||||
"match": "\\.s$",
|
||||
"isAsync": true,
|
||||
"cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}"
|
||||
},
|
||||
{
|
||||
"match": "\\.S$",
|
||||
"isAsync": true,
|
||||
"cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}"
|
||||
},
|
||||
{
|
||||
"match": "\\.MACS\\.S$",
|
||||
"isAsync": true,
|
||||
"cmd": "C:\\\\Programs\\\\IIgsXDev\\\\bin\\\\Cadius.exe INDENTFILE ${file}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -15,3 +15,4 @@ REM Cadius does not overwrite files, so clear the root folder first
|
||||
REM Now copy files and folders as needed
|
||||
%CADIUS% ADDFILE %IMAGE% %FOLDER% test\\GTETestApp
|
||||
%CADIUS% ADDFILE %IMAGE% %FOLDER% src\\GTETool
|
||||
%CADIUS% ADDFILE %IMAGE% %FOLDER% emu\\test.pic
|
||||
|
BIN
emu/Target.2mg
BIN
emu/Target.2mg
Binary file not shown.
BIN
emu/test.pic
Normal file
BIN
emu/test.pic
Normal file
Binary file not shown.
@ -18,228 +18,229 @@
|
||||
**************************************************
|
||||
|
||||
|
||||
_AddNotifyProcGS mac
|
||||
CallGSOS $2034;]1
|
||||
<<<
|
||||
_AddNotifyProcGS mac
|
||||
CallGSOS $2034;]1
|
||||
<<<
|
||||
|
||||
_BeginSessionGS mac
|
||||
CallGSOS $201D;]1
|
||||
<<<
|
||||
_BeginSessionGS mac
|
||||
CallGSOS $201D;]1
|
||||
<<<
|
||||
|
||||
_BindIntGS mac
|
||||
CallGSOS $2031;]1
|
||||
<<<
|
||||
_BindIntGS mac
|
||||
CallGSOS $2031;]1
|
||||
<<<
|
||||
|
||||
_ChangePathGS mac
|
||||
CallGSOS $2004;]1
|
||||
<<<
|
||||
_ChangePathGS mac
|
||||
CallGSOS $2004;]1
|
||||
<<<
|
||||
|
||||
_ClearBackupBitGS mac
|
||||
CallGSOS $200B;]1
|
||||
<<<
|
||||
_ClearBackupBitGS mac
|
||||
CallGSOS $200B;]1
|
||||
<<<
|
||||
|
||||
_CloseGS mac
|
||||
CallGSOS $2014;]1
|
||||
<<<
|
||||
_CloseGS mac
|
||||
CallGSOS $2014;]1
|
||||
<<<
|
||||
|
||||
_CreateGS mac
|
||||
CallGSOS $2001;]1
|
||||
<<<
|
||||
_CreateGS mac
|
||||
CallGSOS $2001;]1
|
||||
<<<
|
||||
|
||||
_DControlGS mac
|
||||
CallGSOS $202E;]1
|
||||
<<<
|
||||
_DControlGS mac
|
||||
CallGSOS $202E;]1
|
||||
<<<
|
||||
|
||||
_DelNotifyProcGS mac
|
||||
CallGSOS $2035;]1
|
||||
<<<
|
||||
_DelNotifyProcGS mac
|
||||
CallGSOS $2035;]1
|
||||
<<<
|
||||
|
||||
_DestroyGS mac
|
||||
CallGSOS $2002;]1
|
||||
<<<
|
||||
_DestroyGS mac
|
||||
CallGSOS $2002;]1
|
||||
<<<
|
||||
|
||||
_DInfoGS mac
|
||||
CallGSOS $202C;]1
|
||||
<<<
|
||||
_DInfoGS mac
|
||||
CallGSOS $202C;]1
|
||||
<<<
|
||||
|
||||
_DReadGS mac
|
||||
CallGSOS $202F;]1
|
||||
<<<
|
||||
_DReadGS mac
|
||||
CallGSOS $202F;]1
|
||||
<<<
|
||||
|
||||
_DRenameGS mac
|
||||
CallGSOS $2036;]1
|
||||
<<<
|
||||
_DRenameGS mac
|
||||
CallGSOS $2036;]1
|
||||
<<<
|
||||
|
||||
_DStatusGS mac
|
||||
CallGSOS $202D;]1
|
||||
<<<
|
||||
_DStatusGS mac
|
||||
CallGSOS $202D;]1
|
||||
<<<
|
||||
|
||||
_DWriteGS mac
|
||||
CallGSOS $2030;]1
|
||||
<<<
|
||||
_DWriteGS mac
|
||||
CallGSOS $2030;]1
|
||||
<<<
|
||||
|
||||
_EndSessionGS mac
|
||||
CallGSOS $201E;]1
|
||||
<<<
|
||||
_EndSessionGS mac
|
||||
CallGSOS $201E;]1
|
||||
<<<
|
||||
|
||||
_EraseDiskGS mac
|
||||
CallGSOS $2025;]1
|
||||
<<<
|
||||
_EraseDiskGS mac
|
||||
CallGSOS $2025;]1
|
||||
<<<
|
||||
|
||||
_ExpandPathGS mac
|
||||
CallGSOS $200E;]1
|
||||
<<<
|
||||
_ExpandPathGS mac
|
||||
CallGSOS $200E;]1
|
||||
<<<
|
||||
|
||||
_FlushGS mac
|
||||
CallGSOS $2015;]1
|
||||
<<<
|
||||
_FlushGS mac
|
||||
CallGSOS $2015;]1
|
||||
<<<
|
||||
|
||||
_FormatGS mac
|
||||
CallGSOS $2024;]1
|
||||
<<<
|
||||
_FormatGS mac
|
||||
CallGSOS $2024;]1
|
||||
<<<
|
||||
|
||||
_FSTSpecificGS mac
|
||||
CallGSOS $2033;]1
|
||||
<<<
|
||||
_FSTSpecificGS mac
|
||||
CallGSOS $2033;]1
|
||||
<<<
|
||||
|
||||
_GetBootVolGS mac
|
||||
CallGSOS $2028;]1
|
||||
<<<
|
||||
_GetBootVolGS mac
|
||||
CallGSOS $2028;]1
|
||||
<<<
|
||||
|
||||
_GetDevNumberGS mac
|
||||
CallGSOS $2020;]1
|
||||
<<<
|
||||
_GetDevNumberGS mac
|
||||
CallGSOS $2020;]1
|
||||
<<<
|
||||
|
||||
_GetDirEntryGS mac
|
||||
CallGSOS $201C;]1
|
||||
<<<
|
||||
_GetDirEntryGS mac
|
||||
CallGSOS $201C;]1
|
||||
<<<
|
||||
|
||||
_GetEOFGS mac
|
||||
CallGSOS $2019;]1
|
||||
<<<
|
||||
_GetEOFGS mac
|
||||
CallGSOS $2019;]1
|
||||
<<<
|
||||
|
||||
_GetFileInfoGS mac
|
||||
CallGSOS $2006;]1
|
||||
<<<
|
||||
_GetFileInfoGS mac
|
||||
CallGSOS $2006;]1
|
||||
<<<
|
||||
|
||||
_GetFSTInfoGS mac
|
||||
CallGSOS $202B;]1
|
||||
<<<
|
||||
_GetFSTInfoGS mac
|
||||
CallGSOS $202B;]1
|
||||
<<<
|
||||
|
||||
_GetLevelGS mac
|
||||
CallGSOS $201B;]1
|
||||
<<<
|
||||
_GetLevelGS mac
|
||||
CallGSOS $201B;]1
|
||||
<<<
|
||||
|
||||
_GetMarkGS mac
|
||||
CallGSOS $2017;]1
|
||||
<<<
|
||||
_GetMarkGS mac
|
||||
CallGSOS $2017;]1
|
||||
<<<
|
||||
|
||||
_GetNameGS mac
|
||||
CallGSOS $2027;]1
|
||||
<<<
|
||||
_GetNameGS mac
|
||||
CallGSOS $2027;]1
|
||||
<<<
|
||||
|
||||
_GetPrefixGS mac
|
||||
CallGSOS $200A;]1
|
||||
<<<
|
||||
_GetPrefixGS mac
|
||||
CallGSOS $200A;]1
|
||||
<<<
|
||||
|
||||
_GetRefInfoGS mac
|
||||
CallGSOS $2039;]1
|
||||
<<<
|
||||
_GetRefInfoGS mac
|
||||
CallGSOS $2039;]1
|
||||
<<<
|
||||
|
||||
_GetRefNumGS mac
|
||||
CallGSOS $2038;]1
|
||||
<<<
|
||||
_GetRefNumGS mac
|
||||
CallGSOS $2038;]1
|
||||
<<<
|
||||
|
||||
_GetStdRefNumGS mac
|
||||
CallGSOS $2037;]1
|
||||
<<<
|
||||
_GetStdRefNumGS mac
|
||||
CallGSOS $2037;]1
|
||||
<<<
|
||||
|
||||
_GetSysPrefsGS mac
|
||||
CallGSOS $200F;]1
|
||||
<<<
|
||||
_GetSysPrefsGS mac
|
||||
CallGSOS $200F;]1
|
||||
<<<
|
||||
|
||||
_GetVersionGS mac
|
||||
CallGSOS $202A;]1
|
||||
<<<
|
||||
_GetVersionGS mac
|
||||
CallGSOS $202A;]1
|
||||
<<<
|
||||
|
||||
_JudgeNameGS mac
|
||||
CallGSOS $2007;]1
|
||||
<<<
|
||||
_JudgeNameGS mac
|
||||
CallGSOS $2007;]1
|
||||
<<<
|
||||
|
||||
_NewLineGS mac
|
||||
CallGSOS $2011;]1
|
||||
<<<
|
||||
_NewLineGS mac
|
||||
CallGSOS $2011;]1
|
||||
<<<
|
||||
|
||||
_NullGS mac
|
||||
CallGSOS $200D;]1
|
||||
<<<
|
||||
_NullGS mac
|
||||
CallGSOS $200D;]1
|
||||
<<<
|
||||
|
||||
_OpenGS mac
|
||||
CallGSOS $2010;]1
|
||||
<<<
|
||||
_OpenGS mac
|
||||
CallGSOS $2010;]1
|
||||
<<<
|
||||
|
||||
_OSShutDownGS mac
|
||||
CallGSOS $2003;]1
|
||||
<<<
|
||||
_OSShutDownGS mac
|
||||
CallGSOS $2003;]1
|
||||
<<<
|
||||
|
||||
_QuitGS mac
|
||||
CallGSOS $2029;]1
|
||||
<<<
|
||||
_QuitGS mac
|
||||
CallGSOS $2029;]1
|
||||
<<<
|
||||
|
||||
_ReadGS mac
|
||||
CallGSOS $2012;]1
|
||||
<<<
|
||||
_ReadGS mac
|
||||
CallGSOS $2012;]1
|
||||
<<<
|
||||
|
||||
_ResetCacheGS mac
|
||||
CallGSOS $2026;]1
|
||||
<<<
|
||||
_ResetCacheGS mac
|
||||
CallGSOS $2026;]1
|
||||
<<<
|
||||
|
||||
_SessionStatusGS mac
|
||||
CallGSOS $201F;]1
|
||||
<<<
|
||||
_SessionStatusGS mac
|
||||
CallGSOS $201F;]1
|
||||
<<<
|
||||
|
||||
_SetEOFGS mac
|
||||
CallGSOS $2018;]1
|
||||
<<<
|
||||
_SetEOFGS mac
|
||||
CallGSOS $2018;]1
|
||||
<<<
|
||||
|
||||
_SetFileInfoGS mac
|
||||
CallGSOS $2005;]1
|
||||
<<<
|
||||
_SetFileInfoGS mac
|
||||
CallGSOS $2005;]1
|
||||
<<<
|
||||
|
||||
_SetLevelGS mac
|
||||
CallGSOS $201A;]1
|
||||
<<<
|
||||
_SetLevelGS mac
|
||||
CallGSOS $201A;]1
|
||||
<<<
|
||||
|
||||
_SetMarkGS mac
|
||||
CallGSOS $2016;]1
|
||||
<<<
|
||||
_SetMarkGS mac
|
||||
CallGSOS $2016;]1
|
||||
<<<
|
||||
|
||||
_SetPrefixGS mac
|
||||
CallGSOS $2009;]1
|
||||
<<<
|
||||
_SetPrefixGS mac
|
||||
CallGSOS $2009;]1
|
||||
<<<
|
||||
|
||||
_SetStdRefNumGS mac
|
||||
CallGSOS $203A;]1
|
||||
<<<
|
||||
_SetStdRefNumGS mac
|
||||
CallGSOS $203A;]1
|
||||
<<<
|
||||
|
||||
_SetSysPrefsGS mac
|
||||
CallGSOS $200C;]1
|
||||
<<<
|
||||
_SetSysPrefsGS mac
|
||||
CallGSOS $200C;]1
|
||||
<<<
|
||||
|
||||
_UnbindIntGS mac
|
||||
CallGSOS $2032;]1
|
||||
<<<
|
||||
_UnbindIntGS mac
|
||||
CallGSOS $2032;]1
|
||||
<<<
|
||||
|
||||
_VolumeGS mac
|
||||
CallGSOS $2008;]1
|
||||
<<<
|
||||
_VolumeGS mac
|
||||
CallGSOS $2008;]1
|
||||
<<<
|
||||
|
||||
_WriteGS mac
|
||||
CallGSOS $2013;]1
|
||||
<<<
|
||||
_WriteGS mac
|
||||
CallGSOS $2013;]1
|
||||
<<<
|
||||
|
||||
CallGSOS mac
|
||||
jsl $E100A8
|
||||
dw ]1
|
||||
adrl ]2
|
||||
<<<
|
||||
|
||||
CallGSOS mac
|
||||
jsl $E100A8
|
||||
dw ]1
|
||||
adrl ]2
|
||||
<<<
|
||||
|
@ -6,13 +6,14 @@
|
||||
"config": {
|
||||
"merlin32": "C:\\Programs\\IIgsXDev\\bin\\Merlin32.exe",
|
||||
"cadius": "C:\\Programs\\IIgsXDev\\bin\\Cadius.exe",
|
||||
"gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe"
|
||||
"gsport": "C:\\Programs\\gsport\\gsport_0.31\\GSPort.exe",
|
||||
"macros": "C:\\Programs\\BrutalDeluxe\\Merlin32\\Library"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "npm run build && build-image.bat %npm_package_config_cadius% && %npm_package_config_gsport%",
|
||||
"build": "npm run build:tool && npm run build:test",
|
||||
"build:test": "%npm_package_config_merlin32% -V macros test/App.s",
|
||||
"build:tool": "%npm_package_config_merlin32% -V C:\\Programs\\BrutalDeluxe\\Merlin32\\Library src\\Tool.s",
|
||||
"build:test": "%npm_package_config_merlin32% -V %npm_package_config_macros% test\\App.s",
|
||||
"build:tool": "%npm_package_config_merlin32% -V %npm_package_config_macros% src\\Tool.s",
|
||||
"build:watch": "watch \"npm run build\" src"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -37,7 +37,7 @@
|
||||
; things to be fast and complex things to not be slow. That is, the developer has a lot
|
||||
; of control over the time taken to render the full screen based on how complex it can be.
|
||||
;
|
||||
; That said, I'll cover three cases, ranging from the simple (a single background) and
|
||||
; That said, I'll cover three cases, ranging from the simple (a single background) to the
|
||||
; complex (2 backgrounds, 50% mixed). The even- and odd-aligned cases are also broken out.
|
||||
;
|
||||
; Simple case; all elements of the code field are PEA instructions
|
||||
@ -74,14 +74,16 @@
|
||||
; - Final JMP to next line = 3 cycles
|
||||
; -- total of 1,517 cycles / line of which 700 were spent doing necessary instructions
|
||||
; -- theoretically about 8 fps
|
||||
|
||||
;
|
||||
; Odd:
|
||||
MX %00
|
||||
entry_1 ldx #0000 ; patch with the address of the direct page tiles. Fixed.
|
||||
entry_2 ldy #0000 ; patch with the address of the line in the second layer. Set when BG1 scroll position changes.
|
||||
entry_3 lda #0000 ; patch with the address of the right edge of the line. Set when origin position changes.
|
||||
tcs
|
||||
|
||||
entry_jmp jmp $2000
|
||||
dfb 00 ; of the screen is odd-aligned, then the opcode is set to
|
||||
dfb 00 ; if the screen is odd-aligned, then the opcode is set to
|
||||
; ; $AF to convert to a LDA long instruction. This puts the
|
||||
; ; first two bytes of the instruction field in the accumulator
|
||||
; ; and falls through to the next instruction.
|
||||
@ -117,7 +119,7 @@ r_is_pea xba ; fast code for PEA
|
||||
r_is_jmp sep #$41 ; Set the C and V flags which tells a snippet to push only the low byte
|
||||
ldal entry_jmp+1
|
||||
stal r_jmp_patch+1
|
||||
r_jmp_patch dfb $4C,$00,$00 ; Jump back to address in entry_jmp (this takes 13 cycles, is there a better way?)
|
||||
r_jmp_patch dfb $4C,$00,$00 ; Jump back to address in entry_jmp (this takes 16 cycles, is there a better way?)
|
||||
|
||||
; This is the spot that needs to be page-aligned. In addition to simplifying the entry address
|
||||
; and only needing to update a byte instad of a word, because the code breaks out of the
|
||||
@ -132,7 +134,7 @@ loop lup 82 ; +6 Set up 82 PEA instructions, which is 32
|
||||
jmp loop ; +252 Ensure execution continues to loop around
|
||||
jmp even_exit ; +255
|
||||
|
||||
odd_exit lda #patch ; This operabd field is *always* used to hold the original 2 bytes of the code field
|
||||
odd_exit lda #0000 ; This operand field is *always* used to hold the original 2 bytes of the code field
|
||||
; ; that are replaced by the needed BRA instruction to exit the code field. When the
|
||||
; ; left edge is odd-aligned, we are able to immediately load the value and perform
|
||||
; ; similar logic to the right_odd code path above
|
||||
@ -150,12 +152,12 @@ l_is_pea xba
|
||||
pha
|
||||
rep #$30
|
||||
bra even_exit
|
||||
r_is_jmp sep #$01 ; Set the C flag (V is always cleared at this point) which tells a snippet to push only the high byte
|
||||
l_is_jmp sep #$01 ; Set the C flag (V is always cleared at this point) which tells a snippet to push only the high byte
|
||||
ldal entry_jmp+1
|
||||
stal r_jmp_patch+1
|
||||
r_jmp_patch dfb $4C,$00,$00 ; Jump back to address in entry_jmp (this takes 13 cycles, is there a better way?)
|
||||
stal l_jmp_patch+1
|
||||
l_jmp_patch dfb $4C,$00,$00 ; Jump back to address in entry_jmp (this takes 13 cycles, is there a better way?)
|
||||
|
||||
even_exit jmp next_entry ; Jump to the next line. We set up the blitter to do 8 or 16 lines at a time
|
||||
even_exit jmp $0000 ; Jump to the next line. We set up the blitter to do 8 or 16 lines at a time
|
||||
; ; before restoring the machine state and re-enabling interrupts. This makes
|
||||
; ; the blitter interrupt friendly to allow things like music player to continue
|
||||
; ; to function.
|
||||
@ -205,4 +207,17 @@ even_exit jmp next_entry ; Jump to the next line. We set up the blitte
|
||||
; ; The slow paths have 21 and 22 cycles for the right and left
|
||||
; ; odd-aligned cases respectively.
|
||||
|
||||
snippets ds 32*82
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1 +1 @@
|
||||
RTL
|
||||
RTL
|
||||
|
12
src/Tool.s
12
src/Tool.s
@ -1,13 +1,15 @@
|
||||
*-------------------------------------*
|
||||
* GTE Tool *
|
||||
*-------------------------------------*
|
||||
DSK GTETool
|
||||
TYP $BA
|
||||
XPL
|
||||
DSK GTETool
|
||||
TYP $BA
|
||||
XPL
|
||||
|
||||
*-------------------------------------*
|
||||
* Segment #1 *
|
||||
*-------------------------------------*
|
||||
|
||||
ASM GTE.Main.s
|
||||
SNA Main
|
||||
ASM GTE.Main.s
|
||||
ASM GTE.Line.s
|
||||
SNA Main
|
||||
|
||||
|
73
test/App.Init.s
Normal file
73
test/App.Init.s
Normal file
@ -0,0 +1,73 @@
|
||||
; Initialize the system for fun!
|
||||
;
|
||||
; Mostly memory allocation
|
||||
;
|
||||
; * 13 banks of memory for the blitter
|
||||
; * 1 bank of memory for the second background
|
||||
; * 1 bank of memory for the second background mask
|
||||
;
|
||||
; * $01/2000 - $01/9FFF for the shadow screen
|
||||
; * $00/2000 - $00/9FFF for the fixed background
|
||||
;
|
||||
; * 10 pages of direct page in Bank $00
|
||||
; - 1 page for scratch space
|
||||
; - 1 page for pointer to the second background
|
||||
; - 8 pages for the dynamic tiles
|
||||
|
||||
mx %00
|
||||
|
||||
MemInit PushLong #0 ; space for result
|
||||
PushLong #$008000 ; size (32k)
|
||||
PushWord UserId
|
||||
PushWord #%11000000_00010111 ; Fixed location
|
||||
PushLong #$002000
|
||||
_NewHandle ; returns LONG Handle on stack
|
||||
plx ; base address of the new handle
|
||||
pla ; high address 00XX of the new handle (bank)
|
||||
_Deref
|
||||
sta Buff00+2
|
||||
stx Buff00
|
||||
|
||||
PushLong #0 ; space for result
|
||||
PushLong #$008000 ; size (32k)
|
||||
PushWord UserId
|
||||
PushWord #%11000000_00010111 ; Fixed location
|
||||
PushLong #$012000
|
||||
_NewHandle ; returns LONG Handle on stack
|
||||
plx ; base address of the new handle
|
||||
pla ; high address 00XX of the new handle (bank)
|
||||
_Deref
|
||||
sta Buff01+2
|
||||
stx Buff01
|
||||
|
||||
PushLong #0 ; space for result
|
||||
PushLong #$000A00 ; size (10 pages)
|
||||
PushWord UserId
|
||||
PushWord #%11000000_00010101 ; Page-aligned, fixed bank
|
||||
PushLong #$000000
|
||||
_NewHandle ; returns LONG Handle on stack
|
||||
plx ; base address of the new handle
|
||||
pla ; high address 00XX of the new handle (bank)
|
||||
_Deref
|
||||
sta ZeroPage+2
|
||||
stx ZeroPage
|
||||
|
||||
rts
|
||||
|
||||
Buff00 ds 4
|
||||
Buff01 ds 4
|
||||
ZeroPage ds 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
280
test/App.Main.s
280
test/App.Main.s
@ -1,6 +1,278 @@
|
||||
USE EDS.GSOS.MACS
|
||||
|
||||
_QuitGS qtRec
|
||||
; Test program for graphics stufff...
|
||||
|
||||
rel
|
||||
|
||||
use Util.Macs.s
|
||||
use Locator.Macs.s
|
||||
use Mem.Macs.s
|
||||
use Misc.Macs.s
|
||||
put ..\macros\App.Macs.s
|
||||
put ..\macros\EDS.GSOS.MACS.s
|
||||
|
||||
mx %00
|
||||
|
||||
; Typical init
|
||||
|
||||
phk
|
||||
plb
|
||||
|
||||
; Tool startup
|
||||
|
||||
_TLStartUp ; normal tool initialization
|
||||
pha
|
||||
_MMStartUp
|
||||
_Err ; should never happen
|
||||
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
|
||||
|
||||
; Start up the graphics engine...
|
||||
|
||||
jsr MemInit
|
||||
|
||||
; Load a picture and copy it into Bank $E1. Then turn on the screen.
|
||||
|
||||
jsr AllocOneBank ; Alloc 64KB for Load/Unpack
|
||||
sta BankLoad ; Store "Bank Pointer"
|
||||
|
||||
ldx #ImageName ; Load+Unpack Boot Picture
|
||||
jsr LoadPicture ; X=Name, A=Bank to use for loading
|
||||
|
||||
lda BankLoad ; get address of loaded/uncompressed picture
|
||||
clc
|
||||
adc #$0080 ; skip header?
|
||||
sta :copySHR+2 ; and store that over the 'ldal' address below
|
||||
ldx #$7FFE ; copy all image data
|
||||
:copySHR ldal $000000,x ; load from BankLoad we allocated
|
||||
stal $E12000,x ; store to SHR screen
|
||||
dex
|
||||
dex
|
||||
bpl :copySHR
|
||||
|
||||
jsr GrafOn
|
||||
jsr WaitForKey
|
||||
|
||||
; Deallocate all of our memory
|
||||
PushWord UserId
|
||||
_DisposeAll
|
||||
|
||||
Exit _QuitGS qtRec
|
||||
|
||||
bcs Fatal
|
||||
Fatal brk $00
|
||||
|
||||
WaitForKey sep #$30
|
||||
:WFK ldal $00C000
|
||||
bpl :WFK
|
||||
stal $00C010
|
||||
rep #$30
|
||||
rts
|
||||
|
||||
****************************************
|
||||
* Fatal Error Handler *
|
||||
****************************************
|
||||
PgmDeath tax
|
||||
pla
|
||||
inc
|
||||
phx
|
||||
phk
|
||||
pha
|
||||
bra ContDeath
|
||||
PgmDeath0 pha
|
||||
pea $0000
|
||||
pea $0000
|
||||
ContDeath ldx #$1503
|
||||
jsl $E10000
|
||||
|
||||
; Graphic screen initialization
|
||||
|
||||
GrafInit ldx #$7FFE
|
||||
lda #0000
|
||||
:loop stal $E12000,x
|
||||
dex
|
||||
dex
|
||||
bne :loop
|
||||
rts
|
||||
|
||||
|
||||
GrafOn sep #$30
|
||||
lda #$81
|
||||
stal $00C029
|
||||
rep #$30
|
||||
rts
|
||||
|
||||
; Bank allocator (for one full, fixed bank of memory. Can be immediately deferenced)
|
||||
|
||||
AllocOneBank PushLong #0
|
||||
PushLong #$10000
|
||||
PushWord UserId
|
||||
PushWord #%11000000_00011100
|
||||
PushLong #0
|
||||
_NewHandle ; returns LONG Handle on stack
|
||||
plx ; base address of the new handle
|
||||
pla ; high address 00XX of the new handle (bank)
|
||||
xba ; swap accumulator bytes to XX00
|
||||
sta :bank+2 ; store as bank for next op (overwrite $XX00)
|
||||
:bank ldal $000001,X ; recover the bank address in A=XX/00
|
||||
rts
|
||||
|
||||
; Graphics helpers
|
||||
|
||||
LoadPicture jsr LoadFile ; X=Nom Image, A=Banc de chargement XX/00
|
||||
bcc :loadOK
|
||||
brl Exit
|
||||
:loadOK jsr UnpackPicture ; A=Packed Size
|
||||
rts
|
||||
|
||||
|
||||
UnpackPicture sta UP_PackedSize ; Size of Packed Data
|
||||
lda #$8000 ; Size of output Data Buffer
|
||||
sta UP_UnPackedSize
|
||||
lda BankLoad ; Banc de chargement / Decompression
|
||||
sta UP_Packed+1 ; Packed Data
|
||||
clc
|
||||
adc #$0080
|
||||
stz UP_UnPacked ; On remet a zero car modifie par l'appel
|
||||
stz UP_UnPacked+2
|
||||
sta UP_UnPacked+1 ; Unpacked Data buffer
|
||||
|
||||
PushWord #0 ; Space for Result : Number of bytes unpacked
|
||||
PushLong UP_Packed ; Pointer to buffer containing the packed data
|
||||
PushWord UP_PackedSize ; Size of the Packed Data
|
||||
PushLong #UP_UnPacked ; Pointer to Pointer to unpacked buffer
|
||||
PushLong #UP_UnPackedSize ; Pointer to a Word containing size of unpacked data
|
||||
_UnPackBytes
|
||||
pla ; Number of byte unpacked
|
||||
rts
|
||||
|
||||
UP_Packed hex 00000000 ; Address of Packed Data
|
||||
UP_PackedSize hex 0000 ; Size of Packed Data
|
||||
UP_UnPacked hex 00000000 ; Address of Unpacked Data Buffer (modified)
|
||||
UP_UnPackedSize hex 0000 ; Size of Unpacked Data Buffer (modified)
|
||||
|
||||
; Basic I/O function to load files
|
||||
|
||||
LoadFile stx openRec+4 ; X=File, A=Bank/Page XX/00
|
||||
sta readRec+5
|
||||
|
||||
:openFile _OpenGS openRec
|
||||
bcs :openReadErr
|
||||
lda openRec+2
|
||||
sta eofRec+2
|
||||
sta readRec+2
|
||||
|
||||
_GetEOFGS eofRec
|
||||
lda eofRec+4
|
||||
sta readRec+8
|
||||
lda eofRec+6
|
||||
sta readRec+10
|
||||
|
||||
_ReadGS readRec
|
||||
bcs :openReadErr
|
||||
|
||||
:closeFile _CloseGS closeRec
|
||||
clc
|
||||
lda eofRec+4 ; File Size
|
||||
rts
|
||||
|
||||
:openReadErr jsr :closeFile
|
||||
nop
|
||||
nop
|
||||
|
||||
PushWord #0
|
||||
PushLong #msgLine1
|
||||
PushLong #msgLine2
|
||||
PushLong #msgLine3
|
||||
PushLong #msgLine4
|
||||
_TLTextMountVolume
|
||||
pla
|
||||
cmp #1
|
||||
bne :loadFileErr
|
||||
brl :openFile
|
||||
:loadFileErr sec
|
||||
rts
|
||||
|
||||
msgLine1 str 'Unable to load File'
|
||||
msgLine2 str 'Press a key :'
|
||||
msgLine3 str ' -> Return to Try Again'
|
||||
msgLine4 str ' -> Esc to Quit'
|
||||
|
||||
; Data storage
|
||||
ImageName strl '1/test.pic'
|
||||
MasterId ds 2
|
||||
UserId ds 2
|
||||
BankLoad hex 0000
|
||||
|
||||
openRec dw 2 ; pCount
|
||||
ds 2 ; refNum
|
||||
adrl ImageName ; pathname
|
||||
|
||||
eofRec dw 2 ; pCount
|
||||
ds 2 ; refNum
|
||||
ds 4 ; eof
|
||||
|
||||
readRec dw 4 ; pCount
|
||||
ds 2 ; refNum
|
||||
ds 4 ; dataBuffer
|
||||
ds 4 ; requestCount
|
||||
ds 4 ; transferCount
|
||||
|
||||
closeRec dw 1 ; pCount
|
||||
ds 2 ; refNum
|
||||
|
||||
qtRec adrl $0000
|
||||
da $00
|
||||
|
||||
put App.Init.s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
qtRec DW 0
|
||||
|
||||
|
39
test/App.s
39
test/App.s
@ -1,13 +1,30 @@
|
||||
*-------------------------------------*
|
||||
* GTE Tool *
|
||||
*-------------------------------------*
|
||||
DSK GTETestApp
|
||||
TYP $B3 ; S16 file
|
||||
XPL
|
||||
TYP $B3 ; S16 file
|
||||
DSK GTETestApp
|
||||
|
||||
ASM App.Main.s
|
||||
SNA Main
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*-------------------------------------*
|
||||
* Segment #1 *
|
||||
*-------------------------------------*
|
||||
|
||||
ASM App.Main.s
|
||||
SNA Main
|
||||
|
Loading…
x
Reference in New Issue
Block a user