aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtclasm.tcl29
1 files changed, 21 insertions, 8 deletions
diff --git a/tclasm.tcl b/tclasm.tcl
index 8c89eeb..d326c00 100755
--- a/tclasm.tcl
+++ b/tclasm.tcl
@@ -214,6 +214,11 @@ proc _jump {{im_modification im=im} {cond non-cond} {swap_regs no_swap}} {
puts 01$cond$swap_regs[__encode_immediate $im_modification]
}
+# example: _cond_jump im=h16A swap
+proc _cond_jump {{im_modification im=im} {swap_regs no_swap}} {
+ _jump $im_modification cond $swap_regs
+}
+
# example: _extended_instruction nop swap # it's really no longer a true nop...
# _extended_instruction halt
proc _extended_instruction {instruction {swap_regs no_swap}} {
@@ -281,16 +286,24 @@ proc load {{im_modification im=im}} {
_load r1 @im $im_modification
}
-# example: jump im=h1dd
-# jump # im=im is the default if not specified
-proc jump {{im_modification im=im}} {
- _jump $im_modification non-cond
+# example: jump # if no address is given - im is used
+# jump h4FFFE
+proc jump {{address im_address}} {
+ if {"$address" == "im_address"} {
+ _jump im=im
+ } else {
+ _const _jump $address
+ }
}
-# example: cond_jump im=h00FE
-# cond_jump # im=im is the default if not specified
-proc cond_jump {{im_modification im=im}} {
- _jump $im_modification cond
+# example: cond_jump
+# cond_jump b100100110100111101 # same semantics as 'jump'
+proc cond_jump {{address im_address}} {
+ if {"$address" == "im_address"} {
+ _jump im=im cond
+ } else {
+ _const _cond_jump $address
+ }
}
foreach instruction {halt nop swap add sub div mul} {