about summary refs log tree commit diff stats
path: root/subx/examples/ex10.subx
Commit message (Collapse)AuthorAgeFilesLines
* 4668Kartik Agaram2018-10-051-5/+5
|
* 4667Kartik Agaram2018-10-051-11/+12
| | | | | Standardize on hyphens in all names. And we'll use colons for namespacing labels in functions.
* 4662Kartik Agaram2018-10-051-0/+2
|
* 4644Kartik Agaram2018-10-011-5/+5
|
* 4639Kartik Agaram2018-10-011-3/+3
|
* 4624Kartik Agaram2018-09-301-1/+1
| | | | | | | | Start requiring a '-o' flag to designate the output binary when translating. Things currently get funky if you pass in multiple inputs, but that's ok. This is the first step to supporting multiple input files for a single output binary.
* 4516Kartik K. Agaram2018-09-241-10/+9
| | | | | | | More calling convention tweaks. Use EBP to get consistently at parameters and locals. Always put the first function argument closest to EBP.
* 4591Kartik Agaram2018-09-221-2/+2
|
* 4585Kartik Agaram2018-09-211-72/+0
|
* 4584 - discrepancy between SubX and native x86Kartik Agaram2018-09-211-1/+76
| | | | | | | | | | | | | | | | | | | | | | | | | One of the more painful things I had to debug with machine code. Tricks I used can be seen in ex10.subx: - printing argv[1] in various places - printing a single 'X' in various places to count how many times we get to different instructions - exiting with the current value of EAX in various places I repeatedly went down the wrong trail in several ways: - forgetting that the problem lay in native runs, and accidentally switching to subx runs during debugging. - forgetting to pass commandline args, because ex10 doesn't check its argv - writing the wrong comment for an instruction, and then miscalculating the set of registers that need to be saved. - forgetting that syscalls clobber EAX. Debugging native runs is hard, because you have to write non-trivial code to instrument the binary, and instrumentation can itself be buggy. When we finally tracked it down, I recognized the problem immediately. I'd meant to confirm the behavior of opcode 8a against bare metal, and then forgot. In any case, opcode 8a was inconsistent with 88. Sloppy.
* 4583Kartik Agaram2018-09-211-1/+1
|
* 4581Kartik Agaram2018-09-211-1/+1
| | | | | | | | | | | | Even more cuddling. We want to keep lines short where the opcode and operands are self-explanatory. If there are any implicit registers, etc., we'll continue to do the table layout. The first two columns look messy now; let's see how this goes. Maybe I'll give up on the tabular layout altogether, just string args with a single space.
* 4579Kartik Agaram2018-09-211-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.