⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drivers.mac

📁 Dos6.0
💻 MAC
📖 第 1 页 / 共 2 页
字号:

media_check_req STRUC                   ; Media Check request
                    db  TYPE static_rhp DUP (?)
    media_id        db  ?               ; Media ID byte -- NOTE: this offset is
media_check_req ENDS                    ;  used by several other requests!

media_check_ans STRUC                   ; Media check answer
                    db  TYPE static_rhp DUP (?)
                    db  ?
    media_changed   db  ?               ; Media changed code
    media_label     dd  ?               ; Segment:Offset of volume label
media_check_ans ENDS



build_bpb_req   STRUC                   ; Build BPB request
                    db  TYPE static_rhp DUP (?)
    media_id        db  ?               ; Media ID byte
    bpb_fat         dd  ?               ; Segment:Offset of FAT buffer
build_bpb_req   ENDS

build_bpb_ans   STRUC                   ; Build BPB answer
                    db  TYPE static_rhp DUP (?)
                    db  (12H - (TYPE static_rhp)) DUP (?)
    bpb_bpb         dd  ?               ; Segment:Offset of BPB
build_bpb_ans   ENDS



io_req          STRUC ; Read/Write/Write-Verify/IOCTL-Read/IOCTL-Write request
                    db  TYPE static_rhp DUP (?)
    media_id        db  ?               ; Media ID byte
    io_data         dd  ?               ; Segment:Offset of data
    io_requested    dw  ?               ; Bytes/Sectors Requested
    io_start        dw  ?               ; Starting sector number (LSW)
    io_start_high   dw  ?               ; Starting sector (MSW) (DOS 3.31 only)
                    dw  ?
    io_huge_start   dd  ?               ; 32-bit starting sector number
io_req          ENDS

io_ans          STRUC ; Read/Write/Write-Verify/IOCTL-Read/IOCTL-Write answer
                    db  TYPE static_rhp DUP (?)
                    db  (12H - (TYPE static_rhp)) DUP (?)
    io_transfered   dw  ?               ; Bytes/Sectors transfered
                    dw  ?
    io_label        dd  ?               ; Segment:Offset of volume label
io_ans          ENDS


nd_read_ans     STRUC                   ; Non-Destructive read answer
                    db  TYPE static_rhp DUP (?)
    nd_read_char    db  ?               ; Character read
nd_read_ans     ENDS

gen_ioctl_req   STRUC                   ; Generic IOCTL request
                    db  TYPE static_rhp DUP (?)
    gen_category    db  ?               ; Category (major) code
    gen_function    db  ?               ; Function (minor) code
    gen_si          dw  ?               ; SI register contents
    gen_di          dw  ?               ; DI register contents
    gen_data        dd  ?               ; Segment:Offset of data package
gen_ioctl_req   ENDS

media_id_buffer STRUC
    mib_info_level      dw  ?
    mib_serial_number   dd  ?
    mib_volume_label    db  11 dup (?)
    mib_file_sys_type   db   8 dup (?)
media_id_buffer ENDS

device_params   STRUC
    dpSpecFunc          db  ?   ;special functions
    dpDevType           db  ?   ;device type
    dpDevAttr           dw  ?   ;device attributes
    dpCylinders         dw  ?   ;number of cylinders
    dpMediaType         db  ?   ;media type
    dpBPB               db  TYPE bios_parameter_block DUP (?)
device_params   ENDS



MEDIA_5_25_DS_15    equ 0F9H            ; 5.25" double sided, 15 sector
MEDIA_5_25_SS_9     equ 0FCH            ; 5.25" single sided, 9 sector
MEDIA_5_25_DS_9     equ 0FDH            ; 5.25" double sided, 9 sector
MEDIA_5_25_SS_8     equ 0FEH            ; 5.25" single sided, 8 sector
MEDIA_5_25_DS_8     equ 0FFH            ; 5.25" double sided, 8 sector
MEDIA_3_5_DS_9      equ 0F9H            ; 3.5"  double sided, 9 sector
MEDIA_FIXED_DISK    equ 0F8H            ; Fixed disk
MEDIA_3_5_DS_18     equ 0F0H            ; 3.5"  double sided, 18 sector
;* Page 458 of MS-DOS Encyclopedia indicates that the media ID byte for
;* 3.5" double sided, 18 sector disks is 0F0H, but page 96 of the same
;* same reference indicates that this media ID is 0F9H
;*

CR              EQU     13              ; ASCII carrage return
LF              EQU     10              ; ASCII line feed

COMMENT #
    Below are the segment and group definitions for the driver.

        o  CORE         Core code that is ALWAYS loaded.
        o  BLOCK        Block device driver code - loaded if drives redirected
        o  SERIAL       Serial 3-wire polled I/O routines
        o  PARALLEL     Parallel 11-wire I/O routines
        o  PRINTER      Printer redirection code
        o  INIT         Device driver initialization code
        o  MAIN         Code that is executed when .EXE file run as a program
        o  STACK        Stack used when executed as a .EXE file

    All of the groups will belong to the group DRIVER and will be ordered
    as in the above list.  The resident code must come before the transient
    data and code.  Segment CORE must be at the begining because the device
    driver header must be located at location zero.  The CS, DS, and SS
    registers will be ASSUMED to be at GROUP DRIVER.  All code and data must be
    assigned to one of these segments.
#

                .SEQ                    ; Segments must appear in this order

    CORE        SEGMENT WORD PUBLIC 'CODE'
    CORE        ENDS

    BLOCK       SEGMENT WORD PUBLIC 'CODE'
    BLOCK       ENDS
                
    SERIAL      SEGMENT WORD PUBLIC 'CODE'
    SERIAL      ENDS

    PARALLEL    SEGMENT WORD PUBLIC 'CODE'
    PARALLEL    ENDS

    PRINTER     SEGMENT WORD PUBLIC 'CODE'
    PRINTER     ENDS

    VARLEN      SEGMENT WORD PUBLIC 'CODE'
    VARLEN      ENDS

    INIT        SEGMENT WORD PUBLIC 'CODE'
    INIT        ENDS

    MAIN        SEGMENT WORD PUBLIC 'CODE'
    MAIN        ENDS

    STACK       SEGMENT WORD STACK 'STACK'
    STACK       ENDS

    DRIVER      GROUP CORE, BLOCK, SERIAL, PARALLEL, PRINTER
    DRIVER      GROUP VARLEN, INIT, MAIN, STACK

                ASSUME  DS:DRIVER, CS:DRIVER, SS:DRIVER

DVR             EQU     <OFFSET DRIVER>

STACK_SIZE      EQU     256             ; Stack size for device drivers & TSRs
MAX_PRINTERS    EQU     3               ; Max printers that can be redirected

LOCAL_MODE      equ     0               ; Current operating mode values for
REMOTE_MODE     equ     1               ; auxiliary drivers and print
AUTO_MODE       equ     2               ; redirector

COMMENT @
    pchar -- prints a character using DOS output
@
pchar           MACRO   char

                mov     ah, 02H         ; Print character
    IFDIFI  <char>,<dl>
                mov     dl, char
    ENDIF
                int     21H

                ENDM



COMMENT @
    pmsg -- prints a '$' terminated string on the default output
    display (using int 21H, subfunction 9).  This function is safe to use
    at initialize time.
    Arguments:
        message     starting offset of message to be printed
                    or dx if offset is in dx.
    uses register   ah, dx
@

pmsg            MACRO   message

                mov     dx, DVR:message
                call    print_msg

                ENDM


block_driver    STRUC                   ; Template of main block driver
                        db  TYPE device_header DUP (?)  ; Device driver header
    o_fingerprint       db  DEVICE_NAME_SIZE DUP (?)    ; Driver fingerprint
    o_send_pack         dw  ?                   ; Send_pack entry point
    o_recv_pack         dw  ?                   ; Recv_pack entry point
    o_start_transaction dw  ?                   ; Start transaction entry point
    o_end_transaction   dw  ?                   ; End transaction entry point
    o_send_sync         dw  ?                   ; Send Sync entry point
    o_master_code       dw  ?                   ; Master driver id code
    o_eboxprn_seg       dw  ?                   ; EBOXPRN.COM TSR load segment
    o_default_units     db  ?                   ; Default max number of devices
    o_recv_timeout      dw  ?                   ; Timeout for recv_pack
    o_crc_errors        dw  ?                   ; Number of CRC errors recieved
    o_initialized       db  ?                   ; Driver Initialized flag
    o_max_devices       db  ?                   ; Maximum # of devices allowed
    o_first_unit        db  ?                   ; First drive number
    o_units             db  ?                   ; # of devices
    o_slave_units       db  ?                   ; # of Block devices on slave
    o_drive_mapping     db  MAX_DEVICES DUP (?) ; Drive mapping table
    o_invalid           db  MAX_DEVICES DUP (?) ; Device invalid flag
    o_busy_semaphore    db  ?                   ; Communications busy semaphore
    o_port_address      dw  ?
    o_bios_port_num     db  ?
    o_is_serial         db  ?

block_driver    ENDS


auxiliary_driver    STRUC               ; Template of auxiliary driver

                        db  TYPE device_header DUP (?)  ; Device driver header
                        db  DEVICE_NAME_SIZE DUP (?)    ; Driver fingerprint
                        db  DEVICE_NAME_SIZE DUP (?)    ; Driver signature
    o_remote_name       db  DEVICE_NAME_SIZE DUP (?)    ; Remote device name
    o_aux_code          dw  ?                   ; Master arbitrary id code
    o_replacement       db  ?                   ; Replacement driver flag
    o_aux_mode          db  ?                   ; Current Mode of operation
    o_aux_initialized   db  ?                   ; Driver initialized flag
    o_id_code           db  ?                   ; Identification code

auxiliary_driver    ENDS


redirector_tsr  STRUC                   ; Template of the BIOS redirector

                        db  STACK_SIZE + 5CH DUP (?)    ; Room for PSP & STACK
    o_tsr_fingerprint   db  DEVICE_NAME_SIZE DUP (?)    ; TSR Fingerprint
    o_tsr_signature     db  DEVICE_NAME_SIZE DUP (?)    ; TSR Signature
    o_tsr_mode          db  ?                           ; Current operating mode
    o_port_map          db  MAX_PRINTERS DUP (?)        ; Redirection port map
    o_side              db  ?                           ; 0 Local/!0 remote printing

redirector_tsr  ENDS

MAX_SERIAL_PORTS    EQU     4
MAX_PARALLEL_PORTS  EQU     4

MAX_SERIAL_BLOCK    EQU     8192

BAUD_1200       EQU     0
BAUD_2400       EQU     1
BAUD_4800       EQU     2
BAUD_9600       EQU     3
BAUD_19200      EQU     4
BAUD_38400      EQU     5
BAUD_57600      EQU     6
BAUD_115200     EQU     7

SERIAL_PORT_DEF STRUC
    sp_address  dw      ?
    sp_biosnum  db      ?
    irqnum      db      ?               ; IRQ number for serial ports
    maxbaud     dw      ?               ; Maximum baud rate for serial ports
SERIAL_PORT_DEF ENDS

PARALLEL_PORT_DEF STRUC
    pp_address  dw      ?
    pp_biosnum  db      ?
PARALLEL_PORT_DEF ENDS

Win386_Startup_Info_Struc STRUC
    SIS_Version             db  3, 0
    SIS_Next_Dev_Ptr        dd  0
    SIS_Virt_Dev_File_Ptr   dd  Virt_Dev_File
    SIS_Reference_Data      dd  0
    SIS_Instance_Data_Ptr   dd  0
Win386_Startup_Info_Struc ENDS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -