-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from cdm-processors/fix-templates
Fix templates
- Loading branch information
Showing
5 changed files
with
60 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,3 +251,7 @@ class Handler: | |
'ldi': 0xD0 | ||
}) | ||
] | ||
|
||
@staticmethod | ||
def assembly_directives(): | ||
return {'ds', 'dc'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
asect 0 | ||
main: ext # Declare labels | ||
default_handler: ext # as external | ||
|
||
# Interrupt vector table (IVT) | ||
# Place a vector to program start and | ||
# map all internal exceptions to default_handler | ||
dc main, 0 # Startup/Reset vector | ||
dc default_handler, 0 # Unaligned SP | ||
dc default_handler, 0 # Unaligned PC | ||
dc default_handler, 0 # Invalid instruction | ||
dc default_handler, 0 # Double fault | ||
align 0x80 # Reserve space for the rest | ||
# of IVT | ||
|
||
# Exception handlers section | ||
rsect exc_handlers | ||
|
||
# This handler halts processor | ||
default_handler> | ||
halt | ||
|
||
# Templates | ||
tplate foo | ||
a: ds 7 | ||
b: dc "abcd" | ||
c: db 10 | ||
d: dw 20 | ||
e: ds 984 | ||
f: dc 30 | ||
|
||
|
||
# Main program section | ||
rsect main | ||
main> | ||
ldi r0, foo.a | ||
ldi r1, foo.b | ||
ldi r2, foo.c | ||
ldi r3, foo.d | ||
ldi r4, foo.e | ||
ldi r5, foo.f | ||
ldi r6, foo._ | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
registers: | ||
r0: 0 | ||
r1: 7 | ||
r2: 11 | ||
r3: 12 | ||
r4: 14 | ||
r5: 998 | ||
r6: 1000 |