about summary refs log tree commit diff stats
path: root/subx
Commit message (Collapse)AuthorAgeFilesLines
* 4579Kartik Agaram2018-09-212-0/+67
| | | | | | | | | | | | New example program: ascii null-terminated string comparison I'd hoped this would be a stepping stone to supporting general ascii comparison, but we're planning to use size-prefixed rather than null-terminated arrays everywhere. The only exception is commandline arguments, which will remain null-terminated to interoperate with Linux. So I'm going to need separate functions for "compare with argv" and for general string comparison.
* 4578 - subx: implement inc/dec operationsKartik Agaram2018-09-214-18/+162
|
* 4577Kartik Agaram2018-09-211-1/+1
|
* 4576Kartik Agaram2018-09-213-11/+11
|
* 4575Kartik Agaram2018-09-212-0/+49
| | | | | | | | New example, just to fix in my head how arguments go on the stack. It's possible I'm still confused about the order callers push args in to the stack. But even if this violates the calling convention, it should still run.
* 4574Kartik Agaram2018-09-211-1/+1
|
* 4573Kartik Agaram2018-09-211-1/+1
|
* 4572Kartik Agaram2018-09-211-1/+3
|
* 4571Kartik Agaram2018-09-211-66/+74
|
* 4569Kartik Agaram2018-09-211-2/+2
|
* 4568Kartik Agaram2018-09-211-2/+7
| | | | Get the 'edit' script working again with the 'EE' command in Vim.
* 4567 - support automated tests in SubXKartik Agaram2018-09-213-11/+179
| | | | | | | | | All it takes is to code-generate a simple function called 'run_tests' that calls all functions starting with 'test_' one by one. I've temporarily switched the factorial app to run as a test. But that's temporary, because all the code to print '.' vs 'F' needs to get extracted out into a helper.
* 4566Kartik Agaram2018-09-211-2/+2
| | | | | Neither jump nor call instructions support immediates. Drop that. The only form of absolute addressing relies on rm32.
* 4565Kartik Agaram2018-09-213-3/+22
|
* 4564Kartik Agaram2018-09-202-5/+5
|
* 4563Kartik Agaram2018-09-201-0/+15
|
* 4562Kartik Agaram2018-09-203-8/+8
|
* 4561Kartik Agaram2018-09-205-51/+51
|
* 4560Kartik Agaram2018-09-202-0/+3
|
* 4559Kartik Agaram2018-09-202-0/+16
|
* 4558Kartik Agaram2018-09-201-1/+1
|
* 4557Kartik Agaram2018-09-202-4/+17
|
* 4556Kartik Agaram2018-09-202-10/+58
|
* 4555Kartik Agaram2018-09-202-3/+2
|
* 4554Kartik Agaram2018-09-202-2/+2
|
* 4553Kartik Agaram2018-09-202-0/+55
| | | | Start of a new example program.
* 4552Kartik Agaram2018-09-201-6/+13
| | | | | More useful trace if we mess up args to a syscall and pass a non-pointer where a pointer is expected.
* 4551Kartik Agaram2018-09-201-0/+1
| | | | | | | | Running reset() doesn't seem necessary so far for the translate sub-command, but it's likely to expose us to weird bugs. Immediately, it requires toggling `Dump_trace` in different places to print traces while translating vs while running.
* 4550Kartik Agaram2018-09-202-1/+19
|
* 4548: start of a compiler for a new experimental low-level languageKartik Agaram2018-09-177-0/+148
|
* 4547Kartik Agaram2018-09-163-3/+3
|
* 4545Kartik Agaram2018-09-151-34/+0
| | | | Stale file since 4523.
* 4544Kartik Agaram2018-09-126-55/+96
| | | | | | | | Attempt #3 at fixing CI. In the process the feature gets a lot less half-baked. Ridiculously misleading that we had `has_metadata()` was special-cased to one specific transform. I suck.
* 4543Kartik Agaram2018-09-121-6/+31
| | | | | | | Really fix CI. Also realized we don't need to worry about function pointers. They won't be in /disp32 fields.
* 4542Kartik Agaram2018-09-121-2/+2
| | | | Fix CI (`subx translate examples/ex6.subx examples/ex6`)
* 4541Kartik Agaram2018-09-112-3/+2
|
* 4540Kartik Agaram2018-09-111-2/+2
|
* 4538Kartik Agaram2018-09-075-16/+16
|
* 4537Kartik Agaram2018-09-077-41/+97
| | | | | | | | | | | | | | | Streamline the factorial function; we don't need to save a stack variable into a register before operating on it. All instructions can take a stack variable directly. In the process we found two bugs: a) Opcode f7 was not implemented correctly. It was internally consistent but I'd never validated it against a natively running program. Turns out it encodes multiple instructions, not just 'not'. b) The way we look up imm32 operands was sometimes reading them before disp8/disp32 operands.
* 4535 - support for global variable namesKartik Agaram2018-09-017-77/+203
|
* 4534Kartik Agaram2018-09-011-0/+0
| | | | | | | | | | | | | | | I'd been planning to add segment address computation after all labels were computed, including labels in the data segment (which isn't built yet). But now I realize that won't work, because labels in the data segment will require segment start addresses. We need to deal in absolute addresses rather than relative offsets as with the jump instructions that use code labels. Layer 34 is now broken by this change in a way that isn't obvious right now: it is oblivious to imm32 and disp32 operand tags that are now going to be present in the programs it sees. It's a lucky accident that everything still works, because we're only using segment names right now for the very first (code) segment in a program.
* 4533Kartik Agaram2018-09-012-0/+3
|
* 4532Kartik Agaram2018-09-012-28/+36
| | | | Make segment names a separate transform.
* 4531 - automatically compute segment addressesKartik Agaram2018-09-0114-61/+83
|
* 4530 - create an apps/ directoryKartik Agaram2018-09-0111-205/+217
|
* 4529 - move examples to a sub-directoryKartik Agaram2018-09-0121-12/+11
|
* 4528 - commandline arguments working nativelyKartik Agaram2018-08-313-22/+9
| | | | | | | | | | | | | | Turns out I had totally the wrong idea. The stack at the start of the program doesn't contain 2 words, one for argc and a second for argv that must then be dereferenced to get to its contents (each a pointer to a string). It contains a word for argc, one for argv[0], another for argv[1], and so on. Many thanks to Jeremiah Orians and the #bootstrappable channel on freenode for showing me https://github.com/oriansj/mescc-tools/blob/master/test/test5/exec_enable_amd64.M1 which set me straight. I could just pop the args like that example does, but it seems slightly more elegant, given the current calling convention, to assume the imaginary caller handles the popping.
* 4527 - reading commandline argumentsKartik Agaram2018-08-308-14/+166
| | | | | | | | | | | The new example ex9 doesn't yet work natively. In the process I've emulated the kernel's role in providing args, implemented a couple of instructions acting on 8-bit operands (useful for ASCII string operations), and begun the start of the standard library (ascii_length is the same as strlen). At the level of SubX we're just only going to support ASCII.
* 4526Kartik Agaram2018-08-291-1/+1
| | | | | New levels should be added at the top of list of transforms rather than bottom. See layer 29.
* 4524Kartik Agaram2018-08-204-6/+6
|