more documentation of similarities and avoiding them where practicable.

This commit is contained in:
Paul Gardner-Stephen committed 2019-04-24 16:13:24 +09:30
1 parent 035b386f6c
commit 7448909da8
17 files changed
+161 -12

No files matched your search

+6 -5
View File
@@ -88,12 +88,13 @@ no_need_to_extend:
dey
cpy current_screen_x
bne -
;; Put space in the inserted gap
lda #$20
sta (current_screen_line_ptr),y
;; Increase insert mode count (which causes quote-mode like behaviour)
inc insert_mode
;; Put space in the inserted gap
lda #$20
sta (current_screen_line_ptr),y
jmp chrout_done
not_94:
@@ -566,10 +567,10 @@ scroll_copy_loop2:
;; Fill in scrolled up area
ldx load_or_scroll_temp_pointer+0
scroll_copy_loop3:
lda #$20
sta (current_screen_line_ptr),y
lda text_colour
sta (current_screen_line_colour_ptr),y
lda #$20
sta (current_screen_line_ptr),y
iny
dex
bne scroll_copy_loop3
+7 -7
View File
@@ -26,18 +26,18 @@ cint:
;; Making some numbers up here: Repeat every ~1/10th sec
;; But require key to be held for ~1/3sec before
;; repeating (Compute's Mapping the 64 p58)
lda #22-2 ; Fudge factor to match speed
sta key_first_repeat_delay
ldx #22-2 ; Fudge factor to match speed
stx key_first_repeat_delay
;; Set current colour for text (Compute's Mapping the 64 p215)
lda #$0e ; light blue by default
sta $0286
ldx #$0e ; light blue by default
stx $0286
;; Set maximum keyboard buffer size (Compute's Mapping the 64 p215)
lda #10
sta key_buffer_size
ldx #10
stx key_buffer_size
;; Put non-zero value in enable_case_switch
sta enable_case_switch
stx enable_case_switch
;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215)
jmp clear_screen
+12
View File
@@ -108,6 +108,12 @@ int main(int argc,char **argv)
// Ignore matches of no more than 3 bytes,
// since that is the max length of a 6502 instruction
int single_instruction=0;
if (k==5) {
if (f1[i]==0xa9&&f1[i+2]==0x8d) break; // LDA #$xx / STA $nnnn
}
if (k==4) {
if (f1[i]==0xa9&&f1[i+2]==0x85) break; // LDA #$xx / STA $nn
}
if (k==3) {
// Reject some very common instruction fragments
@@ -118,6 +124,12 @@ int main(int argc,char **argv)
if (f1[i]==0xb0) break;
if (f1[i]==0x90) break;
if (f1[i]==0x10) break;
// Any single byte followed by a branch
if (f1[i+1]==0xd0) break;
if (f1[i+1]==0xf0) break;
if (f1[i+1]==0xb0) break;
if (f1[i+1]==0x90) break;
if (f1[i+1]==0x10) break;
// Any 2-byte opcode followed by a branch
if (f1[i+2]==0xd0) break;
if (f1[i+2]==0xf0) break;
+5
View File
@@ -0,0 +1,5 @@
CLC / ADC #40 / STA $nn
Add 40 to a ZP location. No creativity here.
Effectivelhy only one insstruction.
Not copyrightable.
+4
View File
@@ -0,0 +1,4 @@
string "BASIC "
Since we are writing a BASIC language interprettor, such a string is expected.
BASIC appears in many other works. It cannot be copyrighted as a word.
+8
View File
@@ -0,0 +1,8 @@
String "BASIC V2"
As we are implementing a V2 class BASIC interprettor, it is
natural for us to include this string.
There are many BASIC intreprettors, and the word cannot be
copyrighted, nor it is reasonable to contemplate that a party
could be constrained from having a BASIC with version 2, or
displaying that information anywhere. Not copyrightable.
+7
View File
@@ -0,0 +1,7 @@
RTS + LDA $028D
RTS is a very common instruction, as is loading A from absolute address.
The RTS is the end of a routine, and the LDA $028D thus the start of
another. Thus this would occur whenever a routine begins with loading
A from $028D, immediately after another routine. Nothing creative.
Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
Something with $0277 / INX
Only one whole instruction here. Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
something with $0286 / STA ($F3),Y
Only one whole instruction. Not copyrightable.
+44
View File
@@ -0,0 +1,44 @@
Copy screen + colour RAM to the right one place
This sequence of instructions:
loop:
DEY
LDA ($D1),Y
INY
STA ($D1),Y
DEY
LDA ($F3),Y
INY
STA ($F3),Y
DEY
CPY $D3
BNE loop
LDA #$20
STA ($D1),Y
is the obvious any minimal way to copy the screen and colour RAM data.
The constants $D1 and $F3 are fixed by the publicly documented interface
of the KERNAL to point to the screen and colour RAM of the screen.
The Y register is the only register that can be used to post-increment an
indirect address on the 6502.
Thus the only efficient manner to copy a string to the right one byte
is to read, increment Y by one to get the destination address, store,
then decrement Y again so that it points to the source offset, now read
the colour RAM byte, add one to Y so that we point to the destination,
and then write it.
Similarly the check against $D3 (current column of cursor on screen) is also
necessary for working out when to terminate the loop. The storing of $20
into the screen RAM is also required to effect the insertion of a space.
In fact, about the only variant possible would be to swap the $D1 and $F3
constants so that the colour RAM is copied before the screen RAM in each
loop, instead of after it.
It is telling that this routine was the result of independent implementation
of this routine, without looking at the KERNALs routine, in terms of supporting
the argument that the routine is the obvious manner in which to do this.
+44
View File
@@ -0,0 +1,44 @@
Copy screen + colour RAM to the right one place
This sequence of instructions:
loop:
DEY
LDA ($D1),Y
INY
STA ($D1),Y
DEY
LDA ($F3),Y
INY
STA ($F3),Y
DEY
CPY $D3
BNE loop
LDA #$20
STA ($D1),Y
is the obvious any minimal way to copy the screen and colour RAM data.
The constants $D1 and $F3 are fixed by the publicly documented interface
of the KERNAL to point to the screen and colour RAM of the screen.
The Y register is the only register that can be used to post-increment an
indirect address on the 6502.
Thus the only efficient manner to copy a string to the right one byte
is to read, increment Y by one to get the destination address, store,
then decrement Y again so that it points to the source offset, now read
the colour RAM byte, add one to Y so that we point to the destination,
and then write it.
Similarly the check against $D3 (current column of cursor on screen) is also
necessary for working out when to terminate the loop. The storing of $20
into the screen RAM is also required to effect the insertion of a space.
In fact, about the only variant possible would be to swap the $D1 and $F3
constants so that the colour RAM is copied before the screen RAM in each
loop, instead of after it.
It is telling that this routine was the result of independent implementation
of this routine, without looking at the KERNALs routine, in terms of supporting
the argument that the routine is the obvious manner in which to do this.
+4
View File
@@ -0,0 +1,4 @@
something with $028D / CMP #$03 / BNE somewhere
Only one whole instruction. Nothing creative.
Not copyrightable.
+1
View File
@@ -0,0 +1 @@
STA $028C / LDA #$0E / STA $0286 / LDA
+3
View File
@@ -0,0 +1,3 @@
Use X register to compare contents of a ZP and absolute address location
Nothing copyrightable here in this simple comparison of memory contents.
+4
View File
@@ -0,0 +1,4 @@
LDA ($D1),Y / CMP #$20
Compare a byte read from a pointer with a specific value.
No creativity here. Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
Fragment / CMP #$11 / BNE somewhere
Only one whole intruction here. Not copyrightable.
+3
View File
@@ -0,0 +1,3 @@
Fragment / CMP #$13 / BNE somewhere
Only one whole intruction here. Not copyrightable.