Traps
A program talks to the operating system with TRAP instructions.
| Instruction | System | How the function is chosen |
|---|---|---|
TRAP #1 | GEMDOS (the disk and console operating system) | the function number is a word pushed on the stack, last, then the arguments in the order the call needs: move.w #$3d,-(sp) then trap #1 is Fopen |
TRAP #13 | BIOS | the same, with the BIOS numbers |
TRAP #14 | XBIOS (the extended BIOS) | the same, with the XBIOS numbers |
TRAP #2 | GEM: the AES and the VDI | d1 holds the address of a parameter block, and d0 is $C8 (200) for the AES or $73 (115) for the VDI |
The explorer names a call in a note on the TRAP instruction. For traps 1, 13 and 14 it looks at the instruction directly before: when that is move.w #n,-(sp) (or
clr.w -(sp), number 0) the note is the function’s name with the words from the push above. For trap 2 it looks for move.w #$C8,d0, move.w #$73,d0 or
the moveq form directly before. A number that was put there another way, or with other instructions between, is not followed: the note then says the call is a GEMDOS, BIOS
or XBIOS call without a name. It is a note only: the instruction text is not changed.
GEMDOS functions named
$00 Pterm0, $01 Cconin, $02 Cconout, $03 Cauxin, $04 Cauxout, $05 Cprnout, $06 Crawio, $07 Crawcin, $08 Cnecin,
$09 Cconws, $0A Cconrs, $0B Cconis, $0E Dsetdrv, $10 Cconos, $11 Cprnos, $12 Cauxis, $13 Cauxos,
$14 Maddalt, $15 Srealloc, $19 Dgetdrv, $1A Fsetdta, $20 Super, $2A Tgetdate, $2B Tsetdate, $2C Tgettime,
$2D Tsettime, $2F Fgetdta, $30 Sversion, $31 Ptermres, $36 Dfree, $39 Dcreate, $3A Ddelete, $3B Dsetpath,
$3C Fcreate, $3D Fopen, $3E Fclose, $3F Fread, $40 Fwrite, $41 Fdelete, $42 Fseek, $43 Fattrib,
$44 Mxalloc, $45 Fdup, $46 Fforce, $47 Dgetpath, $48 Malloc, $49 Mfree, $4A Mshrink, $4B Pexec,
$4C Pterm, $4E Fsfirst, $4F Fsnext, $56 Frename, $57 Fdatime.
The documentation lists many more numbers for MiNT, MagiC and network extensions (up to $1068 and beyond); those are not named.
BIOS functions named
0 Getmpb, 1 Bconstat, 2 Bconin, 3 Bconout, 4 Rwabs, 5 Setexc, 6 Tickcal, 7 Getbpb,
8 Bcostat, 9 Mediach, 10 Drvmap, 11 Kbshift.
XBIOS functions named
0 Initmouse, 1 Ssbrk, 2 Physbase, 3 Logbase, 4 Getrez, 5 Setscreen (VsetScreen on a Falcon), 6 Setpalette, 7 Setcolor,
8 Floprd, 9 Flopwr, 10 Flopfmt, 11 Dbmsg, 12 Midiws, 13 Mfpint, 14 Iorec, 15 Rsconf, 16 Keytbl,
17 Random, 18 Protobt, 19 Flopver, 20 Scrdmp, 21 Cursconf, 22 Settime, 23 Gettime, 24 Bioskeys,
25 Ikbdws, 26 Jdisint, 27 Jenabint, 28 Giaccess, 29 Offgibit, 30 Ongibit, 31 Xbtimer, 32 Dosound,
33 Setprt, 34 Kbdvbase, 35 Kbrate, 36 Prtblk, 37 Vsync, 38 Supexec, 39 Puntaes, 41 Floprate,
42 DMAread, 43 DMAwrite, 44 Bconmap, 46 NVMaccess, 47 Waketime.
The later numbers (the TT, Falcon, DSP, video and sound functions from 48 up) are in the documentation but are not named by the explorer.
Line-A
An instruction word from $A000 up is not a 68000 instruction: it raises the Line-A exception, which TOS uses for 16 graphics functions. The explorer notes them in order:
$A000 Initialization, $A001 Put pixel, $A002 Get pixel, $A003 Arbitrary line, $A004 Horizontal line, $A005 Filled rectangle,
$A006 Filled polygon, $A007 Bit block transfer, $A008 Text block transfer, $A009 Show mouse, $A00A Hide mouse,
$A00B Transform mouse, $A00C Undraw sprite, $A00D Draw sprite, $A00E Copy raster form, $A00F Seedfill. The documentation’s
list gives the sixteen names in this order and the pages for $A000 and $A00F give those two numbers; the numbers between them follow the order and were not read
on their own pages.
Not described
Known, not yet covered
- Reference: parameters, return values and the differences between TOS versions of each call are not described; the numbers come from the FreeMiNT TOS documentation pages through a summary. The AES and VDI function numbers inside their parameter blocks are not listed.
- Viewer: the push is found only directly before the TRAP; the AES/VDI parameter block is not followed.
Links
Reference
- GEMDOS function list – FreeMiNT TOS documentation
- BIOS function list – FreeMiNT TOS documentation
- XBIOS function list – FreeMiNT TOS documentation
- Line-A – FreeMiNT TOS documentation: the sixteen functions
- AES fundamentals – FreeMiNT TOS documentation: the call through TRAP #2
- VDI bindings – FreeMiNT TOS documentation: the call through TRAP #2