adapted to Kick Assembler, some documentation update

This commit is contained in:
FeralChild64 committed 2019-09-07 12:35:21 +02:00
1 parent ae23dbae7b
commit de27124b4f
198 files changed
+4181 -3976

No files matched your search

+26 -26
View File
@@ -1,23 +1,23 @@
;; Multiply Floating Point Accumulator by 10
;; = 8x + 2x
;; Implement by shifting MAC left one bit,
;; and then keeping that value to add on after
;; shifting two more bits left.
;; This should be done using basic_fac1_overflow to
;; hold the overflow bits, so that the result can
;; be exponent adjusted after, if required.
// Multiply Floating Point Accumulator by 10
// = 8x + 2x
// Implement by shifting MAC left one bit,
// and then keeping that value to add on after
// shifting two more bits left.
// This should be done using basic_fac1_overflow to
// hold the overflow bits, so that the result can
// be exponent adjusted after, if required.
fac1_mul10:
lda #$00
sta basic_fac1_overflow
;; Multiply mantissa by 2
// Multiply mantissa by 2
jsr fac1_mantissa_mul2
;; copy down to BASIC numeric work area at $57
;; (basic_numeric_work_area)
;; (We copy all 7 bytes off the FAC1, so that we have
;; the overflow bits, and the copy is as small as possible)
// copy down to BASIC numeric work area at $57
// (basic_numeric_work_area)
// (We copy all 7 bytes off the FAC1, so that we have
// the overflow bits, and the copy is as small as possible)
ldx #7
f1m10_l1:
lda basic_fac1_mantissa,x
@@ -25,11 +25,11 @@ f1m10_l1:
dex
bpl f1m10_l1
;; Multiply mantissa by 4, so it is now 8x original
// Multiply mantissa by 4, so it is now 8x original
jsr fac1_mantissa_mul2
jsr fac1_mantissa_mul2
;; Now add stored value of 2x to it, to get the total x10
// Now add stored value of 2x to it, to get the total x10
ldy #3
ldx #0
clc
@@ -44,22 +44,22 @@ f1m10_l2:
adc basic_numeric_work_area+7
sta basic_fac1_overflow
;; Now shift right and increase exponent until overflow
;; bits = $00
// Now shift right and increase exponent until overflow
// bits = $00
f1m10_l3:
lda basic_fac1_overflow
bne +
;; All done, return
bne !+
// All done, return
clc
rts
*
;; Divide mantissa by two, and increment exponent
!:
// Divide mantissa by two, and increment exponent
jsr fac1_mantissa_div2
inc basic_fac1_exponent
lda basic_fac1_exponent
bpl f1m10_l3
;; Exponent has bit 7 set, so has wrapped.
;; = OVERFLOW ERROR
// Exponent has bit 7 set, so has wrapped.
// = OVERFLOW ERROR
jmp do_OVERFLOW_error
fac1_mantissa_mul2:
@@ -67,8 +67,8 @@ fac1_mantissa_mul2:
ldx #0
clc
f1m1_l1:
;; Multiply mantissa by 2, and store overflow
;; in basic_fac1_bits
// Multiply mantissa by 2, and store overflow
// in basic_fac1_bits
lda basic_fac1_mantissa,x
rol
sta basic_fac1_mantissa,x
@@ -82,7 +82,7 @@ f1m1_l1:
rts
fac1_mantissa_div2:
;; Divide mantissa by 2, including using overflow bits
// Divide mantissa by 2, including using overflow bits
clc
lda basic_fac1_overflow
ror