Difference between revisions of "83:OS:ROMPage0C"
Guillaumeh (Talk | contribs) |
(Lots more documentation, mostly about indirect ROM calls.) |
||
Line 5: | Line 5: | ||
==Structure== | ==Structure== | ||
− | ===4000=== | + | ===Direct Calls, 4000 to 4F0B=== |
Here is the ROM Call jumptable, which looks like this : | Here is the ROM Call jumptable, which looks like this : | ||
Line 20: | Line 20: | ||
... seldom having some jumps instead of calls. | ... seldom having some jumps instead of calls. | ||
+ | |||
+ | ===Indirect ROM Calls, 4F0C to 51F2=== | ||
At 4F0C, the ROM Calls start to look like this : | At 4F0C, the ROM Calls start to look like this : | ||
− | + | <nowiki> | |
− | + | push af | |
ld a,XX | ld a,XX | ||
ld (80C8),a | ld (80C8),a | ||
Line 31: | Line 33: | ||
</nowiki> | </nowiki> | ||
+ | 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=== | + | ===52E9 to 7FFF=== |
This part only has FF FF FF FF FF ... until the end (7FFF). | This part only has FF FF FF FF FF ... until the end (7FFF). |
Revision as of 03:16, 13 December 2015
This ROM page is loaded as soon as an ASM program is launched.
Contents
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).