-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a098c59
commit e4c289a
Showing
5 changed files
with
94 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// Adds two 16-bit integers | ||
@macro add16 (%h0:reg, %l0:reg, %h1:reg|imm, %l1:reg|imm) { | ||
add %l0, %l1 | ||
adc %h0, %h1 | ||
} | ||
|
||
/// Subtracts two 16-bit integers | ||
@macro sub16 (%h0:reg, %l0:reg, %h1:reg|imm, %l1:reg|imm) { | ||
sub %l0, %l1 | ||
sbc %h0, %h1 | ||
} | ||
|
||
/// Increments the given byte | ||
@macro inc (%reg:reg) { | ||
add %reg, 1 | ||
} | ||
|
||
/// Decrements the given byte | ||
@macro dec (%reg:reg) { | ||
sub %reg, 1 | ||
} | ||
|
||
/// Bitwise inverts the given byte | ||
@macro not (%reg:reg) { | ||
nand %reg, %reg | ||
} |
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@macro push { | ||
; push two registers | ||
(%r0:reg, %r1:reg) { | ||
push %r0 | ||
push %r1 | ||
} | ||
; push three registers | ||
(%r0:reg, %r1:reg, %r2:reg) { | ||
push %r0 | ||
push %r1, %r2 | ||
} | ||
; push four registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg) { | ||
push %r0 | ||
push %r1, %r2, %r3 | ||
} | ||
; push five registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg, %r4:reg) { | ||
push %r0 | ||
push %r1, %r2, %r3, %r4 | ||
} | ||
; push six registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg, %r4:reg, %r5:reg) { | ||
push %r0 | ||
push %r1, %r2, %r3, %r4, %r5 | ||
} | ||
} | ||
|
||
@macro pop { | ||
; pop two registers | ||
(%r0:reg, %r1:reg) { | ||
pop %r0 | ||
pop %r1 | ||
} | ||
; pop three registers | ||
(%r0:reg, %r1:reg, %r2:reg) { | ||
pop %r0 | ||
pop %r1, %r2 | ||
} | ||
; pop four registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg) { | ||
pop %r0 | ||
pop %r1, %r2, %r3 | ||
} | ||
; pop five registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg, %r4:reg) { | ||
pop %r0 | ||
pop %r1, %r2, %r3, %r4 | ||
} | ||
; pop six registers | ||
(%r0:reg, %r1:reg, %r2:reg, %r3:reg, %r4:reg, %r5:reg) { | ||
pop %r0 | ||
pop %r1, %r2, %r3, %r4, %r5 | ||
} | ||
} | ||
|
||
@macro pusha () { | ||
push A, B, C, D, E, F | ||
} | ||
|
||
@macro popa () { | ||
pop F, E, D, C, B, A | ||
} |
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