diff options
Diffstat (limited to 'subx')
-rw-r--r-- | subx/opcodes | 140 |
1 files changed, 74 insertions, 66 deletions
diff --git a/subx/opcodes b/subx/opcodes index 8d9ca2f6..77630208 100644 --- a/subx/opcodes +++ b/subx/opcodes @@ -1,66 +1,74 @@ -idle - 90/nop/xchg-eax-eax -copy - mov r/m32 r32: 89 - mov r32 r/m32: 8b - mov r/m32 imm32: c7 - memcpy - $copy_and_increment_refcounts destination, source, [type descriptor] - -add -subtract -multiply -divide -divide-with-remainder -square-root -shift-right -shift-left -not -flip-bits -or -or-bits -and -and-bits -xor-bits -equal -not-equal -lesser-than -lesser-or-equal -greater-than -greater-or-equal -round -truncate -max -min -random -jump -jump-if -jump-unless -call (dynamic) -return -next-ingredient -ingredient -rewind-ingredients -character-to-code -new _, _ -length -index -put-index -new _ -get -put -maybe-convert -trace -to-text -deep-copy -hash -wait-for-reset-then-set -reset -get-location -wait-for-routine -switch -current-routine-is-blocked -current-routine-is-unblocked -wait-for-routine-to-block -restart -limit-time +Opcodes currently supported by SubX: + 01: add r32 to rm32 + 03: add rm32 to r32 + 05: add imm32 to R0 (EAX) + 09: rm32 = bitwise OR of r32 with rm32 + 0b: r32 = bitwise OR of r32 with rm32 + 0d: R0 = bitwise OR of imm32 with R0 (EAX) + 21: rm32 = bitwise AND of r32 with rm32 + 23: r32 = bitwise AND of r32 with rm32 + 25: R0 = bitwise AND of imm32 with R0 (EAX) + 29: subtract r32 from rm32 + 2b: subtract rm32 from r32 + 2d: subtract imm32 from R0 (EAX) + 31: rm32 = bitwise XOR of r32 with rm32 + 33: r32 = bitwise XOR of r32 with rm32 + 35: R0 = bitwise XOR of imm32 with R0 (EAX) + 39: compare: set SF if rm32 < r32 + 3b: compare: set SF if r32 < rm32 + 3d: compare: set SF if R0 < imm32 + 50: push R0 (EAX) to stack + 51: push R1 (ECX) to stack + 52: push R2 (EDX) to stack + 53: push R3 (EBX) to stack + 54: push R4 (ESP) to stack + 55: push R5 (EBP) to stack + 56: push R6 (ESI) to stack + 57: push R7 (EDI) to stack + 58: pop top of stack to R0 (EAX) + 59: pop top of stack to R1 (ECX) + 5a: pop top of stack to R2 (EDX) + 5b: pop top of stack to R3 (EBX) + 5c: pop top of stack to R4 (ESP) + 5d: pop top of stack to R5 (EBP) + 5e: pop top of stack to R6 (ESI) + 5f: pop top of stack to R7 (EDI) + 68: push imm32 to stack + 74: jump disp8 bytes away if ZF is set + 75: jump disp8 bytes away if ZF is not set + 7c: jump disp8 bytes away if lesser (SF != OF) + 7d: jump disp8 bytes away if greater or equal (SF == OF) + 7e: jump disp8 bytes away if lesser or equal (ZF is set or SF != OF) + 7f: jump disp8 bytes away if greater (ZF is unset, SF == OF) + 81: combine rm32 with imm32 based on subop + 87: swap the contents of r32 and rm32 + 88: copy r8 (lowermost byte of r32) to r8/m8-at-r32 + 89: copy r32 to rm32 + 8a: copy r8/m8-at-r32 to r8 (lowermost byte of r32) + 8b: copy rm32 to r32 + 8f: pop top of stack to rm32 + b8: copy imm32 to R0 (EAX) + b9: copy imm32 to R1 (ECX) + ba: copy imm32 to R2 (EDX) + bb: copy imm32 to R3 (EBX) + bc: copy imm32 to R4 (ESP) + bd: copy imm32 to R5 (EBP) + be: copy imm32 to R6 (ESI) + bf: copy imm32 to R7 (EDI) + c3: return from most recent unfinished call + c7: copy imm32 to rm32 + cd: software interrupt + e8: call disp32 + e9: jump disp16 bytes away + eb: jump disp8 bytes away + f4: halt + f7: bitwise complement of rm32 + ff: jump/push/call rm32 based on subop + 0f 84: jump disp16 bytes away if ZF is set + 0f 85: jump disp16 bytes away if ZF is not set + 0f 8c: jump disp16 bytes away if lesser (SF != OF) + 0f 8d: jump disp16 bytes away if greater or equal (SF == OF) + 0f 8e: jump disp16 bytes away if lesser or equal (ZF is set or SF != OF) + 0f 8f: jump disp16 bytes away if greater (ZF is unset, SF == OF) + 0f af: multiply rm32 into r32 +Run `subx help instructions` for details on words like 'r32' and 'disp8'. |