Beruflich Dokumente
Kultur Dokumente
toggle_active:
mov dl,cs:active
xor dl,01
mov cs:active,dl
jmp bye_bye_
install_check:
cmp bx,'Di'
jne pass_it_on
cmp cx,'Vu'
jne pass_it_on
cmp dl,7eh
je toggle_active
cmp dl,7fh
jne pass_it_on
bye_bye_:
mov bx,'dI'
mov cx,'vU'
mov ah,01
stc
db 0caH ;retf 2
dw 2
;
;INT 40H handler
altd:
; mov cs:al,al
cmp ah,10h
jne pass_it_on
jmp install_check
pass_it_on:
pushf
call dword ptr altdisk
pushf
mov cs:ax_save,ax
call near ptr bingo
mov cs:the_count,ax
mov ax,cs:ax_save
popf
db 0caH ;retf 2
dw 2
;
;INT 1cH HANDLER
counter label near
cli
mov cs:ax_savw,ax
mov ax,cs:the_count
dec ax
jnz no_bingo
call near ptr bingow
no_bingo label near
mov cs:the_count,ax
mov ax,cs:ax_savw
jmp dword ptr cs:[oldtick]
;
bingow label near
cmp cs:active,0
je rets_
mov cs:bx_savw,bx
mov cs:cx_savw,cx
mov cs:dx_savw,dx
mov cs:si_savw,si
mov cs:di_savw,di
mov cs:bp_savw,bp
mov cs:ds_savw,ds
mov cs:es_savw,es
call near ptr bingoc
; restore and exit
mov es,cs:es_savw
mov ds,cs:ds_savw
mov bp,cs:bp_savw
mov di,cs:di_savw
mov si,cs:si_savw
mov dx,cs:dx_savw
mov cx,cs:cx_savw
mov bx,cs:bx_savw
rets_:
mov ax,cs:max_count
db 0c3h ; rets
;
bingo label near
cmp cs:active,0
je rets_
mov cs:bx_save,bx
mov cs:cx_save,cx
mov cs:dx_save,dx
mov cs:si_save,si
mov cs:di_save,di
mov cs:bp_save,bp
mov cs:ds_save,ds
mov cs:es_save,es
call near ptr bingoc
; restore and exit
mov es,cs:es_save
mov ds,cs:ds_save
mov bp,cs:bp_save
mov di,cs:di_save
mov si,cs:si_save
mov dx,cs:dx_save
mov cx,cs:cx_save
mov bx,cs:bx_save
mov ax,cs:max_count
db 0c3h ; rets
;
;
bingoc label near
;have saved - set up addressing
mov ax,0
mov es,ax
assume cs:code_seg,ds:nothing,es:abs0
push cs
pop ds
;reset count for next round
mov ax,max_count
mov the_count,ax
;get SRT & hd unload/ hd load & DMA
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx]
call convert
mov al,0
mov row,al
call display
; get motor wait / sector size
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+2]
call convert
mov al,1
mov row,al
call display
;now do sectors/track & r/w/v gap
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+4]
call convert
mov al,2
mov row,al
call display
;now do DTL / format gap
mov ax,0
mov es,ax
les bx,dword ptr es:[78h]
mov bx,word ptr es:[bx+6]
call convert
mov al,3
mov row,al
call display
call blankit
mov al,4
mov row,al
call display
;get BIOS DISK STATE MACHINE values
mov ax,40h
mov es,ax
assume cs:code_seg,ds:code_seg,es:bios_data
mov bx,es:[states]
call convert
mov al,5d
mov row,al
call display
; same for operation
mov bx,es:[state_ops]
call convert
mov al,6d
mov row,al
call display
; same for cylinders
mov bx,es:[cylinders]
call convert
mov al,7d
mov row,al
call display
; same for
mov bh,es:[media_control]
mov bl,es:[diskette_info]
call convert
mov al,8d
mov row,al
call display
call blankit
mov al,9
mov row,al
call display
;get BIOS DISK data values -- recal status / motor status
mov bx,word ptr es:[3eh]
call convert
mov al,10d
mov row,al
call display
; 41/42 diskette status/NEC status byte 1
; diskette status: 80 = timeout
; 40 = bad seek
; 20 = bad NEC
; 10 = bad CRC
; 09 = DMA bounds (cross 64k boundary)
; 08 = DMA overrun
; 04 = sector not found
; 03 = write protect violation
; 02 = address mark not found
; 01 = bad command to NEC
mov bx,word ptr es:[41h]
call convert
mov al,11d
mov row,al
call display
; 43/44 NEC status bytes 2 & 3
mov bx,word ptr es:[43h]
call convert
mov al,12d
mov row,al
call display
; 45/46 NEC status bytes 4 & 5
mov bx,word ptr es:[45h]
call convert
mov al,13d
mov row,al
call display
; 47/48 NEC status bytes 6 & 7
mov bx,word ptr es:[47h]
call convert
mov al,14d
mov row,al
call display
call blankit
mov al,15d
mov row,al
call display
; exit
assume cs:code_seg,ds:nothing,es:nothing
db 0c3h ; rets
;
assume cs:code_seg,ds:code_seg
blankit label near
mov al,' '
mov string[0],al
mov string[1],al
; mov string[2],al
mov string[3],al
mov string[4],al
db 0c3h ; rets
;
;
convert label near
mov si,offset hex_dig
mov it,bx
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[1],al
mov bx,it
shr bl,1
shr bl,1
shr bl,1
shr bl,1
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string,al
mov bx,it
mov bl,bh
mov it,bx
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[4],al
mov bx,it
shr bl,1
shr bl,1
shr bl,1
shr bl,1
and bx,0fH
add bx,si
mov al,byte ptr ds:[bx]
mov string[3],al
db 0c3h ; rets
;
;
display label near
mov ah,3
xor bx,bx
int 10h
mov cursor,dx
mov ah,2
mov bh,0
mov dl,075d
mov dh,row
int 10h
mov ah,10d
mov al,string
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,076d
mov dh,row
int 10h
mov ah,10d
mov al,string[1]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,077d
mov dh,row
int 10h
mov ah,10d
mov al,string[2]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,078d
mov dh,row
int 10h
mov ah,10d
mov al,string[3]
mov bx,070
mov cx,1
int 10h
mov ah,2
mov bh,0
mov dl,079d
mov dh,row
int 10h
mov ah,10d
mov al,string[4]
mov bx,070
mov cx,1
int 10h
mov ah,2
xor bx,bx
mov dx,cursor
int 10h
db 0c3h ; rets
;
init label near
mov bx,'Di' ;install check, are we already installed?
mov cx,'Vu'
mov dl,7fh
mov ah,10h
int 40h
cmp bx,'dI'
jne can_do_install
cmp cx,'vU'
jne can_do_install
push cs
pop ds
lea dx,id_mess
mov ah,9
int 21h
mov ax,4c01h
int 21h
int 20h
can_do_install:
assume cs:code_seg,ds:code_seg,es:nothing
xor ax,ax
mov es,ax
assume cs:code_seg,ds:code_seg,es:abs0
les di,dword ptr es:[timertk]
mov word ptr oldticko,di
mov di,es
mov word ptr oldticks,di
xor ax,ax
mov es,ax
les di,dword ptr es:[diskalt]
mov word ptr altdisko,di
mov di,es
mov word ptr altdisks,di
xor ax,ax
mov es,ax
cli
mov ax,offset counter
mov word ptr es:tickoff,ax
mov ax,cs
mov word ptr es:tickseg,ax
mov ax,offset altd
mov word ptr es:altoff,ax
mov ax,cs
mov word ptr es:altseg,ax
mov ax,max_count
mov the_count,ax
push cs
pop ds
push cs
pop es
assume cs:code_seg,ds:code_seg,es:code_seg
mov di,0081H ;copy an ID mess to command line buffer
mov si,offset id_mess
mov cx,(offset id_end) - (offset id_mess)
mov byte ptr ds:[080H],cl
cld
rep movsb
lea dx,sign_on
mov ah,09
int 21h
code_seg ends
;
;
abs0 segment at 0
org 4ch
romdisk label dword
diskoff dw ?
diskseg label word
org 70h
timertk label dword
tickoff dw ?
tickseg label word
org 78h
dskparm label dword
parmoff dw ?
parmseg label word
org 100h
diskalt label dword
altoff dw ?
altseg label word
abs0 ends
;
bios_data segment at 040h
org 08bh
media_control db ? ;bits 7-6 last data rate [00=500 01=300 10=250 11=reserved]
;bits 5-4 last drive step rate
;bits 3-2 {data rate at start of operation}
;bits 1-0 reserved
org 08fh
diskette_info db ? ;bit 7 reserved
;bit 6 =1 if drive 1 determined
;bit 5 =1 if multi-rate valid only if determined
;bit 4 =1 if drive 1 does 80 tracks, always valid
;bit 3 reserved
;bit 2 =1 if drive 0 determined
;bit 1 =1 if multi-rate valid only if determined
;bit 0 =1 if drive 0 does 80 tracks, always valid
org 090h
states label word
a_state db ?
b_state db ?
state_ops label word
a_state_op db ?
b_state_op db ?
cylinders label word
a_cyl db ?
b_cyl db ?
bios_data ends
end entry_point
_