more sane directory name, updated binaries

This commit is contained in:
FeralChild64 committed 2020-06-26 19:44:01 +02:00
1 parent d4d32095d1
commit 76aaf298b8
697 files changed
+56 -56

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Routine probably used very often, it's call can be seen in a tutorial here:
- https://codebase64.org/doku.php?id=base:generating_sines_with_basic
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Just a compatibility jump - our routine is longer than original one
jmp mov_MEM_FAC1
+3
View File
@@ -0,0 +1,3 @@
This is an important floating point math routine, documented in many places.
XXX - try to find real-life example
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Just a compatibility jump - our routine is longer than original one
jmp mov_r_FAC1_TMP2
+3
View File
@@ -0,0 +1,3 @@
This is an important floating point math routine, documented in many places.
XXX - try to find real-life example
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Just a compatibility jump - our routine is longer than original one
jmp mov_r_FAC1_TMP1
+3
View File
@@ -0,0 +1,3 @@
This is an important floating point math routine, documented in many places.
XXX - try to find real-life example
+21
View File
@@ -0,0 +1,21 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - move FAC1 (rounds) to memory variable
//
// Input:
// - FORPNT ($49/$4A) - variable address
//
// See also:
// - https://www.c64-wiki.com/wiki/BASIC-ROM
//
mov_r_FAC1_VAR:
ldy #FORPNT+1
ldx #FORPNT+0
// FALLTROUGH to mov_r_FAC1_MEM
+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Example code utilizing this routine:
- https://codebase64.org/doku.php?id=base:mandelbrot
+26
View File
@@ -0,0 +1,26 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - copy FAC1 to memory location, do not round
//
// Input:
// - .X - address low byte
// - .Y - address high byte
//
// Output:
// - .A - FAC1 exponent
//
// See also:
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
//
mov_r_FAC1_MEM:
// Start by rounding FAC1
jsr round_FAC1
jmp mov_FAC1_MEM
+3
View File
@@ -0,0 +1,3 @@
This is an important floating point math routine, documented in many places.
XXX - try to find real-life example
+8
View File
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Just a compatibility jump - our routine is longer than original one
jmp mov_FAC2_FAC1
+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Example code utilizing this routine:
- https://github.com/irmen/prog8/blob/master/compiler/res/prog8lib/c64flt.p8
+23
View File
@@ -0,0 +1,23 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - round and move FAC1 to FAC2
//
// Output:
// - .A - FAC1 exponent
//
// See also:
// - [CM64] Computes Mapping the Commodore 64 - page 115
// - https://www.c64-wiki.com/wiki/BASIC-ROM
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
//
mov_r_FAC1_FAC2:
// First round FAC1
jsr round_FAC1
// FALLTROUGH to mov_FAC1_FAC2
+4
View File
@@ -0,0 +1,4 @@
This is an important floating point math routine, documented in many places.
Example code utilizing this routine:
- https://github.com/irmen/prog8/blob/master/compiler/res/prog8lib/c64flt.p8
@@ -0,0 +1,8 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# X16 BASIC_0 #TAKE-OFFSET 2000
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Just a compatibility jump - our routine is longer than original one
jmp mov_FAC1_FAC2
+51
View File
@@ -0,0 +1,51 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - move FAC1 to FAC2
//
// Output (all found by experimentation):
// - .A - FAC1 exponent
// - .X - always 0
//
// Preserves (found by experimentation):
// - .Y
//
// Note:
// - observed that original ROM always clears FACOV, not sure why
//
// See also:
// - [CM64] Computes Mapping the Commodore 64 - page 115
// - https://www.c64-wiki.com/wiki/BASIC-ROM
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
//
mov_FAC1_FAC2:
// Copy the exponent
lda FAC1_exponent
sta FAC2_exponent
beq !+ // for 0 no need to copy mantissa and sign
// Copy the mantissa
lda FAC1_mantissa+0
sta FAC2_mantissa+0
lda FAC1_mantissa+1
sta FAC2_mantissa+1
lda FAC1_mantissa+2
sta FAC2_mantissa+2
lda FAC1_mantissa+3
sta FAC2_mantissa+3
// Copy the sign
lda FAC1_sign
sta FAC2_sign
lda FAC1_exponent
!:
// Duplicate the original ROM behaviour
ldx #$00
stx FACOV
rts
+74
View File
@@ -0,0 +1,74 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - copy FAC1 to memory location, do not round
//
// Input:
// - .X - address low byte
// - .Y - address high byte
//
// Output:
// - .A - FAC1 exponent
//
// See also:
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
//
mov_FAC1_MEM:
// Original routines use $22/$23 location for a vector too, see here:
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
sty INDEX+1
stx INDEX+0
ldy #$00
// Copy exponent
lda FAC1_exponent
sta (INDEX), y
beq mov_FAC1_MEM_end // for 0 no need to copy anything more
// Copy first byte of mantissa
iny
lda FAC2_mantissa+3
sta (INDEX), y
// Copy the sign XXX try to optimize this part
lda FAC1_sign
bne !+
lda FAC2_mantissa+3
and #$7F
sta (INDEX), y
!:
// Copy remaining parts of mantissa
iny
lda FAC2_mantissa+2
sta (INDEX), y
iny
lda FAC2_mantissa+1
sta (INDEX), y
iny
lda FAC2_mantissa+0
sta (INDEX), y
// Checked, that mov_FAC1_MEM works on real ROM too (at $BBD7),
// and clears FACOV in a similar way as mov_FAC1_FAC2 does (not surprising)
ldy #$00
sty FACOV
mov_FAC1_MEM_end:
lda FAC1_exponent
rts
+49
View File
@@ -0,0 +1,49 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - copy FAC2 to FAC1
//
// Output (found by experimentation):
// - .A - FAC1 exponent
// - .X - always 0
//
// Preserves:
// - .Y
//
// See also:
// - [CM64] Computes Mapping the Commodore 64 - page 115
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
//
mov_FAC2_FAC1:
// Copy the mantissa
lda FAC2_mantissa+3
sta FAC1_mantissa+3
lda FAC2_mantissa+2
sta FAC1_mantissa+2
lda FAC2_mantissa+1
sta FAC1_mantissa+1
lda FAC2_mantissa+0
sta FAC1_mantissa+0
// Copy the sign
lda FAC2_sign
sta FAC1_sign
// Copy the exponent
lda FAC2_exponent
sta FAC1_exponent
// Clear FACOV
ldx #$00
stx FACOV
rts
+79
View File
@@ -0,0 +1,79 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
// Math package - fetch FAC1 from RAM location
//
// Input:
// - .A - address low byte
// - .Y - address high byte
//
// Output:
// - .A - FAC1 exponent, affects status flags
// - .Y - always 0
//
// Preserves:
// - .X - (experimentation with original ROM)
//
// See also:
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
// XXX test this
mov_MEM_FAC1:
// Original routines use $22/$23 location for a vector too, see here:
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
sty INDEX+1
sta INDEX+0
// Now copy the data from RAM to FAC2, for the format description see:
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic#Representation_in_the_C-64
// Copy the mantissa
ldy #$04
lda (INDEX), y
sta FAC1_mantissa+3
dey
lda (INDEX), y
sta FAC1_mantissa+2
dey
lda (INDEX), y
sta FAC1_mantissa+1
dey
lda (INDEX), y
ora #$80 // clear the sign bit
sta FAC1_mantissa+0
// Copy the sign
lda (INDEX), y
bpl !+ // assumption: non-negative numbers are more frequent
lda #$FF
skip_2_bytes_trash_nvz
!:
lda #$00
sta FAC1_sign
// Copy the exponent
dey
lda (INDEX), y
sta FAC1_exponent
// Set low order mantissa to 0 - this should give the
// most precision while operating on integers
sty FACOV
// Return the FAC1 exponent
lda FAC1_exponent
rts
+77
View File
@@ -0,0 +1,77 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - fetch FAC2 from memory location
//
// Input:
// - .A - address low byte
// - .Y - address high byte
//
// Output:
// - .A - FAC1 exponent (yes, really - Codebase64 is right)
// - .Y - 0 (experimentation with original ROM)
//
// Preserves:
// - .X - (experimentation with original ROM)
//
// See also:
// - [CM64] Computes Mapping the Commodore 64 - page 114
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
//
// XXX test this
mov_MEM_FAC2:
// Original routines use $22/$23 location for a vector too, see here:
// - https://codebase64.org/doku.php?id=base:kernal_floating_point_mathematics
sty INDEX+1
sta INDEX+0
// Now copy the data from RAM to FAC2, for the format description see:
// - https://www.c64-wiki.com/wiki/Floating_point_arithmetic#Representation_in_the_C-64
// Copy the mantissa
ldy #$04
lda (INDEX), y
sta FAC2_mantissa+3
dey
lda (INDEX), y
sta FAC2_mantissa+2
dey
lda (INDEX), y
sta FAC2_mantissa+1
dey
lda (INDEX), y
ora #$80 // clear the sign bit
sta FAC2_mantissa+0
// Copy the sign
lda (INDEX), y
bpl !+ // assumption: non-negative numbers are more frequent
lda #$FF
skip_2_bytes_trash_nvz
!:
lda #$00
sta FAC2_sign
// Copy the exponent
dey
lda (INDEX), y
sta FAC2_exponent
// Return the FAC1 exponent
lda FAC1_exponent
rts
+18
View File
@@ -0,0 +1,18 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - store FAC1 (rounds) in TEMPF1
//
// See also:
// - https://www.c64-wiki.com/wiki/BASIC-ROM
// - https://sta.c64.org/cbm64basconv.html
//
mov_r_FAC1_TMP1:
ldy #$00
ldx #$5C
jmp mov_r_FAC1_MEM
+18
View File
@@ -0,0 +1,18 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Math package - store FAC1 (rounds) in TEMPF2
//
// See also:
// - https://www.c64-wiki.com/wiki/BASIC-ROM
// - https://sta.c64.org/cbm64basconv.html
//
mov_r_FAC1_TMP2:
ldy #$00
ldx #$57
jmp mov_r_FAC1_MEM