Category : Miscellaneous Language Source Code
Archive   : MUMPS.ZIP
Filename : ZCTEST.ASM
db 0cbh ;Macro assembler ver 3 which does not support a far
endm ;return instruction. So use this macro to provide the
;required instruction.
code segment byte public 'code'
assume cs:code, ds:code, es:code, ss:code
jmp my_code
cback dd 0
bsiz dw offset stk_siz - $ - 5
t_len dw 0
cnt db 0
buf DB 80H DUP(0)
stk_siz dw 0
pntr dw 0
pbuf DB 80h DUP(0)
noparam db 'none',0dh,0ah,'$'
newl db 0dh,0ah,'$'
pos db 13,10,9,9,9,9,'$'
anull db 'null parameter',0dh,0ah,'$'
SIGNON DB 0dh,0ah,0ah
db 9,'--- assembly routine to test call-back functions ---',13,10
db 'passed parameters:',13,10,'$'
scrn1 db 13,10,10,'Call-Back Options:',9,'
db 9,9,9,'<0> set glvn or settable function',13,10
db 9,9,9,'<1> fetch glvn or dollar function',13,10
DB 9,9,9,'<2> kill glvn',13,10,10
db 9,9,9,' choice ? $'
name_buf DB 256 DUP(0)
value_buf DB 256 DUP(0)
kill_q db 13,10,10,'kill which cariable NAME ? $'
fetch_q db 13,10,10,'fetch what variable NAME ? $'
name_q db 13,10,10,'NAME of variable to set: $'
value_q db 13,10,'VALUE for this variable: $'
badnm db 7,'illegal variable name',13,10,'$'
notfnd db 'var not found',13,10,'$'
my_code:
mov ah,9
lea dx,signon
int 21h
cmp cnt,0 ;any parameters ?
jz none ;no
lea bx,buf ;move to length byte of first param
mov pntr,bx ;pntr always points to length byte of a param
loop: cmp cnt,0 ;is count down to 0 ?
jz pdone ;yes
mov bx,pntr ;no, get pointer to size byte
mov cl,[bx] ;get size
mov ch,0 ;extend to 16 bits
cmp cx,0 ;is it null?
jnz LP1 ;yes
jmp null
LP1: mov si,bx
inc si ;source
add bx,cx ;point to next size field
inc bx
mov pntr,bx ; & save
mov di, offset pbuf
rep movsb
mov byte ptr [di],'$'
mov ah,9
mov dx, offset pbuf
int 21h
call crlf
dec cnt
jmp loop
none: mov ah,9
lea dx,noparam
int 21h
pdone: jmp menu
;
menu: mov ah,9
lea dx, scrn1
int 21h
menulp: mov ah,6
mov dl,0ffh
int 21h ;get one char reply
cmp al,0
jz menulp
cmp al,'2' ;call back 'kill'
jz kill
cmp al,'1'
jz fetch ;call back 'fetch'
cmp al,'0'
jnz m1
jmp set ;call back 'set'
m1: cmp al,1bh ;esc?
jnz menulp ;no
retf ;yes, back to mumps
kill: mov ah,9
lea dx,kill_q
int 21h ;'what var?' prompt
mov ah,10
lea dx,name_buf
mov di,dx
mov byte ptr [di],255 ;buf size
int 21h ;get reply
lea dx,name_buf
inc dx ;look at size of reply
mov di,dx
cmp byte ptr[di],0
jz menu ;no reply
mov cl,2 ;call_back 'kill' fucn #
call dword ptr cs:cback
cmp al,0 ;was mumps successful ?
jz menu ;yes
mov ah,9 ;no, tell someone
lea dx,badnm
int 21h
jmp menu
fetch: mov ah,9
lea dx,fetch_q
int 21h ;'what var?' prompt
mov ah,10
lea dx,name_buf
mov di,dx
mov byte ptr [di],255 ;buf size
int 21h ;get reply
lea dx,name_buf
inc dx ;look at size of reply
mov di,dx
cmp byte ptr[di],0
jnz f1 ;no reply
jmp menu
f1: mov cl,1 ;call_back 'fetch' fucn #
call dword ptr cs:cback
cmp al,0 ;was mumps successful ?
jz good_fetch ;yes
cmp al,0feh ;no, was error 'bad name'
jnz fetch1
call tab
mov ah,9
lea dx,badnm
int 21h
jmp menu
fetch1: call tab
mov ah,9
lea dx,notfnd
int 21h
jmp menu
good_fetch: ;byte length + string is in buffer. Put '$' @end & print it
call tab
lea di,buf ;point to length
mov ch,0
mov cl,[di] ;get length
inc di ;1st string byte
mov dx,di ;start printing here
add di,cx
mov byte ptr[di],'$';mark end
mov ah,9
int 21h
call crlf
jmp menu
;
set: ;set a mumps glvn or settable function
mov ah,9
lea dx, name_q
int 21h
mov ah,10
lea dx,name_buf
mov di,dx
mov byte ptr [di],255 ;buffer size
int 21h ;input name of variable
lea dx,name_buf
inc dx ;look at size
mov di,dx
cmp byte ptr[di],0
jz set_quit ;null string, quit
mov ah,9
lea dx, value_q
int 21h
mov ah,10
lea dx,value_buf
mov di,dx
mov byte ptr [di],255 ;buffer size
int 21h ;input the value for the variable
lea dx, name_buf+1
lea bx, value_buf+1
mov cl,0 ;set function
call dword ptr cs:cback
jmp menu
set_quit:
mov ax,0
retf
;
;
tab: mov ah,9
lea dx,pos
int 21h
ret
crlf: mov ah,9
mov dx, offset newl
int 21h
ret
null: inc pntr ;next byte is also a size byte cause this one null
dec cnt
mov ah,9
mov dx, offset anull
int 21h
jmp loop
code ends
end
OBJ CQ[ Hg CONFIG SYS `
À RECT ASM K
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/