tosdiva0:
ldx #0
tosdivax:
- pha ; check if high-bytes indicate
- txa ; different sign, so that we
- ldy #1 ; negate the result after the operation
- eor (sp),y ; eor with lhs high byte
- sta tmp1 ; save post negation indicator to tmp1
- pla ; back to entry accu
+ pha ; Check if high-bytes indicate
+ txa ; different sign, so that we have to
+ ldy #1 ; negate the result after the operation.
+ eor (sp),y ; Eor with lhs high byte
+ sta tmp1 ; Save post negation indicator to tmp1
+ pla ; Back to entry accu
jsr absvaludiv16
ldx ptr1+1
lda ptr1
- ldy tmp1 ; fetch indicator
+ ldy tmp1 ; Fetch indicator
bmi negate
rts
negate: jmp negax
; modulo operation is the same as that of the left operand.
pha
- ldy #1 ; prepare lhs operant hi-byte fetch
+ ldy #1 ; Prepare lhs operant hi-byte fetch
lda (sp),y
- sta tmp1 ; save post negation indicator to tmp1
- pla ; back to entry accu
+ sta tmp1 ; Save post negation indicator to tmp1
+ pla ; Back to entry accu
jsr absvaludiv16
- ldx sreg+1 ; remainder to return registers
+ ldx sreg+1 ; Remainder to return registers
lda sreg
- ldy tmp1 ; fetch indicator
+ ldy tmp1 ; Fetch indicator
bmi negate
rts
negate: jmp negax
.export negax
.export _abs
-_abs: cpx #$00 ; test hi byte
- bpl L1 ; don't touch if positive
+_abs: cpx #$00 ; Test hi byte
+ bpl L1 ; Don't touch if positive
negax: clc
eor #$FF
adc #1