;************************************************************************ ;* * ;* Supervisory program for MONSTEP.COM. This program loads * ;* MONSTEP and patches it and generally supervises the running of * ;* MONSTEP. Begun February 18, 1990 by Ronald E. Jacobs. * ;* * ;************************************************************************ ORG 100h FCB equ 5Ch ;file control block address TPA equ 100h ;transient program area BDOS equ 05 ;BDOS entry point jr endcopr ;jump around copyright notice defb 'Copyright 1990 Ronald E. Jacobs', 1Ah endcopr: ;* Fill the default File Control Block (FCB) with zeros. xor a ;zero register A ld hl,FCB ;5Ch=default file control block area ld (hl),a ;0 first byte of file control block ld de,FCB+1 ;second byte of FCB ld bc,31 ;number of bytes to fill with zero push de ;save destination pointer ldir ;ripple the zero into all FCB bytes ;* Write the file name into the File Control Block (FCB). pop de ;restore destination pointer =FCB+1 ld hl,fname ;source= file name ld bc,fend-fstart ;length of file name ldir ;move the file name into default FCB ;* Relocate this program ld de, 1100h ;destination to copy code into ld hl, msstart ;starting location to copy code from ld bc, msend-msstart ;number of bytes to copy ldir ;* Open file to be loaded at 100h (probably MONSTEP.COM). ld c,15 ;BDOS function 15: open file ld de,FCB call BDOS cp 0FFh ;BDOS returns 0FFh if file not found jp nz,1100h ;go execute relocated msloader code ;* This code executes if file (probably MONSTEP.COM) not found nofile: ld c,09 ;BDOS function 9: print string ld de,nofind ;address of message "file not found:" call BDOS ld hl,fstart ;point to file name (MONSTEP.COM) ld b,08 ;count of characters in file name ld c,02 ;BDOS function output a char to console call outstr ;CRT <- filename ld e,'.' push hl ;save filename string pointer call BDOS ;put "." between file name & extentsion pop hl ;retrieve filename string pointer ld b,03 ;count of characters in file extension ld c,02 ;BDOS function output a char to console call outstr ;CRT <- 3 characters of file extension jp 0 ;warm boot ;* SUBROUTINE: output string pointed to by HL for BC count outstr: ld e,(hl) ;get a character from the string push bc ;save count and BDOS function number push hl ;save string pointer call bdos pop hl ;retrieve string pointer pop bc ;retrieve count and BDOS function numbr inc hl ;point to next character in filename dec b ;count=count-1 of chars left to output jr nz,outstr ret msstart: ;start of code to relocate to 1100h .phase 1100h ;* Read the file (probably MONSTEP.COM) into the TPA (100h). ld de,TPA ;Start of Transient Program Area ld a,1000h/128 ;maximum number of records to load ldfile: push af ;save record count ld c,26 ;BDOS function: set DMA address push de ;save DMA address call BDOS ld c,20 ;BDOS function: read sequential ld de,FCB call BDOS cp 00 ;BDOS rets 0 if more else EOF reached ld hl,128 ;128 =record length loaded from file pop de ;retrieve DMA address add hl,de ;increment the DMA ADDRESS ex de,hl ;put the new DMA address in DE jp nz,run ;if all of file has been loaded pop af ;retrieve countdown of records to load dec a ;decrement record count jr nz,ldfile ;if haven't loaded 1000h bytes yet run: JP TPA ;>>>>>EXECUTE LOADED PROGRAM (MONSTEP)<<<< .dephase msend: fname: fstart: defb 'MONSTEP COM' fend: nofind: defb 'File not found: $' end