.TITLE UPCSUM - UPDATE CHECKSUM .IDENT /V1.01/ .NLIST TOC,SYM .ENABL LC ; Part of Sira Paper Tape Punch Despooler. ; ; COPYRIGHT(C) 1981,1982 Sira Institute Ltd., ; South Hill, Chislehurst, Kent, BR7 5EH, England. ; ; Author: C.J. Doran ; ; Assemble as: ; >MAC PPPUPCSUM=PPPUPCSUM ;+ ; Add bits of character in %0 to appropriate bytes of checksum. ;- .PSECT CODE,I,RO UPCSUM::MOV %1,-(SP) ; Save %1 MOVB %0,-(SP) ; Push character MOV #CHKSUM+8.,%1 ; Address end of checksum block 10$: TSTB @SP ; See if any bits left (clearing carry) BEQ 20$ ; No more, exit RORB @SP ; Shift out a bit ADCB -(%1) ; Add to appropriate checksum byte BR 10$ ; Repeat 20$: TST (SP)+ ; Done, purge stack, MOV (SP)+,%1 ; Restore register RTS PC ; and return .END