Compare commits
4 Commits
3e75753b1b
...
d802ca3e07
| Author | SHA1 | Date |
|---|---|---|
|
|
d802ca3e07 | |
|
|
6c00f2b5da | |
|
|
385202985f | |
|
|
3bb4aa0060 |
|
|
@ -550,8 +550,7 @@ generated machine code which can directly be executed by the emulator.
|
|||
|
||||
### Emulator
|
||||
|
||||
The second part of the tool kit is the assembler. Included with the assembler is
|
||||
a simple linker.
|
||||
The third part of the tool kit is the emulator.
|
||||
|
||||
Running the following command we can get the arguments for the
|
||||
compiler `python -m pytd12dk em -h`:
|
||||
|
|
|
|||
|
|
@ -192,6 +192,8 @@ fn test_func2() -> Point {
|
|||
test += 15;
|
||||
}
|
||||
|
||||
let length: int = 10;
|
||||
|
||||
for (i: int = 0; i < length; i++)
|
||||
$(inData + i) ^= $(pass + ((i + offset) % pLength));
|
||||
|
||||
|
|
@ -204,6 +206,8 @@ fn test_func2() -> Point {
|
|||
$(inData + i) ^= $(pass + ((i + offset) % pLength));
|
||||
}
|
||||
|
||||
let i: int;
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
$(inData + i) ^= $(pass + ((i + offset) % pLength));
|
||||
} else {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -572,6 +572,9 @@ class FunctionArgument:
|
|||
@property
|
||||
def identifier(self) -> Identifier | None: return self._identifier
|
||||
|
||||
@property
|
||||
def value(self) -> Expression: return self._value
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Function Argument\n"
|
||||
if self._identifier: s += f"{pre_cont}├─ Name: {self._identifier}\n"
|
||||
|
|
@ -601,6 +604,9 @@ class FunctionCall:
|
|||
@property
|
||||
def identifier(self) -> Identifier: return self._identifier
|
||||
|
||||
@property
|
||||
def args(self) -> list[FunctionArgument]: return self._args[:]
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Function Call: {self._identifier}\n"
|
||||
if self._args:
|
||||
|
|
@ -823,6 +829,9 @@ class ElseBlock:
|
|||
@property
|
||||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
@property
|
||||
def code(self) -> list[Statement]: return self._code[:]
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Else Block\n"
|
||||
if self._code:
|
||||
|
|
@ -876,6 +885,12 @@ class ForPreDef:
|
|||
@property
|
||||
def identifier(self) -> Identifier: return self._identifier
|
||||
|
||||
@property
|
||||
def data_type(self) -> DataType: return self._type
|
||||
|
||||
@property
|
||||
def pointer(self) -> bool: return self._pointer
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} For Loop Pre-Definition: {self._identifier}\n"
|
||||
if self._assignment: s += f"{pre_cont}├─ Type: "
|
||||
|
|
@ -914,6 +929,22 @@ class ForBlock:
|
|||
@property
|
||||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
@property
|
||||
def pre_statement(self) -> Expression | ForPreDef:
|
||||
return self._pre_statement
|
||||
|
||||
@property
|
||||
def condition(self) -> Expression: return self._condition
|
||||
|
||||
@property
|
||||
def code(self) -> list[Statement]: return self._code[:]
|
||||
|
||||
@property
|
||||
def post_statement(self) -> Expression: return self._post_statement
|
||||
|
||||
@property
|
||||
def else_block(self) -> ElseBlock | None: return self._else
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} For Loop\n"
|
||||
if self._code or self._else is not None:
|
||||
|
|
@ -1026,6 +1057,15 @@ class WhileBlock:
|
|||
@property
|
||||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
@property
|
||||
def condition(self) -> Expression: return self._condition
|
||||
|
||||
@property
|
||||
def code(self) -> list[Statement]: return self._code[:]
|
||||
|
||||
@property
|
||||
def else_block(self) -> ElseBlock | None: return self._else
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} While Loop\n"
|
||||
if self._code or self._else is not None:
|
||||
|
|
@ -1097,6 +1137,20 @@ class DoBlock:
|
|||
@property
|
||||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
@property
|
||||
def condition(self) -> Expression: return self._condition
|
||||
|
||||
@property
|
||||
def first_code(self) -> list[Statement]: return self._first_code[:]
|
||||
|
||||
@property
|
||||
def second_code(self) -> list[Statement] | None:
|
||||
if self._second_code is None: return None
|
||||
else: return self._second_code[:]
|
||||
|
||||
@property
|
||||
def else_block(self) -> ElseBlock | None: return self._else
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} Do Loop\n"
|
||||
if self._first_code:
|
||||
|
|
@ -1184,6 +1238,15 @@ class IfBlock:
|
|||
@property
|
||||
def file_info(self) -> FileInfo: return self._file_info
|
||||
|
||||
@property
|
||||
def condition(self) -> Expression: return self._condition
|
||||
|
||||
@property
|
||||
def code(self) -> list[Statement]: return self._code[:]
|
||||
|
||||
@property
|
||||
def else_block(self) -> ElseBlock | None: return self._else
|
||||
|
||||
def tree_str(self, pre: str = "", pre_cont: str = "") -> str:
|
||||
s: str = f"{pre} If Statement\n"
|
||||
if self._code or self._else is not None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue