# new data structure: a slice is an open interval of addresses [start, end) # that includes 'start' but not 'end' == 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 slice-empty?: # s: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 51/push-ecx # ecx = s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx # if (s->start >= s->end) return true # . eax = s->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax # . if (eax >= s->end) return true 3b/compare 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # compare eax with *(ecx+4) b8/copy-to-eax 1/imm32/true 73/jump-if-addr>= $slice-empty?:end/disp8 b8/copy-to-eax 0/imm32/false $slice-empty?:end: # . restore registers 59/pop-to-ecx # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp c3/return test-slice-empty-true: # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # var slice/ecx: slice = {34, 34} 68/push 34/imm32/end 68/push 34/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # slice-empty?(slice) # . . push args 51/push-ecx # . . call e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # check-ints-equal(eax, 1, msg) # . . push args 68/push "F - test-slice-empty-true"/imm32 68/push 1/imm32 50/push-eax # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp c3/return test-slice-empty-false: # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # var slice/ecx: slice = {32, 34} 68/push 34/imm32/end 68/push 32/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # slice-empty?(slice) # . . push args 51/push-ecx # . . call e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # check-ints-equal(eax, 0, msg) # . . push args 68/push "F - test-slice-empty-false"/imm32 68/push 0/imm32 50/push-eax # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp c3/return test-slice-empty-if-start-greater-than-end: # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # var slice/ecx: slice = {34, 32} 68/push 32/imm32/end 68/push 34/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # slice-empty?(slice) # . . push args 51/push-ecx # . . call e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # check-ints-equal(eax, 1, msg) # . . push args 68/push "F - test-slice-empty-if-start-greater-than-end"/imm32 68/push 1/imm32 50/push-eax # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp c3/return slice-equal?: # s: (addr slice), p: (addr array byte) -> result/eax: boolean # pseudocode: # if (p == 0) return (s == 0) # currs = s->start # maxs = s->end # if (maxs - currs != p->size) return false # currp = p->data # while currs < maxs # if (*currs != *currp) return false # ++currs # ++currp # return true # # registers: # currs: edx # maxs: esi # currp: ebx # *currs: eax # *currp: ecx # # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 51/push-ecx 52/push-edx 53/push-ebx 56/push-esi # esi = s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi # var currs/edx: (addr byte) = s->start 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx # var maxs/esi: (addr byte) = s->end 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi # var ssize/eax: int = maxs - currs 89/copy 3/mod/direct 0/rm32/eax . . . 6/r32/esi . . # copy esi to eax 29/subtract 3/mod/direct 0/rm32/eax . . . 2/r32/edx . . # subtract edx from eax # ebx = p 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 . # copy *(ebp+12) to ebx # if (p != 0) goto next check 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32 # compare ebx
# Binds are of the form <key sequence> = <command to run>
# To use '=' in a key sequence, substitute it with "Eq": "<Ctrl+Eq>"
# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit
q = :quit<Enter>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>
<C-t> = :term<Enter>
[messages]
j = :next-message<Enter>
<Down> = :next-message<Enter>
<C-d> = :next-message 50%<Enter>
<C-f> = :next-message 100%<Enter>
<PgDn> = :next-message -s 100%<Enter>
k = :prev-message<Enter>
<Up> = :prev-message<Enter>
<C-u> = :prev-message 50%<Enter>
<C-b> = :prev-message 100%<Enter>
<PgUp> = :prev-message -s 100%<Enter>
g = :select-message 0<Enter>
G = :select-message -1<Enter>
J = :next-folder<Enter>
K = :prev-folder<Enter>
<Enter> = :view-message<Enter>
d = :confirm 'Really delete this message?' ':delete-message<Enter>'<Enter>
D = :delete-message<Enter>
c = :cf<space>
$ = :term<space>
| = :pipe<space>
[view]
q = :close<Enter>
| = :pipe<space>
r = :reply<Enter>
a = :reply -a<Enter>
f = :forward<Enter>
[terminal]
$noinherit = true
$ex = <semicolon>
<C-p> = :prev-tab<Enter>
<C-n> = :next-tab<Enter>