Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : PERROR.ASM

 
Output of file : PERROR.ASM contained in archive : PJ91.ZIP
title perror - print error message
include asm.inc

public perror

.data
extrn dgroup_segment:word

.data?
errmsg_buffer db 100 dup(?)


.code
extn clear_strerror,get_strerror,fwrite,save_most,strcpy_limit

;; perror
;
; entry DS:SI optional message prefix
; uses AX
;
perror proc
call save_most
mov es,dgroup_segment[bp] ; set destination pointer
mov di,offset errmsg_buffer
lea dx,[di+size errmsg_buffer-4] ; (-4 leaves room for ": " & \n)

cmp si,NULL_POINTER
je per1 ; if no message prefix
call strcpy_limit ; else copy message prefix
mov ax,' :' ; and ": "
stosw

per1: call get_strerror
jz per2 ; if no error string
call clear_strerror
call strcpy_limit

per2: mov ax,NEWLINE_CHARS ; append \n
stosw

mov bx,stderr ; write text to standard error
mov ds,dgroup_segment[bp]
lea si,errmsg_buffer
mov cx,di ; compute message byte count
sub cx,si
call fwrite
ret
perror endp

end


  3 Responses to “Category : Files from Magazines
Archive   : PJ91.ZIP
Filename : PERROR.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/