summary refs log tree commit diff
path: root/quine.asm
AgeCommit message (Collapse)Author
3 daysimplement looking up words by name (wow!)Irene Knapp
also, fix strlen to not include the null byte Force-Push: yes Change-Id: Ifd95da1fc0cf7006df0a25278e03651d6185f037
2025-11-10implement stringcmp, with extensive commentingIrene Knapp
and a lot of other stuff necessary for that, as follows implement the "adc" and "sbb" instructions in flatassembler (there's no Forth implementation of them yet) implement "cmps8" in flatassembler; Forth already has a much more thorough suite of string instructions add Forth jmp_rel_imm8 and flatassembler jmp.rel.bimm unconditional jumps. they're nver used, it just seems like they should exist. split the disp8 case from the indirect case for the flatassembler implementation of register-to-register mov, to match how the Forth implementation works fix the name of mov.disp8.qreg.qreg, which had been incorrectly named mov.qreg.disp8.qreg. it's never called anyway. fix a citation for the MOV instruction; Intel's section numbers are confusing. Force-Push: yeah Change-Id: I53761a3487041c142ade1a82a8ab9a3f1129b853
2025-11-09implement the rest of the string instructionsIrene Knapp
in both repeatable and non-repeatable forms no ins or outs though Force-Push: yes Change-Id: Ica93a1de8b3b698db4e9b3c3c2f00b9e145a2064
2025-11-08implement sys_exit and sys_writeIrene Knapp
Force-Push: yes Change-Id: Idbdfe11a5ba4107c90065f015705708030684439
2025-11-08implement branch and 0branch; fix jmp_cc_rel_imm8Irene Knapp
Force-Push: yes Change-Id: I45c0a5e729cae2493e341ad3b6145708826383ab
2025-11-08memory-handling words; fix mov_reg8_indirect_reg64Irene Knapp
Force-Push: yes Change-Id: I511c869c1f5a3c533213a8d3072dd586f29a5a1c
2025-11-08lit, litstring as asm-in-Forth. give repnz_scas8 the correct name.Irene Knapp
Force-Push: yes Change-Id: I6e34fef69b8d254e215eb377f7a50df57190eed0
2025-11-08bitwise operationsIrene Knapp
Force-Push: yes Change-Id: Idf4fe951fa583946f0a51a53f15eff7f1138b7c6
2025-11-08write comparator words; fix cmp, set, and reg8Irene Knapp
Force-Push: yes Change-Id: I56f82c56307a8e0cd20fdac38dd264136478dd60
2025-11-08assembly-in-Forth arithmetic words; also fixed the implementationsIrene Knapp
some basic mistakes in those Force-Push: yes Change-Id: Ife797b31962c26fc8a8ab741f4d97bd3da3c0612
2025-11-08assembly-in-Forth versions of the rest of the stack-manip wordsIrene Knapp
Force-Push: yes Change-Id: I67f3a218ea3c0cbb362e2825adf200e7cca05edc
2025-11-08added assembly-in-forth unroll, and mov_indexed_reg64_reg64Irene Knapp
missed that instruction. oops. well, we have it now. Force-Push: yes Change-Id: I22583d6c6bda3cb66ad67a69a644aeb777114085
2025-11-08added assembly-in-forth implementation of rollIrene Knapp
also fixed scalefield the testing bar we're applying for these next changes is that it runs successfully, we aren't actually calling the generated funcions yet. we'll need to invent some methodology for checking they're generated correctly. Force-Push: yes Change-Id: I820e5671d74fa3bd4342e5d5b26b867e053ba3ca
2025-11-08add workaround for 8-byte strings (yepppppp)Irene Knapp
Force-Push: yepppppp Change-Id: I3afbaf2af5b2d31ba435fdad759117c7fb52c1d8
2025-11-07the naming commit!!!!Irene Knapp
now there are stubs for all the basic words. we took this opportunity to do a pass on thinking about their "real" names :) Force-Push: yes Change-Id: If2c5b94c540a2a0b8e0df7650f6769405dae2ffd
2025-11-07re-order some stuff to make bootstrapping feel easierIrene Knapp
it may not actually be any easier, but at the very least this is a readability improvement Force-Push: yeah Change-Id: I1ab991fc895e41af44f2aaac59d6152053bd9be3
2025-11-06okay now all the conditional operations and jumps are implemented, tooIrene Knapp
this completes the assembly-in-Forth stuff! yay Force-Push: yes Change-Id: I7f9466a3a71375c32991379fc040d6cc3d657302
2025-11-06all the non-64-bit addressing modes for movIrene Knapp
or at least, all the ones we need yay it's theoretically possible these work! it was a lot of details to get right, and they're not tested at all Force-Push: config Change-Id: I4f1bef007982af7901aa263af8e618d19e262f12
2025-11-06did all the pending instructions that use indexed addressing modesIrene Knapp
we're starting to feel vaguely proficient in stack juggling, but it will still be quite a thing if these don't need fixing later Force-Push: yes Change-Id: Ic1285d01cc42c6e8a30d36fc53e67135d8d9e175
2025-11-06rename all the modrm_* words to addressing_*Irene Knapp
also re-order "sib" to be before them we were about to add one for indexed modes, and realized that really, these words are responsible for both the ModRM and SIB bytes, it's just that some modes only need one of them. this makes their responsibilities clearer, and as a bonus it draws a stronger distinction between these high-level words and the low-level "modrm", which omits consistency checking. having it called something else reduces the likelihood of inappropriately using the low-level one when a high-level one would be more suitable. their names are a bit long now, but that's probably also good, it will incentivize building higher-level abstractions that define multiple variants of instructions rather than writing each one by hand. someday. Force-Push: yes Change-Id: Ia8f8fcc0e092f94e66f17a3fa55e8bf3e927fdff
2025-11-06implement a bunch of assembly-in-ForthIrene Knapp
Force-Push: yes Change-Id: Ia9844da8f6e5d59ed77348b85200c28a7113bd1f
2025-11-06listed out all the assembly instructions that need Forth versionsIrene Knapp
Force-Push: yes Change-Id: Ib9efd1cd1c8b362547bef8b15829f9da6a28b4d1
2025-11-06yay now it has "exit" on the heap, tooIrene Knapp
Force-Push: yes Change-Id: I19215825a8891bbc8b36bac03a0f0ca440721cb3
2025-11-06there is now a full implementation of docol on the heapIrene Knapp
yay that was hard. lots of bug-fixing. for some reason the condition code for not-equal was being output as 0x6 instead of 0x4. there was also a lot of stack manipulation to trace through very carefully. Force-Push: yes Change-Id: I8f2c19d5be96ba27a3e8c56c460c761a3b16666f
2025-11-04some notes to figure out the topological sort and so onIrene Knapp
also a minor renaming for consistency Force-Push: yes Change-Id: I80f7a091272fa9a73cedd7caba495a45d5866d16
2025-11-03the variable words are fully defined on the heap nowIrene Knapp
not used for anything yet, but hey verifying this required a lot of time in the debugger Force-Push: yes Change-Id: I38a9536ce8efde236b1ed81ca94e0cf7e101413d
2025-11-03move the output helpers and assembly-in-forth stuff earlier in the fileIrene Knapp
this better reflects the logical dependencies, per the new plan Force-Push: yes Change-Id: I2caa0e6bb1c722a7839f6695c48b05d0b2cfad25
2025-11-03add the beginnings of some word-defining wordsIrene Knapp
Force-Push: yes Change-Id: I7e4c678c27a87b79a9f2c2aad12bd65d7d5600cc
2025-11-02downcase _all_ the thingsIrene Knapp
this will get more painful the longer we put it off Force-Push: yes Change-Id: I82430303d9d9d8a317eb8f020316e2145020a5c8
2025-11-02those ;codeword comments were unnecessarily verboseIrene Knapp
and the 0x in front of the 8 was silly Force-Push: yes Change-Id: I23a8ffd6aeec1d78ee7362c1f97d99e94947e5b6
2025-11-02okay some words-as-variables are defined nowIrene Knapp
and the heap bootstrapping strategy is explained, or part of it Force-Push: yes Change-Id: I4c48cf081709a7200a70041e321ace4d6713be94
2025-11-02output a whole bunch of assembly from ForthIrene Knapp
and begin to grow the Forth-styled assembly language it needs runtime word definition next, in our view, so we're checkpointing it here so as to work on that Force-Push: yes Change-Id: I08927581f6b6fdc69f6543936e46fe9ff83c8d48
2025-10-30clean up the first two instruction macros ever writtenIrene Knapp
they had some minor confusing stuff going on; now they don't Force-Push: yes Change-Id: Ie3756cf18222cb8b3f4794f57d91cb5229be715e
2025-10-30get rid of the redundant copy of the label valueIrene Knapp
Force-Push: yes Change-Id: I5709b96b401362564cc0f1dec3953dad13c319b7
2025-10-29get it down to a single call to write()Irene Knapp
this also adds a block-copy routine, further breaking up the handful of remaining monolithic things Force-Push: yes Change-Id: Ida960d83bab6176d016168cdf25e0763aa6050ef
2025-10-29the two-pass magick works!!!!!Irene Knapp
yessssssss that was a lot of debugging, wow. there were two bugs in UNROLL: the source and destination for the block move were set to the high end instead of the low end; and the encoding of an lea variant fell into an unsupported case but was emitted anyway due to an incorrect guard clause that was seriously a lot of debugging. also all the stack logic for grabbing and stashing the label stuff was wrong several times, but it works now the original "old code" is now fully eliminated, wow! Force-Push: yeah Change-Id: I85d951eabc7de6ba502e2a1aa0f5998f9b399765
2025-10-27ROLL, UNROLL, and a whole bunch of addressing modesIrene Knapp
also a couple more gdb tips Force-Push: yes Change-Id: I31038334449ea45238c811b4e97e2d87833d8ea6
2025-10-26added a macro BEFORENEXT and a bunch of words like LITPACK64Irene Knapp
this shaves like 700 bytes off the file size, though it feels like more should be achievable Force-Push: yes Change-Id: Iaa51c462cc80cea1a16a67b428b5064e40d9b9f1
2025-10-26move almost all the ELF stuff to code writen in ForthIrene Knapp
wow, this sure does balloon the file size. must be something we can do about that... Force-Push: yes Change-Id: I477c4fdc9b42c3e5d50654d2864e3933da65a64d
2025-10-26heap allocation now works! also fix some encoding issuesIrene Knapp
implement indirect adds and subtracts; it turns out they're convenient for heap management the operand order for lea.qreg.qreg.disp32 didn't match what the name suggested, so it's fixed now the semantics of push.dimm are quite surprising, for reasons that are now extensively documented also add notes on helpful ways to use gdb Force-Push: yes Change-Id: I717eb6427520e2c336586d4e8066ef172d97ce55
2025-10-25break up OLD_CODE into separate callsIrene Knapp
the goal is to make the assembly monolith, less of one. no individual piece of this is complicated, it was just tightly coupled... now it is less so. Force-Push: yes Change-Id: I4bf5711ee6eae18e68be9d4e1f5107933c45fbbd
2025-10-25memory manipulationIrene Knapp
Force-Push: yes Change-Id: I5587783da20301abf11489caad6990531b13e3f1
2025-10-24add stack manip, arithmetic, bitwise stuff, comparisonsIrene Knapp
this is all untested, but I'm highly confident in my reading of the Intel manual at this point Force-Push: yes Change-Id: I3dbd59da02994db58f2a53d1890136d583803bc6
2025-10-23a convenience macro for word headersIrene Knapp
Force-Push: yes Change-Id: Ifda1a168808d541f8899a06d39bb9d13733dbadc
2025-10-23pick a header format, document itIrene Knapp
also all the existing stuff has word headers now. it doesn't need them to run, it just has them anyway. and EXIT was moved after DOCOL because it feels poetic that DOCOL is the first Forth word in the file Force-Push: yes Change-Id: I592445310712bfde42fde8cffd7bc672f16c4e6c
2025-10-20implement Forth EXITIrene Knapp
this is the final word called by interpreted words, to return Force-Push: yes Change-Id: I8301fa31009915e4beb069664c9bd16cdf33d879
2025-10-20woooooo successful debuggingIrene Knapp
it turns out things are real enough now that we can't just scribble wherever :) Change-Id: I26c71beaaefecae018ebb3ced4f1f579879a030a Force-Push: yes
2025-10-19it does threaded execution now!!!!!!!!Irene Knapp
this is the core Forth thing, or a large part of it Force-Push: yes Change-Id: Id15cf5289cb7b41e0ea824ef68791f663c2f90e6
2025-10-19much closer to being able to move to threaded executionIrene Knapp
not quite, but very very near Force-Push: yes Change-Id: I79ae9f2970e4d7263db5c511e3a5398c22c4771c
2025-10-19there was an important bug in mov.qreg.disp8.bimmIrene Knapp
it was using rax as an index register, when it should have been using no index register. this was working by coincidence, because rax was zero, but now it's not. yay fixed! there's also lots of decisions made and documented about the execution model, but they're only part-implemented and I wouldn't be checking them in right now if that were all that's new Force-Push: yes Change-Id: Ie8f64914484cd405272d640feeb1cf586ad915d7