diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-07-25 16:40:00 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-07-25 16:40:00 -0700 |
commit | 3d3cb2a166b54e0ce990e420c64f9c37a88f0d7e (patch) | |
tree | bb5dd17dbd79602a322f668222f1aea0e1b5f364 | |
parent | b22e5e144787370ea5d0a715e6979d2b987d4295 (diff) | |
download | mu-3d3cb2a166b54e0ce990e420c64f9c37a88f0d7e.tar.gz |
4409
Word-wrap online help. Fixes #8.
-rw-r--r-- | subx/001help.cc | 10 | ||||
-rw-r--r-- | subx/010vm.cc | 12 | ||||
-rw-r--r-- | subx/011parse.cc | 34 |
3 files changed, 41 insertions, 15 deletions
diff --git a/subx/001help.cc b/subx/001help.cc index 4a98a4b6..c5b16a39 100644 --- a/subx/001help.cc +++ b/subx/001help.cc @@ -47,15 +47,19 @@ init_help(); void init_help() { put(Help, "usage", "Welcome to SubX, a better way to program in machine code.\n" - "SubX uses a subset of the x86 instruction set. SubX programs will run without modification on Linux computers.\n" - "It provides a better experience and better error messages than programming directly in machine code, but you have to stick to the instructions it supports.\n" + "SubX uses a subset of the x86 instruction set. SubX programs will run\n" + "without modification on Linux computers.\n" + "It provides a better experience and better error messages than\n" + "programming directly in machine code, but you have to stick to the\n" + "instructions it supports.\n" "\n" "== Ways to invoke subx\n" "- Run tests:\n" " subx test\n" "- See this message:\n" " subx --help\n" - "- Convert a textual SubX program into a standard ELF binary that you can run on your computer:\n" + "- Convert a textual SubX program into a standard ELF binary that you can\n" + " run on your computer:\n" " subx translate <input 'source' file> <output ELF binary>\n" "- Run a SubX binary using SubX itself (for better error messages):\n" " subx run <ELF binary>\n" diff --git a/subx/010vm.cc b/subx/010vm.cc index d2f39e90..4d13f27d 100644 --- a/subx/010vm.cc +++ b/subx/010vm.cc @@ -37,12 +37,18 @@ cerr << " registers\n"; put(Help, "registers", "SubX currently supports eight 32-bit integer registers: R0 to R7.\n" "R4 (ESP) contains the top of the stack.\n" - "There's also a register for the address of the currently executing instruction. It is modified by jumps.\n" - "Various instructions modify one or more of three 1-bit 'flag' registers, as a side-effect:\n" - "- the sign flag (SF): usually set if an arithmetic result is negative, or reset if not.\n" + "\n" + "There's also a register for the address of the currently executing\n" + "instruction. It is modified by jumps.\n" + "\n" + "Various instructions modify one or more of three 1-bit 'flag' registers,\n" + "as a side-effect:\n" + "- the sign flag (SF): usually set if an arithmetic result is negative, or\n" + " reset if not.\n" "- the zero flag (ZF): usually set if a result is zero, or reset if not.\n" "- the overflow flag (OF): usually set if an arithmetic result overflows.\n" "The flag bits are read by conditional jumps.\n" + "\n" "We don't support non-integer (floating-point) registers yet.\n" ); diff --git a/subx/011parse.cc b/subx/011parse.cc index 3874e72f..639299df 100644 --- a/subx/011parse.cc +++ b/subx/011parse.cc @@ -3,18 +3,34 @@ :(before "End Help Texts") put(Help, "syntax", "SubX programs consist of segments, each segment in turn consisting of lines.\n" - "Line-endings are significant; each line should contain a single instruction, macro or directive.\n" - "Comments start with the '#' character. It should be at the start of a word (start of line, or following a space).\n" - "Each segment starts with a header line: a '==' delimiter followed by the starting address for the segment.\n" - "The starting address for a segment has some finicky requirements. But just start with a round number, and `subx` will try to guide you to a valid configuration.\n" - "A good rule of thumb is to try to start the first segment at the default address of 0x08048000, and to start each subsequent segment at least 0x1000 (most common page size) bytes after the last.\n" - "If a segment occupies than 0x1000 bytes you'll need to push subsequent segments further down.\n" - "Currently only the first segment contains executable code (because it gets annoying to have to change addresses in later segments every time an earlier one changes length; one of those finicky requirements).\n" + "Line-endings are significant; each line should contain a single\n" + "instruction, macro or directive.\n" "\n" - "Lines consist of a series of words. Words can contain arbitrary metadata after a '/', but they can never contain whitespace. Metadata has no effect at runtime, but can be handy when rewriting macros.\n" + "Comments start with the '#' character. It should be at the start of a word\n" + "(start of line, or following a space).\n" + "\n" + "Each segment starts with a header line: a '==' delimiter followed by the\n" + "starting address for the segment.\n" + "\n" + "The starting address for a segment has some finicky requirements. But just\n" + "start with a round number, and `subx` will try to guide you to a valid\n" + "configuration.\n" + "A good rule of thumb is to try to start the first segment at the default\n" + "address of 0x08048000, and to start each subsequent segment at least 0x1000\n" + "(most common page size) bytes after the last.\n" + "If a segment occupies than 0x1000 bytes you'll need to push subsequent\n" + "segments further down.\n" + "Currently only the first segment contains executable code (because it gets\n" + "annoying to have to change addresses in later segments every time an earlier\n" + "one changes length; one of those finicky requirements).\n" + "\n" + "Lines consist of a series of words. Words can contain arbitrary metadata\n" + "after a '/', but they can never contain whitespace. Metadata has no effect\n" + "at runtime, but can be handy when rewriting macros.\n" "\n" "Check out some examples in this directory (ex*.subx)\n" - "Programming in machine code can be annoying, but let's see if we can make it nice enough to be able to write a compiler in it.\n" + "Programming in machine code can be annoying, but let's see if we can make\n" + "it nice enough to be able to write a compiler in it.\n" ); :(before "End Help Contents") cerr << " syntax\n"; |