       ORG 0100H
       LOAD 4000H ;KEEP IT SAFE
CR:    EQU 0DH
LF:    EQU 0AH
REST:  EQU 0FB30H
START: LD A,0 ;DRIVE NUMBER
       LD HL,8000H ;LOAD FROM HERE
       LD DE,8200H ;TO HERE
       LD BC,0 ;TRACK & SECTOR 0
       RST 08H ;GO AND GET IT
       DB 0A4H
       LD C,0 ;NOW REMOVE
       LD HL,8208H ;ANY PREVIOUS
       LD DE,8227H ;AUTO COMMAND
       RST 8
       DB 85H
       LD A,0CH ;CLEAR SCREEN
       RST 8
       DB 9EH
       LD HL,M2 ;DATA FOR PROMPT
       LD BC,19F0H ;VIDEO RAM FOR
       LD D,8      ;PROMPT
MUSH:  LD A,(HL)   ;PUT IT
       RST 8
       DB 0C3H
       INC HL
       INC BC
       DEC D
       LD A,D
       CP 0
       JR NZ,MUSH  ;NOW ITS THERE
       LD HL,100H ;START POINT
       LD (REST),HL ;LOAD VECTORS
       LD (REST+2),HL ;SO PROG CAN
       LD (REST+4),HL ;NOT EXIT
       RST 08H ;SIGN ON AND PRINT
       DB 0CFH ;INSTRUCTIONS
       DB CR,LF,'  AutoEx (c)'
       DB ' Copyright Keith'
       DB ' Stokes 198','5'+80H
       RST 8
       DB 0A6H
       RST 8
       DB 0CFH
       DB 'This program will '
       DB 'enable you to make any'
       DB 'disk autoboot any pro'
       DB 'gram you wish','.'+80H
       RST 8
       DB 0A6H
       RST 8
       DB 0CFH
       DB '     '
       DB 'Just enter the program'
       DB ' name at the prompt.'
       DB CR,LF
       DB 'NO ext is required I.E'
       DB '. type '
       DB 'BACKUP not BACKUP.COM'
       DB CR,LF,'      '
       DB 'The file MUST be on th'
       DB 'e disk or a NO FILE '
       DB 'ERROR will occur when'
       DB ' booting.'
       DB CR,LF,LF
       DB 'To ERASE the AUTOBOOT '
       DB 'from a disk press ente'
       DB 'r at the prompt.',LF
       DB CR,LF,'Put destination '
       DB 'disk into any drive',LF
       DB CR,LF,'FILE NAME'
       DB ' '+80H
       LD DE,BUFFER ;STORE AREA
       LD A,3EH ;PROMPT
       RST 8 ;PRINT IT
       DB 9EH
       RST 8
       DB 9DH ;GET INPUT
       LD C,0
       LD DE,BUFFER+10
       INC DE
COUNT: LD A,(DE) ;GET LENGTH
       INC C ;OF INPUT
       CP 20H
       JR Z,MOVE
       AND 5FH ;UPPERCASE ONLY
       LD (DE),A ;PUT IT BACK
       INC DE
       JR COUNT
MOVE:  LD DE,BUFFER+11
       LD HL,8208H
       DEC C ;PUT INTO BUFFER
       LD A,C
       CP 0
       JR Z,WRITE
       LD (HL),C
       INC HL
       EX DE,HL
       LD B,0
       LDIR
WRITE: RST 8 ;WRITE SETUP
       DB 0CFH
       DB CR,LF,'DRIVE NO (0-3'
       DB ')'+80H
       LD A,3EH
       RST 8
       DB 9EH
       RST 8
       DB 9CH
       RST 8
       DB 9EH
       SUB 30H ;CHECK IF VALID
       CP 4 ;DRIVE NO
       JR NC,ERR ;NOT VALID
       LD HL,8000H ;VALID
       LD DE,8512H
       LD BC,0
       RST 8
       DB 0A5H ;WRITE TO DISK
       CP 4
       JR NC,ERR2 ;MORE ERRORS
       JR Z,ERR2
       CP 2
       JR Z,WPROT
       JR AGAIN ;OK
       RST 8
       DB 0CFH
ERR:   RST 8
       DB 0CFH
       DB LF
       DB CR,LF,'INVALID'
       DB ' DRIVE N','O'+80H
       JR WRITE
ERR2:  RST 8
       DB 0CFH
       DB LF
       DB CR,LF,'DRIVE NOT'
       DB ' READ','Y'+80H
       JR WRITE
WPROT: RST 8
       DB 0CFH
       DB CR,LF,LF,'DISK IS '
       DB 'WRITE PROTECTE','D'+80H
       JR $-30
AGAIN: RST 8
       DB 0CFH
       DB CR,LF,LF,'DO IT AGAIN'
       DB ' (Y or N',')'+80H
       LD A,3EH
       RST 8
       DB 9EH
       RST 8
       DB 9CH
       RST 8
       DB 9EH
       AND 5FH
       CP 'Y'
       JP Z,START
       LD A,0CH
       RST 8
       DB 9EH
EXIT:  JP 0H    ; JUMP TO DOS
M2:    DB 00,78H,0FCH,30H
       DB 30H,30H,30H,0
BUFFER:DB 0
END
    RST 8
       DB 9EH
EXIT:  JP 0H    ; JUMP TO DOS
M2:    DB 00,78H,0FCH,30H
       DB 30H,30H,30H,0
BUF