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

📄 core.asm

📁 Dos6.0
💻 ASM
📖 第 1 页 / 共 3 页
字号:
;***
;* $Workfile:   core.asm  $
;* $Revision:   1.5  $
;*   $Author:   Dave Sewell  $
;*     $Date:   08 Aug 1989 16:44:52  $
;***

                INCLUDE drivers.mac
                INCLUDE packets.mac
                INCLUDE debug.mac

DRIVER_ATTRIB   = ATT_BLOCK     ; Device driver type
LPT_ATTRIB      = ATT_CHARACTER OR ATT_OCRM

PARALLEL        SEGMENT WORD PUBLIC 'CODE'
                EXTRN   send_pack_parallel:NEAR
                EXTRN   recv_pack_parallel:NEAR
                EXTRN   send_sync_parallel:NEAR
                EXTRN   save_parallel:NEAR
                EXTRN   restore_parallel:NEAR
                EXTRN   timer_passthru_par:FAR
                EXTRN   ss_timeout:NEAR
                EXTRN   ssp1:NEAR
                EXTRN   ssp2:NEAR
                EXTRN   ssp3:NEAR
                EXTRN   sw_timeout:NEAR
                EXTRN   swp1:NEAR
                EXTRN   swp2:NEAR
                EXTRN   sp_timeout:NEAR
                EXTRN   spp2:NEAR
                EXTRN   spp3:NEAR
                EXTRN   spp4:NEAR
                EXTRN   spn_timeout:NEAR
                EXTRN   spn2:NEAR
                EXTRN   spn3:NEAR
                EXTRN   spn4:NEAR
                EXTRN   rw_timeout:NEAR
                EXTRN   rwp1:NEAR
                EXTRN   rwp2:NEAR
                EXTRN   rp_timeout:NEAR
                EXTRN   rpp1:NEAR
                EXTRN   rpp2:NEAR
                EXTRN   rpp3:NEAR
                EXTRN   rpn_timeout:NEAR
                EXTRN   rpn1:NEAR
                EXTRN   rpn2:NEAR
                EXTRN   rpn3:NEAR
                EXTRN   wsa1:NEAR
                EXTRN   wsa_timeout:NEAR
PARALLEL        ENDS

SERIAL          SEGMENT WORD PUBLIC 'CODE'
                EXTRN   send_pack_serial:NEAR
                EXTRN   recv_pack_serial:NEAR
                EXTRN   send_sync_serial:NEAR
                EXTRN   init_port_serial:NEAR
                EXTRN   reset_port_serial:NEAR
SERIAL          ENDS

BLOCK           SEGMENT WORD PUBLIC 'CODE'
                EXTRN   intr:FAR
                EXTRN   unmapped_unit:WORD
                EXTRN   units:BYTE
BLOCK           ENDS

CORE            SEGMENT WORD PUBLIC 'CODE'
                PUBLIC  start_packet
                PUBLIC  end_packet
                PUBLIC  header
                PUBLIC  lpt3_header
                PUBLIC  lpt2_header
                PUBLIC  lpt1_header
                PUBLIC  finger_print
                PUBLIC  major_version
                PUBLIC  minor_version
                PUBLIC  strat_seg
                PUBLIC  intr1_seg
                PUBLIC  intr2_seg
                PUBLIC  intr3_off
                PUBLIC  intr3_seg
                PUBLIC  intr0_seg
                PUBLIC  intr_error
                PUBLIC  device_id
                PUBLIC  header_seg
                PUBLIC  driver_id
                PUBLIC  end_low_stub
                PUBLIC  end_core_data
                PUBLIC  driver_call
                PUBLIC  send_pack
                PUBLIC  recv_pack
                PUBLIC  send_sync
                PUBLIC  get_remote_info
        IFDEF DEBUG
                PUBLIC  debug_msg
                PUBLIC  hex_out
        ENDIF
                PUBLIC  client_id
                PUBLIC  crc_errors
                PUBLIC  seq_num
                PUBLIC  busy_semaphore
                PUBLIC  idle_semaphore
                PUBLIC  port_address
                PUBLIC  port_index
                PUBLIC  bios_port_num
                PUBLIC  max_baud
                PUBLIC  client_max_baud
                PUBLIC  max_serial_block
                PUBLIC  is_serial
                PUBLIC  int2f_ok
                PUBLIC  old_int2f_vec
                PUBLIC  old_int25_vec
                PUBLIC  old_int26_vec
                PUBLIC  C int2f_handler
                PUBLIC  C int25_handler
                PUBLIC  C int26_handler
                PUBLIC  win386_enh_mode
                PUBLIC  win386_std_mode
                PUBLIC  Virt_Dev_File
                PUBLIC  Win386_Startup_Info
                PUBLIC  win_386_api_ok
                PUBLIC  win_386_api
                PUBLIC  crctab
                PUBLIC  rhptr
                PUBLIC  dos_version
                PUBLIC  dos_major
                PUBLIC  dos_minor
                PUBLIC  slave_dos_version
                PUBLIC  slave_dos_minor
                PUBLIC  slave_dos_major
                PUBLIC  server_major
                PUBLIC  server_minor
                PUBLIC  packet_buf
                PUBLIC  num_ports
                PUBLIC  num_ser_ports
                PUBLIC  num_par_ports
                PUBLIC  serial_ports
                PUBLIC  parallel_ports
                PUBLIC  default_units
                PUBLIC  first_unit
                PUBLIC  printer_loaded
                PUBLIC  actual_prn_map
                PUBLIC  slave_units
                PUBLIC  initialized
                PUBLIC  drive_mapping
                PUBLIC  default_mapping
                PUBLIC  invalid
                PUBLIC  dd_attributes
                PUBLIC  save_area
                PUBLIC  timeout
                PUBLIC  code_list_ptr
                PUBLIC  code_save
                PUBLIC  ticks_remaining
                PUBLIC  set_alarm_time
                PUBLIC  alarm_vector
                PUBLIC  par_timer_save
                PUBLIC  send_sync_list
                PUBLIC  send_word_list
                PUBLIC  send_pack_list2
                PUBLIC  sp_normal_list
                PUBLIC  recv_word_list
                PUBLIC  recv_pack_list
                PUBLIC  rp_normal_list
                PUBLIC  wait_send_list
                PUBLIC  timer_jmp
                PUBLIC  par_fixup_start
                PUBLIC  par_fixup_end
                PUBLIC  request        
                PUBLIC  port           
                PUBLIC  old_int17
                PUBLIC  device_high
                PUBLIC  init_size
                PUBLIC  low_memory
                PUBLIC  driver_size
                PUBLIC  num_lpt
                PUBLIC  num_com
                PUBLIC  display_scan
                PUBLIC  fx_force_variable

                ORG     0       ; The First device header must be at loc 0!

lpt3_header     device_header <DVR:lpt2_header, -1, LPT_ATTRIB, DVR:strat_jmp, DVR:intr3_jmp, 'LPT3    '>
lpt2_header     device_header <DVR:lpt1_header, -1, LPT_ATTRIB, DVR:strat_jmp, DVR:intr2_jmp, 'LPT2    '>
lpt1_header     device_header <DVR:header,      -1, LPT_ATTRIB, DVR:strat_jmp, DVR:intr1_jmp, 'LPT1    '>
header          device_header <-1, -1, DRIVER_ATTRIB, DVR:strat_jmp, DVR:intr0_jmp, 'C'>
                                        ; Device header

finger_print    db      'INTERLNK'
major_version   db      MAJOR_VER
minor_version   db      MINOR_VER

strat_jmp       LABEL   NEAR

                jmp     far ptr strat

strat_seg       EQU     WORD PTR strat_jmp + 3

intr1_jmp       LABEL   NEAR

                push    ax
                mov     al, 1
                jmp     far ptr intr

intr1_seg       EQU     WORD PTR $ - 2

intr2_jmp       LABEL   NEAR

                push    ax
                mov     al, 2
                jmp     far ptr intr

intr2_seg       EQU     WORD PTR $ - 2

intr3_jmp       LABEL   NEAR

                push    ax
                mov     al, 3
                jmp     far ptr intr

intr3_off       EQU     WORD PTR $ - 4
intr3_seg       EQU     WORD PTR $ - 2

intr0_jmp       LABEL   NEAR

                push    ax
                mov     al, 0
                jmp     far ptr intr

intr0_seg       EQU     WORD PTR $ - 2

end_low_stub    LABEL   NEAR

                EVEN

;NOTE: port_address gets set to zero if send_pack or recv_pack fails.
;This indicates that the connection has been lost and that send_sync must
;be called again to re-establish the connection before calling send_pack
;or recv_pack again.

port_address    dw      0       ; Set to address of serial or parallel port

; initialized   This value is non-zero if the init_packet sequence has been
;               successfully completed (get_remote_info).
;
initialized     db      0                   ; Driver currently Initialized flag

device_id       db      0                   ; 0 = block, 1 - 3 = LPT1 - LPT3
header_seg      dw      0

driver_id       db      1                   ; Logical Interlnk driver number

is_serial       db      0
send_pack       DW      DVR:error_proc
recv_pack       DW      DVR:error_proc

driver_call     DW      DVR:far_call
                DW      ?                   ; Must be updated with correct CS

send_sync       DW      DVR:send_sync_proc
get_remote_info DW      DVR:gri_proc
start_packet    DW      DVR:start_vxd
end_packet      DW      DVR:end_vxd

IFDEF DEBUG
debug_msg       DW      DVR:debug_msg_proc
hex_out         DW      DVR:hex_out_proc
ENDIF

;NOTE: the two DWORDs below must be in this order so that they can be moved
;into the SERVER_INFO_REQ packet with a block move, and compared against the
;SERVER_INFO_ANS packet with a block compare.

client_id       dd      0
last_server_id  dd      0

; crc_errors    This is the number of CRC errors that have been detected
;               since the driver was installed.  This value is maintained
;               by the protocol routines and is for informational purposes
;               only.
;
crc_errors      dw  0                   ; Number of CRC errors recieved

; busy_semaphore    This byte is non-zero if communications are currently in
;                   progress.  All auxiliary drivers, TSRs as well as the main
;                   driver update this byte when they start and end a com-
;                   munication session.  If the semaphore is set, then somebody
;                   else is using the port.  It is mandatory that this byte be
;                   checked and updated in a non-interruptable manner (either
;                   by using sti/cli or xchg/test).
;
busy_semaphore  db      0

idle_semaphore  db      0       ; Set non-zero if background idling is OK

port_index      dw      0       ; Indexes into serial_ports or parallel_ports

bios_port_num   db      0       ; 0 if not BIOS, 1 - 4 for COM1 - 4, LPT1 - 4

max_baud        db      BAUD_115200     ; Maximum actual baud rate
client_max_baud db      BAUD_115200     ; Maximum desired baud rate
max_serial_block    dw  MAX_SERIAL_BLOCK

win386_enh_mode db      0
win386_std_mode db      0
int2f_ok        db      0
old_int2f_vec   dd      0
old_int25_vec   dd      0
old_int26_vec   dd      0
win_386_api_ok  db      0
win_386_api     dd      ?

Virt_Dev_File   db      67 DUP (0)

Win386_Startup_Info Win386_Startup_Info_Struc <>

; default_units Number of units to be installed
;
default_units   db  3                   ; Default max number of devices

; first_unit    This is the actual drive number (0=A:, 1=B:, etc.) of the first
;               drive supported by this driver.
;
first_unit      db  ?                   ; First drive number

printer_loaded  db  1                   ; 0 if printer code not loaded

; slave_units   This is the number of logical block devices available on the
;               slave system.
;
slave_units     db      ?               ; Number of Block devices on slave


;-----------------------------------------------------------------------------
;--- IMPORTANT NOTE: actual_prn_map must immediately precede drive_mapping,
;--- because a block move is used to copy values in and out of the init packet
actual_prn_map  db  3 dup (DONT_CARE)
; drive_mapping This array is the drive mapping translation table.  This array
;               is addressed by the unit number in the RHP.  The contents of
;               the location is the actual unit number on the slave device.
;               The most significant bit of the value is the write protect bit.
;               If the bit is set, write operations are not allowed.  If it is
;               clear, write operations are allowed.  The lower 7 bits are the
;               actual unit number on the slave devices.
;
drive_mapping   LABEL   BYTE            ; Drive mapping translation table
        db      MAX_DEVICES DUP(DONT_CARE)

default_mapping db      MAX_DEVICES DUP(DONT_CARE)
;-----------------------------------------------------------------------------

; invalid   This array (like the drive_mapping array) is addressed by the unit
;           number in the RHP.  In general if invalid[unit] is non-zero,    
;           the BPB for the unit must be updated.
;               In media_check, if invalid[unit] is set, the media_check
;           will be forced to return MEDIA_CHANGED.  The on-line drive mapping
;           sets this value.  This forces DOS to rebuild the BPB for the device
;           the next time it is accessed.
;
invalid         db  MAX_DEVICES DUP (0FFH)  ; Rebuild-BPB flags

                db      90H                 ;$$$

; dd_attributes are the device driver attributes for each logical device on
; the slave system.  This array is addressed by the mapped unit number (the
; device number on the slave system)--NOT the unit number in the RHP
;
dd_attributes   dw      MAX_DEVICES DUP (0)


crctab  DW 00000H, 01021H, 02042H, 03063H, 04084H, 050a5H, 060c6H, 070e7H
        DW 08108H, 09129H, 0a14aH, 0b16bH, 0c18cH, 0d1adH, 0e1ceH, 0f1efH
        DW 01231H, 00210H, 03273H, 02252H, 052b5H, 04294H, 072f7H, 062d6H
        DW 09339H, 08318H, 0b37bH, 0a35aH, 0d3bdH, 0c39cH, 0f3ffH, 0e3deH
        DW 02462H, 03443H, 00420H, 01401H, 064e6H, 074c7H, 044a4H, 05485H
        DW 0a56aH, 0b54bH, 08528H, 09509H, 0e5eeH, 0f5cfH, 0c5acH, 0d58dH
        DW 03653H, 02672H, 01611H, 00630H, 076d7H, 066f6H, 05695H, 046b4H
        DW 0b75bH, 0a77aH, 09719H, 08738H, 0f7dfH, 0e7feH, 0d79dH, 0c7bcH
        DW 048c4H, 058e5H, 06886H, 078a7H, 00840H, 01861H, 02802H, 03823H
        DW 0c9ccH, 0d9edH, 0e98eH, 0f9afH, 08948H, 09969H, 0a90aH, 0b92bH
        DW 05af5H, 04ad4H, 07ab7H, 06a96H, 01a71H, 00a50H, 03a33H, 02a12H
        DW 0dbfdH, 0cbdcH, 0fbbfH, 0eb9eH, 09b79H, 08b58H, 0bb3bH, 0ab1aH
        DW 06ca6H, 07c87H, 04ce4H, 05cc5H, 02c22H, 03c03H, 00c60H, 01c41H
        DW 0edaeH, 0fd8fH, 0cdecH, 0ddcdH, 0ad2aH, 0bd0bH, 08d68H, 09d49H
        DW 07e97H, 06eb6H, 05ed5H, 04ef4H, 03e13H, 02e32H, 01e51H, 00e70H
        DW 0ff9fH, 0efbeH, 0dfddH, 0cffcH, 0bf1bH, 0af3aH, 09f59H, 08f78H
        DW 09188H, 081a9H, 0b1caH, 0a1ebH, 0d10cH, 0c12dH, 0f14eH, 0e16fH
        DW 01080H, 000a1H, 030c2H, 020e3H, 05004H, 04025H, 07046H, 06067H
        DW 083b9H, 09398H, 0a3fbH, 0b3daH, 0c33dH, 0d31cH, 0e37fH, 0f35eH
        DW 002b1H, 01290H, 022f3H, 032d2H, 04235H, 05214H, 06277H, 07256H
        DW 0b5eaH, 0a5cbH, 095a8H, 08589H, 0f56eH, 0e54fH, 0d52cH, 0c50dH
        DW 034e2H, 024c3H, 014a0H, 00481H, 07466H, 06447H, 05424H, 04405H
        DW 0a7dbH, 0b7faH, 08799H, 097b8H, 0e75fH, 0f77eH, 0c71dH, 0d73cH
        DW 026d3H, 036f2H, 00691H, 016b0H, 06657H, 07676H, 04615H, 05634H
        DW 0d94cH, 0c96dH, 0f90eH, 0e92fH, 099c8H, 089e9H, 0b98aH, 0a9abH
        DW 05844H, 04865H, 07806H, 06827H, 018c0H, 008e1H, 03882H, 028a3H
        DW 0cb7dH, 0db5cH, 0eb3fH, 0fb1eH, 08bf9H, 09bd8H, 0abbbH, 0bb9aH
        DW 04a75H, 05a54H, 06a37H, 07a16H, 00af1H, 01ad0H, 02ab3H, 03a92H
        DW 0fd2eH, 0ed0fH, 0dd6cH, 0cd4dH, 0bdaaH, 0ad8bH, 09de8H, 08dc9H
        DW 07c26H, 06c07H, 05c64H, 04c45H, 03ca2H, 02c83H, 01ce0H, 00cc1H
        DW 0ef1fH, 0ff3eH, 0cf5dH, 0df7cH, 0af9bH, 0bfbaH, 08fd9H, 09ff8H
        DW 06e17H, 07e36H, 04e55H, 05e74H, 02e93H, 03eb2H, 00ed1H, 01ef0H

rhptr           dd      ?               ; Pointer to request header, passed
                                        ; by MS-DOS kernal to Strategy routine

dos_version     LABEL   WORD            ; DOS's version number in WORD format
dos_minor       db      ?               ; DOS's minor version number
dos_major       db      ?               ; DOS's major version number

slave_dos_version   LABEL   WORD        ; DOS version of slave in WORD format
slave_dos_minor db      ?               ; DOS minor number of slave
slave_dos_major db      ?               ; DOS major number of slave

server_major    db      ?               ; Server major version number
server_minor    db      ?               ; Server minor version number

⌨️ 快捷键说明

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