adapted to Kick Assembler, some documentation update

This commit is contained in:
FeralChild64 committed 2019-09-07 12:35:21 +02:00
1 parent ae23dbae7b
commit de27124b4f
198 files changed
+4181 -3976

No files matched your search

+61 -61
View File
@@ -1,12 +1,12 @@
basic_shift_mem_up_and_relink:
;; Shift memory up from basic_current_line_ptr
;; X bytes.
// Shift memory up from basic_current_line_ptr
// X bytes.
;; NOTE: Pointers need to be reduced by one, due to the way
;; the copyroutine works, so we do that here.
;; Work out end point of destination
// NOTE: Pointers need to be reduced by one, due to the way
// the copyroutine works, so we do that here.
// Work out end point of destination
txa
clc
adc basic_end_of_text_ptr+0
@@ -22,7 +22,7 @@ basic_shift_mem_up_and_relink:
sbc #0
sta memmove_dst+1
;; End point of source is just current end of BASIC text
// End point of source is just current end of BASIC text
lda basic_end_of_text_ptr+0
sec
sbc #1
@@ -31,7 +31,7 @@ basic_shift_mem_up_and_relink:
sbc #0
sta memmove_src+1
;; Work out size of region to copy
// Work out size of region to copy
lda basic_end_of_text_ptr+0
sec
sbc basic_current_line_ptr+0
@@ -40,25 +40,25 @@ basic_shift_mem_up_and_relink:
sbc basic_current_line_ptr+1
sta memmove_size+1
;; jsr printf
;; .byte "TOP OF BASIC = $"
;; .byte $f1,<basic_end_of_text_ptr,>basic_end_of_text_ptr
;; .byte $f0,<basic_end_of_text_ptr,>basic_end_of_text_ptr
;; .byte $0d
;; .byte "SHIFTING UP $"
;; .byte $f1,<memmove_size,>memmove_size
;; .byte $f0,<memmove_size,>memmove_size
;; .byte " BYTES FROM $"
;; .byte $f1,<memmove_src,>memmove_src
;; .byte $f0,<memmove_src,>memmove_src
;; .byte " TO $"
;; .byte $f1,<memmove_dst,>memmove_dst
;; .byte $f0,<memmove_dst,>memmove_dst
;; .byte $0d,0
// jsr printf
// .text "TOP OF BASIC = $"
// .byte $f1,<basic_end_of_text_ptr,>basic_end_of_text_ptr
// .byte $f0,<basic_end_of_text_ptr,>basic_end_of_text_ptr
// .byte $0d
// .text "SHIFTING UP $"
// .byte $f1,<memmove_size,>memmove_size
// .byte $f0,<memmove_size,>memmove_size
// .text " BYTES FROM $"
// .byte $f1,<memmove_src,>memmove_src
// .byte $f0,<memmove_src,>memmove_src
// .text " TO $"
// .byte $f1,<memmove_dst,>memmove_dst
// .byte $f0,<memmove_dst,>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.
// 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
sec
sbc memmove_size+0
@@ -75,35 +75,35 @@ basic_shift_mem_up_and_relink:
sbc #0
sta memmove_dst+1
;; Now make exit easy, by being able to check for zero on size high byte when done
// Now make exit easy, by being able to check for zero on size high byte when done
inc memmove_size+1
;; Then set Y to the number offset required
// Then set Y to the number offset required
ldy memmove_size+0
iny
stx tokenise_work3
;; jsr printf
;; .byte "REVISED BOUNDS $"
;; .byte $f1,<memmove_size,>memmove_size
;; .byte $f0,<memmove_size,>memmove_size
;; .byte " BYTES FROM $"
;; .byte $f1,<memmove_src,>memmove_src
;; .byte $f0,<memmove_src,>memmove_src
;; .byte " TO $"
;; .byte $f1,<memmove_dst,>memmove_dst
;; .byte $f0,<memmove_dst,>memmove_dst
;; .byte $0d,0
// jsr printf
// .text "REVISED BOUNDS $"
// .byte $f1,<memmove_size,>memmove_size
// .byte $f0,<memmove_size,>memmove_size
// .text " BYTES FROM $"
// .byte $f1,<memmove_src,>memmove_src
// .byte $f0,<memmove_src,>memmove_src
// .text " TO $"
// .byte $f1,<memmove_dst,>memmove_dst
// .byte $f0,<memmove_dst,>memmove_dst
// .byte $0d,0
;; Do the copy
// Do the copy
jsr shift_mem_up
;; Now fix the pointer to the next line
// Now fix the pointer to the next line
;; First, we need to point the current BASIC line
;; pointer to itself, so that we can add the shift
;; to make it end up pointing to the next line
// First, we need to point the current BASIC line
// pointer to itself, so that we can add the shift
// to make it end up pointing to the next line
ldy #0
ldx #<basic_current_line_ptr+0
lda basic_current_line_ptr+0
@@ -113,10 +113,10 @@ basic_shift_mem_up_and_relink:
jsr poke_under_roms
relink_up_next_line:
;; inc $d020
;; jmp relink_up_next_line
// inc $d020
// jmp relink_up_next_line
;; Advance pointer by tokenise_word3 bytes
// Advance pointer by tokenise_word3 bytes
ldy #0
ldx #<basic_current_line_ptr+0
jsr peek_under_roms
@@ -132,20 +132,20 @@ relink_up_next_line:
adc #0
sta memmove_src+1
;; jsr printf
;; .byte "LINE ADDR = $"
;; .byte $f1,<basic_current_line_ptr,>basic_end_of_text_ptr
;; .byte $f0,<basic_current_line_ptr,>basic_end_of_text_ptr
;; .byte $d," BEFORE = $"
;; .byte $f1,<memmove_dst,>memmove_dst
;; .byte $f0,<memmove_dst,>memmove_dst
;; .byte ", AFTER = $"
;; .byte $f1,<memmove_src,>memmove_src
;; .byte $f0,<memmove_src,>memmove_src
;; .byte $d
;; .byte 0
// jsr printf
// .text "LINE ADDR = $"
// .byte $f1,<basic_current_line_ptr,>basic_end_of_text_ptr
// .byte $f0,<basic_current_line_ptr,>basic_end_of_text_ptr
// .text $d," BEFORE = $"
// .byte $f1,<memmove_dst,>memmove_dst
// .byte $f0,<memmove_dst,>memmove_dst
// .text ", AFTER = $"
// .byte $f1,<memmove_src,>memmove_src
// .byte $f0,<memmove_src,>memmove_src
// .byte $d
// .byte 0
;; Write memmove_src back to current line pointer
// Write memmove_src back to current line pointer
ldy #0
ldx #<basic_current_line_ptr
lda memmove_src+0
@@ -156,13 +156,13 @@ relink_up_next_line:
relink_up_loop:
;; Now advance pointer to the next line,
// Now advance pointer to the next line,
lda memmove_src+0
sta basic_current_line_ptr+0
lda memmove_src+1
sta basic_current_line_ptr+1
;; Have we run out of lines to patch?
// Have we run out of lines to patch?
ldx #<basic_current_line_ptr
jsr peek_pointer_null_check
bcs relink_up_next_line