Mercurial > hg > Members > kono > nitros9-code
changeset 860:35aca42e87ce
Added better comments
author | boisy |
---|---|
date | Thu, 16 Jan 2003 03:06:50 +0000 |
parents | b35fcebc8581 |
children | c952d6b742ae |
files | level1/cmds/printerr.asm |
diffstat | 1 files changed, 33 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/cmds/printerr.asm Wed Jan 15 02:45:07 2003 +0000 +++ b/level1/cmds/printerr.asm Thu Jan 16 03:06:50 2003 +0000 @@ -23,7 +23,11 @@ mod eom,name,tylg,atrv,start,size org 0 -datarea rmb 86 +s.erpath rmb 1 +s.flpath rmb 1 +s.errcod rmb 1 + rmb 2 +s.buffer rmb 81 size equ . name fcs /Printerr/ @@ -52,86 +56,86 @@ FPErr ldx <D.Proc get current process pointer lda P$PATH+2,x get stderr path beq Exit2 branch if not open - leas <-$56,s else make room on stack + leas <-size,s else make room on stack ldb R$B,u get error code leau ,s point U to save area - sta ,u store path - stb 2,u store error code + sta s.erpath,u store path + stb s.errcod,u store error code bsr PErrOrg print error as originally done lda #READ. read access mode leax >ErrFile,pcr point to error file os9 I$Open open path to it - sta 1,u save path to file + sta s.flpath,u save path to file bcs Exit1 branch if error bsr FindErr attempt to find line that matches error code bcs Close if error, close file and return to OS-9 bne Close -L0077 bsr WriteLn else write line +NxtLine bsr WriteLn else write line bsr ReadLine read next line bcs Close branch if error ldb ,x get first byte of line just read cmpb #'0 number? - bcs L0077 branch if not -Close lda 1,u get path + bcs NxtLine branch if not +Close lda s.flpath,u get path os9 I$Close close path to error file -Exit1 leas <$56,s clean stack +Exit1 leas <size,s clean stack Exit2 clrb clear carry rts and return to OS-9 FindErr bsr ReadLine read line - bcs L009B branch if error - bsr L00DE get error number + bcs FindRts branch if error + bsr ASC2Byte get error number cmpa #'0 bcc FindErr - cmpb 2,u same as error? + cmpb s.errcod,u same as error? bne FindErr branch if not -L009B rts +FindRts rts * read a line from the error file -ReadLine lda 1,u get path number of file - leax 5,u point X to buffer +ReadLine lda s.flpath,u get path number of file + leax s.buffer,u point X to buffer ldy #80 max 80 chars os9 I$ReadLn read line rts PErrOrg leax >ErrMsg,pcr point X to error header - leay 5,u point Y to buffer area + leay s.buffer,u point Y to buffer area lda ,x+ get byte at X CopyLoop sta ,y+ and store it at Y lda ,x+ get byte... bpl CopyLoop while hi bit not set in A - ldb 2,u get error number + ldb s.errcod,u get error number lda #$2F start out just below '0 -L00BA inca increment A - subb #$64 subtract - bcc L00BA continue if carry clear +Hundreds inca increment A + subb #100 subtract + bcc Hundreds continue if carry clear sta ,y+ else store as character lda #$3A start out just beyond '9 -L00C3 deca decrement A +Tens deca decrement A addb #10 add 10 to B - bcc L00C3 continue if carry clear + bcc Tens continue if carry clear sta ,y+ save A tfr b,a transfer adda #$30 add '0 ldb #C$CR std ,y+ - leax 5,u point X at buffer + leax s.buffer,u point X at buffer WriteLn ldy #80 max string len - lda ,u get stderr path + lda s.erpath,u get stderr path os9 I$WritLn write it out rts -L00DE clrb clear B -L00DF lda ,x+ get byte from X +ASC2Byte clrb clear B +ASC2BLp lda ,x+ get byte from X suba #'0 make 8 bit integer cmpa #$09 compare against 9 - bhi L00F0 branch if greater + bhi ASC2BEx branch if greater pshs a else save A lda #10 multiply by 10 mul do it addb ,s+ add on stack - bcc L00DF if carry clear, do it again -L00F0 lda -1,x load byte + bcc ASC2BLp if carry clear, do it again +ASC2BEx lda -1,x load byte rts return emod