•  Back 
  •  MagiC PC interface 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : TOS - The Operating System
Author      : 
Version     : tos.hyp (December 19, 2008)
Subject     : Programmieren/Atari
Nodes       : 3010
Index Size  : 93790
HCP-Version : 5
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Title
@help       : 
@options    : +g -i -s +x +zz -t4
@width      : 70
View Ref-File12.2.2  mec1 interface                                             TOS

  1. Concept

     The mec1 interface makes it possible to call functions predefined 
     by the emulator in Motorola code. In principle it is similar to 
     the mec0 (MPS) interface, though the functions are not freely 
     definable in a DLL but already predefined by the emulator. Call: 
     The functions are called uniformly by the opcode $43bf, followed 
     by a function number, thus with 4 bytes total length. Example:

     dc.w $43bf,$0031

     calls the mec1 function with the number 0x31. ($43bf is the 
     opcode for chk <ea>,d1, with <ea> = 111111 binary, so invalid). 
     Parameter passing is, as with mec0, via the Motorola registers.

  2. The functions

      $0001   long emu_version:

               Parameters:  None 
               Return:      d0: Version number 
                            d1: Version date 
                            d2: Bit0: Is it a demo-version? 

      $0002   long emu_enquire: Obtains diverse information

               Parameters:  long d0: What do you want to know? 
               Return:      long d0: Value 

              bisher definiert:

               was:  1: Version number 
                     2: Version date 
                     3: Is it a demo? 

      $0003   void emu_getexepath: Obtains the full path (including 
              drive, without MAGIC_PC.EXE)

               Parameters:  a0: char *bufadr (Buffer) 
                            d0: short nb_max (Max. bytecount for buffer) 

      $0004   int emu_install_newvdi:

               Parameters:  a0: Byte *bufadr (New contents of NVDI_PC.DLL) 
                            d0: long nbytes  (Length) 
               Return:      d0: >0:  NVDI_PC.DLN sucessfully created. 
                            At next runup it will be automatically 
                            renamed to NVDI_PC.DLL, as discussed. 

      $0010   void dw_addline:  ! As of 03.97

              Output text in new line in the debug window

               Parameters:  a0: Pointer to the text. 

      $0011   void dw_addtext:  ! As of 03.97

              Output text in debug window

               Parameters:  a0: Pointer to the text 

      $0011   void dw_formtxt:  ! As of 03.97

              Output text sprintf-like in debug window

               Parameters:  a0: Pointer to the format-string 
                            d0, d1, ...  Additional parameters suitable 
                            for the format-string. The format-string 
                            corresponds roughly to sprintf(format,...); 
                            string pointers are not allowed, however. 

      $0031   int printer_open  ! As of 03.97

              printer_open Opens the standard printer and starts a new 
              document

               Parameters:  a0: char *DocName (NULL-pointer allowed) 
               Return:      d0>0: All OK 
                            d0<=0 Error 

      $0032   int printer_close  ! As of 03.97

              printer_close Terminates the previously opened document 
              and closes the printer

               Parameters:  None 
               Return:      d0>0: All OK 
                            d0<=0 Error 

      $0033   int printer_write  ! As of 03.97

               Parameters:  a0: Byte *pData;  // Pointer to the data buffer 
                            d0: long nBytes;  // No. of bytes in buffer 
               Return:      d0: Number of bytes transferred 

      $0040   DWORD getTickCount  ! As of 03.97

               Return:  d0: TickCount (msec since start of the computer) 

      $0041   DWORD getDrivePath  ! ab 02.99

              The function obtains the Windows path for a MagiC drive

               Parameters:  d0: Drive No. (0 for A:, 1 for B:, ...) 
                            a0: Text buffer for the path 
                            d1: Size of the text buffer 
               Return:      d0: 0: Not found, 
                                1: Container drive, 
                                2: xfs drive (Windows drive) 
                                4: Floppy drive 

      $0042   DWORD setClipboardDir  ! ab 02.99

               Parameters:  a0: char *pPath // NULL: Set to default 
               Return:      d0: 1 

              Beispiel:

                      movea.l stringadr,a0    *
                      dc.w    $43bf,$0042     * mec1, call function $42
                      tst.l   d0              * -1: Function not implemented
                      jl  nichtimplementiert

      $0043   long getMouseWheel

               Parameters:  d0.l: 1: Reset position after readout 
                                  0: Don't reset position after readout 
               Return:      d0.l: Current position of the mouse-wheel 

              Beispiel:

                      moveq   #1,d0       * Reset position after readout
                      dc.w    $43bf,$0043 * mec1, call function $43
                      tst.l   d0          * Position altered since last reset
                      je  no_action
                      <d0.l verarbeiten>

      $0045   long setCompiler  ! As of 17.06.99

               Parameters:  d0.l: Selection; realised at present: 
                            d0 = 1: Switch compiler on/off: 
                            ----- 
                            d1 = 0: Compiler off, 
                            d1 = 1: Compiler on 
                            d1 = -1: Query mode (from my experience 
                                     this does not work, but it ought 
                                     to work in the 6.20 version) 
               Return:      Old mode (0 or 1)