home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
sampler0
/
smallcom.asm
< prev
next >
Wrap
Assembly Source File
|
1986-12-11
|
2KB
|
84 lines
page 65,132
;a very small command processor: smallcom
;reads commands, runs them via int 2eh
;exit with command: x (either case)
cseg segment
assume cs:cseg,ds:cseg,es:cseg
cr equ 13
lf equ 10
org 80h ;length of parm
pspparml db ?
org 81h ;parm from caller
pspparm db ?
org 100h
begin: jmp start
db 'Copyright 1986 Arnold B. Krueger GPW MI 48236'
db 20 dup('stack ')
stack equ $
stkseg dw 0 ;save ss here
stkptr dw 0 ;save sp here
msg1 db 'Enter command or x to exit',cr,lf,'$'
msg2 db 'Command complete'
crlf db cr,lf,'$'
start:
mov sp,offset stack
mov bx,offset cs:endcode
add bx,15
mov cl,4
shr bx,cl
mov ah,4ah ;release unneeded storage
int 21h
mov stkseg,ss
mov stkptr,sp
command:
mov dx,offset msg1
mov ah,9h
int 21h
mov pspparml,78h ;max possible bytes read
mov dx,offset pspparml ;where read buffer is
mov ah,0ah ;read buffer
int 21h
mov dx,offset crlf ;send cr,lf to save command
mov ah,9h ;type out string
int 21h
cmp pspparml+1,1 ;read just one byte?
jne notexit
cmp pspparml+2,'X' ;exit command?
je endexit
cmp pspparml+2,'x'
je endexit
notexit:
mov si,offset pspparml+1 ;ds:si is command to run
int 2eh ;have command.com execute parm
mov ss,cs:stkseg ;restore environment
mov sp,cs:stkptr
push cs
pop ds ;restore ds
push cs
pop es ;restore es
mov dx,offset msg2 ;send out message
mov ah,9h
int 21h
jmp command
endexit:
mov ah,4ch
int 21h
endcode equ $
cseg ends
end begin