Mercurial > hg > Members > kono > nitros9-code
changeset 825:0e8e511dd806
Added comments to source
author | boisy |
---|---|
date | Tue, 14 Jan 2003 00:54:37 +0000 |
parents | 4caaf0f992bf |
children | 6c56dfe1de1c |
files | level1/cmds/printerr.asm |
diffstat | 1 files changed, 83 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/level1/cmds/printerr.asm Tue Jan 14 00:39:54 2003 +0000 +++ b/level1/cmds/printerr.asm Tue Jan 14 00:54:37 2003 +0000 @@ -22,6 +22,7 @@ mod eom,name,tylg,atrv,start,size + org 0 datarea rmb 86 size equ . @@ -39,99 +40,99 @@ fdb FPErr-*-2 fcb $80 -start clra - leax <name,pcr - os9 F$Link link one extra time - bcs error - leay <SysSVC,pcr - os9 F$SSvc - clrb -error os9 F$Exit +start clra any module + leax <name,pcr point to name + os9 F$Link link one extra time + bcs error branch if error + leay <SysSVC,pcr point to system service table + os9 F$SSvc add it to system calls + clrb clear carry +error os9 F$Exit and exit -FPErr ldx <D.Proc - lda P$PATH+2,x get stderr path - beq Exit2 - leas <-$56,s 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 - bsr PErrOrg print error as originally done - lda #READ. - leax >ErrFile,pcr - os9 I$Open - sta 1,u save path to file - bcs Exit1 - bsr L008D - bcs L0083 - bne L0083 -L0077 bsr L00D4 - bsr ReadLine - bcs L0083 - ldb ,x - cmpb #$30 - bcs L0077 -L0083 lda 1,u - os9 I$Close -Exit1 leas <$56,s -Exit2 clrb - rts +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 + ldb R$B,u get error code + leau ,s point U to save area + sta ,u store path + stb 2,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 + 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 + 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 + os9 I$Close close path to error file +Exit1 leas <$56,s clean stack +Exit2 clrb clear carry + rts and return to OS-9 -L008D bsr ReadLine - bcs L009B - bsr L00DE - cmpa #$30 - bcc L008D - cmpb 2,u - bne L008D +FindErr bsr ReadLine read line + bcs L009B branch if error + bsr L00DE get error number + cmpa #'0 + bcc FindErr + cmpb 2,u same as error? + bne FindErr branch if not L009B rts * read a line from the error file -ReadLine lda 1,u get path number of file - leax 5,u point X to buffer - ldy #80 max 80 chars - os9 I$ReadLn read line +ReadLine lda 1,u get path number of file + leax 5,u point X to buffer + ldy #80 max 80 chars + os9 I$ReadLn read line rts -PErrOrg leax >ErrMsg,pcr - leay 5,u point to buffer area - lda ,x+ -CopyLoop sta ,y+ - lda ,x+ - bpl CopyLoop while hi bit not set in A - ldb 2,u get error number - lda #$2F -L00BA inca - subb #$64 - bcc L00BA - sta ,y+ - lda #$3A -L00C3 deca - addb #10 - bcc L00C3 - sta ,y+ - tfr b,a - adda #$30 +PErrOrg leax >ErrMsg,pcr point X to error header + leay 5,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 + lda #$2F start out just below '0 +L00BA inca increment A + subb #$64 subtract + bcc L00BA continue if carry clear + sta ,y+ else store as character + lda #$3A start out just beyond '9 +L00C3 deca decrement A + addb #10 add 10 to B + bcc L00C3 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 -L00D4 ldy #80 max string len - lda ,u get stderr path - os9 I$WritLn + leax 5,u point X at buffer +WriteLn ldy #80 max string len + lda ,u get stderr path + os9 I$WritLn write it out rts -L00DE clrb -L00DF lda ,x+ - suba #$30 - cmpa #$09 - bhi L00F0 - pshs a - lda #10 - mul - addb ,s+ - bcc L00DF -L00F0 lda -1,x - rts +L00DE clrb clear B +L00DF lda ,x+ get byte from X + suba #'0 make 8 bit integer + cmpa #$09 compare against 9 + bhi L00F0 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 + rts return emod eom equ *