Q2 Computer - Multiplication

This makes some assumptions about values in the zero page, like the common functions.

; Multiply x2 = x0 * x1
; Destroys x0, x1, x2, x3
mult:
  sta   =x3
  lea   =0
  sta   =x2
mult_loop:
  lda   =x0
  jfc   mult_cont

  ; done when =x0 is 0.
  jmp  @=x3

mult_cont:
  shr   =x0
  sta   =x0
  jfc   mult_next

  ; bit is set, update =x2
  lda   =x1
  add   =x2
  sta   =x2

mult_next:

  ; shift =x1 left
  lda   =x1
  add   =x1
  sta   =x1
  jmp   mult_loop