Difference between revisions of "83:OS:ROMPage0C"

From WikiTI
Jump to: navigation, search
m (Ugly spacing is ugly)
m (Indirect ROM Calls, 4F0C to 51F2: whoops)
 
Line 24: Line 24:
 
At 4F0C, the ROM Calls start to look like this :
 
At 4F0C, the ROM Calls start to look like this :
  
<nowiki>
+
<nowiki>
 
push af
 
push af
 
ld a,XX     
 
ld a,XX     
Line 34: Line 34:
 
Calling a routine that uses the above format in the jump table loads a table index in ASM_IND_CALL (80C8), then goes to one of two handlers. The jr address calls either PARSER_EXEC (for addresses between 4F0C and 50A9) or GRAPH_EXEC (between 510A and 51E6). PARSER_EXEC goes to page $09 and GRAPH_EXEC goes to page $04. After calling a routine in one of those two ranges, the OS calls a handler on the corresponding page that adds 2*(80C8) (memory addresses are two bytes) to the start address of the address table, puts that value on the stack, and rets to that address.  
 
Calling a routine that uses the above format in the jump table loads a table index in ASM_IND_CALL (80C8), then goes to one of two handlers. The jr address calls either PARSER_EXEC (for addresses between 4F0C and 50A9) or GRAPH_EXEC (between 510A and 51E6). PARSER_EXEC goes to page $09 and GRAPH_EXEC goes to page $04. After calling a routine in one of those two ranges, the OS calls a handler on the corresponding page that adds 2*(80C8) (memory addresses are two bytes) to the start address of the address table, puts that value on the stack, and rets to that address.  
  
There is a region between 50B2 and 5109 that contain normal calls, like those around 4000. GRAPH_EXEC, PARSER_EXEC, and IO_EXEC are also normal calls.  
+
There is a region between 50B2 and 5109 that contain normal calls, like those around 4000. GRAPH_EXEC, PARSER_EXEC, and IO_EXEC are also normal calls.
  
 
===51F3 to 52E8===
 
===51F3 to 52E8===

Latest revision as of 03:20, 13 December 2015

This ROM page is loaded as soon as an ASM program is launched.

Structure

Direct Calls, 4000 to 4F0B

Here is the ROM Call jumptable, which looks like this :

 call 0033
 ret
 call 010F
 ret
 call 011B
 ret
 call 111F
 ret
 ...

... seldom having some jumps instead of calls.

Indirect ROM Calls, 4F0C to 51F2

At 4F0C, the ROM Calls start to look like this :

	push	af
	ld	a,XX    
	ld	(80C8),a
	pop	af
	jr	5188

Calling a routine that uses the above format in the jump table loads a table index in ASM_IND_CALL (80C8), then goes to one of two handlers. The jr address calls either PARSER_EXEC (for addresses between 4F0C and 50A9) or GRAPH_EXEC (between 510A and 51E6). PARSER_EXEC goes to page $09 and GRAPH_EXEC goes to page $04. After calling a routine in one of those two ranges, the OS calls a handler on the corresponding page that adds 2*(80C8) (memory addresses are two bytes) to the start address of the address table, puts that value on the stack, and rets to that address.

There is a region between 50B2 and 5109 that contain normal calls, like those around 4000. GRAPH_EXEC, PARSER_EXEC, and IO_EXEC are also normal calls.

51F3 to 52E8

This has code that has something to do with something, maybe parsing/handling/executing nostub assembly?

52E9 to 7FFF

This part only has FF FF FF FF FF ... until the end (7FFF).