BASIC editor rework finished

This commit is contained in:
FeralChild64 committed 2020-07-01 03:39:37 +02:00
1 parent 4bae8ae878
commit 8d705f2f6d
23 files changed
+302 -426

No files matched your search

@@ -0,0 +1,36 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Helper routine for memory copy. Moves down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
//
shift_mem_adapt_pointers:
sty RESHO+4
// Adapt source pointer
sec
lda memmove__src+0
sbc RESHO+4
sta memmove__src+0
bcs !+
dec memmove__src+1
!:
// Adapt destination pointer
sec
lda memmove__dst+0
sbc RESHO+4
sta memmove__dst+0
bcs !+
dec memmove__dst+1
!:
// Adapt data size
inc memmove__size+1
rts
+59
View File
@@ -0,0 +1,59 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Copies the memory down
//
// Input:
// - memmove__src - pointer to the first byte of source
// - memmove__dst - pointer to the first byte of destination
// - memmove__size - number of bytes to copy
//
// All the input variables, .A, and .Y register, are destroyed. Also uses RESHO+4 variable.
//
shift_mem_down:
// The copy routine is simplified, so that it is fast and (for memory model 60K)
// can fit in a small RAM area - therefore it requires to pre-set .Y, so that
// the copy ends when it reaches 0; so if copying one byte we want .Y = $FF
sec
lda #$00
sbc memmove__size+0
tay
// Now we have to move down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
jsr shift_mem_adapt_pointers
#if CONFIG_MEMORY_MODEL_38K
shift_mem_down_internal:
// 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 initialized
php
!:
lda (memmove__src),y
sta (memmove__dst),y
iny
bne !-
inc memmove__src+1
inc memmove__dst+1
dec memmove__size+1
bne !-
plp
rts
#else
jmp shift_mem_down_internal
#endif
-28
View File
@@ -1,28 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_MEMORY_MODEL_38K
shift_mem_down:
// 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 initialized
php
!:
lda (memmove__src),y
sta (memmove__dst),y
iny
bne !-
inc memmove__src+1
inc memmove__dst+1
dec memmove__size+1
bne !-
plp
rts
#endif
+56
View File
@@ -0,0 +1,56 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Copies the memory up
//
// Input:
// - memmove__src - pointer to the last byte of source
// - memmove__dst - pointer to the last byte of destination
// - memmove__size - number of bytes to copy
//
// All the input variables, .A, and .Y register, are destroyed. Also uses RESHO+4 variable.
//
shift_mem_up:
// The copy routine is simplified, so that it is fast and (for memory model 60K)
// can fit in a small RAM area - therefore it requires to pre-set .Y, so that
// the copy ends when it reaches 0; so if copying one byte we want .Y = $01
ldy memmove__size+0
// Now we have to move down the memmove_src and memmove_dst pointers to compensate for .Y not being 0
jsr shift_mem_adapt_pointers
#if CONFIG_MEMORY_MODEL_38K
shift_mem_up_internal:
// 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 initialized
php
!:
lda (memmove__src),y
sta (memmove__dst),y
dey
bne !-
dec memmove__src+1
dec memmove__dst+1
dec memmove__size+1
bne !-
plp
rts
#else
jmp shift_mem_up_internal
#endif
-28
View File
@@ -1,28 +0,0 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
#if CONFIG_MEMORY_MODEL_38K
shift_mem_up:
// 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 initialized
php
!:
lda (memmove__src),y
sta (memmove__dst),y
dey
bne !-
dec memmove__src+1
dec memmove__dst+1
dec memmove__size+1
bne !-
plp
rts
#endif
@@ -70,7 +70,7 @@ peek_under_roms_via_FAC1_PLUS_1:
shift_mem_up:
shift_mem_up_internal:
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
//
@@ -96,13 +96,13 @@ shift_mem_up:
bne !-
#if HAS_OPCODES_65C02
bra shift_mem_finalize
bra shift_mem_internal_finalize
#else
jmp shift_mem_finalize
jmp shift_mem_internal_finalize
#endif
shift_mem_down:
shift_mem_down_internal:
// Move memmove__size bytes from memmove__src to memmove__dst, where memmove__dst > memmove__src
//
@@ -126,9 +126,10 @@ shift_mem_down:
inc memmove__dst+1
dec memmove__size+1
bne !-
// FALLTROUGH
shift_mem_finalize:
shift_mem_internal_finalize:
// Restore memory mapping and quit