User Tools

Site Tools


x68000:trap_codes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
x68000:trap_codes [2017/08/14 11:36] – created neko68kx68000:trap_codes [2019/08/27 20:45] (current) – external edit 127.0.0.1
Line 1: Line 1:
-TRAP exception handling list+====== TRAP exception handling list ======
  
-|trap #0|User defined| +^Trap #^Description^ 
-|trap #1|〃(mpcm.x)| +|0|User defined| 
-|trap #2|〃(pcm8.x)| +|1|〃(mpcm.x)| 
-|trap #3|〃(zmusic.x、zmsc3.x、middrv.r)| +|2|〃(pcm8.x)| 
-|trap #4|〃(mxdrv.x、madrv.x、mld.x、mcdrv.x)| +|3|〃(zmusic.x、zmsc3.x、middrv.r)| 
-|trap #5|〃| +|[[trap_codes#trap4|4]]|〃(mxdrv.x、madrv.x、mld.x、mcdrv.x)| 
-|trap #6|〃| +|5|〃| 
-|trap #7|〃| +|6|〃| 
-|trap #8|Breakpoint(ROM Debugger)| +|7|〃| 
-|trap #9|〃 (db.x、scd.x)| +|8|Breakpoint(ROM Debugger)| 
-|trap #10|Reset/power off handling| +|9|〃 (db.x、scd.x)| 
-|trap #11|BREAK key processing| +|[[trap_codes#trap10|10]]|Reset/power off handling| 
-|trap #12|COPY key processing| +|[[trap_codes#trap11|11]]|BREAK key processing| 
-|trap #13|CTRL+C processing| +|[[trap_codes#trap12|12]]|COPY key processing| 
-|trap #14|Error handling| +|[[trap_codes#trap13|13]]|CTRL+C processing| 
-|trap #15|IOCS call|+|[[trap_codes#trap14|14]]|Error handling| 
 +|[[trap_codes#trap15|15]]|IOCS call|
  
-trap #10 Reset/power off handling+<BOOKMARK:trap4> 
 +===trap #4 MXDRV=== 
 + Args d0.l = Command
  
- Arg d0.l = $58363801('X68'<<8+1) Power off by front switch+^Command^Name^Function^ 
 +|  0x00  |  UNLINK  | | 
 +|  0x01  |  ERROR  | | 
 +|  0x02  |  LOADMML  |Set MDX data \\ Args: \\ a1 = address \\ d1 = length| 
 +|  0x03  |  LOADPCM  |Set PDX data \\ Args: \\ a1 = address \\ d1 = length| 
 +|  0x04  |  M_PLAY  |Play with no muting. See 0x0F| 
 +|  0x05  |  M_END  |Stop playback| 
 +|  0x06  |  M_STOP  |Pause playback| 
 +|  0x07  |  M_CONT  |Resume playback| 
 +|  0x08  |  MMLNAME  |Get Title address| 
 +|  0x09  |  PCMNAME  |Get PDX filename| 
 +|  0x0A  |  VOLADD  | | 
 +|  0x0B  |  PCMCUT  | | 
 +|  0x0C  |  FADEOUT  |Fade out \\ Args: \\ d1 = speed| 
 +|  0x0D  |  AMPLAY  |Set ignore keys \\ Args: \\ D1 = mask \\ Return: \\ d0 = old value| 
 +|  0x0E  |  CHMASK  |Set channel mask| 
 +|  0x0F  |  M_PLAY2  |Play with channel mute mask \\ Args: \\ d1 = mask (1 = mute)| 
 +|  0x10  |  WORKS  |Get FM buffer address| 
 +|  0x11  |  TIMSET  | | 
 +|  0x12  |  M_STAT  |Get playing flags \\ Return: \\ d0 = flags| 
 +|  0x13  |  KEYBCONT  | | 
 +|  0x14  |  M_STAT2  | | 
 +|  0x15  |  EXMODE  |(?) Dont check for Performance End command right after a loop end| 
 +|  0x16  |  TRACEMODE  |Stop playback and disable timer writes depending \\ Args: \\ d1 = new value \\ Return: \\ d0 = old value| 
 +|  0x17  |  TRACESTEP  | | 
 +|  0x18  |  PCM4WORKS  |Get PCM buffer address| 
 +|  0x19  |  EXCHWORKS  |(?)PCM Key On work| 
 +|  0x1A  | | | 
 +|  0x1B  | | | 
 +|  0x1C  | | | 
 +|  0x1D  | | | 
 +|  0x1E  | | | 
 +|  0x1F  | | | 
 + 
 +<BOOKMARK:trap10> 
 +===trap #10 Reset/power off handling=== 
 + 
 + Args d0.l = $58363801('X68'<<8+1) Power off by front switch
  $58363802('X68'<<8+2) Power off by external switch  $58363802('X68'<<8+2) Power off by external switch
  $58363803('X68'<<8+3) Power off with soft switch  $58363803('X68'<<8+3) Power off with soft switch
-  
- Software reset other than above 
  
- It is called from the power off interrupt and keyboard +==Software reset other than above==
- processing or from the user program and performs power +
- off and reset processing by software.+
  
- It is hooked at Human68k startup. It will not be executed +It is called from the power off interrupt and keyboard 
- immediately even if it is called during DOS call execution. +processing or from the user program and performs power 
- It will be called after it ends.+off and reset processing by software.
  
-trap #11 BREAK key processing+It is hooked at Human68k startup. It will not be executed 
 +immediately even if it is called during DOS call execution. 
 +It will be called after it ends. 
 + 
 +<BOOKMARK:trap11> 
 +===trap #11 BREAK key processing===
  
  Arg d0.b Shift key status  Arg d0.b Shift key status
  
- Called from the keyboard process when the BREAK key is pressed +Called from the keyboard process when the BREAK key is pressed 
- but ignored while executing disk related IOCS of $40 to $4F. +but ignored while executing disk related IOCS of $40 to $4F. 
- It is hooked at Human68k startup, it will not be executed +It is hooked at Human68k startup, it will not be executed 
- immediately even if it is called during DOS call execution. +immediately even if it is called during DOS call execution. 
- It will be called after it ends.+It will be called after it ends.
   
- If you press the BREAK key without pressing SHIFT, trap #13 +If you press the BREAK key without pressing SHIFT, trap #13 
- is also executed after trap #11.+is also executed after trap #11.
   
- Since multiple calls are noe made, there is no need to have +Since multiple calls are noe made, there is no need to have 
- a reentrant structure.+a reentrant structure.
  
-trap #12 COPY key handling+<BOOKMARK:trap12> 
 +===trap #12 COPY key handling===
  
-Arg d0.b Shift key status+ Arg d0.b Shift key status
  
- When the COPY key is pressed it is called from the keyboard +When the COPY key is pressed it is called from the keyboard 
- process and performs the hard copy process of the screen.+process and performs the hard copy process of the screen.
   
- Since multiple calls are not made there is no need to have +Since multiple calls are not made there is no need to have 
- a reentrant structure.+a reentrant structure.
  
- The following operations are performed depending on the +The following operations are performed depending on the 
- shift key state.+shift key state.
  
- COPY Reduced copy (1 color) +  * COPY Reduced copy (1 color) 
- SHIFT + COPY Enlarged copy (1 color) +  SHIFT + COPY Enlarged copy (1 color) 
- CTRL  + COPY Enlarged copy (4 colors) +  CTRL  + COPY Enlarged copy (4 colors) 
- OPT.1 + COPY FF output. +  OPT.1 + COPY FF output. 
- OPT.2 + COPY LF 〃+  OPT.2 + COPY LF 〃
  
-trap #13 CTRL+C handling+<BOOKMARK:trap13> 
 +===trap #13 CTRL+C handling===
  
- Called from keyboard processing when CTRL+C and BREAK keys +Called from keyboard processing when CTRL+C and BREAK keys 
- are entered.+are entered.
   
- Usually routines that do not do anything are registered, +Usually routines that do not do anything are registered, 
- so they can be used by users.+so they can be used by users.
  
-trap #14 Error handling+<BOOKMARK:trap14> 
 +===trap #14 Error handling===
  
-Arg d7.w Error number + Arg d7.w Error number 
- a5.l String address (only for d7.w = $??00)+     a5.l String address (only for d7.w = $??00)
  
- When ROM is started it just restarts waiting for key +When ROM is started it just restarts waiting for key 
- input, but when Human68k starts up it is hooked and +input, but when Human68k starts up it is hooked and 
- replaced with a routine that displays a white strip +replaced with a routine that displays a white strip 
- and waits for the users response.+and waits for the users response.
  
- If the system detects an error, set error number d7.w +If the system detects an error, set error number d7.w 
- and trap #14. In this error handling routine, depending +and trap #14. In this error handling routine, depending 
- on the type of error, after outputting a message +on the type of error, after outputting a message 
- according to the type of error, it waits for input from the +according to the type of error, it waits for input from the 
- keyboard and sets d7.w to 1 (reexecution) or 2 (ignore) and +keyboard and sets d7.w to 1 (reexecution) or 2 (ignore) and 
- return. If abort is specified (will not return).+return. If abort is specified (will not return).
  
-Error number+^Code^Description^Other info^ 
 +|$00xx|CPU Exception processing/unregistered interrupt (stop only).|The lower byte is the vector number, see table below.|
  
-$00xx CPU Exception processing/unregistered interrupt (stop only) +^Code^Description^ 
- The lower byte is the vector number. +|$0002|Bus error| 
- $0002 Bus error +|$0003|Address error| 
- $0003 Address error +|$0004|Invalid instruction| 
- $0004 Invalid instruction +|$0005|Divide by 0| 
- $0005 Divide by 0 +|$0006|CHK instruction executed| 
- $0006 CHK instruction executed +|$0007|TRAPV instruction executed| 
- $0007 TRAPV instruction executed +|$0008|Privileged instruction executed| 
- $0008 Privileged instruction executed +|$001f|Interrupt(NMI) switch pressed| 
- $001f Interrupt(NMI) switch pressed +|$01xx|Unregistered IOCS call|
-  +
-$01xx Unregistered IOCS call +
- The lower byte is the IOCS call number. +
- It is also called when using a call to SASI that can only be +
- performed on FD or vice versa.+
  
-Error number+^Code^Description^ 
 +|$02xx~$0fxx|Reserved| 
 +|$10xx~$1fxx|Error (cancellation only)| 
 +|$20xx~$2fxx|Error (retry only)| 
 +|$30xx~$3fxx|Error (re-execute & cancel)| 
 +|$301f|Interrupt(NMI) switch pressed| 
 +|$40xx~$4fxx|Error (ignore only)| 
 +|$50xx~$5fxx|Error (ignore & cancel)| 
 +|$60xx~$6fxx|Error (ignore & rerun)| 
 +|$70xx~$7fxx|Error (ignore & re-execute & cancel)| 
 +|$80xx~$efxx|Reserved| 
 +|$f0xx~$fdxx|Interrupt other than F series DOS call (only stop)| 
 +|$fexx|Floating-point operation package not installed (abort only)|
  
-$00xx CPU Exception processing/unregistered interrupt (stop only) +^Code^Description^Other info^ 
- The lower byte is the vector number. +|$ffxx|Unregistered DOS call|In Human68k version 3.0x unregistered DOS call returns -1 and error handling is not called. When the interrupt switch is pressed the error numbers are two numbers, $001F and $003F. Usually the latter is used.|
- $0002 Bus error +
- $0003 Address error +
- $0004 Invalid instruction +
- $0005 Divide by 0 +
- $0006 CHK instruction executed +
- $0007 TRAPV instruction executed +
- $0008 Privileged instruction executed +
- $001f Interrupt(NMI) switch pressed +
-  +
-$01xx Unregistered IOCS call +
- The lower byte is the IOCS call number. +
- It is also called when using a call to SASI that can only be +
- performed on FD or vice versa. +
-$02xx~$0fxx Reserved +
-$10xx~$1fxx Error (cancellation only) +
-$20xx~$2fxx Error (retry only) +
-$30xx~$3fxx Error (re-execute & cancel) +
- $301f Interrupt(NMI) switch pressed +
-$40xx~$4fxx Error (ignore only) +
-$50xx~$5fxx Error (ignore & cancel) +
-$60xx~$6fxx Error (ignore & rerun) +
-$70xx~$7fxx Error (ignore & re-execute & cancel) +
-$80xx~$efxx Reserved +
-$f0xx~$fdxx Interrupt other than F series DOS call (only stop) +
-$fexx Floating-point operation package not installed (abort only) +
-$ffxx Unregistered DOS call +
- In Human68k version 3.0x unregistered DOS call returns -1 and +
- error handling is not called. +
-  +
- When the interrupt switch is pressed the error numbers are two +
- numbers, $001F and $003F. Usually the latter is used. +
-  +
- For error numbers from $1000~$7FFF, bits 4, 5, and 6 of the +
- high-order byte are cancelled. It corresponts to retry, ignore. +
- The contents of the lower byte at this time are as follows.+
  
 +For error numbers from $1000~$7FFF, bits 4, 5, and 6 of the high-order byte are cancelled. It corresponts to retry, ignore. The contents of the lower byte at this time are as follows.
  
-$00 User defined (put a string address in a5.l) +^Code^Description^ 
-$01 An invalid unit number was specified. +|$00|User defined (put a string address in a5.l)| 
-$02 Disk is not inserted. +|$01|An invalid unit number was specified.| 
-$03 Invalid command specified in the device driver. +|$02|Disk is not inserted.| 
-$04 CRC error. +|$03|Invalid command specified in the device driver.| 
-$05 Disk management area is destroyed. +|$04|CRC error.| 
-$06 Seek error. +|$05|Disk management area is destroyed.| 
-$07 Invalid media. +|$06|Seek error.| 
-$08 Sector not found. +|$07|Invalid media.| 
-$09 Printer is not connected. +|$08|Sector not found.| 
-$0a Write error. +|$09|Printer is not connected.| 
-$0b Read error. +|$0A|Write error.| 
-$0c Other error. +|$0B|Read error.| 
-$0d Write protected (remove protect and put the same disk). +|$0C|Other error.| 
-$0e Impossible to write. +|$0D|Write protected (remove protect and put the same disk).| 
-$0f File sharing violation.+|$0E|Impossible to write.| 
 +|$0F|File sharing violation.|
  
- If the low-order byte is 0 the user can specify the character +If the low-order byte is 0 the user can specify the character string to be displayed. The address of the character string is passed in a5.l and the character string must not be more than the display witdh 52 digits. However, as the error code of the device driver, if the low byte (3rd byte from the head of the request header) is 0, it is handled as normal ternimation and it is impossible to pass the address of the character string, so this function can not be used.
- string to be displayed. The address of the character string is +
- passed in a5.l and the character string must not be more than +
- the display witdh 52 digits. However, as the error code of the +
- device driver, if the low byte (3rd byte from the head of the +
- request header) is 0, it is handled as normal ternimation and it +
- is impossible to pass the address of the character string, so this +
- function can not be used. +
-  +
-・trap #15 IOCS processing+
  
-Arg d0.b IOCS call number+<BOOKMARK:trap15> 
 +===trap #15 - IOCS processing===
  
- Execute IOCS. During execution, the IOCS call number is stored + Arg d0.b IOCS call number
- in one word from IOCS work area $A0E (upper byte is always 0). +
- Arguments and return values other than d0.b differ depending +
- on the call number.+
  
- To speed up the IOCS call, execute the shortcut call by the  +Execute IOCS. During execution, the IOCS call number is storedin one word from IOCS work area //$A0E// (upper byte is always 0). Arguments and return values other than //d0.b// differ depending on the call number. 
- following method while in supervisor mode.+ 
 +To speed up the IOCS call, execute the shortcut call by the following method while in supervisor mode.
  
  movea.l (IOCS call number*4+$400),a0  movea.l (IOCS call number*4+$400),a0
  jsr (a0)  jsr (a0)
  
- Each function of IOCS is created as a subroutine returning with +Each function of IOCS is created as a subroutine returning with //rts//. There is no problem in destroying //a0.l// (from the point of view of the user, there is no guarantee that it will be saved when shortcutting), do not destroy registers that do not pass other return values.
- rts. There is no problem in destroying a0.l (from the point of +
- view of the user, there is no guarantee that it will be saved +
- when shortcutting), do not destroy registers that do not pass +
- other return values. +
- +
-How handles vector base register 'vbr'+
  
- In X68030 (ROM IOCS version 1.3), vbr can be enabled. After +===How handles vector base register VBR===
- checking that the following vectors are standard vectors +
- pointing inside the ROM, change the value obtained by +
- subtracting 2 from each address. However, in some IOCS calls, +
- routines in ROM can not deal with what is calling(?).+
  
- trap #15(IOCS processing address table is also changed to vbr+$400) +In X68030 (ROM IOCS version 1.3), //VBR// can be enabled. After checking that the following vectors are standard vectors pointing inside the ROM, change the value obtained by subtracting 2 from each address. However, in some IOCS calls, routines in ROM can not deal with what is calling(?).
- IOCS _FNTGET +
- IOCS _OPMINTST +
- IOCS _TIMERDST +
- IOCS _VDISPST +
- IOCS _CRTCRAS +
- IOCS _HSYNCST +
- IOCS _PRNINTST +
- IOCS _B_INTVCS+
  
 +  * trap #15(IOCS processing address table is also changed to VBR+$400)
 +  * IOCS _FNTGET
 +  * IOCS _OPMINTST
 +  * IOCS _TIMERDST
 +  * IOCS _VDISPST
 +  * IOCS _CRTCRAS
 +  * IOCS _HSYNCST
 +  * IOCS _PRNINTST
 +  * IOCS _B_INTVCS
x68000/trap_codes.1502674614.txt.gz · Last modified: 2019/08/27 20:44 (external edit)