home *** CD-ROM | disk | FTP | other *** search
-
- ;simplified version of exec with no command line args
- ; to call EPERROR
-
- include BDS.LIB
-
- epexec::
-
- lxi d,$efname
-
- ;DE has fname ptr
- push b
- lxi h,-60 ;compute &nfcb for use here
- dad sp
- push h ; save for much later (will pop into BC)
- push h ;make a few copies for local use below
- call setfcu ;set up COM file for execl-ing
- lda usrnum
- call setusr ;set destination user area
- pop d ;get new fcb addr
- mvi c,openc ;open the file for reading
- call .bdos
- call rstusr ;reset user number to previous
- cpi errorv
- jnz noerrr
- err: pop h ;discard fcb addr
- pop b
- jmp error
-
- noerrr:
- lxi d,code0 ;copy loader down to end of tbuff
- lxi h,tpa-49
- mvi b,49 ;length of loader
- excl4: ldax d
- mov m,a
- inx d
- inx h
- dcr b
- jnz excl4
-
- pop b ;get fcb pointer in BC
- ;reset the SP:
- lhld base+6 ;get BDOS pointer in HL
- go1: sphl
-
- lxi h,base
- push h ;set base of ram as return addr
- jmp tpa-49 ;(go to `code0:')
-
- $efname: db 'EPERROR.COM',0
-
- ;
- ; This loader code is now: 49 bytes long.
- ;
-
- code0: lxi d,tpa ;destination address of new program
- code1: push d ;push dma addr
- push b ;push fcb pointer
- mvi c,sdma ;set DMA address for new sector
- call .bdos
- pop d ;get pointer to working fcb in DE
- push d ;and re-push it
- mvi c,reads ;read a sector
- call .bdos
- pop b ;restore fcb pointer into BC
- pop d ;and dma address into DE
- ora a ;end of file?
- jz tpa-8 ;if not, get next sector (goto `code2:')
-
- mov d,b
- mov e,c
- mvi c,closec
- call .bdos
-
- mvi c,sdma ;reset DMA pointer
- lxi d,tbuff
- call .bdos
- jmp tpa ;and go invoke the program
-
- code2: lxi h,80h ;bump dma address
- dad d
- xchg
- jmp tpa-46 ;and go loop (at code1)
-
-
- end