The text editor code has been difficult; I can only stand to work on it a bit at a time.
The 6800 version keeps values in the X register for long stretches of code, sometimes across several subroutines. I am about to give up trying to keep it in 6502 registers even part of the time, but to declare RegX, a 2-byte variable in the zero page, and copy values into and out of it as the 6800 loads and stores X. Addresses already have to be stored in the zero page to access memory. It will not be as efficient, but the code will be somewhat clearer; this program really needs that.
So far, the following functionality is complete:
loading a file
saving a file
text buffer management
Print command
Insert command
Delete command
Renumber command
Overlay command
Find command
The Copy command has been coded, but it does not work. When that is done, the Move command should be easy as it does a copy followed by a delete. I would guess we are somewhat past the halfway mark.
During breaks, I have been working on assemblers.
First, I added the SET directive to the 6800 ASMB. It is like EQU, but a label may be assigned a value more than once.
I have always liked the local labels in RELASMB, the 6809 relocatable assembler, and wished that ASMB implemented them.
Local labels work like this: a one or two digit number in the label field is considered to be a local label. It is referenced by stating the number followed by a "b" or "f" to designate whether to search for the nearest occurrence of the number before or following the current line. Note that it is not possible to find a local label on the current line. For example:
Code: Select all
2 ; This is the target for "2b"
2 beq target ; The label for this line cannot be specified
2 ; This is the target for "2f"
Advantages of a local label include doing away with the need to come up with meaningful and unique names for short, trivial branches and a local label uses less memory than a regular symbol.
A web search for local label uncovered no prevalent standard, but a number with a "b" or "f" suffix is a very common form.
I will put a seemingly arbitrary limit on local labels: the number may not consist of only "0" and "1" digits. Why? ASMB 6800 accepts binary numbers in both the %xx and xxb forms. Something like "1b" is ambiguous.
I had been initially tempted to limit the reference of local labels to relative branch instructions to prevent people writing FORTRANish code, but RELASMB does not have that restriction. And it is convenient to be able to do something like the following:
Code: Select all
ldx #2f ; Print error message
jsr PSTRNG
rts
2 fcc "Operand expected."
fcb 4
I am currently implementing local labels in my 6502 cross assembler. Should that go well, the capability will be migrated to the 6800 and 6809 assemblers. Then I will implement it in ASMB 6800; ASMB 6502 will inherit that functionality.