Add inv_FAC1_mantissa

This commit is contained in:
Rikard Nordgren committed 2025-03-03 20:08:06 +01:00
1 parent b521241636
commit 0b90926c09
9 files changed
+65 -5

No files matched your search

+1 -1
View File
@@ -211,7 +211,7 @@ Floating point mathematical routines - not official, but well known and broadly
| `$B867` | `add_MEM_FAC1` | DONE | |
| `$B86A` | `add_FAC2_FAC1` | DONE | |
| `$B8FE` | `normal_FAC1` | DONE | |
| `$B947` | `inv_FAC1_mantissa` | NOT DONE | |
| `$B947` | `inv_FAC1_mantissa` | DONE | |
| `$B9EA` | `log_FAC1` | NOT DONE | |
| `$BA28` | `mul_MEM_FAC1` | DONE | |
| `$BA2B` | `mul_FAC2_FAC1` | DONE | |
+1 -1
View File
@@ -108,7 +108,7 @@
; --- Software features
;; #CONFIG# PANIC_SCREEN YES
;; #CONFIG# DOS_WEDGE YES
;; #CONFIG# DOS_WEDGE NO
;; #CONFIG# TAPE_WEDGE YES
;; #CONFIG# TAPE_HEAD_ALIGN NO
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
+1 -1
View File
@@ -97,7 +97,7 @@
; --- Software features
;; #CONFIG# PANIC_SCREEN YES
;; #CONFIG# DOS_WEDGE YES
;; #CONFIG# DOS_WEDGE NO
;; #CONFIG# TAPE_WEDGE YES
;; #CONFIG# TAPE_HEAD_ALIGN NO
;; #CONFIG# BCD_SAFE_INTERRUPTS YES
File renamed without changes.
@@ -12,9 +12,25 @@
; - https://sta.c64.org/cbm64basconv.html
;
; XXX implement, test
; 2-complement the FAC1 mantissa
; The 4 byte mantissa is treated as an integer in big endian form
inv_FAC1_mantissa:
+STUB_IMPLEMENTATION
ldx #3
@1: lda FAC1_mantissa,X
eor #$FF
sta FAC1_mantissa,X
dex
bpl @1
inc FAC1_mantissa+3
bne @2
inc FAC1_mantissa+2
bne @2
inc FAC1_mantissa+1
bne @2
inc FAC1_mantissa
@2: rts
+3
View File
@@ -0,0 +1,3 @@
$65 + BNE $0A + INC $64 + BNE $06 + INC $63 + BNE $02 + INC $62 + RTS
Incrementing a 32-bit integer at the well known position of the FAC1 mantissa in the zero page.
+3
View File
@@ -0,0 +1,3 @@
fragment + LDA #$00 + STA fragment
Fragments of clearing byte in zero page.
+3
View File
@@ -0,0 +1,3 @@
BNE $03 + JMP fragment
If zero do jump else not. Common long conditional branch idiom.
+35
View File
@@ -314,6 +314,41 @@ print "COMPARE"
compare $61 $66 $1001
print "END"
print "TEST: inv_FAC1_mantissa 0"
fill $62 $65 00 00 00 00
r PC=$B947
ret
fill $1001 $1004 00 00 00 00
print "COMPARE"
compare $62 $65 $1001
print "END"
print "TEST: inv_FAC1_mantissa 1"
fill $62 $65 00 00 00 01
r PC=$B947
ret
fill $1001 $1004 FF FF FF FF
print "COMPARE"
compare $62 $65 $1001
print "END"
print "TEST: inv_FAC1_mantissa 2130706432"
fill $62 $65 7F 00 00 00
r PC=$B947
ret
fill $1001 $1004 81 00 00 00
print "COMPARE"
compare $62 $65 $1001
print "END"
print "TEST: inv_FAC1_mantissa -100"
fill $62 $65 FF FF FF 9C
r PC=$B947
ret
fill $1001 $1004 00 00 00 64
print "COMPARE"
compare $62 $65 $1001
print "END"
q