;;; Program to compute quotient and remainder for 1009 / 77. LOOP: LDA REM,d ; PROCESS: subtract DIV repeatedly. CPA DIV,d ; Can we subtract again? BRLT DONE ; No. (REM is smaller than DIV) SUBA DIV,d ; Subtract DIV from Remainder STA REM,d LDA Q,d ; Add 1 to quotient ADDA 1,i STA Q,d BR LOOP DONE: DECO Q,d ; OUTPUT: Quotient & Remainder CHARO 10,i ; NEWLINE DECO REM,d CHARO 10,i ; NEWLINE STOP NUMBER: .WORD 1009 ; Numerator REM: .WORD 1009 ; Remainder DIV: .WORD 77 ; Denominator Q: .WORD 0 ; Quotient = number of loops .END