top decor
ROM subroutines How to call ROM subroutines


To call any E-MMI ROM subroutine you just follow the below simple recommendations.
  1. Set register $70 to the beginning of the ROM (EE00 0000 0000 0000) by means of SETH $70, EE00 instruction (its code is E0 70 EE00; see this link for operation details).
  2. Find subroutine you need in the list and remember the displacement of its entry from the beginning of ROM (see entry parameter).
  3. Define input parameters if required (see subroutines list for details). Usually E-MMI ROM use $71 for this aim.
  4. Add GOI $6F, $70, <entry> instruction (9F 6F 70 <entry>) to your program.

The number of registers from $6F I have selected arbitrary. I strongly hope MMIX users will not want to call into requisition these registers. If this by mischance happens and somebody will need exactly these numbers, I can recompile E-MMI software ROM for him from any value he points.

Example:
To print $1 as integer value input the following code:

addr code mnemonic action comments
0E0 70 EE00SETH $70, EE00$70 <== EE00set the beginning ROM address
421 71 01 00ADDI $71, 01, 0$71 <== $1move $1 to $71
89F 6F 70 10GOI $6F, $70, 10call $70+10, return - $6Fcall ROM subroutine
C00 000000TRAP 0exit to system 

Note that ROM subroutines never modify $70 with ROM beginning address. So if you'll not also do this modification, you may set $70 only once in the beginning of your program.

back previous page next page forward


Related topics:

E-MMI software
 

  (C) 2003, Evgeny Eremin. rEd-MMI project documentation
1