Category : Word Processors
Archive   : FMAC16AS.ZIP
Filename : EXECUTE.ASM
;Sun Mar 26 20:54:16 1989 remove reference to textseg.
;03-27-88 14:27:20 remove execute_filter code.
;03-13-88 12:26:39 remove the execute filter stuff.
stderr equ 1
.xlist
include memory.def
data segment byte public
extrn phd_seg: word
fcb_struc struc
fcb_drive db 0
fcb_fname db ' '
fcb_ext db ' '
fcb_curblk dw 0
fcb_recsz dw 0
fcb_filsz dw 0,0
fcb_date dw 0
fcb_time dw 0
fcb_res dd ?,?
fcb_currec db 0
fcb_ranrec dw 0,0
fcb_struc ends
segofs struc
offs dw ?
segm dw ?
segofs ends
data ends
code segment byte public
;all the routines in this segment are entered with ds=data, es=data
assume cs:code, ds:data, es:data, ss:data
;the following externs are in 'buffers'
extrn compact_buffers: near
extrn uncompact_buffers: near
;the following externs are in 'memory'
extrn read_mark: near
extrn del_to_mark: near
extrn insert_string$: near
;the following externs are in 'redisplay'
extrn redisplay: near
extrn paint_screen: near
extrn init_entry: near
extrn uninit_exit: near
extrn abort_fatal: near ;fatal error handler
our_sp dw ?
our_ss dw ?
parameters dw 0
dw 80h, ?
dw 5ch, ?
dw 6ch, ?
copy_to_dioa:
;enter with si, cx->command.
;exit with cs:phd_dioa set to the string.
push es
mov es,phd_seg ;copy the command to phd_dioa+1
mov di,80h+1
if 0
mov ax,3700h ;get the switch char.
int 21h
mov al,dl
stosb
mov al,'C' ;store -C or /C.
stosb
endif
rep movsb
mov al,CR ;store the terminating CR.
stosb
sub di,80h+1+1 ;don't count the CR.
mov ax,di
mov es:[80h],al ;store the count.
pop es ;restore es.
ret
public execute_program
execute_program:
;enter with si, cx->path of filter to execute, di ->null terminated filename.
;exit with ax=return result.
push di
call copy_to_dioa
pop di
call actually_execute
ret
actually_execute:
;enter with di -> filename, cs:phd_dioa = arguments.
push di
call uninit_exit
pop di
push ds
push es
push di
call compact_buffers ;make room for the program.
pop di
mov dx,phd_seg ;subtract off the allocated segment.
sub bx,dx
mov es,dx ;get es=allocated segment.
assume es:nothing
mov ah,4ah ;reduce ourself in size.
int 21h
mov our_sp,sp ;remember our stack.
mov our_ss,ss
mov ds,phd_seg ;move ds first because we need ds.
assume ds:nothing
mov es,phd_seg
assume es:nothing
mov dx,di ;set up to execute the program.
mov ax,2901h ;parse fcb1.
mov si,81h ;->phd_sdioa.
mov di,5ch ;->phd_fcb1
int 21h
mov ax,2901h ;parse fcb2.
mov di,6ch ;->phd_fcb2.
int 21h
push ss ;ss:dx -> filename to execute.
pop ds
assume ds:data
push cs
pop es
assume es:code
mov bx,offset parameters
mov ax,phd_seg
mov es:[bx]+4,ax ;use original phd parameters.
mov es:[bx]+8,ax
mov es:[bx]+12,ax
mov ax,4b00h
int 21h
jc actually_execute_1
xor ax,ax ;make sure ax is zero if no errors.
actually_execute_1:
cli ;get our stack back.
mov ss,cs:our_ss
mov sp,cs:our_sp
sti
push ax
mov bx,0ffffh ;now grab all of memory again.
mov es,phd_seg
mov ah,4ah ;see how much is available.
int 21h
mov ah,4ah ;grab all of it.
int 21h
push cs ;reset the fatal error address.
pop ds
mov dx,offset abort_fatal
mov ax,2524h
int 21h
mov ax,33h*256+1 ;turn break checking back off.
mov dl,0 ; in case someone turned it on.
int 21h
pop ax
pop es
pop ds
assume ds:data, es:data
push ax
call uncompact_buffers ;make room for the text again.
call init_entry
call paint_screen
pop ax
ret
code ends
end
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/