home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / MAGS / ICTARI09.ARJ / ictari.09 / ASSEMBLY / MACROS / MACRO_1 / TOSMACRO.TXT < prev   
Text File  |  1994-04-14  |  19KB  |  554 lines

  1.  
  2.  
  3.                   MACROs FOR TOS CALLS (GEMDOS, BIOS & XBIOS)
  4.                       Compiled by Peter Hibbs for ICTARI
  5.  
  6.                       For use with MACRO file TOSMACRO.S
  7.  
  8.     Version 1. 15-10-1993.
  9.  
  10.     Note that registers d0-d2 and  a0-a2   may   be  corrupted by all these
  11.     MACROs and should  be  saved   if   necessary  before  using any MACRO.
  12.     Register d0 is normally used  to   return   information from a TOS call
  13.     and is tested with the   tst.w   instruction immediately before exiting
  14.     each MACRO. If the function requires to  test  d0 for a value after the
  15.     call, a branch instruction can be  executed  without having to test the
  16.     register again. For  example  the   f_close   MACRO  returns a negative
  17.     value in d0.w if the call  failed   so   the main program can branch on
  18.     return from the MACRO as follows :-
  19.  
  20.                    f_close         try to close a file
  21.                    bmi     error   branch if negative value in d0.w
  22.  
  23.     Note, however,  that  if  the   value    is   returned   in   the whole
  24.     register (longword), it should be  tested  again  after returning  from
  25.     the MACRO. See ATARI documentation for  more  information  on  the  TOS
  26.     calls  and   file  MACROTUT.TXT  for   information   on   how   to  use
  27.     MACROs. The MACRO names used  in  this  file  are  the  same  as  those
  28.     used  in the back of the  DevPac   assembler manual  (except for mfpint
  29.     which  appears twice, XBIOS 31 has  been  changed to xbtimer)  and  the
  30.     parameters are used in the same order.
  31.  
  32.         ------------------------ GEMDOS (TRAP #1) ---------------------
  33.  
  34.       0 ($0)       Terminate process (old form)
  35.            p_term0
  36.  
  37.       1 ($1)       Read character from keyboard
  38.            c_conin
  39.            Result- d0.l=key code
  40.  
  41.       2 ($2)       Write character to screen
  42.            c_conout        char
  43.  
  44.       3 ($3)       Read character from serial port
  45.            c_auxin
  46.            Result- d0.b=character read
  47.  
  48.       4 ($4)       Write character to serial port
  49.            c_auxout        char
  50.  
  51.       5 ($5)       Write character to printer
  52.            c_prnout        char
  53.            Result- d0.w=0 if failed, =-1 if OK
  54.  
  55.       6 ($6)       Raw I/O to standard I/O
  56.            Input-  char=character to output or =$00FF to read
  57.            c_rawio         char
  58.            Result- d0.w if $00FF passed
  59.  
  60.       7 ($7)       Raw input from keyboard
  61.            c_rawcin
  62.            Result- d0.l=character read
  63.  
  64.       8 ($8)       Read character from keyboard, no echo
  65.            c_necin
  66.            Result- d0.l=character read
  67.  
  68.       9 ($9)       Write string to screen
  69.            c_conws         buffer_addr.l
  70.  
  71.       10 ($A)      Read edited string from keyboard
  72.            c_conrs         buffer_addr.l
  73.  
  74.       11 ($B)      Check status of keyboard
  75.            c_conis
  76.            Result- d0.l=-1 if character available, =0 if none
  77.  
  78.       12 ($C)      Set default drive
  79.            d_setdrv        drive_No
  80.            Result- d0.l=bit map of drives on system
  81.  
  82.       16 ($10)     Check status of standard output
  83.            c_conos
  84.            Result- d0.l=-1 if console ready, =0 if not ready
  85.  
  86.       17 ($11)     Check status of printer
  87.            c_prnos
  88.            Result- d0.l=-1 if ready, =0 if not ready
  89.  
  90.       18 ($12)     Check status of serial port input
  91.            c_auxis
  92.            Result- d0.l=-1 if character waiting, =0 if not
  93.  
  94.       19 ($13)     Check status of serial port output
  95.            c_auxos
  96.            Result- d0.l=-1 if ready, =0 if not ready
  97.  
  98.       20 ($14)     Informs GEMDOS of alternative memory (GEMDOS V0.25)
  99.            m_addalt        size.l,address.l
  100.            Result- d0.w=0 if OK, =error code if not OK
  101.  
  102.       25 ($19)     Get default drive
  103.            d_getdrv
  104.            Result- d0.w=drive number
  105.  
  106.       26 ($1A)     Set disk transfer address
  107.            f_setdta        buffer_address.l
  108.  
  109.       32 ($20)     Set Supervisor/User mode
  110.            super
  111.            Result- d0.l=old stack pointer (save for use with 'user' macro)
  112.  
  113.            user            old_stack.l
  114.  
  115.       42 ($2A)     Get date
  116.            t_getdate
  117.            Result- d0.w=date value
  118.  
  119.       43 ($2B)     Set date
  120.            t_setdate       date
  121.            Result- d0.w=0 if OK =error code if not
  122.  
  123.       44 ($2C)     Get time
  124.            t_gettime
  125.            Result- d0.w=time value
  126.  
  127.       45 ($2D)     Set time
  128.            t_settime       time
  129.  
  130.       47 ($2F)     Get disk transfer address
  131.            f_getdta
  132.            Result- d0.l=pointer to disk transfer address
  133.  
  134.       48 ($30)     Get version number
  135.            s_version
  136.            Result- d0.w=GEMDOS version number
  137.  
  138.       49 ($31)     Terminate and stay resident
  139.            p_termres       ret_code,bytes.l
  140.  
  141.       54 ($36)     Get drive free space
  142.            d_free          drive,buffer.l
  143.  
  144.       57 ($39)     Create a sub-directory
  145.            d_create        address.l
  146.            Result- d0.w=0 if OK =error code if not
  147.  
  148.       58 ($3A)     Delete a sub-directory
  149.            d_delete        address.l
  150.            Result- d0.w=0 if OK, =error code if not
  151.  
  152.       59 ($3B)     Set current directory
  153.            d_setpath       address.l
  154.            Result- d0.w=0 if OK, =error code if not
  155.  
  156.       60 ($3C)     Create a file
  157.            f_create        attribute,filename.l
  158.            Result- d0.w=file handle if OK, d0.l=error code if not
  159.  
  160.       61 ($3D)     Open a file
  161.            f_open          attribute,filename.l
  162.            Result- d0.w=file handle if OK, d0.l=error code if not
  163.  
  164.       62 ($3E)     Close a file
  165.            f_close         fhandle
  166.            Result- d0.w=0 if OK, =error code if not
  167.  
  168.       63 ($3F)     Read a file
  169.            f_read          buffer.l,count.l,fhandle
  170.            Result- d0.l=number of bytes read or error code
  171.  
  172.       64 ($40)     Write a file
  173.            f_write         buffer.l,count.l,fhandle
  174.            Result- d0.l=number of bytes written or error code
  175.  
  176.       65 ($41)     Delete a file
  177.            f_delete        filename.l
  178.            Result- d0.w=0 if OK, =error code if not
  179.  
  180.       66 ($42)     Seek file pointer
  181.            f_seek          mode,fhandle,offset.l
  182.            Result-d0.l=absolute position in file after seek
  183.  
  184.       67 ($43)     Get/set file attributes
  185.            f_attrib        attribute,get/set,address.l
  186.            Result- d0.w=new attributes or error code
  187.  
  188.       69 ($45)     Duplicate file handle
  189.            f_dup           standard_handle
  190.            Result- d0.w=new handle or error code
  191.  
  192.       70 ($46)     Force file handle
  193.            f_force         nstdh,stdh
  194.            Result- d0.w=0 if OK, =error code if not OK
  195.  
  196.       71 ($47)     Get current directory
  197.            d_getpath       drive,address
  198.            Result- d0.w=0 if OK, =error code if not
  199.  
  200.       72 ($48)     Allocate memory
  201.            m_alloc         size.l
  202.            Result- d0.l=start address of allocated memory or 0 if error
  203.  
  204.       73 ($49)     Free allocated memory
  205.            m_free          address.l
  206.            Result- d0.w=0 if OK, =error code if not
  207.  
  208.       74 ($4A)     Shrink allocated memory
  209.            m_shrink        newsize.l,block.l
  210.            Result- d0.w=0 if OK, =error code if not
  211.  
  212.       75 ($4B)     Load or execute a program
  213.            p_exec          environ.l,command.l,filename.l,mode
  214.            Result- d0.l depends on mode
  215.  
  216.       76 ($4C)     Terminate program
  217.            The macro on its own returns a value of zero to calling program
  218.            If a value follows the macro, that value is returned.
  219.  
  220.            p_term          return_code or nothing
  221.  
  222.       78 ($4E)     Search for first
  223.            f_sfirst        attribute,filespec.l
  224.            Result- d0.w=0 if found, =-33 if not found
  225.  
  226.       79 ($4F)     Search for next occurrence
  227.            f_snext
  228.            Result- d0.w=0 if found, =-33 if not found
  229.  
  230.       86 ($56)     Rename file
  231.            f_rename        newname.l,oldname.l
  232.            Result- d0.w=0 if OK, =error code if not
  233.  
  234.       87 ($57)     Get/Set file Date & Time stamp
  235.            f_datime        mode,fhandle,buffer.l
  236.  
  237.  
  238.         ------------------------BIOS (TRAP #13) -------------------------
  239.  
  240.       0 ($0)       Get memory parameter block
  241.            getmpb          pointer.l
  242.  
  243.       1 ($1)       Return device input status
  244.            bconstat        device
  245.            Result- d0.w=0 no characters, =-1 at least one character ready
  246.  
  247.       2 ($2)       Read a character from a device
  248.            bconin          device
  249.            Result- d0.l=character found
  250.  
  251.       3 ($3)       Write a character to a device
  252.            bconout         character,device
  253.            Result- d0.w=0 if OK, =error code if not OK
  254.  
  255.       4 ($4)       Read/Write logical sectors on a device
  256.            rwabs           drive,recno,count,buffer.l,mode
  257.            Result- d0.w=0 if OK, =error code if not OK
  258.  
  259.       5 ($5)       Set exception vector
  260.            setexc          vecaddress.l,vecnum
  261.            Result- d0.l=old vector entry
  262.  
  263.       6 ($6)       Get system timer tick interval
  264.            tickcal
  265.            Result- d0.l=timer calibration in milliseconds
  266.  
  267.       7 ($7)       Get BIOS parameter block for a device
  268.            getbpb          deviceno
  269.            Result- d0.l=pointer to the BPB for this device, =0 if error
  270.  
  271.       8 ($8)       Return device output status
  272.            bcostat         deviceno
  273.            Result- d0.w=0 if device not ready
  274.  
  275.       9 ($9)       Return media change status
  276.            mediach         deviceno
  277.            Result- d0.w=0 media definitely NOT changed
  278.                    d0.w=1 media may have been changed
  279.                    d0.w=2 media definitely HAS changed
  280.  
  281.       10 ($A)      Return bitmap of mounted drives
  282.            drvmap
  283.            Result- d0.l=bitmap of mounted drives (bit 0=drive A)
  284.  
  285.       11 ($B)      Find state of keyboard 'shift' keys
  286.            kbshift         mode
  287.            Result- d0.w=bitmap of state before call
  288.  
  289.          -------------------- Extended BIOS (TRAP #14) ----------------
  290.  
  291.       0 ($0)       Set mouse mode and packet handler
  292.            initmous        mode,parameter.l,vector.l
  293.  
  294.       2 ($2)       Get physical screen address
  295.            physbase
  296.            Result- d0.l=start of physical screen address
  297.  
  298.       3 ($3)       Get logical screen address
  299.            logbase
  300.            Result- d0.l=start of logical screen address
  301.  
  302.       4 ($4)       Get screen resolution
  303.            getrez
  304.            Result- d0.w=screen resolution (0-7)
  305.  
  306.       5 ($5)       Set screen address & mode
  307.            setscreen       mode,physaddress.l,logaddress.l
  308.  
  309.       6 ($6)       Set display palette
  310.            setpalette      pointer.l
  311.  
  312.       7 ($7)       Set display palette
  313.            setcolor        color,colnumber
  314.  
  315.       8 ($8)       Read sectors from floppy disk
  316.            floprd          count,sideno,trackno,sectno,driveno,buffer.l
  317.            Result- d0.w=0 if OK, =error code if not
  318.  
  319.       9 ($9)       Write sectors to floppy disk
  320.            flopwr          count,sideno,trackno,sectno,driveno,buffer.l
  321.            Result- d0.w=0 if OK, =error code if not
  322.  
  323.       10 ($A)      Format a track on a floppy disk
  324.            flopfmt         newdata,magic.l,interlv,sideno,trackno,sector,
  325.                            driveno,buffer.l
  326.            Result- d0.w=0 if OK, =error code if not
  327.  
  328.       12 ($C)      Write string to MIDI port
  329.            midiws          pointer.l,count
  330.  
  331.       13 ($D)      Set the MFP interrupt handler
  332.            mfpint          address.l,number
  333.  
  334.       14 ($E)      Find serial device I/O structure
  335.            iorec           device
  336.            Result- d0.l=pointer to I/O record
  337.  
  338.       15 ($F)      Configure RS232 port
  339.            rsconf          scr,tsr,rsr,ucr,ctrl,baud
  340.            Result- d0.l=old 68901 configuration
  341.  
  342.       16 ($10)     Get/Set keyboard translation table
  343.            keytbl          caps.l,shift.l,unshift.l
  344.            Result- d0.l=pointer to structure
  345.  
  346.       17 ($11)     Get random number
  347.            random
  348.            Result- d0.l=random number
  349.  
  350.       18 ($12)     Build prototype boot sector
  351.            protobt         execflag,disktype,serialno.l,buffer.l
  352.  
  353.       19 ($13)     Verify sectors from a floppy disk
  354.            flopver         count,sideno,trackno,sectno,driveNo,buffer.l
  355.            Result- d0.w=0 if OK, =error code if not OK
  356.  
  357.       20 ($14)     Copy screen to printer
  358.            scrdmp
  359.  
  360.       21 ($15)     Configure VT52 cursor
  361.            cursconf        flash,function
  362.            Result- d0.w=old flash rate (if function 5)
  363.  
  364.       22 ($16)     Set IKBD time
  365.            settime         time
  366.  
  367.       23 ($17)     Get IKBD time
  368.            gettime
  369.            Result- d0.l=time/date
  370.  
  371.       24 ($18)     Reset keyboard translation tables
  372.            bioskeys
  373.  
  374.       25 ($19)     Write string to keyboard processor
  375.            ikbdws          pointer.l,number
  376.  
  377.       26 ($1A)     Disable 68901 interrupt
  378.            jdisint         number
  379.  
  380.       27 ($1B)     Enable 68901 interrupt
  381.            jenabint        number
  382.  
  383.       28 ($1C)     Read/Write sound chip registers
  384.            giaccess        register,data
  385.            Result- d0.w=value of register
  386.  
  387.       29 ($1D)     Reset bit on port A of sound chip
  388.            offgbit         bit_mask
  389.  
  390.       30 ($1E)     Set bit on port A of sound chip
  391.            ongibit         bit_mask
  392.  
  393.       31 ($1F)     Configure MFP timer
  394.            xbtimer         vector.l,data,cntrl,timer
  395.  
  396.       32 ($20)     Initialise sound daemon
  397.            dosound         pointer.l
  398.  
  399.       33 ($21)     Set/Get printer configuration
  400.            setprt          config
  401.            Result- d0.w=old configuration
  402.  
  403.       34 ($22)     Get system ACIA dispatch handler
  404.            kbdvbase
  405.            Result- d0.l=pointer to structure
  406.  
  407.       35 ($23)     Get/Set keyboard repeat & delay
  408.            kbrate          repeat,delay
  409.            Result- d0.w=old delay rate & old repeat rate
  410.  
  411.       36 ($24)     Print bitmap
  412.            prtblk          pointer.l
  413.            Result- d0.w=error status
  414.  
  415.       37 ($25)     Wait for vertical sync to occur
  416.            vsync
  417.  
  418.       38 ($26)     Call supervisor routine
  419.            supexec         where.l
  420.  
  421.       39 ($27)     Discard AES
  422.            puntaes
  423.  
  424.     -----------------------------------------------------------------------
  425.     List of MACRO definitions grouped in functions
  426.  
  427.     Input/output.
  428.  
  429.            c_conin
  430.            c_conout        char
  431.            c_auxin
  432.            c_auxout        char
  433.            c_prnout        char
  434.            c_rawio         char
  435.            c_rawcin
  436.            c_necin
  437.            c_conws         buffer_addr.l
  438.            c_conrs         buffer_addr.l
  439.            c_conis
  440.            c_conos
  441.            c_prnos
  442.            c_auxis
  443.            c_auxos
  444.            bconstat        device
  445.            bconin          device
  446.            bconout         character,device
  447.            getbpb          deviceno
  448.            bcostat         deviceno
  449.            kbshift         mode
  450.            midiws          pointer.l,count
  451.            iorec           device
  452.            rsconf          scr,tsr,rsr,ucr,ctrl,baud
  453.            keytbl          caps.l,shift.l,unshift.l
  454.            bioskeys
  455.            ikbdws          pointer.l,number
  456.            setprt          config
  457.  
  458.     Program termination.
  459.  
  460.            p_term0
  461.            p_termres       ret_code,bytes.l
  462.            p_term          return_code or nothing
  463.  
  464.     Disk Handling.
  465.  
  466.            d_setdrv        drive_No
  467.            d_getdrv
  468.            f_setdta        buffer_address.l
  469.            f_getdta
  470.            d_free          drive,buffer.l
  471.            d_create        address.l
  472.            d_delete        address.l
  473.            d_setpath       address.l
  474.            f_create        attribute,filename.l
  475.            f_open          attribute,filename.l
  476.            f_close         fhandle
  477.            f_read          buffer.l,count.l,fhandle
  478.            f_write         buffer.l,count.l,fhandle
  479.            f_delete        filename.l
  480.            f_seek          mode,fhandle,offset.l
  481.            f_attrib        attribute,get/set,address.l
  482.            f_dup           standard_handle
  483.            f_force         nstdh,stdh
  484.            d_getpath       drive,address
  485.            f_sfirst        attribute,filespec.l
  486.            f_snext
  487.            f_rename        newname.l,oldname.l
  488.            f_datime        mode,fhandle,buffer.l
  489.            rwabs           drive,recno,count,buffer.l,mode
  490.            mediach         deviceno
  491.            drvmap
  492.            floprd          count,sideno,trackno,sectno,driveno,buffer.l
  493.            flopwr          count,sideno,trackno,sectno,driveno,buffer.l
  494.            flopfmt         newdata,magic.l,interlv,sideno,trackno,sector,
  495.                            driveno,buffer.l
  496.            protobt         execflag,disktype,serialno.l,buffer.l
  497.            flopver         count,sideno,trackno,sectno,driveNo,buffer.l
  498.  
  499.     Time and timer functions.
  500.  
  501.            t_getdate
  502.            t_setdate       date
  503.            t_gettime
  504.            t_settime       time
  505.            tickcal
  506.            settime         time
  507.            gettime
  508.            xbtimer         vector.l,data,cntrl,timer
  509.            vsync
  510.  
  511.     Interrupt and exception vector control.
  512.  
  513.            setexc          vecaddress.l,vecnum
  514.            mfpint          address.l,number
  515.            jdisint         number
  516.            jenabint        number
  517.  
  518.     Screen and palette control.
  519.  
  520.            physbase
  521.            logbase
  522.            getrez
  523.            setscreen       mode,physaddress.l,logaddress.l
  524.            setpalette      pointer.l
  525.            setcolor        color,colnumber
  526.  
  527.     Memory control.
  528.  
  529.            m_addalt        size.l,address.l
  530.            m_alloc         size.l
  531.            m_free          address.l
  532.            m_shrink        newsize.l,block.l
  533.            getmpb          pointer.l
  534.  
  535.     Miscellaneous.
  536.  
  537.            super
  538.            user            old_stack.l
  539.            s_version
  540.            p_exec          environ.l,command.l,filename.l,mode
  541.            initmous        mode,parameter.l,vector.l
  542.            random
  543.            scrdmp
  544.            cursconf        flash,function
  545.            giaccess        register,data
  546.            offgbit         bit_mask
  547.            ongibit         bit_mask
  548.            dosound         pointer.l
  549.            kbdvbase
  550.            kbrate          repeat,delay
  551.            prtblk          pointer.l
  552.            supexec         where.l
  553.            puntaes
  554.