parse very simplistic comments in assembler

master
Drake 1 year ago
parent 9ac52951aa
commit df97dec431

@ -1,52 +1,79 @@
LOL 1c 011f
LOL 03 0120
LOL 00 0121
LOL 01 0119
/* start VariableDeclaration */
LOL 62 011f
LOL 65 0120
LOL 6e 0121
LOL 64 0122
LOL 79 0123
LOL 2e 0124
LOL 70 0125
LOL 6e 0126
LOL 67 0127
/* end VariableDeclaration */
/* start BlockStatement */
/* start VariableDeclaration */
LOL 62 0128
LOL 65 0129
LOL 6e 012a
LOL 64 012b
LOL 79 012c
LOL 2e 012d
LOL 6a 012e
LOL 70 012f
LOL 67 0130
/* end VariableDeclaration */
/* start ExpressionStatement */
LOL 00 0118
LOL 01 0117
LOA 011f 0118
LOA 0120 0118
LOA 0121 0118
LOA 0122 0118
LOA 0123 0118
LOA 0124 0118
LOA 0125 0118
LOA 0126 0118
LOA 0127 0118
LOL 00 0117
LOL 00 0119
LOL 00 0118
LOL 2f 0122
LOL 00 0118
LOL 01 0116
LOL 01 0117
LOA 0122 0118
LOL 00 0116
LOL 00 0117
LOL 00 0119
LOL 00 0118
LOL 01 0119
/* end ExpressionStatement */
/* start ExpressionStatement */
LOL 00 0118
LOL 01 0117
LOA 0120 0118
LOA 0128 0118
LOA 0129 0118
LOA 012a 0118
LOA 012b 0118
LOA 012c 0118
LOA 012d 0118
LOA 012e 0118
LOA 012f 0118
LOA 0130 0118
LOL 00 0117
LOL 00 0119
LOL 00 0118
LOL 20 0123
LOL 7e 0124
LOL 3d 0125
LOL 20 0126
LOL 01 0116
LOL 01 0117
LOL 00 0116
LOL 00 0117
/* end ExpressionStatement */
/* end BlockStatement */
/* start ExpressionStatement */
LOL 00 0118
LOL 01 0117
LOA 011f 0118
LOA 0120 0118
LOA 0121 0118
LOA 0122 0118
LOA 0123 0118
LOA 0124 0118
LOA 0125 0118
LOA 0126 0118
LOL 00 0117
LOL 00 0119
LOL 00 0118
LOL 00 00F2
JML 00b6
SAA 011f 0120
STA 011f
LOL 01 00F0
AAA 0121 00F0
STA 0121
JGT 00a2 011f 00f2
LOL 01 0119
LOL 00 0118
LOL 01 0117
LOA 0121 0118
LOA 0127 0118
LOL 00 0117
LOL 00 0119
LOL 00 0118
@ -54,4 +81,5 @@ LOL 01 0116
LOL 01 0117
LOL 00 0116
LOL 00 0117
/* end ExpressionStatement */
HLT

Binary file not shown.

@ -11,8 +11,15 @@ def writeHex(str):
outhex += str
count = 1
comment = False
for i in re.split("\n| ",code):
if comment:
if i == "*/":
comment = False
continue
match i:
case "/*":
comment = True
case "NOP":
writeHex("00")
case "INC":

Loading…
Cancel
Save