View Single Post
Old 23rd Jan 2023, 9:05 pm   #122
Realtime
Hexode
 
Join Date: Jan 2021
Location: Ashford, Kent, UK
Posts: 318
Default Re: Yet another MK14 tape interface (ESP32).

I've been playing with SBASM and have come up with the following:

In the assembler code I've defined the Execution Address by a label ENTRY (this is separate from the memory address where the code is loaded, but could be the same address). In the example here the code starts with a look-up table and is loaded to 0x400, but the entry point for execution is actually 0x048C.

Code:
		.DB 63,00,49,14,49,49,63,63,63,00  ; 
		.DB 63,14,49,14,49,49,63,49,63,14  ; 
		.DB 14,14,49,14,49,49,14,49,14,14  ; 
		.DB 00,00,14,14,14,49,00,63,00,00  ; 
		.DB 00,14,14,14,14,49,00,49,00,14  ; 
		.DB 32,37,32,27,28,31,32,27,36,31  ; 
		.DB 41,22,49,14,49,49,41,41,41,22  ; 
		.DB 41,22,49,22,49,41,41,41,41,22  ;
		.DB 22,22,41,22,41,41,22,41,22,22  ; 
		.DB 14,14,22,22,22,41,14,49,14,14  ;
		.DB 14,22,22,22,22,41,14,41,14,22  ; 
		.DB 32,37,32,27,28,31,32,27,36,31  ;
		.DB 30,55,34,59,32,57,34,55,30,59  ; 
		.DB 00,00,63,00,63,63,00,63,00,00  ;
		
ENTRY:	
;===============================================
; P2 is the variables pointer
;===============================================	
	LDI VAR/256
	XPAH	P2
	LDI	VAR\256
	XPAL	P2
At the end of the assembler I've added the following:

Code:
EXEC_ADR:
	.NO 0xFFFE
	.DB ENTRY/256
	.DB ENTRY\256
This places a record at the end of the .hex file with the execution address (0x048C) positioned at 0xFFFE, i.e.

Code:
:10079000D4209806C202E401CA0202C202980103F0
:1007A000C201D401CA02C2011DCA0102C2029801DB
:0707B00003C2001DCA003F57
:02FFFE00048C71  -------------------------This one!
:00000001FF
So you only need to decode the address field as being 0xFFFE, in the fast loader code, to determine that that record holds the the execution address. Of course it means genuine code cannot use 0xFFFE/F.

Hope that makes sense
Realtime is offline