home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / utility / disk / pdos_112 / dos_defs.s < prev    next >
Text File  |  1993-07-29  |  28KB  |  677 lines

  1. *******************************************************************************
  2. * PowerDOS, an operating system by Chris Latham, Copyright (C) 1992
  3. * This file is the PowerDOS System global definitions
  4. *
  5. *     Begun on 01-10-92
  6. *
  7. * Completed on 04-04-92
  8. *
  9. * Revision history:
  10. *   Date            Comment
  11. ****************************************************************************
  12.  
  13.     opt    C16-
  14.     opt    O+
  15.     opt    OW-
  16.  
  17. * The three OS vectors we are concerned with
  18. v_trap1    equ    $84    BDOS vector
  19. v_trap13    equ    $b4    BIOS vector
  20. v_trap14    equ    $b8    XBIOS vector
  21.  
  22.  
  23. * ST global system variables
  24.  
  25. etv_timer    equ    $400    AES timer (not used by PowerDOS)
  26. etv_critic    equ    $404    Critical error handler vector
  27. etv_term    equ    $408    AES terminate vector
  28. *    equ    $40c
  29. *    equ    $410
  30. *    equ    $414    Expansion Vectors as defined by Atari
  31. *    equ    $418
  32. *    equ    $41c
  33.  
  34. * Globals used by PowerDOS (these must be located in an absolute location
  35. * for quick access without the need for a base register)
  36. Sys_vars    equ    $416    Points to global system variables
  37. S_int_flag    equ    $41a    Interupt in progress flag
  38. S_startproc    equ    $41b    Start next process flag
  39. S_ticks    equ    $41c    #%0001000100010001 (tick rotate mask)
  40. dmasem    equ    $41e    DMA semaphore
  41.  
  42. memvalid    equ    $420    Contains $752019f3 for validation
  43. memctrl    equ    $424    Copy of mem controller config value
  44. _resvalid    equ    $426    Contains $31415926 if reset vector valid
  45. _resvector    equ    $42a    If $426 valid, jump through this vector
  46. phystop    equ    $42e    Physical top of memory
  47. _membot    equ    $432    Begin of TPA
  48. _memtop    equ    $436    End of TPA
  49. memval2    equ    $43a    Another magic number $237698aa
  50. flock    equ    $43e    Disk access in progress
  51. seekrate    equ    $440    Floppy seek rate
  52. _timer_ms    equ    $442    Tick length in ms (20)
  53. _fverify    equ    $444    If not zero, verify floppy
  54. _bootdev    equ    $446    Device system was booted from
  55. palmode    equ    $448    If not zero, set to 50hz pal mode
  56. defshiftmod    equ    $44a    0=low, 1=medium (for color only)
  57. sshiftmod    equ    $44c    $000,$100,$200 (low, med, high)
  58. _v_bas_ad    equ    $44e    Logical screen base
  59. vblsem    equ    $452    If zero, no vblank routine
  60. nvbls    equ    $454    Number of vblank routines (8)
  61. _vbqueue    equ    $456    Points to vblank vectors
  62. colorptr    equ    $45a    Points to new color palette or 0
  63. screenpt    equ    $45e    Points to new screen to set, or 0
  64. _vbclock    equ    $462    Number of vbl interupts
  65. _frclock    equ    $466    Number of vbl routines executed
  66. hdv_init    equ    $46a    Vector for hard drive initialization
  67. swv_vec    equ    $46e    Vector for change in screen res
  68. hdv_bpb    equ    $472    Vector to fetch bpb for drives
  69. hdv_rw    equ    $476    Vector for drive read/write
  70. hdv_boot    equ    $47a    Vector for drive reboot
  71. hdv_mediach    equ    $47e    Vector to test for drive change
  72. _comload    equ    $482    If not 0, execute "COMMAND.PRG"
  73. conterm    equ    $484    Byte defining console attributes
  74. shiftstat    equ    $485    Byte containing shift/cntrl/alt status
  75. trp14ret    equ    $486    Trap #14 return address (unused)
  76. criticret    equ    $48a    Return address for critical error
  77. themd    equ    $48e    Initial Memory discriptor
  78. __md    equ    $49e    (???)
  79. savptr    equ    $4a2    Points to reg save area for (x)bios calls
  80. _nflops    equ    $4a6    Number of connected floppies
  81. con_state    equ    $4a8    Vector for screen output
  82. save_row    equ    $4ac    Temp storage for cursor
  83. sav_context    equ    $4ae    Location of context after a crash
  84. _bufl    equ    $4b2    Points to head of BCB list
  85. cache_ptr    equ    $4b6    Points to first cashe header, or 0
  86. _hz_200    equ    $4ba    Counter for 200 hz system clock
  87. the_env    equ    $4be    Default environment string $00000000
  88. _drvbits    equ    $4c2    Bit map of connected drives
  89. _dskbufp    equ    $4c6    Points to a 1024 byte disk buffer
  90. _autopath    equ    $4ca    Points to autoexec path (0)
  91. _vbl_list    equ    $4ce    8 longs, vbl vectors
  92. _dumpflg    equ    $4ee    Flag to start a screen dump
  93. _prtabt    equ    $4f0    Printer abort flag
  94. _sysbase    equ    $4f2    Start of the OS
  95. _shell_p    equ    $4f6    Global shell info (???)
  96. end_os    equ    $4fa    End of OS (if ram based), start of TPA
  97. exec_os    equ    $4fe    Exec address of AES
  98.  
  99. * Next is used to determine if an extended exception stack frame is used.
  100. _longframe    equ    $59e    0 if 68000, else 020, 030, 040, etc.
  101.  
  102. * System cookie jar
  103. _p_cookies    equ    $5a0    0 if no cookie jar, else ptr to jar
  104.  
  105. * Value used to validate reset vector
  106. RESMAGIC    equ    $31415926
  107.  
  108. * The following are needed to determine the logical sector size if
  109. * cache sectors are to be installed.
  110. pun_ptr    equ    $516    Points to Physical Units info
  111. Defsize    equ    512    Default sector size
  112. maxunits    equ    16    Max units (at least for pun storeage)
  113.  
  114.     RSRESET
  115. puns    rs.w    1    Total units in system
  116. pun    rs.b    maxunits    Physical unit for each logical unit
  117. part_start    rs.l    maxunits    Start of partition on the physical unit
  118. P_cookie    rs.l    1    Cookie if AHDI 3.0 or later is installed
  119. P_cookptr    rs.l    1    Points back to cookie to validate it
  120. P_version    rs.w    1    Who knows?
  121. P_max_sec    rs.w    1    Max sector size being handled
  122.  
  123. * Macro to allow interupt routines to perform an s_send function without
  124. * causing unfreindly trap #1 grabbers to kill the system. What it does
  125. * is to save the current trap #1 vector on the stack, then replace it
  126. * with the known good vector of PowerDOS. After the call, the original vector
  127. * is restored. Note: uses a0, so it should not be one of the parameters
  128. * of the s_send call.
  129. int_s_send    macro
  130.     move.l    (v_trap1).w,-(sp)    Save original trap #1 vector
  131.     move.l    (Sys_vars).w,a0    Get pointer to system vars
  132.     move.l    G_trap1(a0),(v_trap1).w    Put safe trap #1
  133.     s_send    \1,\2        Perform s_send call
  134.     move.l    (sp)+,(v_trap1).w    Restore original trap #1 vector
  135.     endm
  136.  
  137. * Error codes
  138.  
  139. Edskchg    equ    -14    Disk in drive was changed
  140.  
  141. Einvfn    equ    -32    Invalid function number
  142. Efilnf    equ    -33    File not found
  143. Epthnf    equ    -34    Pathname not found
  144. Enhndl    equ    -35    No file handles left
  145. Eaccdn    equ    -36    Access denied
  146. Eihndl    equ    -37    Invalid handle number
  147. Ensmem    equ    -39    Not enough memory left
  148. Eimba    equ    -40    Invalid memory block address
  149. Edrive    equ    -46    Invalid drive specification
  150. Enmfil    equ    -49    No more matching files
  151.  
  152. Ebnam    equ    -52    Bad pathname element
  153. Efaterr    equ    -53    Error with FAT table
  154. Edskfull    equ    -54    Disk is full
  155. Elpcl    equ    -55    Clusters looped
  156. Erootful    equ    -56    Root directory is full
  157. Edirex    equ    -57    Directory already exists
  158. Elocked    equ    -58    Record is locked
  159. Enslock    equ    -59    Can't find requested lock to remove
  160. Eeof    equ    -60    End of file
  161. Etime    equ    -61    Device timed out
  162. Epermit    equ    -62    Permission violation
  163. Enovol    equ    -63    No volume name, can't change attributes
  164.  
  165. Erange    equ    -64    Range error
  166. Eintrn    equ    -65    Internal error
  167. Eplfmt    equ    -66    Invalid program load format
  168. Egsbf    equ    -67    Setblock failure
  169.  
  170. Eunknp    equ    -70    Unknown process
  171. Edeadpr    equ    -71    ID is for dead process
  172. Enochld    equ    -72    Process has no children
  173. Etabfull    equ    -73    IO device table is full
  174. Efmddne    equ    -74    File manager or device driver non-existant
  175. Eprocnf    equ    -75    Process with this name not found
  176. Eioqs    equ    -76    Process already part of this ioqueue chain
  177. Eqnf    equ    -77    Queue not found (by name)
  178. Eunknq    equ    -78    Unknown queue (by queue_id)
  179. Eqinuse    equ    -79    Queue in use; can't delete
  180. Eqempty    equ    -80    Queue has no message or count available
  181. Eqexist    equ    -81    Can't create; queue w/ same name exists
  182. Epipex    equ    -82    Can't create; pipe w/ same name exists
  183. Epipenf    equ    -83    Named pipe not found for open
  184. Epipewrt    equ    -84    Pipe write error: written data can't be read
  185. Enodev    equ    -85    No device for given device number
  186. Enomdev    equ    -86    No devices with given number or higher
  187. Eorphan    equ    -87    Process is an orphan; it has no parent
  188. Enosighand    equ    -88    Process has no signal handler installed
  189.  
  190. * Base page offsets
  191.  
  192. P_lowtpa    equ    0    Base address of the TPA
  193. P_hitpa    equ    4    End of TPA+1
  194. P_tbase    equ    8    Base address of text segment
  195. P_tlen    equ    $C    Length of text segment
  196. P_dbase    equ    $10    Base address of data segment
  197. P_dlen    equ    $14    Length of data segment
  198. P_bbase    equ    $18    Base address of BSS
  199. P_blen    equ    $1C    Length of BSS
  200. P_DTA    equ    $20    Points to programs DTA
  201. P_parent    equ    $24    Points to parents base page
  202. P_prgflags    equ    $28    Program flags from the file header 
  203. P_env    equ    $2C    Pointer to environment string
  204. P_fakeenv    equ    $68    If no env ptr, fake one is placed here
  205. P_prgname    equ    $6c    Name of the program (ASCIIZ string)
  206. P_neofix    equ    $7c    Pointer to caller's PC for p_exec #0 call
  207. P_cmdlin    equ    $80    Start of command line
  208.  
  209. * File header format
  210.  
  211. H_flag    equ    0    Header type flag (601A)
  212. H_tlen    equ    2    Length of text segment
  213. H_dlen    equ    6    Length of data degment
  214. H_blen    equ    $A    Length of BSS segment
  215. H_slen    equ    $E    Length of symbol table
  216. H_rsv1    equ    $12    Reserved 1
  217. H_flags    equ    $16    Flags for altering loading conditions
  218. H_nreloc    equ    $1A    Non zero if no relocation bytes
  219. H_btext    equ    $1C    Beginning of text segment
  220.  
  221.  
  222. * Process descriptor definitions
  223.  
  224. Num_files    equ    32    Number of open files per process
  225.  
  226.     RSRESET
  227.  
  228. PD_ID    rs.w    1    Process ID
  229. PD_parent    rs.w    1    Parent's ID
  230. PD_sibling    rs.w    1    Sibling's ID
  231. PD_child    rs.w    1    First child's ID
  232. PD_group    rs.w    1    Group ID
  233. PD_user    rs.w    1    User ID
  234. PD_priority    rs.w    1    Process priority
  235. PD_age    rs.w    1    Process age
  236. PD_status    rs.b    1    Process execution status
  237. PD_queueID    rs.b    1    Current queue (sleep, wait or active)
  238. PD_basepage    rs.l    1    First memory block of process (basepage)  
  239. PD_max_mem    rs.l    1    Max mem size returned for Malloc #-1
  240. PD_ucall    rs.w    1    Last user state function call executed
  241. PD_scall    rs.w    1    Last system state function call executed
  242. PD_uticks    rs.l    1    Number of user state ticks elapsed
  243. PD_sticks    rs.l    1    Number of system state ticks elapsed
  244. PD_sleep    rs.l    1    Count of ticks to remain sleeping
  245. PD_datetime    rs.l    1    Date and time process started
  246. PD_fcalls    rs.l    1    Number of function calls executed
  247. PD_iocalls    rs.l    1    Number of i/o calls executed
  248. PD_rbytes    rs.l    1    Number of bytes read
  249. PD_wbytes    rs.l    1    Number of bytes written
  250. PD_vector    rs.l    1    User defined vector
  251. PD_dta    rs.l    1    Disk transfer address
  252. PD_name    rs.b    14    Name of process
  253. PD_devname    rs.b    8    Process current device name (currently only A, B, C, etc.)
  254. PD_files    rs.w    Num_files    Process local path handles
  255. PD_reentry    rs.b    1    Count of number of levels of reenterancy
  256. PD_attrib    rs.b    1    Various attributes
  257. PD_memblk    rs.w    1    Index of head of procs mdb's
  258. PD_pqueue    rs.l    1    Previous process queue pointer
  259. PD_nqueue    rs.l    1    Next process queue pointer
  260. PD_pioq    rs.w    1    ID of previous process in i/o queue
  261. PD_nioq    rs.w    1    ID of next process in i/o queue
  262. PD_q_ptr    rs.l    1    Pointer or flag for queue functions
  263. PD_intcpt    rs.l    1    Address of signal intercept routine
  264. PD_intcptv    rs.l    1    Address of vars needed for intercept
  265. PD_signal    rs.l    1    Signal code that caused death
  266. PD_stack    rs.l    1    Process stack pointer
  267. PD_reg_save    rs.l    1    Pointer to current (X)BIOS register save
  268. PD_trap1    rs.l    1    Save area for "dirty" trap one vector
  269. PD_macpath    rs.l    1    Pointer to a partial path to use
  270. * See the Macro Path definitions further on. Set to zero if a macro is
  271. * not being used, else is a pointer to the macro data structure.
  272. PD_defdirs    rs.l    26    Default directory of up to 26 drives
  273. * Dir's first cluster number, 0 for root. Copied from parent when created
  274. * Most file managers that use this feature require only words; but a long
  275. * is allocated because of the future possibility of an HCFS file manager.
  276. PD_status2    rs.b    1    Place for new attributes to be stored
  277. PD_reserve1    rs.b    1
  278. PD_reserve2    rs.w    18    Space for additions in the future...
  279. PD_stackbot    rs.b    1000    Process supervisor stack space
  280. PD_sstack    equ    __RS    Top of process supervisor stack
  281.     rs.b    162    Allow for 3 levels of reentrancy to (X)BIOS
  282. PD_bios_sav    equ    __RS
  283. PD_size    equ    __RS    Size of process descriptor
  284.  
  285. * Process descriptor block allocation size. First long is pointer to next
  286. * block. Ten process descriptors per block allocated
  287. PD_alloc    equ    4+PD_size*10
  288.  
  289. * Status flag bits (for PD_status)
  290.  
  291. Sys_state    equ    0    Executing in system state
  292. Wake_sig    equ    1    Process has pending wakeup signal
  293. Time_out    equ    2    Time slice has expired
  294. Subtask    equ    3    Process is a subtask of parent
  295. Pexec4    equ    4    Assign base memory to parent on exit
  296. Condemn    equ    5    Process is condemned
  297. Concurrent    equ    6    Task is running concurrently with parent
  298. Deskthread    equ    7    Set if process is Desktop process or decendent
  299.  
  300. * Bit definitions for PD_attrib
  301.  
  302. B_redirect    equ    0    Have BIOS check for con redirection
  303. N_redirect    equ    1    Make negative handles redirect
  304. proc_trace    equ    3    If set, jump through trace vector on function call
  305.  
  306. * Status flag bits for PD_status2
  307. s2_preempt    equ    0    Allow preemption when clear, even if process is in system state
  308. s2_suspend    equ    1    Suspend process at next entry to user state
  309.  
  310. * Defined signals
  311.  
  312. S_kill    equ    0
  313. S_wake    equ    1
  314. S_abort    equ    2
  315.  
  316. * Queue ID codes (for PD_queueID)
  317.  
  318. Q_current    equ    0    No queue, currently running
  319. Q_active    equ    1    Active process queue
  320. Q_sleep    equ    2    Sleeping process queue
  321. Q_wait    equ    3    Waiting process queue
  322. Q_event    equ    4    Waiting for an event
  323. Q_dead    equ    5    No queue, dead process
  324.  
  325. * The structure that is filled in when a p_procinf call is made
  326.     RSRESET
  327. pi_pid    rs.w    1    Process ID
  328. pi_ppid    rs.w    1    Parent process ID
  329. pi_sibling    rs.w    1    1st sibling's process ID
  330. pi_child    rs.w    1    1st child's process ID
  331. pi_gu    rs.l    1    Group.user ID
  332. pi_priority    rs.w    1    Process priority
  333. pi_age    rs.w    1    Process age
  334. pi_status    rs.b    1    Process execution status
  335. pi_queueID    rs.b    1    Current queue (sleep, wait or active)
  336. pi_basepage    rs.l    1    First memory block of process (basepage)  
  337. pi_max_mem    rs.l    1    Max mem size returned for Malloc #-1
  338. pi_ucall    rs.w    1    Last user state function call executed
  339. pi_scall    rs.w    1    Last system state function call executed
  340. pi_ucpu    rs.l    1    Number of user state milliseconds used
  341. pi_scpu    rs.l    1    Number of system state milliseconds used
  342. pi_sleep    rs.l    1    Number of milliseconds left to sleep
  343. pi_datetime    rs.l    1    Date and time process started
  344. pi_fcalls    rs.l    1    Number of function calls executed
  345. pi_iocalls    rs.l    1    Number of i/o calls executed
  346. pi_rbytes    rs.l    1    Number of bytes read
  347. pi_wbytes    rs.l    1    Number of bytes written
  348. pi_vector    rs.l    1    User defined vector
  349. pi_dta    rs.l    1    Disk transfer address
  350. pi_name    rs.b    14    Name of process
  351. pi_devname    rs.b    8    Process current device name
  352. pi_totmem    rs.l    1    Total memory used by process
  353. pi_stack    rs.l    1    Current process system stack
  354.  
  355. pi_size    equ    __RS    Total size of structure
  356.  
  357. ************************************************************************
  358. * I/O definitions
  359. *
  360. * Path descriptor definitions
  361. sz_pt_opt    equ    40    Size of option vars (must be mul of 4)
  362.     RSRESET
  363. PT_descrip    rs.l    1    Points to device descriptor
  364. PT_params    rs.l    1    Points to callers stacked parameters
  365. PT_owner    rs.w    1    ID of current user (0 when done)
  366. PT_lastusr    rs.w    1    Last user of path
  367. PT_count    rs.b    1    # of local paths accessing this pd
  368. PT_mode    rs.b    1    Mode of I/O (parameter from open call)
  369. PT_flags    rs.b    1    Flags passed by OS (used by con routines)
  370. PT_forfm    rs.b    1    Except bit 0, used by file manager
  371. PT_opt    rs.b    sz_pt_opt    Optional file manager information
  372. PT_size    equ    __RS
  373.  
  374. * bit definitions for PT_flags
  375. PTF_ne    equ    1    If set, no echo
  376. PTF_necntr    equ    2    If set, don't echo control codes
  377. PTF_rawcnt    equ    4    If set, echo raw control codes
  378. PTF_ncsq    equ    8    If set, ignor ^C, ^S or ^Q
  379. PTF_ncntrl    equ    16    If set, ignor other control codes
  380. PTF_stripcr    equ    32    If set, strip carriage rets & line feeds
  381.  
  382. * bit definitions for PT_forfm
  383. d_io_bit    equ    0    If this bit is set, path is dio path
  384.  
  385. * Path block allocation size. First long is pointer to next block
  386. * Twenty paths per block allocated
  387. PT_alloc    equ    4+PT_size*20
  388.  
  389. * File manager information for SCF path descriptor
  390. * These parameters may not be read or changed by the user
  391.     RSSET    PT_opt
  392. SC_link    rs.l    1    Link to next path using same device
  393. SC_lastscan    rs.w    1    Last scan code (if required)
  394. * These parameters may be read or set by the user
  395. *SC_attribs    rs.b    1    Various attribute bits
  396. SC_echo    rs.b    1    If set, echo input to output
  397. SC_scan    rs.b    1    If set, return scan code
  398. SC_send_lf    rs.b    1    If set, send lf after cr
  399. SC_des_back    rs.b    1    If set, destructive backspace
  400. SC_pause    rs.b    1    If set, pause at end of page
  401. SC_eor    rs.b    1    Char recognized as end of record
  402. SC_aeor    rs.b    1    Char recognized as alternate eor
  403. SC_eof    rs.b    1    Char recognized as end of file
  404. SC_backspc    rs.b    1    Char recognized as backspace
  405. SC_clrl    rs.b    1    Char recognized as clear line
  406. SC_rpl    rs.b    1    Char recognized as reprint line
  407. SC_newl    rs.b    1    Char recognized as start new line
  408. SC_dupl    rs.b    1    Char recognized as dup last line
  409. SC_bell    rs.b    1    Char recognized as bell
  410. SC_tab    rs.b    1    Char recognized as tab
  411. SC_abort    rs.b    1    Char recognized as keyboard abort
  412. SC_xon    rs.b    1    Char recognized as X-on
  413. SC_xoff    rs.b    1    Char recognized as X-off
  414. SC_tab_wid    rs.b    1    Width of tab field
  415. SC_plength    rs.b    1    Lines per page
  416. SC_timeout    rs.b    1    Number of seconds to wait for device
  417.  
  418. * Attribute bits for SC_attribs
  419. *SC_echo    equ    0    If set, echo input to output
  420. *SC_scan    equ    1    If set, return scan code
  421. *SC_send_lf    equ    2    If set, send lf after cr
  422. *SC_des_back    equ    3    If set, destructive backspace
  423. *SC_pause    equ    4    If set, pause at end of page
  424.  
  425. * If SC_scan set, returns last scan code in SC_lastscan
  426. * If SC_tab_wid = 0, let tabs pass through (default)
  427. * SC_timeout is used on devices (like printers) that sould time out if
  428. * no response is given in a certain period of time. This is set to the
  429. * number of seconds (1 to 255) that the driver should wait for the
  430. * device to respond. 0 means an indefinite wait.
  431.  
  432. *************************************************************************
  433. * Following is information required by the system global variables section
  434. *
  435. * I/O device definition requirements
  436. * When an I/O device is installed, pointers are created to its
  437. * file manager and device driver jump tables and variables. When
  438. * a path is created, a pointer to the device descriptor information
  439. * is placed in the path descriptor.
  440.  
  441.     RSRESET
  442. DD_name    rs.b    8    Name of the device
  443. DD_fm_globl    rs.l    1    File manager var ptr (might not be used)
  444. DD_fm_jump    rs.l    1    File manager jump table
  445. DD_dr_globl    rs.l    1    Device driver var ptr (might not be used)
  446. DD_dr_jump    rs.l    1    Device driver jump table
  447. DD_type    rs.b    1    File manager type
  448. * 0 = RBF, 1 = PIPE, 2 = SCF, 3 = NET, 4 = NULL
  449. DD_share    rs.b    1    If set, device not sharable
  450. DD_dev_vars    rs.b    40    Device vars required by file manager
  451. DD_options    rs.b    sz_pt_opt    Variables for path descriptor
  452. * The optional static vars are copied to the path descriptor when first
  453. * linked to the device descriptor.
  454. DD_size    equ    __RS
  455. iodevs    equ    40    Max number of i/o devices in system
  456.  
  457. * When installing a file manager, three pointers and a word are passed.
  458. * The first pointer is to the name of the file manager, the second to
  459. * its jump table, and the third is its global var ptr (if required).
  460. * The word is the file managers type.
  461.     RSRESET
  462. Mfm_name    rs.l    1    Points to name
  463. Mfm_entry    rs.l    1    Points to jump table
  464. Mfm_vars    rs.l    1    Points to any required ram storage
  465. Mfm_type    rs.w    1    File manager type word
  466. Mfm_size    equ    __RS
  467.  
  468. * When installing a device driver, three pointers are passed. The first
  469. * pointer is to the name of the device driver, the second to its jump
  470. * table, and the third is its global var ptr (if required).
  471.     RSRESET
  472. Mdd_name    rs.l    1    Points to name
  473. Mdd_entry    rs.l    1    Points to jump table
  474. Mdd_vars    rs.l    1    Points to any required ram storage
  475. Mdd_size    equ    __RS
  476.  
  477. num_fms    equ    10    Max number of file managers
  478. num_dds    equ    30    Max number of device drivers
  479.  
  480. * Offsets used to get pointers to name and jump table of fm or dd.
  481.     RSRESET
  482. offs_name    rs.w    1    Offset to name string
  483. offs_jump    rs.w    1    Offset to jump table
  484. * Next is only necessary for file managers
  485. offs_fm    rs.w    1    Offset to fm type byte
  486.  
  487. * File manager routine offset definitions
  488.     RSRESET
  489. FM_create    rs.w    1    Create a file
  490. FM_open    rs.w    1    Open an exisitng file
  491. FM_close    rs.w    1    Close the file
  492. FM_read    rs.w    1    Read from the file
  493. FM_write    rs.w    1    Write to the file
  494. FM_readln    rs.w    1    Read a line (generally CR terminated)
  495. FM_status    rs.w    1    Get/set device/file status
  496. FM_makedir    rs.w    1    Create a directory              (RBFM)
  497. FM_deldir    rs.w    1    Delete a directory            (RBFM)
  498. FM_chngdir    rs.w    1    Change current dir of drive     (RBFM)
  499. FM_getdir    rs.w    1    Get current dir of drive        (RBFM)
  500. FM_chgatt    rs.w    1    Change attributes of file       (RBFM)
  501. FM_rename    rs.w    1    Rename the file/folder          (RBFM)
  502. FM_delete    rs.w    1    Delete the file/folder          (RBFM)
  503. FM_seek    rs.w    1    Seek the file pointer           (RBFM)
  504. FM_sfirst    rs.w    1    Search for filespec             (RBFM)
  505. FM_snext    rs.w    1    Search for next filespec        (RBFM)
  506. FM_gsdt    rs.w    1    Get/set date/time of file       (RBFM)
  507. FM_dskfree    rs.w    1    Get free space on a disk        (RBFM)
  508.  
  509. * Opcodes used for status operations. These are all status operations that
  510. * may be performed on open files. Not all file managers support all of the
  511. * available operations.
  512.     RSRESET
  513. st_input    rs.b    1    Test for input data available
  514. st_output    rs.b    1    Test for device output ready
  515. st_size    rs.b    1    Get size of file
  516. st_pos    rs.b    1    Get r/w pointer position
  517. st_eof    rs.b    1    Test for end of file
  518. st_rlock    rs.b    1    Change record lock attributes
  519. st_extfile    rs.b    1    Extend the files length
  520. st_readopt    rs.b    1    Read options section of path desc
  521. st_wrtopt    rs.b    1    Write options section of path desc
  522. st_name    rs.b    1    Copy name of open file to buffer
  523. st_type    rs.b    1    Return the file manager type for the file
  524.  
  525. * File manager types
  526.     RSRESET
  527. fmtyp_rbf    rs.b    1    Random block (disk) file manager
  528. fmtyp_pipe    rs.b    1    Pipe (interprocess)
  529. fmtyp_scf    rs.b    1    Sequencial character
  530. fmtyp_net    rs.b    1    Network
  531. fmtyp_null    rs.b    1    The 'do nothing' file manager
  532.  
  533. * Queue directory structure.
  534.     RSRESET
  535. qd_name    rs.b    13    Name of the message queue (12 char + 0)
  536. qd_type    rs.b    1    Type of queue
  537. * 0=message queue 1=event queue, 2=data queue
  538. qd_link    rs.w    1    Number of users linked to queue (0 if free)
  539. qd_pid    rs.w    1    PID of first waiting process
  540. qd_index    rs.w    1    Index to buffer, count for event queue
  541. qd_size    equ    __RS
  542. qd_alloc    equ    4+(qd_size*5) Size of allocation
  543.  
  544. * Message queue buffer definitions
  545.     RSRESET
  546. qb_next    rs.w    1    Index of next; -1 if free, 0 if end
  547. qb_message    rs.l    4    Four longs make up actual message
  548. * For data buffers, first long points to memory block, second long is
  549. * length of block
  550. qb_size    equ    __RS
  551. qb_alloc    equ    4+(qb_size*10) Size of allocation
  552.  
  553. * Memory Definition Block structure
  554.     RSRESET
  555. mem_next    rs.w    1    Index of next MDB (in ascending order)
  556. mem_prev    rs.w    1    Index of previous MDB
  557. mem_start    rs.l    1    Start of memory block
  558. mem_length    rs.l    1    Length of memory block
  559. mem_owner    rs.w    1    PID of owner, 0 for system, -1 for free or -2 if was tsr memory
  560. mem_link    rs.w    1    Index of next MDB owned by process or system
  561. mem_size    equ    __RS
  562. mem_blksiz    equ    4+(50*mem_size) Size of allocation block
  563.  
  564. * Macro path structure definition. These are used to create pseudo drives
  565. * that represent other drives to the file system. For example, a macro,
  566. * called G:, could be created to represent C:\FOLDER1\FOLDER2 to the
  567. * file system. Then, when a path such as G:\FILENAME.EXT was used, the
  568. * file system would actually use C:\FOLDER1\FOLDER2\FILENAME.EXT.
  569.     RSRESET
  570. mp_next    rs.l    1    Next macro path in chain, or 0 for end
  571. mp_devname    rs.b    1    Device name of macro (e.g. G, P, Z)
  572. mp_devnum    rs.b    1    Device number of macro (0, 1, 2)
  573. mp_flag    rs.b    1    Flag: set to zero when created or changed
  574. mp_reserved    rs.b    1
  575. mp_rootdir    rs.l    1    Place for file manager to store root dir info
  576. mp_realname    rs.b    8    Device name of real device
  577. mp_path    rs.b    64    Path to use on real device
  578. mp_size    equ    __RS
  579.  
  580. *
  581. * The following are the variables that are used by the kernal. These variables
  582. * are accessed off the A6 register, which is loaded with the start of the 
  583. * table on entry. These are the global variables, but note that each 
  584. * process has a table of variables associated with it.
  585. *
  586.     RSRESET
  587.  
  588. G_active    rs.l    1    Head of active queue
  589. G_sleep    rs.l    1    Head of sleeping queue
  590. G_wait    rs.l    1    Head of waiting queue
  591. G_event    rs.l    1    Head of event queue
  592. G_cur_pd    rs.l    1    Process descriptor of current process
  593. G_totram    rs.l    1    Total ram found in system (TPA size)
  594. G_bottpa    rs.l    1    Bottom of TPA
  595. G_toptpa    rs.l    1    Top of TPA
  596. G_maxtpa    rs.l    1    Maximum tpa size given to process
  597. G_rsvmem    rs.l    1    High water mark of m_(s)alloc(-1) calls
  598. G_rsvmaxbl    rs.l    1    Max block size returned in G_rsvmem area
  599. G_mem_mdb    rs.l    1    Points to 1st block of memory descriptor blocks
  600. G_hmem_st    rs.w    1    Index of head of memory segment list (ST ram)
  601. G_tmem_st    rs.w    1    Index of tail of memory segment list
  602. G_sys_mem    rs.w    1    Index of linked system memory blocks
  603. G_memblks    rs.w    1    Number of free memory block descriptors
  604. * Extra ram that may be added to the system is allways considered fastram.
  605. * When a block is added for the first time, the index to the head and tail
  606. * of the memory (the next two variables) are defined. If any more memory
  607. * is added after this, it will be added in to the same structure. (If it
  608. * is not contiguous with previous added ram, there will be a gap, but the
  609. * memory allocate and free routines deal with this situation properly.)
  610. G_hmem_alt    rs.w    1    Head of alternate (TT) memory
  611. G_tmem_alt    rs.w    1    Obviously the tail of said memory
  612. G_pd    rs.l    1    Points to 1st process descriptor block
  613. G_pthd    rs.l    1    Points to 1st path descriptor block
  614. G_queue_dir    rs.l    1    Points to 1st queue directory block
  615. G_queue_buf    rs.l    1    Points to 1st queue buffer block
  616. G_max_age    rs.w    1    Max age to age a process
  617. G_min_pty    rs.w    1    Min priority of ageable process
  618. G_timeslice    rs.w    1    Number of milliseconds per tick (20)
  619. G_ticks    rs.w    1    Number of ticks per second (50)
  620. G_timeout    rs.l    1    Global timeout added to 200 hz clock
  621. G_idlecnt    rs.l    1    Used to keep track of idle time in 5 ms periods
  622. G_idlecntdn    rs.w    1    Count till next increment
  623. G_fastload    rs.l    1    Number of k of heap to clear on prg load
  624. G_aes_stack    rs.l    1    Current aes stack top
  625. G_term    rs.l    1    Vector to jump through on proc term
  626. G_pexec    rs.l    1    Vector to jump through on proc create
  627. G_trace    rs.l    1    Vector to jump through to trace a process' function calls
  628. G_macropath    rs.l    1    Pointer to any drive/path replacements
  629. G_pathcheck    rs.l    1    Vector to jump through before path parsing
  630. * To allow PowerDOS to be expanded (or to emulate other OS's), a pointer
  631. * to another table of vectors is available (zero when not used). The first
  632. * long in this table is a pointer to another such table. The third word
  633. * is the lowest sevice number in the table, and the fourth word is the
  634. * highest service number. Following this is the long word pointers to
  635. * the service functions. If a vector in this tables is not used (an unused
  636. * function) it should be set to zero.
  637. G_extservic    rs.l    1    Pointer to a table of extended services
  638. G_p_run    rs.l    1    GemDOS p_run pointer; points to basepage
  639. G_version    rs.w    1    Version number of GemDOS we are replacing
  640. G_sysver    rs.w    1    Version of PowerDOS
  641. G_sysdate    rs.l    1    Date of PowerDOS build (YYYYMMDD)
  642. G_flags    rs.b    1    Various flags bits that may be needed
  643. * Definitions for the bits in G_flags.
  644. Gf_cookjar    equ    0    Set if PowerDOS installed the cookie jar
  645. Gf_server    equ    1    Set if system is being used as a network server
  646. G_reserve    rs.b    1
  647. * When we launch a concurrent task, we give it clean OS vectors so no tsr
  648. * programs will also be in the vectors. Such programs tend to fail when
  649. * used in a multitasking environment. The following are the original
  650. * vectors set when PowerDOS was installed.
  651. G_trap1    rs.l    1    Vector for BDOS
  652. G_trap13    rs.l    1    Vector for BIOS
  653. G_trap14    rs.l    1    Vector for XBIOS
  654. * The following is the special reserved block of memory used for video ram. Both
  655. * its start address and index are given.
  656. G_videomem    rs.l    1    Start address of special videomem block
  657. G_videoidx    rs.w    1    Index of MDB of video memory
  658.  
  659. * The following are the non-public part of the system variables
  660. G_service    rs.l    $c0    Space for 192 BDOS service routines
  661. G_bservice    rs.w    1    Number of BIOS routines
  662.     rs.l    20    Space for 20 BIOS service routines
  663. G_xbservice    rs.w    1    Number of XBIOS routines
  664.     rs.l    140    Space for 140 XBIOS service routines
  665.     rs.b    1000    Space for aes/accessory super stack
  666. G_stackaes    equ    __RS    Top of aes stack space
  667. G_iodev    rs.b    DD_size*iodevs   Space for IO devices
  668. G_fm    rs.b    Mfm_size*num_fms  Space for file manager links
  669. G_drvr    rs.b    Mdd_size*num_dds  Space for device driver links
  670. G_initmblk    rs.b    mem_blksiz*2 Initial memory definition blocks
  671. G_initpth    rs.b    PT_alloc    Initial path block
  672. G_initproc    rs.b    PD_alloc    Initial process descriptor block
  673. G_initqdir    rs.b    qd_alloc    Initial queue directory block
  674. G_initqbuf    rs.b    qb_alloc    Initial queue buffer block
  675. G_size    equ    __RS
  676.  
  677.