more cleanup in BASIC

This commit is contained in:
FeralChild64 committed 2020-06-28 21:09:01 +02:00
1 parent 2085e426c8
commit 01775af002
6 files changed
+54 -46

No files matched your search

+2 -41
View File
@@ -11,53 +11,14 @@ cmd_old:
inx
bne_16 do_DIRECT_MODE_ONLY_error
// Now try to restore program linkage
// Now try to restore program linkage and VARTAB
ldy #$01
tya
sta (TXTTAB),y
jsr LINKPRG
// Now we have to restore VARTAB XXX deduplicate this with line editor
lda TXTTAB+0
sta OLDTXT+0
lda TXTTAB+1
sta OLDTXT+1
!:
lda OLDTXT+0
sta VARTAB+0
lda OLDTXT+1
sta VARTAB+1
jsr basic_follow_link_to_next_line
lda OLDTXT+0
ora OLDTXT+1
bne !- // branch if pointer not NULL
// Correct VARTAB by 2 bytes NULL pointer
#if HAS_OPCODES_65CE02
inw VARTAB
inw VARTAB
#else
clc
lda VARTAB+0
adc #$02
sta VARTAB+0
bcc !+
inc VARTAB+1
!:
#endif
// Call CLR to restore remaining variables
jsr do_clr
jsr calculate_VARTAB
// Quit
+3 -3
View File
@@ -114,9 +114,9 @@ basic_shift_mem_down_and_relink:
relink_down_next_line:
// inc $d020
// jmp relink_down_next_line
// XXX reuse code from cmd_old
// Subtract __tokenise_work3 from the pointer
ldy #0
+2 -2
View File
@@ -128,8 +128,8 @@ basic_shift_mem_up_and_relink:
#endif
relink_up_next_line:
// inc $d020
// jmp relink_up_next_line
// XXX reuse code from cmd_old
// Advance pointer by tokenise_word3 bytes
ldy #0
File renamed without changes.
File renamed without changes.
+47
View File
@@ -0,0 +1,47 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * BASIC_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Calculate the VARTAB value - to mark the end of BASIC program code
//
calculate_VARTAB:
lda TXTTAB+0
sta OLDTXT+0
lda TXTTAB+1
sta OLDTXT+1
!:
lda OLDTXT+0
sta VARTAB+0
lda OLDTXT+1
sta VARTAB+1
jsr basic_follow_link_to_next_line
lda OLDTXT+0
ora OLDTXT+1
bne !- // branch if pointer not NULL
// Correct VARTAB by 2 bytes NULL pointer
#if HAS_OPCODES_65CE02
inw VARTAB
inw VARTAB
#else
clc
lda VARTAB+0
adc #$02
sta VARTAB+0
bcc !+
inc VARTAB+1
!:
#endif
// Call CLR to set-up remaining variables
jmp do_clr