diff --git a/src/aliases/,aliases_ram_lowmem.s b/src/aliases/,aliases_ram_lowmem.s index 08c6d7e9..b6e5dbed 100644 --- a/src/aliases/,aliases_ram_lowmem.s +++ b/src/aliases/,aliases_ram_lowmem.s @@ -71,6 +71,12 @@ .label FAC2_mantissa = $6A // $6A - $6D .label FAC2_sign = $6E + // We re-use FAC2 for memory move pointers, since we cannot be doing calculations while moving memory + .label memmove__src = $69 + .label memmove__dst = $6B + .label memmove__size = $6D + + .label ARISGN = $6F // -- NOT IMPLEMENTED -- .label FACOV = $70 // FAC1 low order mantissa .label FBUFPT = $71 // $71-$72 -- NOT IMPLEMENTED -- diff --git a/src/basic/,aliases.s b/src/basic/,aliases.s index 37741819..291df1a7 100644 --- a/src/basic/,aliases.s +++ b/src/basic/,aliases.s @@ -11,9 +11,3 @@ .label __tokenise_work3 = $0B // COUNT .label __tokenise_work4 = $0F // GARBFL .label __tokenise_work5 = $0C // DIMFLG - - // We re-use FAC2 for memory move pointers, since - // we can't be doing calculations while moving memory - .label __memmove_src = $69 - .label __memmove_dst = $6B - .label __memmove_size = $6D diff --git a/src/basic/basic_shift_mem_down.s b/src/basic/basic_shift_mem_down.s index 2653049f..b3594092 100644 --- a/src/basic/basic_shift_mem_down.s +++ b/src/basic/basic_shift_mem_down.s @@ -9,28 +9,28 @@ basic_shift_mem_down_and_relink: // Destination is OLDTXT lda OLDTXT+0 - sta __memmove_dst+0 + sta memmove__dst+0 lda OLDTXT+1 - sta __memmove_dst+1 + sta memmove__dst+1 // Source is that plus X txa pha // also keep for later clc adc OLDTXT+0 - sta __memmove_src+0 + sta memmove__src+0 lda OLDTXT+1 adc #0 - sta __memmove_src+1 + sta memmove__src+1 // Size is distance from source to end of BASIC text. lda VARTAB+0 sec - sbc __memmove_src+0 - sta __memmove_size+0 + sbc memmove__src+0 + sta memmove__size+0 lda VARTAB+1 - sbc __memmove_src+1 - sta __memmove_size+1 + sbc memmove__src+1 + sta memmove__size+1 // jsr printf // .text "TOP OF BASIC = $" @@ -38,14 +38,14 @@ basic_shift_mem_down_and_relink: // .byte $f0,VARTAB // .byte $0d // .text "SHIFTING DOWN $" - // .byte $f1,<__memmove_size,>__memmove_size - // .byte $f0,<__memmove_size,>__memmove_size + // .byte $f1,memmove__size + // .byte $f0,memmove__size // .text " BYTES FROM $" - // .byte $f1,<__memmove_src,>__memmove_src - // .byte $f0,<__memmove_src,>__memmove_src + // .byte $f1,memmove__src + // .byte $f0,memmove__src // .text " TO $" - // .byte $f1,<__memmove_dst,>__memmove_dst - // .byte $f0,<__memmove_dst,>__memmove_dst + // .byte $f1,memmove__dst + // .byte $f0,memmove__dst // .byte $0d,0 // The copy routine that copies under the ROMs is as simple @@ -59,44 +59,44 @@ basic_shift_mem_down_and_relink: // This means we have to then reduce the source and // target pointers by the same amount - lda __memmove_size+0 + lda memmove__size+0 eor #$ff sta __tokenise_work3 - sta __memmove_size+0 + sta memmove__size+0 - lda __memmove_src+0 + lda memmove__src+0 sec sbc __tokenise_work3 - sta __memmove_src+0 - lda __memmove_src+1 + sta memmove__src+0 + lda memmove__src+1 sbc #0 - sta __memmove_src+1 + sta memmove__src+1 - lda __memmove_dst+0 + lda memmove__dst+0 sec sbc __tokenise_work3 - sta __memmove_dst+0 - lda __memmove_dst+1 + sta memmove__dst+0 + lda memmove__dst+1 sbc #0 - sta __memmove_dst+1 + sta memmove__dst+1 // Increase copy page count so we can post-decrement compare with $00 - inc __memmove_size+1 + inc memmove__size+1 // jsr printf // .text "REVISED BOUNDS $" - // .byte $f1,<__memmove_size,>__memmove_size - // .byte $f0,<__memmove_size,>__memmove_size + // .byte $f1,memmove__size + // .byte $f0,memmove__size // .text " BYTES FROM $" - // .byte $f1,<__memmove_src,>__memmove_src - // .byte $f0,<__memmove_src,>__memmove_src + // .byte $f1,memmove__src + // .byte $f0,memmove__src // .text " TO $" - // .byte $f1,<__memmove_dst,>__memmove_dst - // .byte $f0,<__memmove_dst,>__memmove_dst + // .byte $f1,memmove__dst + // .byte $f0,memmove__dst // .byte $0d,0 // Get Y value ready for the copy - ldy __memmove_size+0 + ldy memmove__size+0 jsr shift_mem_down @@ -131,7 +131,7 @@ relink_down_next_line: sec sbc __tokenise_work3 - sta __memmove_src+0 + sta memmove__src+0 iny #if CONFIG_MEMORY_MODEL_60K @@ -143,10 +143,10 @@ relink_down_next_line: #endif sbc #0 - sta __memmove_src+1 + sta memmove__src+1 ldy #0 - lda __memmove_src+0 + lda memmove__src+0 #if CONFIG_MEMORY_MODEL_60K ldx #VARTAB // .byte $0d // .text "SHIFTING UP $" - // .byte $f1,<__memmove_size,>__memmove_size - // .byte $f0,<__memmove_size,>__memmove_size + // .byte $f1,memmove__size + // .byte $f0,memmove__size // .text " BYTES FROM $" - // .byte $f1,<__memmove_src,>__memmove_src - // .byte $f0,<__memmove_src,>__memmove_src + // .byte $f1,memmove__src + // .byte $f0,memmove__src // .text " TO $" - // .byte $f1,<__memmove_dst,>__memmove_dst - // .byte $f0,<__memmove_dst,>__memmove_dst + // .byte $f1,memmove__dst + // .byte $f0,memmove__dst // .byte $0d,0 // To make life simple for the copy routine that lives in RAM, // we have to adjust the end pointers down one page and set Y to the low // byte of the copy size. - lda __memmove_src+0 + lda memmove__src+0 sec - sbc __memmove_size+0 - sta __memmove_src+0 - lda __memmove_src+1 + sbc memmove__size+0 + sta memmove__src+0 + lda memmove__src+1 sbc #0 - sta __memmove_src+1 + sta memmove__src+1 - lda __memmove_dst+0 + lda memmove__dst+0 sec - sbc __memmove_size+0 - sta __memmove_dst+0 - lda __memmove_dst+1 + sbc memmove__size+0 + sta memmove__dst+0 + lda memmove__dst+1 sbc #0 - sta __memmove_dst+1 + sta memmove__dst+1 // Now make exit easy, by being able to check for zero on size high byte when done - inc __memmove_size+1 + inc memmove__size+1 // Then set Y to the number offset required - ldy __memmove_size+0 + ldy memmove__size+0 iny stx __tokenise_work3 // jsr printf // .text "REVISED BOUNDS $" - // .byte $f1,<__memmove_size,>__memmove_size - // .byte $f0,<__memmove_size,>__memmove_size + // .byte $f1,memmove__size + // .byte $f0,memmove__size // .text " BYTES FROM $" - // .byte $f1,<__memmove_src,>__memmove_src - // .byte $f0,<__memmove_src,>__memmove_src + // .byte $f1,memmove__src + // .byte $f0,memmove__src // .text " TO $" - // .byte $f1,<__memmove_dst,>__memmove_dst - // .byte $f0,<__memmove_dst,>__memmove_dst + // .byte $f1,memmove__dst + // .byte $f0,memmove__dst // .byte $0d,0 // Do the copy @@ -143,10 +143,10 @@ relink_up_next_line: lda (OLDTXT),y #endif - sta __memmove_dst+0 + sta memmove__dst+0 clc adc __tokenise_work3 - sta __memmove_src+0 + sta memmove__src+0 iny php @@ -159,27 +159,27 @@ relink_up_next_line: lda (OLDTXT),y #endif - sta __memmove_dst+1 + sta memmove__dst+1 plp adc #0 - sta __memmove_src+1 + sta memmove__src+1 // jsr printf // .text "LINE ADDR = $" // .byte $f1,VARTAB // .byte $f0,VARTAB // .text $d," BEFORE = $" - // .byte $f1,<__memmove_dst,>__memmove_dst - // .byte $f0,<__memmove_dst,>__memmove_dst + // .byte $f1,memmove__dst + // .byte $f0,memmove__dst // .text ", AFTER = $" - // .byte $f1,<__memmove_src,>__memmove_src - // .byte $f0,<__memmove_src,>__memmove_src + // .byte $f1,memmove__src + // .byte $f0,memmove__src // .byte $d // .byte 0 - // Write __memmove_src back to current line pointer + // Write memmove__src back to current line pointer ldy #0 - lda __memmove_src+0 + lda memmove__src+0 #if CONFIG_MEMORY_MODEL_60K ldx # __memmove_src + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized php !: - lda (__memmove_src),y - sta (__memmove_dst),y + lda (memmove__src),y + sta (memmove__dst),y iny bne !- - inc __memmove_src+1 - inc __memmove_dst+1 - dec __memmove_size+1 + inc memmove__src+1 + inc memmove__dst+1 + dec memmove__size+1 bne !- plp rts diff --git a/src/basic/memory/shift_mem_up_38k.s b/src/basic/memory/shift_mem_up_38k.s index c8fab14b..81c0d9f3 100644 --- a/src/basic/memory/shift_mem_up_38k.s +++ b/src/basic/memory/shift_mem_up_38k.s @@ -7,22 +7,20 @@ shift_mem_up: - // Move __memmove_size bytes from __memmove_src to __memmove_dst, - // where __memmove_dst > __memmove_src + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized php !: - lda (__memmove_src),y - sta (__memmove_dst),y + lda (memmove__src),y + sta (memmove__dst),y dey bne !- - dec __memmove_src+1 - dec __memmove_dst+1 - dec __memmove_size+1 + dec memmove__src+1 + dec memmove__dst+1 + dec memmove__size+1 bne !- plp rts diff --git a/src/basic/memory/under_rom_routines_46k_50k.s b/src/basic/memory/under_rom_routines_46k_50k.s index 7ceb7a84..d7f7beef 100644 --- a/src/basic/memory/under_rom_routines_46k_50k.s +++ b/src/basic/memory/under_rom_routines_46k_50k.s @@ -72,12 +72,10 @@ peek_under_roms_via_FAC1_PLUS_1: shift_mem_up: - // Move __memmove_size bytes from __memmove_src to __memmove_dst, - // where __memmove_dst > __memmove_src + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized // Unmap BASIC lower ROM @@ -88,13 +86,13 @@ shift_mem_up: // Perform the copying !: - lda (__memmove_src),y - sta (__memmove_dst),y + lda (memmove__src),y + sta (memmove__dst),y dey bne !- - dec __memmove_src+1 - dec __memmove_dst+1 - dec __memmove_size+1 + dec memmove__src+1 + dec memmove__dst+1 + dec memmove__size+1 bne !- #if HAS_OPCODES_65C02 @@ -106,12 +104,10 @@ shift_mem_up: shift_mem_down: - // Move __memmove_size bytes from __memmove_src to __memmove_dst, - // where __memmove_dst > __memmove_src + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized // Unmap BASIC lower ROM @@ -122,13 +118,13 @@ shift_mem_down: // Perform the copying !: - lda (__memmove_src),y - sta (__memmove_dst),y + lda (memmove__src),y + sta (memmove__dst),y iny bne !- - inc __memmove_src+1 - inc __memmove_dst+1 - dec __memmove_size+1 + inc memmove__src+1 + inc memmove__dst+1 + dec memmove__size+1 bne !- // FALLTROUGH diff --git a/src/basic/memory/under_rom_routines_60k.s b/src/basic/memory/under_rom_routines_60k.s index 0a07dbc7..a3b72346 100644 --- a/src/basic/memory/under_rom_routines_60k.s +++ b/src/basic/memory/under_rom_routines_60k.s @@ -70,44 +70,44 @@ memmap_allram_routine: rts shift_mem_up_routine: - // Move __memmove_size bytes from __memmove_src to __memmove_dst, - // where __memmove_dst > __memmove_src + + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized + php jsr memmap_allram -smu1: - lda (__memmove_src),y - sta (__memmove_dst),y +!: + lda (memmove__src),y + sta (memmove__dst),y dey - bne smu1 - dec __memmove_src+1 - dec __memmove_dst+1 - dec __memmove_size+1 - bne smu1 + bne !- + dec memmove__src+1 + dec memmove__dst+1 + dec memmove__size+1 + bne !- plp jmp memmap_normal shift_mem_down_routine: - // Move __memmove_size bytes from __memmove_src to __memmove_dst, - // where __memmove_dst > __memmove_src + + // Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src + // // This means we have to copy from the back end down. - // This routine assumes the pointers are already pointed - // to the end of the areas, and that Y is correctly initialised - // to allow the copy to begin. + // This routine assumes the pointers are already pointed to the end of the areas, and that .Y is correctly initialized + php jsr memmap_allram -smd1: - lda (__memmove_src),y - sta (__memmove_dst),y +!: + lda (memmove__src),y + sta (memmove__dst),y iny - bne smd1 - inc __memmove_src+1 - inc __memmove_dst+1 - dec __memmove_size+1 - bne smd1 + bne !- + inc memmove__src+1 + inc memmove__dst+1 + dec memmove__size+1 + bne !- plp jmp memmap_normal