# HG changeset patch # User boisy # Date 1042686410 0 # Node ID 35aca42e87ce3767d675512d4df3788c7a6c3236 # Parent b35fcebc8581c4c28f17edbee35d2377b5204678 Added better comments diff -r b35fcebc8581 -r 35aca42e87ce level1/cmds/printerr.asm --- 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 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 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