diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-03-06 17:41:36 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-03-06 17:42:17 -0800 |
commit | 5c26afb1de61dc650f0f7523c92143747c960432 (patch) | |
tree | 22c00a6ba562cbd80e2432201399ee800c5247da /apps/ex13.subx | |
parent | 0743b981a823049bfe0a24f9204e629ce375af39 (diff) | |
download | mu-5c26afb1de61dc650f0f7523c92143747c960432.tar.gz |
6088 - start using setCC instructions
Diffstat (limited to 'apps/ex13.subx')
-rw-r--r-- | apps/ex13.subx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/ex13.subx b/apps/ex13.subx new file mode 100644 index 00000000..9e407f32 --- /dev/null +++ b/apps/ex13.subx @@ -0,0 +1,25 @@ +# Compare 3 and 3. +# +# To run: +# $ ./subx translate init.linux examples/ex13.subx -o examples/ex13 +# $ ./subx run examples/ex13 +# Expected result: +# $ echo $? +# 1 + +== code +# instruction effective address register displacement immediate +# . op subop mod rm32 base index scale r32 +# . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes + +Entry: + b8/copy-to-eax 3/imm32 + 3d/compare-eax-and 3/imm32 + 0f 94/set-if-= 3/mod/direct 3/rm32/ebx . . . . . . # set ebx to ZF + 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 0xff/imm32 # AND eax with 0xff + +$exit: + # exit(ebx) + e8/call syscall_exit/disp32 + +# . . vim:nowrap:textwidth=0 |