;BOOT DISK MAKER - a program that creates a DOS compatible boot disk ; for O3S ; ;VERSION 1.0 06/04/1998 ;COMPILER: TASM 5.00 ;AUTHOR: Xavier Leclercq ;WWW: http://members.xoom.com/xavierleclercq/ ;E-mail: xavierleclercq@iname.com MODEL SMALL DATASEG question1 db 10,13,"Enter the name of the file with the boot code : ","$" error1 db 10,13,"Can't open the file !","$",10,13 error2 db 10,13,"Can't read from floppy disk !","$",10,13 error3 db 10,13,"Can't write to floppy disk !","$",10,13 error4 db 10,13,"Can't read from file !","$",10,13 filename db 255,256 dup (0) ;The name of the file where your boot code is filehandle dw 0 buffer db 512 dup (0) ;This version only copies one sector so a buffer of 512 bytes ;is enough. CODESEG STARTUPCODE mov ah,09h mov dx,offset question1 int 21h mov ah,0Ah mov dx,offset filename int 21h ;Asking which file holds the boot code and storing it in ;"filename" mov bx,offset filename add bl,[filename+1h] add bx,2h mov al,0h mov [bx],al ;Replacing the final Carriage Return with a null byte for the ;use of the buffer by function 3Dh of int 21h mov ah,3Dh mov al,0h ;read-only mov dx,offset filename+2h int 21h jc ErrorLabel1 mov filehandle,ax ;Opening the file and storing the handle in "filehandle" mov ax,@data mov es,ax ;Initializing es mov ah,02h mov dh,0h mov dl,0h mov ch,0h mov cl,1h mov al,1h mov bx,offset buffer int 13h jc ErrorLabel2 ;Read first sector of the disk and store it in "buffer" mov ah,3Fh mov bx,[filehandle] mov cx,512 mov dx,offset buffer+1Eh int 21h jc ErrorLabel4 ;Read boot code from file and copy it to positions 40h and next ;of "buffer". In this version, the boot code can't be more than ;448 bytes so by reading 512 bytes, we're sure that we get all the ;file. The position where the boot code must be on the disk is ;40h, that's why we copy it to position 40h. The parameters of the ;disk are stored before this position and are unchanged. mov buffer,0EBh mov buffer+1h,1Ch mov buffer+2h,90h ;Copy the code for a jump to the boot code to the first three ;bytes of the sector mov ah,03h mov dl,0h mov dh,0h mov ch,0h mov cl,1h mov al,1h mov bx,offset buffer int 13h jc ErrorLabel3 ;Copy the new boot sector to the disk jmp ProgramEnd ErrorLabel1: mov ah,09h mov dx,offset error1 int 21h jmp ProgramEnd ErrorLabel2: mov ah,09h mov dx,offset error2 int 21h jmp ProgramEnd ErrorLabel3: mov ah,09h mov dx,offset error3 int 21h jmp ProgramEnd ErrorLabel4: mov ah,09h mov dx,offset error4 int 21h ProgramEnd: mov ax,4C00h int 21h ;Returning from program successfully END