diff options
-rw-r--r-- | subx/examples/ex12.subx | 4 | ||||
-rw-r--r-- | subx/examples/ex4.subx | 14 | ||||
-rw-r--r-- | subx/examples/ex6.subx | 12 | ||||
-rw-r--r-- | subx/examples/ex7.subx | 50 | ||||
-rw-r--r-- | subx/subx.vim | 3 | ||||
-rw-r--r-- | vimrc.vim | 3 |
6 files changed, 46 insertions, 40 deletions
diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx index b35c8c95..da752988 100644 --- a/subx/examples/ex12.subx +++ b/subx/examples/ex12.subx @@ -12,7 +12,7 @@ # 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 # syscall(mmap, 0x1000) - bb/copy-to-EBX mmap-new-segment/imm32 + bb/copy-to-EBX Mmap-new-segment/imm32 b8/copy-to-EAX 0x5a/imm32/mmap cd/syscall 0x80/imm8 @@ -26,7 +26,7 @@ == data # various constants used here were found in the Linux sources (search for file mman-common.h) -mmap-new-segment: # type mmap_arg_struct +Mmap-new-segment: # type mmap_arg_struct # addr 00 00 00 00 # null # len diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx index 6a9236eb..f053d3fe 100644 --- a/subx/examples/ex4.subx +++ b/subx/examples/ex4.subx @@ -5,22 +5,22 @@ # $ subx run examples/ex4 == code -# syscall(read, stdin, x, 1) +# syscall(read, stdin, X, 1) # fd = 0 (stdin) bb/copy-to-EBX 0/imm32 - # initialize x (location to write result to) -b9/copy-to-ECX x/imm32 + # initialize X (location to write result to) +b9/copy-to-ECX X/imm32 # size = 1 character ba/copy-to-EDX 1/imm32 # syscall b8/copy-to-EAX 3/imm32/read cd/syscall 0x80/imm8 -# syscall(write, stdout, x, 1) +# syscall(write, stdout, X, 1) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 - # initialize x (location to read from) -b9/copy-to-ECX x/imm32 + # initialize X (location to read from) +b9/copy-to-ECX X/imm32 # size = 1 character ba/copy-to-EDX 1/imm32 # syscall @@ -32,7 +32,7 @@ b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 == data -x: +X: 00 00 00 00 # space for read() to write to # vim:nowrap:textwidth=0 diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx index 2b8aa212..b96ee77f 100644 --- a/subx/examples/ex6.subx +++ b/subx/examples/ex6.subx @@ -10,13 +10,13 @@ # 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 - # syscall(write, stdout, x, size) + # syscall(write, stdout, X, size) # fd = 1 (stdout) bb/copy-to-EBX 1/imm32 - # initialize x (location to write result to) - b9/copy-to-ECX x/imm32 + # initialize X (location to write result to) + b9/copy-to-ECX X/imm32 # initialize size - 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 2/r32/EDX size/disp32 . # copy *size to EDX + 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 2/r32/EDX Size/disp32 . # copy *size to EDX # syscall b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 @@ -26,9 +26,9 @@ cd/syscall 0x80/imm8 == data -size: # size of string +Size: # size of string 0e 00 00 00 # 14 -x: # string to print +X: # string to print 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a 00 # H e l l o , ␣ w o r l d ! newline null diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx index 2cf65ab3..d678bb0b 100644 --- a/subx/examples/ex7.subx +++ b/subx/examples/ex7.subx @@ -15,89 +15,89 @@ # 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 - # syscall(creat, filename) - bb/copy-to-EBX filename/imm32 + # syscall(creat, Filename) + bb/copy-to-EBX Filename/imm32 b9/copy-to-ECX 0x180/imm32/fixed-perms b8/copy-to-EAX 8/imm32/creat cd/syscall 0x80/imm8 - # stream = syscall(open, filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte - bb/copy-to-EBX filename/imm32 + # stream = syscall(open, Filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte + bb/copy-to-EBX Filename/imm32 b9/copy-to-ECX 1/imm32/wronly ba/copy-to-EDX 0x180/imm32/fixed-perms b8/copy-to-EAX 5/imm32/open cd/syscall 0x80/imm8 # save stream - bb/copy-to-EBX stream/imm32 + bb/copy-to-EBX Stream/imm32 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX - # syscall(write, stream, "a", 1) + # syscall(write, Stream, "a", 1) # load stream - bb/copy-to-EBX stream/imm32 + bb/copy-to-EBX Stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX # - b9/copy-to-ECX a/imm32 + b9/copy-to-ECX A/imm32 ba/copy-to-EDX 1/imm32/size b8/copy-to-EAX 4/imm32/write cd/syscall 0x80/imm8 - # syscall(close, stream) + # syscall(close, Stream) # load stream - bb/copy-to-EBX stream/imm32 + bb/copy-to-EBX Stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX # b8/copy-to-EAX 6/imm32/close cd/syscall 0x80/imm8 - # stream = syscall(open, filename, O_RDONLY, 0) - bb/copy-to-EBX filename/imm32 + # stream = syscall(open, Filename, O_RDONLY, 0) + bb/copy-to-EBX Filename/imm32 b9/copy-to-ECX 0/imm32/rdonly ba/copy-to-EDX 0x180/imm32/fixed-perms b8/copy-to-EAX 5/imm32/open cd/syscall 0x80/imm8 - # save stream - bb/copy-to-EBX stream/imm32 + # save Stream + bb/copy-to-EBX Stream/imm32 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX - # syscall(read, stream, b, 1) + # syscall(read, Stream, B, 1) # load stream - bb/copy-to-EBX stream/imm32 + bb/copy-to-EBX Stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX # - b9/copy-to-ECX b/imm32 + b9/copy-to-ECX B/imm32 ba/copy-to-EDX 1/imm32/size b8/copy-to-EAX 3/imm32/read cd/syscall 0x80/imm8 - # syscall(close, stream) + # syscall(close, Stream) # load stream - bb/copy-to-EBX stream/imm32 + bb/copy-to-EBX Stream/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX # b8/copy-to-EAX 6/imm32/close cd/syscall 0x80/imm8 # syscall(unlink, filename) - bb/copy-to-EBX filename/imm32 + bb/copy-to-EBX Filename/imm32 b8/copy-to-EAX 0xa/imm32/unlink cd/syscall 0x80/imm8 # syscall(exit, b) # load b - bb/copy-to-EBX b/imm32 + bb/copy-to-EBX B/imm32 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX # b8/copy-to-EAX 1/imm32/exit cd/syscall 0x80/imm8 == data -stream: +Stream: 00 00 00 00 -a: +A: 61 00 00 00 -b: +B: 00 00 00 00 -filename: +Filename: 2e 66 6f 6f 00 00 00 00 # vim:nowrap:textwidth=0 diff --git a/subx/subx.vim b/subx/subx.vim index 89d06049..0bdeba80 100644 --- a/subx/subx.vim +++ b/subx/subx.vim @@ -27,4 +27,7 @@ let b:cmt_head = "#? " " comment token syntax match subxDelimiter / \. / | highlight link subxDelimiter Delimiter +syntax match subxString %"[^"]*"% | highlight link subxString Constant +syntax match subxGlobal %\<[A-Z][a-z-]*\>% | highlight link subxGlobal SpecialChar + let &cpo = s:save_cpo diff --git a/vimrc.vim b/vimrc.vim index 030eaddc..87bb6d8c 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -39,6 +39,9 @@ function! HighlightTangledFile() syntax match muScenario "^scenario\>" | highlight muScenario ctermfg=34 syntax match muPendingScenario "^pending-scenario\>" | highlight link muPendingScenario SpecialChar syntax match muData "^type\>\|^container\>\|^exclusive-container\>" | highlight muData ctermfg=226 + + syntax match subxString %"[^"]*"% | highlight link subxString Constant + syntax match subxGlobal %\<[A-Z][a-z-]*\>% | highlight link subxGlobal SpecialChar endfunction augroup LocalVimrc autocmd BufRead,BufNewFile *.mu set ft=mu |