📄 init.asm
字号:
pmsg m_no_driver
jmp init_done
initialize ENDP
IFDEF DEBUG
dump_break PROC NEAR
mov ax, es
DBG ' '
DBG 'r'
DBG 'h'
DBG '='
HEX ah
HEX al
DBG ':'
mov ax, di
HEX ah
HEX al
DBG ' '
DBG 'b'
DBG 'a'
DBG '='
mov ax, WORD PTR es:[di].init_ans.init_end + 2
HEX ah
HEX al
DBG ':'
mov ax, WORD PTR es:[di].init_ans.init_end
HEX ah
HEX al
ret
dump_break ENDP
ENDIF
hook_int2f PROC NEAR
mov ax, 352FH
int 21H
mov ax, es
or ax, bx
jz change_int2f
inc int2f_ok ; Vector is not zero
mov WORD PTR old_int2f_vec, bx
mov WORD PTR old_int2f_vec + 2, es
mov ax, (INTERLNK_MULTIPLEX_ID SHL 8) OR 0
mov bl, 0
mov dx, 0FFFFH
int 2FH
cmp al, 0FFH
je @F
xor bl, bl
@@: inc bl
mov driver_id, bl
change_int2f: mov dx, DVR:int2f_handler ;DS:DX -> int2f_handler
mov ax, 252FH
int 21H
mov WORD PTR Win386_Startup_Info.SIS_Virt_Dev_File_Ptr + 2, ds
ret
hook_int2f ENDP
hook_int25_26 PROC NEAR
mov ax, 3525H
int 21H
mov WORD PTR old_int25_vec, bx
mov WORD PTR old_int25_vec + 2, es
mov dx, DVR:int25_handler
mov ax, 2525H
int 21H
mov ax, 3526H
int 21H
mov WORD PTR old_int26_vec, bx
mov WORD PTR old_int26_vec + 2, es
mov dx, DVR:int26_handler
mov ax, 2526H
int 21H
ret
hook_int25_26 ENDP
signon PROC NEAR
PUBLIC signon
pmsg product_name
ret
signon ENDP
show_units PROC NEAR
PUBLIC show_units
mov al, units
aam
add ax, "00"
xchg ah, al
cmp al, '0'
jne stuff_ndrives
mov al, ' '
stuff_ndrives: mov cs:signon_ndrives, ax
cmp units, 0
jne show_drives
pmsg no_drives
jmp short show_units_ret
show_drives: mov bl, first_unit ; Setup default drive mapping message
add bl, 'A'
mov cs:signon_dfirst, bl
add bl, units
dec bl
mov cs:signon_dlast, bl
cmp units, 1
jne show
mov WORD PTR cs:signon_paren, 0D29H ; ")\r"
mov WORD PTR cs:signon_paren + 2, 240AH ; "\n$"
show: pmsg signon_default
show_units_ret: ret
show_units ENDP
show_printers PROC NEAR
PUBLIC show_printers
cmp printer_loaded, 0
jne have_printers
pmsg no_printers
jmp short show_pr_ret
have_printers: mov al, 3
sub al, num_lpt
mov ah, al ; Save number of printers in AH
add al, '0'
mov cs:printer_ndrives, al
mov bl, 3
sub bl, ah
add bl, '1'
mov cs:printer_dfirst, bl
add bl, ah
dec bl
mov cs:printer_dlast, bl
cmp ah, 1
jne show_pr
mov WORD PTR cs:printer_paren, 0D29H ; ")\r"
mov WORD PTR cs: printer_paren + 2, 240AH ; "\n$"
show_pr: pmsg printer_default
show_pr_ret: ret
show_printers ENDP
connect PROC NEAR
PUBLIC connect
pmsg m_connect_try
inc display_scan
mov ax, DVR:send_sync_proc
call driver_call
dec display_scan ;"dec" DOES NOT AFFECT CARRY FLAG
jc connect_fail
mov initialized, 0
mov ax, DVR:gri_proc
call driver_call
jc connect_fail
show_ok: pmsg m_connect_ok
mov bx, port_index
cmp is_serial, 0
jne connect_ser
call show_port_par
jmp short connect_ok
connect_ser: call show_port_ser
connect_ok: call show_crlf
mov idle_semaphore, 0 ; Turn off idler for now
clc
jmp short connect_done
connect_fail: pmsg m_connect_fail
stc
connect_done: ret
connect ENDP
print_asciiz PROC NEAR
push dx
print_loop: lodsb
or al, al
jz blank_fill
mov ah, 2
mov dl, al
int 21H
loop print_loop
blank_fill: jcxz print_done
blank_loop: mov ah, 2
mov dl, ' '
int 21H
loop blank_loop
print_done: pop dx
ret
print_asciiz ENDP
print_msg PROC NEAR
PUBLIC print_msg
push ds
push cs
pop ds
mov ah, 9
int 21H
pop ds
ret
print_msg ENDP
show_drive_map PROC NEAR
PUBLIC show_drive_map
pmsg m_map_header
mov cl, units
xor ch, ch
or cx, cx
jz show_map_ret
xor bx, bx
show_unit_loop: mov al, bl
add al, first_unit
add al, 'A'
mov cs:m_client_letter, al
mov al, drive_mapping[bx]
cmp al, MAX_DEVICES
jae next_unit
add al, 'A'
mov cs:m_server_letter, al
pmsg m_drive_map
push bx
push cx
mov packet_buf.common_packet.packet_type, DRIVE_INFO_REQ
mov al, drive_mapping[bx]
mov packet_buf.drive_info_r.dir_unit, al
mov cx, TYPE drive_info_r
mov si, DVR:packet_buf
push ds
pop es
mov ax, send_pack ; Verify that send_pack preserves ES
call driver_call
jc show_map_err
mov di, DVR:packet_buf
mov cx, MAX_PACKET
mov ax, recv_pack
call driver_call
jc show_map_err
mov si, DVR:packet_buf.drive_info_a.dia_size
mov cx, 8
call print_asciiz
mov si, DVR:packet_buf.drive_info_a.dia_vol_label
mov cx, 12
call print_asciiz
call show_crlf
pop cx
pop bx
next_unit: inc bx
dec cx
jcxz show_map_ret
jmp show_unit_loop
show_map_ret: clc
ret
show_map_err: pop cx
pop bx
pmsg m_lost_connect
stc
ret
show_drive_map ENDP
show_prn_map PROC NEAR
PUBLIC show_prn_map
cmp printer_loaded, 0
je show_prn_ret
mov cx, 3
mov bx, 0
prn_loop: mov al, actual_prn_map[bx]
cmp al, 0FFH
je prn_next
add al, '1'
mov cs:m_prn_se_letter, al
mov al, bl
add al, '1'
mov cs:m_prn_cl_letter, al
pmsg m_prn_map
prn_next: inc bx
loop prn_loop
show_prn_ret: ret
show_prn_map ENDP
fixup_table PROC NEAR
; Enter with AX = fixup value, SI = start of table, CX = end of table
; Destroys BX, SI
xor bx, bx
table_loop: cmp [si], bx
je advance
sub [si], ax
advance: add si, 2
cmp si, cx
jb table_loop
ret
fixup_table ENDP
check_copy_code PROC NEAR
sub cx, si ; CX = number of bytes to move
mov ax, si
sub ax, di ; Leave fixup value in AX
jz no_copy
shr cx, 1
clc ; Indicate copy needs to be done
jmp short copy_done
no_copy: add di, cx
stc
copy_done: ret
check_copy_code ENDP
get_equipment PROC NEAR
int 11H
push ax
rol ax, 1
rol ax, 1
and al, 3
mov num_lpt, al
cmp al, 3
jne @F
mov printer_loaded, 0
@@: pop ax
mov cl, 9
shr ax, cl
and al, 7
cmp al, 4
jbe ser_count_ok
mov al, 4
ser_count_ok: mov num_com, al
ret
get_equipment ENDP
baud_buff db "115200"
baud_buff_tail EQU $ - 1
db CR, LF, '$'
show_max_baud PROC NEAR
PUBLIC show_max_baud
mov bl, client_max_baud
cmp bl, BAUD_115200
jb show_max
mov client_max_baud, BAUD_115200
jmp short show_max_ret
show_max: pmsg m_max_baud
xor bh, bh
mov dl, cs:baud_table_high[bx]
xor dh, dh
shl bx, 1
mov ax, cs:baud_table_low[bx]
mov di, DVR:baud_buff_tail
mov bx, ax ;DX:BX = value
mov cx, 10 ;Get radix to CX
next_digit: xchg ax,dx ;Divide hi
xor dx,dx
div cx ;DX = rem, AX = hi div
xchg ax,bx ;AX = lo, BX = hi div
div cx ;DX = rem, BX:AX = div
xchg ax,dx ;AX = rem, BX:DX = div
xchg dx,bx ;AX = rem, DX:BX = div
add al,'0'
mov cs:[di], al
dec di
mov ax,dx
or ax,bx
jnz next_digit
inc di
mov dx, di
call print_msg
show_max_ret: ret
show_max_baud ENDP
get_dos_version PROC NEAR ; Gets dos version numbers
mov ax, 3000H ; Get the dos version number
int 21H
xchg al, ah ; Put version number in WORD format
cmp ax, DOS30 ; Make special check for Zenith DOS 3.30+
jne @F
cmp bh, 5 ; 5 is Zeniths OEM number
jne @F
mov ax, DOS331 ; Pretend Zenith-DOS 3.30+ is DOS 3.31
@@: mov dos_version, ax
ret
get_dos_version ENDP
toupper PROC NEAR
PUBLIC toupper
cmp al, 'a'
jb toupper_ret
cmp al, 'z'
ja toupper_ret
sub al, 'a' - 'A'
toupper_ret: ret
toupper ENDP
arg_table db 3, 'COM'
dw DVR:set_com_port
db 3, 'LPT'
dw DVR:set_lpt_port
db 3, 'LOW'
dw DVR:set_force_low
db 6, 'DRIVES'
dw DVR:set_num_drives
db 9, 'NOPRINTER'
dw DVR:set_noprinter
db 6, 'NOSCAN'
dw DVR:set_noscan
db 4, 'AUTO'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -