home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / DEMON / ZPM3N10.ARC / SCB.TXT < prev    next >
Text File  |  1993-02-04  |  16KB  |  435 lines

  1. The following has been taken direct from the ZPM3 source and is 
  2. provided as a reference. No guarantees are made with regard to 
  3. its accuracy. The only SCB entries that you should manipulate in 
  4. CP/M 3.0 are the ones published by its authors.
  5.  
  6.  
  7. ;-------------------------------------------------------------------------------
  8. ;68    TRAPS FOR WARM BOOT and CONSOLE FUNCTIONS
  9. ;-------------------------------------------------------------------------------
  10. ; This table allows you to replace certain BIOS functions with new ones in the
  11. ;    TPA.  Because of the banked nature of CP/M 3, simply changing the BIOS
  12. ;    vector could cause a problem as some BIOS functions need to be in the
  13. ;    system bank.  If you redirect any of these functions, you should replace
  14. ;    the first jump (0c3h) in each group with a LD HL, (21h).  When restoring
  15. ;    the jumps check first that the BIOS vectors you are restoring are in
  16. ;    fact to the BIOS and not to another redirection.  To do this, make sure
  17. ;    that the BIOS jumps are pointing above themselves, not down into TPA.
  18.  
  19. ; For ZPM, the need for the traps has been eliminated.
  20. ;  Because pre-ZPM programs may attempt to write to the first byte of each
  21. ;  trap, these bytes can only be used for other things with some caution!
  22.  
  23. ; Warm boot trap
  24.     jp    ?wboot        ;68
  25.     jp    dotpa        ;6b
  26. ; Console status trap
  27.     jp    ?const        ;6e
  28.     jp    dotpa        ;71
  29. ; Console input trap
  30.     jp    ?conin        ;74
  31.     jp    dotpa        ;77
  32. ; Console output trap
  33.     jp    ?conout        ;7a
  34.     jp    dotpa        ;7d
  35.  
  36. ;;; List output trap
  37. ;;    jp    ?list        ;80
  38. ;;    jp    dotpa        ;83
  39.  
  40.  
  41.     db    0c3h    ;80 This first byte should not be used as it
  42.             ; could get changed by programs which attempt to
  43.             ; redirect the printer    
  44.  
  45.     db    0    ;81 Not used yet
  46.  
  47.     db    0    ;82 Function 59 load user number.  Normally
  48.             ; function 59 loads from the current user
  49.             ; however by setting this byte to a user
  50.             ; number + 1, function 59 will load from
  51.             ; that user area instead (only works with
  52.             ; the ZCCP loader RSX).  0=current user number.
  53.  
  54.     dw    0    ; -19        83
  55.             ; This word is set to the address of the
  56.             ;  ZCPR system environment.  If it is 0000h
  57.             ;  the BDOS assumes that the normal CP/M 3
  58.             ;  CCP system is running.  Otherwise, the BDOS
  59.             ;  will perform certain functions differently.
  60.             ;  For example function 152 will use named
  61.             ;  directories if available, function 10
  62.             ;  will the use message buffers for CCP running
  63.             ;  flag and wheel protection of files is enabled.
  64.  
  65.             ;  Note that Z3PLUS users can set this word
  66.             ;  once Z3PLUS is installed to enable the
  67.             ;  extra functions. ZCCP users need not worry
  68.             ;  as it will be done automatically.
  69.  
  70.     db    0    ;        -17    85
  71.             ; This byte holds control flags for various ZPM3
  72.             ;  functions.
  73.             ; bit 7: Setting this bit will clear the function
  74.             ;      10 history buffer. Write only.
  75.             ; bit 6: Controls enabling of the function 10 AUTO
  76.             ;      COMMAND facility.  If set, control-Q toggles
  77.             ;      the facility on and off.  If clear, control-Q
  78.             ;      has no effect.  Read/Write.
  79.             ; bit 5: After function 152 has been called, if a DU:
  80.             ;      D:,U: or DIR: spec has been found, this
  81.             ;      bit is set and the drive and user is
  82.             ;      set in the FCB.
  83.             ; bit 4: This flag is for system use only.  It is
  84.             ;      set after a function 55 call, but is reset
  85.             ;      after any other call.
  86.             ; bit 3: After function 152 has been called, if a
  87.             ;      DIR: spec has been parsed, this bit is set
  88.             ;      and the user and drive is set in the FCB.
  89.             ; bits 2-0: Not used yet            
  90. ;-------------------------------------------------------------------------------
  91. ;    SYSTEM CONTROL BLOCK (unofficial)
  92. ;-------------------------------------------------------------------------------
  93. ; None of these is accessed by the resident BDOS or the user
  94.     dw    0    ;                -16    86
  95.     dw    0    ;                -14    88
  96.     dw    0    ;                -12    8a
  97.     dw    0    ;                -10    8c
  98.     dw    0    ;                -e    8e
  99.  
  100.     dw    0    ; Bit mapped vector of drives    -c    90
  101.             ;  with open files since last warm boot.
  102.     dw    0    ; Bit mapped vector of drives    -a    92
  103.             ;  accessed since last warm boot.
  104.  
  105.     dw    0    ;                -8    94
  106.     dw    07h    ;                -6    96
  107.     dw    base+6    ; This word is the address    -4    98
  108.             ;  of the entry to the BDOS.
  109.             ;  It can be used to find the
  110.             ;  actual BDOS as opposed to
  111.             ;  the top of TPA.
  112.     db    0    ;                -2    9a
  113.     db    0    ;                -1    9b
  114. ;------------------------------------------------------------------------------
  115. ;9c    SYSTEM CONTROL BLOCK
  116. ;------------------------------------------------------------------------------
  117. ; The official system control block starts here.  In reality, the control block
  118. ;    begins before this point, but this is the data section that we are
  119. ;    told about in the DRI literature
  120. ; In this section, a code is used to signify which sections of the code
  121. ;    access the bytes: a * means that that user may read and write the bytes
  122. ; a + means that the resident portion of the BDOS accesses the bytes
  123. ; a ~ means the banked portion of the BDOS accesses the bytes
  124. ; a ~~ means the banked portion of ZPM3 accesses the bytes, but CPM doesn't
  125. scb:
  126.     db    0    ;+ Reserved            0    9c
  127.     dw    0    ;+ Reserved            1    9d
  128.     db    0    ;  Reserved            3    9f
  129.     db    0    ;  Reserved            4    a0
  130.  
  131.     db    31h    ; BDOS version number (in BCD)    5    a1
  132.  
  133.             ; The following four bytes may be used for any purpose.
  134.             ; Note that CCP104 used 8 and 9. ZCCP and ZPM3 do not
  135.             ; affect these bytes at all.
  136.     db    0    ;* Reserved for user        6    a2
  137.     db    0    ;* Reserved for user        7    a3
  138.     db    0    ;* Reserved for user        8    a4
  139.     db    0    ;* Reserved for user        9    a5
  140.  
  141.     db    0    ; Reserved            0a    a6
  142.     db    0    ; Reserved            0b    a7
  143.     db    0    ; Reserved            0c    a8
  144.     db    0    ; Reserved            0d    a9
  145.     db    0    ; Reserved            0e    aa
  146.     db    0    ; Reserved            0f    ab
  147.  
  148.     dw    0    ;* Program Error Return Code.    10    ac
  149.             ; This 2-byte field can be used by a program to pass
  150.             ; an error code or value to chained programs.  CP/M 3's
  151.             ; conditional command facility also uses this field to
  152.             ; determine if a program executes successfuly.  The
  153.             ; BDOS Function 108 (Get/SET Program Return Code) is
  154.             ; used to get/set this value
  155.  
  156.             ; Following byte holds the base page of the top
  157.             ; multiple command RSX (only used by CCP).
  158.     db    0    ; Reserved            12    ae
  159.  
  160.             ; The following bytes are the default disk and user
  161.             ; of the CCP.  When the CCP is run, the disk and user
  162.             ; is restored to these values unless flagged not to
  163.             ; by the chain command.
  164.     db    0    ; CCP disk            13    af
  165.     db    0    ; CCP user number        14    b0
  166.  
  167.             ; The following word holds the address of the next
  168.             ; command to get if running multiple commands or
  169.             ; shells.  It should not be set by the user.
  170.  
  171.     dw    0    ; Multiple command pointer. CCP    15    b1
  172.  
  173.     db    0    ; System flag    CCP use        17    b3
  174.             ; This byte is bit mapped as follows:
  175.             ; Bit 0 Submit flag (set if a file beginning with '$'
  176.             ;       is found, cleared by CCP)
  177.             ;     1 RSX flag (set by loader when it loads a null
  178.             ;    file with RSXs attached (indicates to CCP
  179.             ;    not to attempt to remove the RSXs until the
  180.             ;    second warm boot).  May be set by RSXs
  181.             ;     2-5 unknown (probably used by utilities)
  182.             ;     6 Change default DU to last program's DU
  183.             ;    when chaining.
  184.             ;     7 Chain flag.  Set to indicate to CCP that
  185.             ;    there is a command to chain to at 080h.
  186.             
  187.     db    0    ; System flag    CCP use        18    b4
  188.             ; This byte is bit mapped as follows:
  189.             ; Bit 0    Display command flag
  190.             ;     1 Display command flag
  191.             ;     2 Unknown
  192.             ;     3 File type search order
  193.             ;     4 File type search order
  194.             ;     5 Reset disk system
  195.             ;     6 "GET" RSX flag (set if GET RSX is redirecting)
  196.             ;     7 CCP running flag
  197.             ; Bit 7 is the only one used by the BDOS (in function 10)
  198.  
  199.     db    0    ; System flag    CCP use        19    b5
  200.             ; This byte is bit mapped as follows:
  201.             ; Bit 0 Unknown
  202.             ;     1 Cold boot flag
  203.             ;     2-7 Unknown
  204.  
  205.     db    0    ;* Console Width        1a    b6
  206.             ; This byte contains the number of columns
  207.             ; (characters) per line on your console relative
  208.             ; to zero.  Most systems default this value to
  209.             ; 79.  You can set this default value by using
  210.             ; GENCPM or the DEVICE utility.  The console width
  211.             ; value is used by CP/M 3 in BDOS function 10.  It
  212.             ; is not used by ZPM3. Typing a character into the 
  213.             ; last position of the screen, as specified by the
  214.             ; Console Width field, must not cause the terminal
  215.             ; to advance to the next line.
  216.  
  217.     db    0    ; Console Column Position    1b    b7
  218.             ; This byte contains the current console column postion
  219.  
  220.     db    0    ;* Console Page Length        1c    b8
  221.             ; This byte contains the number of lines (rows) on your
  222.             ; console relative to zero.  Most systems default this
  223.             ; value to 23.  This default value may be changed by
  224.             ; using GENCPM or the DEVICE utility. 
  225.  
  226.     db    0    ; Reserved            1d    b9
  227.             ; The following word is used by function 10 and points
  228.             ; to the next character to get in an initialised
  229.             ; function 10 buffer.  If a ^C termination occurs or
  230.             ; if a null terminator is found before a CR or LF,
  231.             ; this word is set 0.  By setting DE NZ and pointing
  232.             ; this word to a buffer before calling it, you
  233.             ; can have it initialize buffers other than
  234.             ; the default DMA.
  235.  
  236.     dw    0    ;+~Reserved            1e    ba
  237.             ; The following word is used by multiple commands and
  238.             ; shells.  When function 10 retrieves information from
  239.             ; an initialised buffer, it stores the next character
  240.             ; position at offset 1e and here at 20.  If a ^C
  241.             ; termination occurs, 1e is set to 00, but 20 is left
  242.             ; as it was so that the next command can be retrieved.
  243.             ; Therefore, if 1e is 00 and 20 is NZ it means that
  244.             ; a ^C termination happened
  245.  
  246.     dw    0    ;~ Reserved            20    bc
  247.  
  248.  
  249.             ; Redirection flags (following) for each of the five
  250.             ; logical character devices.  If your system's BIOS
  251.             ; supports assignment of logical devices to physical
  252.             ; devices, you can direct each of the five logical
  253.             ; character devices to any combination of up to 12
  254.             ; physical devices.  The 16 bit word for each device
  255.             ; represents the following:
  256.             ;
  257.             ; Each bit represents a physical device where bit 15
  258.             ; corresponds to device zero and bit 4 corresponds to
  259.             ; device 11.  Bits zero through 3 are reserved for
  260.             ; system use and are used for redirection to disk files.
  261.             ;
  262.     dw    0    ;* CONIN Redirection Flag    22    be
  263.     dw    0    ;* CONOUT Redirection Flag    24    c0
  264.     dw    0    ;* AUXIN Redirection Flag    26    c2
  265.     dw    0    ;* AUXOUT Redirection Flag    28    c4
  266.     dw    0    ;* LIST Redirection Flag    2a    c6
  267.  
  268.     db    0    ;* Page Mode            2c    c8
  269.             ; If this byte is set to zero, some CP/M 3 utilities
  270.             ; and CCP built in commands display one page of data
  271.             ; at a time; you display the next page by pressing
  272.             ; any key.  If this byte is not set to zero, the system
  273.             ; displays data on the screen without stopping.  To
  274.             ; stop and start the display, you can press CTRL-S and
  275.             ; CTRL-Q respectively.
  276.  
  277.     db    0    ; Default page mode        2d    c9
  278.  
  279.     db    0    ;* ~~                2e    ca
  280.             ; Determines if CTRL-H is interpreted as a rub/del
  281.             ; character.  If this byte is set to 0, then CTRL-H is
  282.             ; a backspace character (moves back and deletes).  If
  283.             ; this byte is set to 0ffh, then CTRL-H is a rub/del
  284.             ; character, echoes the deleted character.
  285.             ; Under ZPM3, the byte has no effect.  It should not
  286.             ; be used however as it may be written to by
  287.             ; applications.
  288.             
  289.     db    0    ;*                2f    cb
  290.             ; Determines if rub/del is interpreted as CTRL-H
  291.             ; character.  If this byte is set to 0, then rub/del
  292.             ; echoes the deleted character.  If this byte is
  293.             ; set to 0ffh, then rub/del is interpreted as a
  294.             ; CTRL-H character (moves back and deletes).
  295.             ; Under ZPM3, the byte has no effect.  It should not
  296.             ; be used however as it may be written to by
  297.             ; applications.
  298.  
  299.     db    0    ;~ Reserved            30    cc
  300.  
  301.             ; Following two bytes are probably used by CP/M3 utilities
  302.     db    0    ; Reserved            31    cd
  303.     db    0    ; Reserved            32    ce
  304.  
  305.     dw    0    ;*+ Console Mode        33    cf
  306.             ; This is a 16 bit system parameter that determines
  307.             ; the action of certain BDOS Console I/O functions.
  308.  
  309.     dw    bnkbuf    ; Address of 128 byte buffer    35    d1
  310.  
  311.     db    '$'    ;*+ Output delimiter character.    37    d3
  312.             ; The default output delimiter character is $, but
  313.             ; you can change this value by using the BDOS Function
  314.             ; 110 Get/Set Output Delimiter.
  315.  
  316.     db    0    ;* List Output Flag        38    d4
  317.             ; If this byte is reset to 0, console output is not
  318.             ; echoed to the list device.  If this byte is set
  319.             ; to 1, console output is echoed to the list device.
  320.  
  321.     db    0    ; Scroll flag                39    d5
  322.             ; Following bits set when in system bank and:
  323.             ; Bit 7 is set when function 11 is checking the status.
  324.             ; Bit 6 is set when function 2 is checking input.
  325.             ; Note that raw input (function 6 and function 2 raw)
  326.             ;  will not set these bits.
  327.              
  328.     dw    scb    ; Holds the address of the SCB        3a    d6
  329.  
  330.     dw    0080h    ;+ Current DMA Address.            3c    d8
  331.             ; This address can be set by BDOS Function 26.  The
  332.             ; CCP initializes this value to 0080h.  BDOS Function
  333.             ; 13, Reset Disk System also sets the DMA address to
  334.             ; 0080h.
  335.  
  336.     db    0    ; Current Disk.                3e    da
  337.             ; This byte contains the currently selected default
  338.             ; disk number.  This value ranges from 0-15
  339.             ; corresponding to drives a-p, respectively.  BDOS
  340.             ; Function 24, Return Current Disk, can be used to
  341.             ; determine the current disk value.
  342.  
  343.     dw    0    ; BDOS variable 'INFO'            3f    db
  344.             ; This word is used by the banked portion of the
  345.             ; BDOS.  It is normally an entry parameter.
  346.  
  347.     db    0    ; FCB flag                41    dd
  348.             ; If this byte = 0ffh, the word at 03fh is a valid
  349.             ; FCB address.
  350.  
  351.     db    0    ; Same drive flag            42    de
  352.  
  353.     db    0    ;+ BDOS function for error        43    df
  354.  
  355.     db    0    ; Current User Number.            44    e0
  356.             ; This byte contains the current user number.  This
  357.             ; value ranges from 0-15.  BDOS Function 32,
  358.             ; Get/Set User Code can change or interrogate
  359.             ; the currently active user number.  Under ZPM3 you may
  360.             ; change the currently active user number directly
  361.             ; by writing to this byte.
  362.  
  363.     dw    0    ;+ Reserved                45    e1
  364.             ; Holds the current directory entry number.  Lower
  365.             ;  two bits are the search return code.
  366.             
  367.     dw    0    ;+ Search FCB address            47    e3
  368.             ; Holds the FCB address of the last search for
  369.             ;  first/next operation.
  370.  
  371.     db    0    ;+ Search type flag            49    e5
  372.             ; 0=? in drive code search.
  373.             ; 0fh=normal search.
  374.             
  375.     db    01    ;* BDOS Multi-Sector Count.        4a    e6
  376.             ; This field is set by BDOS Function 44, Set Multi-
  377.             ; Sector Count.
  378.  
  379.     db    0    ;* BDOS Error Mode.            4b    e7
  380.             ; This field is set by BDOS Function 45, Set BDOS
  381.             ; Error Mode.  If this byte is set to 0ffh, the
  382.             ; system returns to the current program without
  383.             ; displaying any error messages.
  384.  
  385.  
  386.     db    0    ;* Drive Search Chain 1            4c    e8
  387.     db    0ffh    ;* Drive Search Chain 2            4d    e9
  388.     db    0ffh    ;* Drive Search Chain 3            4e    ea
  389.     db    0ffh    ;* Drive Search Chain 4            4f    eb
  390.  
  391.     db    0    ;* Temporary File Drive            50    ec
  392.  
  393.     db    0    ; Error Drive.                51    ed
  394.             ; This byte contains the drive number of the selected
  395.             ; drive when the last physical or extended error
  396.             ; occured.
  397.  
  398.     db    0    ; Reserved                52    ee
  399.     db    0    ; Reserved                53    ef
  400.  
  401.     db    0    ; Media Flag                54    f0
  402.             ; This flag may be set by the BIOS to indicate that
  403.             ; a drive door has opened thus signalling the BDOS
  404.             ; to relog the drive if required.
  405.     db    0    ; Reserved                55    f1
  406.     db    0    ; Reserved                56    f2
  407.  
  408.     db    080h    ; BDOS Flags.                57    f3
  409.             ; bit 7= expanded error messages
  410.             ;     6= single byte allocation vectors
  411.             
  412.     dw    0ffffh    ;* Date in days in binary since 1 Jan 78 58    f4
  413.     db    0ffh    ;* Hour in BCD                5a    f6
  414.     db    0ffh    ;* Minutes in BCD            5b    f7
  415.     db    0ffh    ;* Seconds in BCD            5c    f8
  416.  
  417. COMBASE:
  418.     dw    0    ; Common Memory Base address        5d    f9
  419.             ; This value is zero for nonbanked systems, and
  420.             ; nonzero for banked systems.  Because the base
  421.             ; address must reside on a page boundary, the
  422.             ; first byte will always be 0.  The second byte
  423.             ; is the important one being the common memory
  424.             ; base page.
  425.  
  426.     jp    bnkdos2    ; Pointer to second entry in banked DOS    5f    fb
  427.             ; This entry handles the displaying of errors to
  428.             ; the user
  429.  
  430.     dw    start    ; Top of user TPA            62    fe
  431.             ; This word always reflects the top of TPA and
  432.             ; should be the same as the word at 0006h unless a
  433.             ; transient changes (0006h) without knowing about
  434.             ; this word
  435.