Update inv_FAC1
This commit is contained in:
1 parent
03db0610a8
commit
dbc603322e
4 files changed
+46
-38
No files matched your search
@@ -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` | DONE | |
|
||||
| `$B947` | `inv_FAC1_mantissa` | DONE | From the Microsoft BASIC, original name: NEGFAC |
|
||||
| `$B96F` | `inc_FAC1` | DONE | From the Microsoft BASIC, original name: INCFAC |
|
||||
| `$B9EA` | `log_FAC1` | PARTIAL | not fully tested yet |
|
||||
| `$BA28` | `mul_MEM_FAC1` | DONE | |
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
;; #LAYOUT# * BASIC_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
; This file is under the MIT license, it contains code released by Microsoft Corporation.
|
||||
; See LICENSE for more information.
|
||||
|
||||
; Math package - neg (2s complement) FAC1
|
||||
;
|
||||
; This is verified to be identical to the original Microsoft implementation where it was named NEGFAC.
|
||||
;
|
||||
; The alternative entry point neg_FAC1_mantissa (NEGFCH) will negate only the mantissa
|
||||
;
|
||||
; See also:
|
||||
; - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
; - https://sta.c64.org/cbm64basconv.html
|
||||
;
|
||||
|
||||
neg_FAC1:
|
||||
lda FAC1_sign
|
||||
eor #$FF
|
||||
sta FAC1_sign
|
||||
|
||||
neg_FAC1_mantissa:
|
||||
|
||||
lda FAC1_mantissa+0
|
||||
eor #$FF
|
||||
sta FAC1_mantissa+0
|
||||
lda FAC1_mantissa+1
|
||||
eor #$FF
|
||||
sta FAC1_mantissa+1
|
||||
lda FAC1_mantissa+2
|
||||
eor #$FF
|
||||
sta FAC1_mantissa+2
|
||||
lda FAC1_mantissa+3
|
||||
eor #$FF
|
||||
sta FAC1_mantissa+3
|
||||
lda FACOV
|
||||
eor #$FF
|
||||
sta FACOV
|
||||
bne inc_FAC1_ret
|
||||
|
||||
; Fallthrough to inc_FAC1
|
||||
@@ -1,36 +0,0 @@
|
||||
;; #LAYOUT# STD * #TAKE
|
||||
;; #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
|
||||
;; #LAYOUT# * BASIC_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
;
|
||||
; Math package - invert FAC1 mantissa
|
||||
;
|
||||
; See also:
|
||||
; - [CM64] Computes Mapping the Commodore 64 - page 113
|
||||
; - https://www.c64-wiki.com/wiki/BASIC-ROM
|
||||
; - https://sta.c64.org/cbm64basconv.html
|
||||
;
|
||||
|
||||
; 2-complement the FAC1 mantissa
|
||||
; The 4 byte mantissa is treated as an integer in big endian form
|
||||
|
||||
|
||||
inv_FAC1_mantissa:
|
||||
|
||||
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
|
||||
+1
-1
@@ -24,7 +24,7 @@ int phase_mask[MAX_SIZE+MAX_SIZE];
|
||||
// Pairs of start, end memory addresses of known exact similarity with the open source Microsoft BASIC
|
||||
unsigned short microsoft_basic_chunks[NUM_CHUNKS * 2] = {
|
||||
0xB849, 0xB84F,
|
||||
0xB96F, 0xB97D,
|
||||
0xB947, 0xB97D,
|
||||
0xBBA2, 0xBC1A,
|
||||
0xBC58, 0xBC5A
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user