Commit Graph

72 Commits

Author SHA1 Message Date
Kartik Agaram 554bd09968 label offset computation still has a bug
I changed the test a little to make it obvious.
Basically there's no way we can compute the segment offset correctly
without knowing the segment name in the previous assertion.
2019-07-11 21:38:25 -07:00
Kartik Agaram be995e2193 revert compute-offsets to segment-relative offsets
The pseudocode was a mess here :/ I was saving the segment-offset but
tracing the file-offset.

Segments need file offsets (to tweak their starting address).
Labels need segment offsets (to add to segment starting address).
2019-07-11 21:31:00 -07:00
Kartik Agaram f57a458e7b . 2019-07-11 21:24:09 -07:00
nc 3a3e7a90d7 move discard instruction to correct spot 2019-07-11 22:31:56 -04:00
nc 2805308785 updated test so 'x' is relative to file-offset not segment offset 2019-07-11 22:21:32 -04:00
nc c2725b65b3 made test 2 pass 2019-07-11 22:13:03 -04:00
Kartik Agaram 538f24c296 . 2019-07-10 11:57:08 -07:00
Kartik Agaram c5f7d9dd57 .
I think we're calling the wrong variant here.
2019-07-10 11:38:24 -07:00
Kartik Agaram 304bce5895 start distinguishing table lookups from inserts 2019-07-10 11:32:46 -07:00
Kartik Agaram 84aa2fad2d .
Fix infinite loop in the 2 remaining failing tests; now it's a segfault.
2019-07-10 09:39:38 -07:00
Kartik Agaram 7e9cdf3c7a . 2019-07-10 09:35:24 -07:00
Kartik Agaram 48aabc860a mostly done with emit-output
Some nooks and crannies will need light final debugging with xxd, but
emit-hex-output covers most of the logic.
2019-07-09 23:41:32 -07:00
Kartik Agaram 20a527702b done with emit-segments
Only failures now are the first two tests in survey.subx.
2019-07-09 22:11:44 -07:00
Kartik Agaram 7bc9240c3c . 2019-07-09 17:50:22 -07:00
Kartik Agaram 4a739023d9 . 2019-07-09 17:41:52 -07:00
Kartik Agaram c7564b7688 . 2019-07-09 16:55:57 -07:00
Kartik Agaram b14457a4cb . 2019-07-09 16:55:57 -07:00
Kartik Agaram 5821a0f612 clean up after a few calls 2019-07-09 16:55:55 -07:00
Kartik Agaram f6ea25613f preserve truthiness of non-booleans
Everywhere we check if something is true, we check it by comparing
against 0, not 1.
2019-07-09 16:55:37 -07:00
Kartik Agaram 7a752f8d3d this looks like a bug
But of course the test is still infinite-looping so we can't be sure.
I'm still just reading the code.
2019-07-09 16:55:13 -07:00
Kartik Agaram ca32bfbed8 . 2019-07-09 16:54:48 -07:00
Kartik Agaram d6c6aebef4 . 2019-07-09 16:37:01 -07:00
Kartik Agaram ba93234603 move 'segment-start' to a global variable as well
It's ugly to have function locals in global variables, but we'll figure
out later how to deal with it.
2019-07-09 16:32:06 -07:00
Kartik Agaram eb4b45db40 . 2019-07-09 16:27:48 -07:00
Kartik Agaram dc7066c7bf there's a variant of compute-width for slices
Looks like the original compute-width is now dead. But still seems
useful to have around.
2019-07-09 16:25:31 -07:00
Kartik Agaram acc83b644b there's a variant of get-or-insert for slices
The compute-offsets test now goes into an infinite loop :( But I figure
all these changes are useful anyway, we should just debug the error
separately.
2019-07-09 16:23:14 -07:00
Kartik Agaram b8b92251e9 keep labels definitions on a separate line
SubX in SubX doesn't support mixing labels with other stuff :)
2019-07-09 16:02:00 -07:00
Kartik Agaram 7761194ec1 switch to global Heap 2019-07-09 16:00:55 -07:00
Kartik Agaram 476049a09d .
Be more consistent about names of ends of a slice.
(In the opposite direction compared to last night's 925fc490d2ce8b8d411de87bd0af5b3a8a704213.)
2019-07-08 17:02:09 -07:00
Kartik Agaram b5da792904 .
minor style tweaks
2019-07-08 16:43:35 -07:00
Kartik Agaram 01b45300ed colocate compute-offsets with its globals 2019-07-08 16:38:32 -07:00
Kartik Agaram 925fc490d2 .
Be more consistent about names of ends of a slice.
2019-07-08 01:05:23 -07:00
Kartik Agaram 597ce7a943 . 2019-07-08 00:17:42 -07:00
Kartik Agaram 195d62f167 build `num-bytes` 2019-07-07 23:56:23 -07:00
Kartik Agaram c38b36e260 move `is-label?` to `subx-common` 2019-07-07 22:49:04 -07:00
nc c0a904382b made first compute-offset test pass 2019-07-07 21:19:50 -04:00
nc c17643b7a8 remove segfaults in survey.subx 2019-07-07 19:41:26 -04:00
Kartik Agaram fb8474af88 new failing test: emit-segments
Now the only piece I plan to not write tests for is emit-headers.
2019-07-07 13:19:51 -07:00
Kartik Agaram 633c289f30 . 2019-07-07 13:13:38 -07:00
Kartik Agaram 764b5726df move phase 3 out of helpers 2019-07-07 13:13:38 -07:00
nc b95060262e cleanup in compute-offset and fix bug in compute-width 2019-07-07 15:39:35 -04:00
nc 9ac5834194 more progress in compute-offset 2019-07-04 22:59:15 -04:00
nc f80a025e52 implement segment section in compute-offsets 2019-07-04 12:21:41 -04:00
Kartik Agaram c015791e80 .
Fix a couple of syntax errors.

survey.subx still failing tests.
2019-07-04 00:02:53 -07:00
nc d818fdd7e5 add todo for section thats not quite complete 2019-07-03 23:04:24 -04:00
nc 98096ca81e add is-label block 2019-07-03 23:02:14 -04:00
nc 87ef858628 updates to survey - part of compute-offsets implemented 2019-07-03 22:39:47 -04:00
Kartik Agaram 34cf8a7034 subx/survey: now computing label addresses 2019-07-02 14:24:44 -07:00
Kartik Agaram 7895d0a480 .
subx/survey/compute-addresses: Now computing segment starting addresses
correctly.
2019-07-02 13:45:48 -07:00
Kartik Agaram 9d5ba2dfbf . 2019-07-02 00:16:23 -07:00