summaryrefslogtreecommitdiff
path: root/programs
diff options
context:
space:
mode:
Diffstat (limited to 'programs')
-rw-r--r--programs/sub-suite/declare.s81
-rw-r--r--programs/sub-suite/subasm.s4
-rw-r--r--programs/sub-suite/subeditor.s8
3 files changed, 80 insertions, 13 deletions
diff --git a/programs/sub-suite/declare.s b/programs/sub-suite/declare.s
index 166197b..cd97b60 100644
--- a/programs/sub-suite/declare.s
+++ b/programs/sub-suite/declare.s
@@ -1,4 +1,70 @@
+; Structs, and unions.
+
+; Line struct.
+.struct ln
+ next .qword ; Pointer to next line.
+ tok .qword ; The tokens for this line.
+
+ bline .word ; Number of blank lines.
+ lnum .dword ; Line number.
+
+ addr .qword ; The address of this line.
+.endstruct
+
+; Token struct.
+.struct tok
+ ;ptype .byte ; Pointer type, 0 for token, -1 for end of token.
+ next .qword ; Pointer to next token.
+ id .byte ; Token ID.
+ type .byte ; Token type ID.
+
+ tabs .byte ; Number of tabs.
+ spaces .byte ; Number of spaces.
+ stab .byte ; Number of sub-token tabs.
+ sspace .byte ; Number of sub-token spaces.
+ digits .byte ; Number of digits.
+
+ .union ; Token value.
+ sym .qword ; Symbol.
+ str .qword ; String.
+ val .qword ; Value.
+ .endunion
+.endstruct
+
+; Fixup struct.
+.struct fix
+ next .qword ; Pointer to next fixup.
+
+ s .qword ; Unresolved symbol.
+ t .qword ; Token that used the unresolved symbol.
+
+ addr .qword ; Address of where it happened.
+.endstruct
+
+; Symbol struct.
+.struct sym
+ next .qword ; Pointer to next symbol.
+ prev .qword ; Pointer to previous symbol.
+ down .qword ; Pointer to child symbol.
+ up .qword ; Pointer to parent symbol.
+
+ val .qword ; Value of symbol.
+
+ strct .byte ; Flag that says this symbol is a struct, or union.
+ def .byte ; Flag that says this symbol has been defined.
+
+ name .qword ; Name of symbol.
+ id .word ; ID of symbol.
+.endstruct
+
+; Instruction struct.
+.struct instr
+ am .word ; Addressing modes.
+ op .byte ; Base value used to get the actual opcode.
+.endstruct
+
+
; Enums.
; I/O constants.
@@ -95,6 +161,7 @@ INDX2 = 1 << 11 ; Special case of INDX that uses the indirect table.
ZM2 = 1 << 12 ; Special case of Zero Matrix used by JMP, and JSR.
+
; RAM declarations.
; Linewrap table.
@@ -257,22 +324,22 @@ lexeme:
.res $100
; Symbol table.
-sym:
+symbol:
.res $8000
; Fixup table.
; Fixups are unresolved symbols.
-fix:
+fixup:
.res $2000
; ROM data declarations.
.org $A000
; String Literals/Constants.
-tok:
- .byte "dab"
-msg:
- .byte "oof, you divided a, and b on me.\n"
+;tok:
+; .byte "dab"
+;msg:
+; .byte "oof, you divided a, and b on me.\n"
ed_name:
.byte "SuBEditor"
@@ -714,7 +781,7 @@ cmd_srt:
.word list
.word asm
.word help
- .word inst
+ .word ins
.word run
.word set
diff --git a/programs/sub-suite/subasm.s b/programs/sub-suite/subasm.s
index ec58a40..3957caa 100644
--- a/programs/sub-suite/subasm.s
+++ b/programs/sub-suite/subasm.s
@@ -161,10 +161,10 @@ help:
nop ;
@end:
rts ; End of help.
-inst:
+ins:
nop ;
@end:
- rts ; End of inst.
+ rts ; End of ins.
run:
nop ;
@end:
diff --git a/programs/sub-suite/subeditor.s b/programs/sub-suite/subeditor.s
index aec613e..fdf1e4b 100644
--- a/programs/sub-suite/subeditor.s
+++ b/programs/sub-suite/subeditor.s
@@ -91,10 +91,10 @@ read:
bra read ; Keep looping.
parse:
- lda #0 ;
- tax ;
- jsr subasm ;
- bra start ;
+ and #0 ; Reset A.
+ tax ; Reset X.
+ jsr subasm ; Call SuBAsm, and start parsing this line.
+ bra start ; Go back to reading the keyboard.
getchar: