more aliases cleanup

This commit is contained in:
FeralChild64 committed 2019-09-28 10:57:12 +02:00
1 parent 2d5bf15ac9
commit 1130db35e0
6 files changed
+67 -80

No files matched your search

+34 -5
View File
@@ -57,12 +57,22 @@
.label JMPER = $54 // $54-$56 -- NOT IMPLEMENTED -- .label JMPER = $54 // $54-$56 -- NOT IMPLEMENTED --
.label TEMPF1 = $57 // $57-$5B BASIC numeric work area .label TEMPF1 = $57 // $57-$5B BASIC numeric work area
.label TEMPF2 = $5C // $5C-$60 BASIC numeric work area .label TEMPF2 = $5C // $5C-$60 BASIC numeric work area
.label FAC1 = $61 // $61-$66 -- NOT IMPLEMENTED --
.label __FAC1 = $61 // $61-$66 floating point accumulator 1
.label FAC1_exponent = $61
.label FAC1_mantissa = $62 // $62 - $65
.label FAC1_sign = $66
.label SGNFLG = $67 // -- NOT IMPLEMENTED -- .label SGNFLG = $67 // -- NOT IMPLEMENTED --
.label BITS = $68 // -- NOT IMPLEMENTED -- .label BITS = $68 // FAC1 overflow
.label FAC2 = $69 // $69-$6E -- NOT IMPLEMENTED -- [!] also used for memory move pointers
.label __FAC2 = $69 // $69-$6E floating point accumulator 2 [!] also used for memory move pointers
.label FAC2_exponent = $69
.label FAC2_mantissa = $6A // $6A - $6D
.label FAC2_sign = $6E
.label ARISGN = $6F // -- NOT IMPLEMENTED -- .label ARISGN = $6F // -- NOT IMPLEMENTED --
.label FACOV = $70 // -- NOT IMPLEMENTED -- .label FACOV = $70 // FAC1 low order mantissa
.label FBUFPT = $67 // $71-$72 -- NOT IMPLEMENTED -- .label FBUFPT = $67 // $71-$72 -- NOT IMPLEMENTED --
.label CHRGET = $73 // $73-$8A -- NOT IMPLEMENTED -- .label CHRGET = $73 // $73-$8A -- NOT IMPLEMENTED --
.label TXTPTR = $7A // $7A-$7B current BASIC statement pointer .label TXTPTR = $7A // $7A-$7B current BASIC statement pointer
@@ -190,7 +200,26 @@
.label TD1IRQ = $2A4 // -- NOT IMPLEMENTED -- .label TD1IRQ = $2A4 // -- NOT IMPLEMENTED --
.label TLNIDX = $2A5 // -- NOT IMPLEMENTED -- .label TLNIDX = $2A5 // -- NOT IMPLEMENTED --
.label TVSFLG = $2A6 // 0 = NTSC, 1 = PAL .label TVSFLG = $2A6 // 0 = NTSC, 1 = PAL
// [!] XXX document $2A7-$2FF usage
// [!] $2A7-$2FF is normally free, but in our case some extra functionality uses it
#if CONFIG_MEMORY_MODEL_60K
// IRQs are disabled when doing such accesses, and a default NMI handler only increments
// a counter, so that if an NMI occurs, it doesn't crash the machine, but can be captured.
.label missed_nmi_flag = $2A7
.label tiny_nmi_handler = $2A8
.label peek_under_roms = tiny_nmi_handler + peek_under_roms_routine - tiny_nmi_handler_routine
.label poke_under_roms = tiny_nmi_handler + poke_under_roms_routine - tiny_nmi_handler_routine
.label memmap_allram = tiny_nmi_handler + memmap_allram_routine - tiny_nmi_handler_routine
.label memmap_normal = tiny_nmi_handler + memmap_normal_routine - tiny_nmi_handler_routine
#if SEGMENT_BASIC
.label shift_mem_up = tiny_nmi_handler + shift_mem_up_routine - tiny_nmi_handler_routine
.label shift_mem_down = tiny_nmi_handler + shift_mem_down_routine - tiny_nmi_handler_routine
#endif // SEGMENT_BASIC
#endif // CONFIG_MEMORY_MODEL_60K
// BASIC vectors // BASIC vectors
.label IERROR = $300 // $300-$301 .label IERROR = $300 // $300-$301
-27
View File
@@ -37,35 +37,8 @@
.label basic_numeric_work_area = $57 // $57 - $60 inclusive = 10 bytes .label basic_numeric_work_area = $57 // $57 - $60 inclusive = 10 bytes
// Floating point accumulator 1 $61 - $68
.label basic_fac1_exponent = $61
.label basic_fac1_mantissa = $62 // $62 - $65
.label basic_fac1_sign = $66
.label basic_fac1_overflow = $68
.label basic_fac1_mantissa_lob = $70
.label basic_fac2_exponent = $69
.label basic_fac2_mantissa = $6A // $6A - $6D
.label basic_fac2_sign = $6E
// We also re-use FAC2 for memory move pointers, since // We also re-use FAC2 for memory move pointers, since
// we can't be doing calculations while moving memory // we can't be doing calculations while moving memory
.label memmove_src = $69 .label memmove_src = $69
.label memmove_dst = $6b .label memmove_dst = $6b
.label memmove_size = $6d .label memmove_size = $6d
#if CONFIG_MEMORY_MODEL_60K
// BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards
// IRQs are disabled when doing such accesses, and a default NMI handler only increments
// a counter, so that if an NMI occurs, it doesn't crash the machine, but can be captured.
.label missed_nmi_flag = $2A7
.label tiny_nmi_handler = $2A8
.label shift_mem_up = tiny_nmi_handler+shift_mem_up_routine-tiny_nmi_handler_routine
.label shift_mem_down = tiny_nmi_handler+shift_mem_down_routine-tiny_nmi_handler_routine
.label peek_under_roms = tiny_nmi_handler+peek_under_roms_routine-tiny_nmi_handler_routine
.label poke_under_roms = tiny_nmi_handler+poke_under_roms_routine-tiny_nmi_handler_routine
.label memmap_allram = tiny_nmi_handler+memmap_allram_routine-tiny_nmi_handler_routine
.label memmap_normal = tiny_nmi_handler+memmap_normal_routine-tiny_nmi_handler_routine
#endif // CONFIG_MEMORY_MODEL_60K
+5 -5
View File
@@ -5,9 +5,9 @@ basic_parse_line_number:
// Check if the number is a valid line number // Check if the number is a valid line number
// i.e., 16 bits, no exponent, no decimal // i.e., 16 bits, no exponent, no decimal
lda basic_fac1_mantissa+2 lda FAC1_mantissa+2
ora basic_fac1_mantissa+3 ora FAC1_mantissa+3
ora basic_fac1_exponent ora FAC1_exponent
beq !+ beq !+
ml_bad_line_number: ml_bad_line_number:
// Invalid line number // Invalid line number
@@ -19,9 +19,9 @@ ml_bad_line_number:
bne ml_bad_line_number bne ml_bad_line_number
// Got a valid line number. // Got a valid line number.
lda basic_fac1_mantissa+0 lda FAC1_mantissa+0
sta basic_line_number+0 sta basic_line_number+0
lda basic_fac1_mantissa+1 lda FAC1_mantissa+1
sta basic_line_number+1 sta basic_line_number+1
clc clc
rts rts
+19 -19
View File
@@ -3,13 +3,13 @@
// Implement by shifting MAC left one bit, // Implement by shifting MAC left one bit,
// and then keeping that value to add on after // and then keeping that value to add on after
// shifting two more bits left. // shifting two more bits left.
// This should be done using basic_fac1_overflow to // This should be done using BITS to
// hold the overflow bits, so that the result can // hold the overflow bits, so that the result can
// be exponent adjusted after, if required. // be exponent adjusted after, if required.
fac1_mul10: fac1_mul10:
lda #$00 lda #$00
sta basic_fac1_overflow sta BITS
// Multiply mantissa by 2 // Multiply mantissa by 2
jsr fac1_mantissa_mul2 jsr fac1_mantissa_mul2
@@ -20,7 +20,7 @@ fac1_mul10:
// the overflow bits, and the copy is as small as possible) // the overflow bits, and the copy is as small as possible)
ldx #7 ldx #7
f1m10_l1: f1m10_l1:
lda basic_fac1_mantissa,x lda FAC1_mantissa,x
sta basic_numeric_work_area,x sta basic_numeric_work_area,x
dex dex
bpl f1m10_l1 bpl f1m10_l1
@@ -34,20 +34,20 @@ f1m10_l1:
ldx #0 ldx #0
clc clc
f1m10_l2: f1m10_l2:
lda basic_fac1_mantissa,x lda FAC1_mantissa,x
adc basic_numeric_work_area,x adc basic_numeric_work_area,x
sta basic_fac1_mantissa,x sta FAC1_mantissa,x
inx inx
dey dey
bpl f1m10_l2 bpl f1m10_l2
lda basic_fac1_overflow lda BITS
adc basic_numeric_work_area+7 adc basic_numeric_work_area+7
sta basic_fac1_overflow sta BITS
// Now shift right and increase exponent until overflow // Now shift right and increase exponent until overflow
// bits = $00 // bits = $00
f1m10_l3: f1m10_l3:
lda basic_fac1_overflow lda BITS
bne !+ bne !+
// All done, return // All done, return
clc clc
@@ -55,8 +55,8 @@ f1m10_l3:
!: !:
// Divide mantissa by two, and increment exponent // Divide mantissa by two, and increment exponent
jsr fac1_mantissa_div2 jsr fac1_mantissa_div2
inc basic_fac1_exponent inc FAC1_exponent
lda basic_fac1_exponent lda FAC1_exponent
bpl f1m10_l3 bpl f1m10_l3
// Exponent has bit 7 set, so has wrapped. // Exponent has bit 7 set, so has wrapped.
// = OVERFLOW ERROR // = OVERFLOW ERROR
@@ -68,30 +68,30 @@ fac1_mantissa_mul2:
clc clc
f1m1_l1: f1m1_l1:
// Multiply mantissa by 2, and store overflow // Multiply mantissa by 2, and store overflow
// in basic_fac1_bits // in FAC1_bits
lda basic_fac1_mantissa,x lda FAC1_mantissa,x
rol rol
sta basic_fac1_mantissa,x sta FAC1_mantissa,x
inx inx
dey dey
bpl f1m1_l1 bpl f1m1_l1
lda basic_fac1_overflow lda BITS
rol rol
sta basic_fac1_overflow sta BITS
rts rts
fac1_mantissa_div2: fac1_mantissa_div2:
// Divide mantissa by 2, including using overflow bits // Divide mantissa by 2, including using overflow bits
clc clc
lda basic_fac1_overflow lda BITS
ror ror
sta basic_fac1_overflow sta BITS
ldy #3 ldy #3
f1md2_l1: f1md2_l1:
lda basic_fac1_mantissa,y lda FAC1_mantissa,y
ror ror
sta basic_fac1_mantissa,y sta FAC1_mantissa,y
dey dey
bpl f1md2_l1 bpl f1md2_l1
rts rts
+9 -9
View File
@@ -60,7 +60,7 @@ injest_number:
// Set sign to negative // Set sign to negative
lda #$ff lda #$ff
sta basic_fac1_sign sta FAC1_sign
// Skip over the minus sign // Skip over the minus sign
jsr basic_consume_character jsr basic_consume_character
@@ -80,7 +80,7 @@ ij_loop1:
// Only add digit if we have not overflowed the accuracy of // Only add digit if we have not overflowed the accuracy of
// the mantissa // the mantissa
lda basic_fac1_exponent lda FAC1_exponent
beq ij_accept_precision beq ij_accept_precision
// We have an extra digit after saturating our precision. // We have an extra digit after saturating our precision.
@@ -103,7 +103,7 @@ ij_accept_precision:
// we can add the new digit in // we can add the new digit in
jsr fac1_mul10 jsr fac1_mul10
lda basic_fac1_exponent lda FAC1_exponent
bne ij_consider_next_digit bne ij_consider_next_digit
// Get digit // Get digit
@@ -114,14 +114,14 @@ ij_accept_precision:
// Add to FAC1 mantissa // Add to FAC1 mantissa
clc clc
adc basic_fac1_mantissa+0 adc FAC1_mantissa+0
sta basic_fac1_mantissa+0 sta FAC1_mantissa+0
ldx #1 ldx #1
ldy #3 ldy #3
ij_loop2: ij_loop2:
lda basic_fac1_mantissa,x lda FAC1_mantissa,x
adc #$00 adc #$00
sta basic_fac1_mantissa,x sta FAC1_mantissa,x
inx inx
dey dey
bne ij_loop2 bne ij_loop2
@@ -146,10 +146,10 @@ erase_fac1:
lda #$00 lda #$00
ldx #8 ldx #8
!: !:
sta basic_fac1_exponent,x sta FAC1_exponent,x
dex dex
bpl !- bpl !-
sta basic_fac1_mantissa_lob sta FACOV
rts rts
-15
View File
@@ -1,15 +0,0 @@
// XXX get rid of this file
#if CONFIG_MEMORY_MODEL_60K
// Under-ROM routines
// (BASIC also includes them. XXX - We should de-duplicate them in a safe manner)
.label missed_nmi_flag = $2A7
.label tiny_nmi_handler = $2A8
.label peek_under_roms = tiny_nmi_handler+peek_under_roms_routine-tiny_nmi_handler_routine
.label poke_under_roms = tiny_nmi_handler+poke_under_roms_routine-tiny_nmi_handler_routine
.label memmap_allram = tiny_nmi_handler+memmap_allram_routine-tiny_nmi_handler_routine
.label memmap_normal = tiny_nmi_handler+memmap_normal_routine-tiny_nmi_handler_routine
#endif // CONFIG_MEMORY_MODEL_60K