New answers tagged

4

It seems that some of the information you have doesn't apply to the SAP-2. Earlier in the book, it said that to execute a decrement instruction, you must load the value you want to decrement in A, subtract 1, and then load it back into the designated register. The Simple As Possible SAP-2 computer has dedicated decrement instructions. Section 11-4 "...


6

The repeated-addition algorithm you describe is not the usual way. Instead, think of long multiplication, but in base 2 instead of base 10. The shift instructions available in most CPUs are useful here. Here's how you might do it on a 6502: Mul8x8to16: LDX #8 LDA #0 STA resultHi @loop: ; shift result up by one place ASL A ROL resultHi ; ...


Top 50 recent answers are included