100 Commits
Author SHA1 Message Date
marcothms 3ec76933d5 fix(interpreter): rep(n)z condition was wrong way around 2025-07-24 11:44:06 +09:00
marcothms 2cb50b5908 fix(interpreter): fix mov AX0b instruction
Should not be imm, but a memoryindex
2025-07-24 11:43:30 +09:00
marcothms 4cc97cffbf ft(interpreter): impl stosb/stosw 2025-07-24 11:43:08 +09:00
marcothms b3a24ade00 ft(interpreter): impl file-based minix interrupts 2025-07-24 11:42:15 +09:00
marcothms 75e9df9be9 ft(interpreter): impl repz/repnz and string ops 2025-07-15 12:44:28 +09:00
marcothms d5d6834a94 ft(interpreter): impl low hanging fruits 2025-07-14 18:32:32 +09:00
marcothms aea3143b4b fix(interpreter): allocate stack on heap 2025-07-08 17:40:57 +09:00
marcothms 20e45679fc chore(interpreter): impl missing instructions as todo 2025-07-08 11:20:38 +09:00
marcothms 9ada099d70 chore: update readme 2025-07-08 11:19:26 +09:00
marcothms cae4a03c26 chore: cleanup calling logic of disasm/interp 2025-07-08 10:43:02 +09:00
marcothms 8c1a07b9e6 ft: rename to i8086-rs 2025-07-08 10:42:58 +09:00
marcothms 0a1fd0e4c6 fix(interpreter): typo selected wrong byte 2025-07-08 09:35:28 +09:00
marcothms ecbe478dcd ft(interpreter): impl SAR 2025-07-08 09:03:16 +09:00
marcothms be0b928a55 fix(interpreter): use correct binary name for argv[0] 2025-07-06 22:41:14 +09:00
marcothms 14a0d3d6f1 chore(interpreter): improve debug output 2025-07-06 22:36:13 +09:00
marcothms 68fb5b7b56 fix(interpreter): correctly sign extend cmp byte 2025-07-06 22:35:39 +09:00
marcothms aba85c9a48 fix(interpreter): invalid operator precendece for padding byte 2025-07-05 00:04:35 +09:00
marcothms 89634e50c4 fix(interpreter): load prog name as argv[0] 2025-07-04 15:05:18 +09:00
marcothms 6c593a8d1e fix(interpreter): fix jg jump condition 2025-07-02 20:58:57 +09:00
marcothms 4e23d9419b fix(interpreter): write to correct 8bit regs 2025-07-02 20:58:39 +09:00
marcothms 4adb975b69 fix(interpreter): actually xchg into AX 2025-07-02 20:41:34 +09:00
marcothms 803c6267d2 ft(interpreter): impl mul and div 2025-07-02 20:32:13 +09:00
marcothms 60b5b6bd51 chore(interpreter): correctly sign extend for CBW/CWD intructions 2025-07-02 17:46:15 +09:00
marcothms 6d60343067 ft(interpreter): impl ret with immediate 2025-07-02 17:38:48 +09:00
marcothms f665390854 fix(interpreter): add missing continue for jmp %reg instructions 2025-07-02 17:31:51 +09:00
marcothms aee5f0b6d7 ft(interpreter): impl custom partialord and ord for immediateoperand
The derived one treated Byte(1) < Word(2) as true, which is not
the desired behaviour.
2025-07-02 17:16:26 +09:00
marcothms 709d2a2639 fix(interpreter): fix safeguard for memory write_raw() 2025-07-02 17:16:01 +09:00
marcothms cf3383c23a fix(interpreter): set flags correctly for inc/dec/neg 2025-07-02 17:15:40 +09:00
marcothms 4f161f47f6 ft(interpreter): expand interrupt functionality
Implement mess2 type, as well as return m_type for existing
and new interrupts.

TODO:
save pointer to message data, as the current write is redundant.
2025-07-02 17:14:05 +09:00
marcothms 5a81bbf43a chore(interpreter): handle errors during fetch 2025-07-02 17:12:19 +09:00
marcothms 09a03ab558 chore: simplify info and debug output 2025-07-02 17:10:55 +09:00
marcothms f6447df90e fix(interpreter): set flags correctly for shifts 2025-07-02 17:09:43 +09:00
marcothms 3ce0a461ca fix(interpreter): fix stack setup 2025-07-02 17:07:37 +09:00
marcothms 0a55b5a68b fix(interrupt): parse correct amount of data 2025-07-01 12:20:23 +09:00
marcothms a5cffa4852 fix(interpreter): impl fetch and decode
I parsed all instructions before executing, but this is not how
intel works.
We need to decode the instructions, pointed to by IP, on the fly.
2025-07-01 12:08:28 +09:00
marcothms f3fd655908 ft(interpreter): expose data to memory 2025-07-01 11:00:22 +09:00
marcothms 13cb907977 ft(interpreter): impl simple stack init 2025-07-01 09:46:06 +09:00
marcothms 0db309b668 chore(main): dont log path 2025-06-18 21:25:17 +09:00
marcothms 4f3d864179 chore(interpreter): move memory access functions to computer
This is mainly to ease the usage of memory access functions, meaning
leaner access of memory with general resulution of memory accesses via
the MemoryIndex struct.
2025-06-18 21:04:41 +09:00
marcothms 79dc560689 chore(interpreter): rewrite displacement memoryindex logic
Previously, the displacement for a MemoryIndex was directly interpreted
and saved as a signed value.
Change this to the normal unsigned ImmediateOperand version to allow
for more flexible usage of this struct for general memoryaccess (future
commit) and just interpret the displacement member as signed, only when
being interpreted as such (memory access, display, ....
2025-06-18 20:35:23 +09:00
marcothms 5a61eb5fd6 ft(interpreter): use DS and SS sregs as correct segment offsets 2025-06-18 20:35:23 +09:00
marcothms 4aeacc649a ft(interpreter): impl far jumps with correct CS addressing 2025-06-18 20:35:04 +09:00
marcothms 6678a1ef4a chore(interpreter): fix small bugs 2025-06-18 20:33:52 +09:00
marcothms 53262f9e3e ft(interpreter): impl shift and rotate 2025-06-18 20:33:52 +09:00
marcothms 7d5f891a93 ft: use instructionwidth instead of immediateoperand
Previously an immediate operand with data of 0 was use to encode
width, now use a dedicated enum for improved clarity.
2025-06-18 20:33:52 +09:00
marcothms 18cc460d40 ft: impl ret 2025-06-18 20:33:52 +09:00
marcothms 7f4d79d840 fix(interpreter): always read word from memory
It's not possible to know if a word or byte is requested, or rather
it would be a pain to retrieve that information.
It is much easier to just read a full word and then discard the top
half, if just a byte is needed.
2025-06-18 20:33:52 +09:00
marcothms 200640447b ft(interpreter): impl basic call 2025-06-18 20:33:52 +09:00
marcothms 7e7e648fa8 fix(interpreter): wrong le byte order on pop 2025-06-18 20:33:52 +09:00
marcothms 1f5e175c68 chore(interpreter): rename Operand -> ArithmeticOperand 2025-06-18 20:33:52 +09:00
marcothms 5fab099cd8 ft(interpreter): impl push/pop 2025-06-18 20:33:52 +09:00
marcothmsandGitHub d1ea96edd8 Update README.md 2025-06-17 16:40:24 +02:00
marcothmsandGitHub bc9df97ea7 Update README.md 2025-06-17 15:35:13 +02:00
marcothms 5942270f63 ft(interpreter): impl all low-hanging fruit instructions 2025-06-11 23:29:34 +09:00
marcothms 4cea76bd1c chore(interpreter): always sign-extend ImmediateOperand::Byte when cast 2025-06-11 17:40:38 +09:00
marcothms 7691b4b2ab chore(interpreter): reduce code complexity 2025-06-11 17:04:34 +09:00
marcothms e5e0edd713 ft(interpreter): impl mov 2025-06-11 16:59:15 +09:00
marcothms 269c4cc54b ft(interpreter): impl adc and sbb 2025-06-11 16:31:07 +09:00
marcothms 11a365a8b1 ft(interpreter): set flags for arithmatic operations 2025-06-11 15:57:39 +09:00
marcothms c9bf8fdc46 ft(interpreter): impl short jumps 2025-06-11 15:44:42 +09:00
marcothms a4dc420d60 fix(disasm): only prepend ptr when modrmtarget is memory 2025-06-10 21:07:28 +09:00
marcothms 7479021d36 ft: impl most arithmatic ops, dec, inc 2025-06-10 20:57:31 +09:00
marcothms 037d74ac6a fix: dont always flip sign_extend msb 2025-06-10 20:00:07 +09:00
marcothms 3756ada3e0 fix: correctly sign-extend instead of plain byte to word cast 2025-06-10 15:54:25 +09:00
marcothms 5529fc0b89 ft: impl flag setting closure for binary operations 2025-06-10 14:38:13 +09:00
marcothms 35fefb7625 ft(interpreter): generalize binary operations 2025-06-10 10:59:35 +09:00
marcothms 2b37884a60 fix: align interrupt data with minix src 2025-06-10 09:44:34 +09:00
marcothms 232b73aad8 chore: Rename Operand -> ImmediateOperand 2025-06-05 10:08:35 +09:00
marcothms ef4663a245 ft: abstract and implement ADD::* interpretation 2025-06-04 23:01:04 +09:00
marcothms ac69d75273 ft: initial work in interpreter 2025-06-03 21:31:28 +09:00
marcothms 5ee80c9364 fix: read data section as words, not bytes 2025-06-03 10:30:35 +09:00
marcothms 4c63b7a21a ft: add dump flag 2025-05-28 16:00:18 +09:00
marcothms 7e8fdeba54 ft: implement missing lock instruction 2025-05-28 14:23:56 +09:00
marcothms a21cc2b4b3 ft: add debug script 2025-05-28 14:13:12 +09:00
marcothms c396d33f76 fix: align pointer parsing with spec
Previously pointer parsing was completely wrong.
Now split into Pointer32 for immediates with
segment;offset and Pointer16 for short jumps, which
use DS or ES as segment and the Pointer16 value
as offset.
2025-05-28 13:31:14 +09:00
marcothms 0893969f4e chore: whole swoop of enhanced documentation 2025-05-28 09:41:40 +09:00
marcothms 322a276617 fix: dont interpret padding as instructions
a.out padds the text section with 0-bytes, which where interpreted
as 0x00 0x00 instruction and occasionally as a single 0x00 byte. Add
logic to ignore single 0x00 bytes and to remove dangling 0x00 0x00
instructions at the end of the instruction vec, so only the 'actual'
instructions are presented in the end. Also adjust visibility of
methods, so only the truncated instructions will ever be presented.

Of course, this could remove an actual `0x00 0x00` instruction from the
end, but they would not have any effect on execution anyway.
2025-05-27 11:13:16 +09:00
marcothms 5c8702fb95 fix: only push raw instruction once 2025-05-27 09:37:57 +09:00
marcothms 3463b5b4ae chore: fix panic
ModRM parsing still used old parsing style.
2025-05-27 09:21:40 +09:00
marcothms 8ea91d80b8 ft: add first basic test 2025-05-25 21:20:12 +09:00
marcothms 35207d23f0 chore: add nice debug output 2025-05-25 21:06:47 +09:00
marcothms f9ae0dc6ee chore: move pointer parsing function to disasm module 2025-05-25 20:31:55 +09:00
marcothms 74e936ab76 chore: replace all panic's with proper error propagation 2025-05-25 15:45:09 +09:00
marcothms 73b1a99cbd ft: Implement memory pointer (Mp) operand 2025-05-25 11:00:47 +09:00
marcothms 6762195378 chore: show raw pointer value in disasm 2025-05-25 10:27:32 +09:00
marcothms 90fb88aec6 chore: fix byte/word size ambiguitis in disasm output 2025-05-25 10:09:23 +09:00
marcothms 058afeb7ba chore: split up some structs and add comments 2025-05-20 18:59:09 +09:00
marcothms 48eeff16fa chore: align disasm print more with objdump(1) 2025-05-20 11:28:23 +09:00
marcothms beccff0d79 chore: update metadata 2025-05-20 11:22:35 +09:00
marcothms 1173dd3d63 chore: output parity for hex
Output all immediate bytes and words as hex.
2025-05-20 11:02:46 +09:00
marcothms ac78e9705c fix: correctly parse jump bytes
Previously only a single byte was read and saved,
but the J-byte means, that the read signed-byte
must be added to the address of the next
instruction.
2025-05-20 10:56:54 +09:00
marcothms 3fe58e8bac ft: implement fmt::Display for all mnemonics 2025-05-20 10:46:52 +09:00
marcothms fd15e57569 fix: correctly add displacement for short jumps 2025-05-20 10:12:13 +09:00
marcothms cb924af0fb chore: naming parity 2025-05-15 23:15:22 +09:00
marcothms 1c7ddbe9fa fix: use unsigned Operand type for immediates 2025-05-15 09:28:28 +09:00
marcothms 8ff92c81b3 ft: decode last set of instructions 2025-05-15 08:32:49 +09:00
marcothmsandGitHub fbec2ddad9 ft: add documentation section to Readme 2025-05-15 01:20:47 +02:00
marcothms db6d7c30a9 fix: typo in cargo.toml 2025-05-14 20:55:30 +09:00
marcothmsandGitHub beec1ae161 ft: Add Readme 2025-05-14 13:52:02 +02:00
marcothms 45ab158b95 ft: implement some more instructions 2025-05-14 20:38:51 +09:00