; TITLE GSYSINIT.SYS to grab SYSINIT module from top of mem ; VERSION 1.0 ; DATE 20/3/92 ; (C) 1992 David Woodhouse cseg SEGMENT para public 'code' org 0 assume cs:cseg,ds:cseg,es:nothing,ss:cseg main: dw 0ffffh ;next dvc dw 0ffffh dw 8000h ;attr. dw dvcstrat ;device strategy dw dvcint ;device interrupt db "GSysInit" ;mfg name/unit msg0 db 0Dh,0Ah,"GSYSINIT.SYS",0Dh,0Ah,00 jmptable equ $ dw INIT ;init dw noop ;media check dw noop ;build bpb dw noop ;ioctl input dw noop ;input dw noop ;input, non-destruct dw noop ;input status dw noop ;input flush dw noop ;output dw noop ;output, verify dw noop ;output status dw noop ;output flush dw noop ;ioctl output rqheadr dd 0 ;request header ptr ;page ;device strategy dvcstrat proc far mov cs:word ptr rqheadr,bx ;save request header ptr mov cs:word ptr rqheadr+2,es ret dvcstrat endp ;device interrupt dvcint proc far push ax ;save all regs push bx push cx push dx push di push si push bp push ds push es mov bx,cs mov ds,bx les di,cs:rqheadr ;es:di --> req. header xor bx,bx mov es:[di+3],bx ;status word = 0 mov bl,es:[di+2] ;get command cmp bl,13 ;make sure in range cmc mov al,3 ;assume unknown command error jc cont1 ;if bad command --> shl bx,1 ;bx = index to jmp address cld call word ptr cs:[jmptable+bx] ;do command ;commands all return here cont1: les di,cs:rqheadr ;es:di --> req. header mov ah,2 ;set done bit rcr ah,1 ;rotate in cy flag for error bit or es:[di+3],ax ;or in error condition pop es ;restore all regs pop ds pop bp pop si pop di pop dx pop cx pop bx pop ax ret dvcint endp ;page master proc near ;........................... INIT: .......................................... Init: push cs pop es mov ax,9000h mov ds,ax mov cx,1000h mov di,offset buffer mov si,0 cld repz movsb ;grab sysinit code mov si,sp mov ax,ss:[si+16h] call phword mov ax,0e3ah int 10h mov ax,ss:[si+14h] call phword mov ax,0e0dh int 10h mov ax,0e0ah int 10h mov ax,ss call phword mov ax,0e3ah int 10h mov ax,sp call phword les di,cs:rqheadr ;point to request header mov word ptr es:[di+14],offset LASTBYTE ;set last byte needed mov es:[di+16],cs i2: ret ;page ;........................... No Operation: ................................... noop: mov ax,3 ;unknown command stc ret ;.....................phword........................... ; IN: AX word to be printed ; OUT: nothing ; LOST: nothing phword: push ax xchg al,ah call phbyte mov al,ah call phbyte pop ax ret ;................phbyte........... ; IN: AL byte to printed ; OUT: nothing ; LOST: nothing phbyte: push ax mov ah,al shr al,1 shr al,1 shr al,1 shr al,1 call phnibble mov al,ah call phnibble pop ax ret ;..............phnibble................ ; IN: AL nibble to be printed ; OUT: nothing ; LOST: nothing phnibble: push ax and al,0Fh add al,'0' cmp al,'9' jna ph1 add al,'A'-'9'-1 ph1: mov ah,0Eh int 10h pop ax ret ;........................... Get setup parameters ............................. db ' BUFFER STARTS HERE:' buffer equ $ LASTBYTE equ $+1000h master endp cseg ends end main