GloriousCowwrote on 2024-08-15, 16:25:aux carry flag is undefined after SHL and SHR. Behavior may differ between CPUs. An 8088 can set AF on a SHL, a V20 will alway […] Show full quote
The 80186 shift tests keep setting the auxilliary carry flag (bit 4) for all results somehow? All other flags seem fine.
aux carry flag is undefined after SHL and SHR. Behavior may differ between CPUs. An 8088 can set AF on a SHL, a V20 will always clear AF.
There's also no guarantee that the tests you're looking at matched actual hardware behavior of a 186.
With the MUL tests only 3 sets of flags are incorrect. I see auxilliary carry erroring(stack offset 8C), then overflow flag with auxilliary carry erroring out at stack offset 88h.
aux carry flag is undefined after MUL. An 8088 will clear it. I believe the overflow flag should be set to the same state as the carry flag.
if you're going to implement undefined flags, you have to first decide which CPU you are going to implement them for.
Hmmm... What about DAA/DAS auxilliary carry? niPCemu sets it, but then (in current versions) resets it when calculating sign/parity flags (probably should leave it unaffected at that point?)
Last edited by superfury on 2024-08-15, 17:52. Edited 1 time in total.
Hmmm... What about DAA/DAS auxilliary carry? UniPCemu sets it, but then (in current versions) resets it when calculating sign/parity flags (probably should leave it unaffected at that point?)
On 8088 and V20, I set AF for both as AF = AL & 0xF > 9 || AF
Hmmm... What about DAA/DAS auxilliary carry? UniPCemu sets it, but then (in current versions) resets it when calculating sign/parity flags (probably should leave it unaffected at that point?)
On 8088 and V20, I set AF for both as AF = AL & 0xF > 9 || AF
And sign/zero/parity? At what point are they samples on 8088 and NEC V30?
Hmmm... What about DAA/DAS auxilliary carry? UniPCemu sets it, but then (in current versions) resets it when calculating sign/parity flags (probably should leave it unaffected at that point?)
On 8088 and V20, I set AF for both as AF = AL & 0xF > 9 || AF
And sign/zero/parity? At what point are they samples on 8088 and NEC V30?
On 8088 and V20, I set AF for both as AF = AL & 0xF > 9 || AF
And sign/zero/parity? At what point are they samples on 8088 and NEC V30?
Set according to the value of AL.
And DAS overflow flag?
Edit: managed to get it implemented I think (the testsuite succeeds on that).
Now on the MUL tests, there's an error in AAD?
It performs a normal MUL (unsigned, adjust timings), then adds the result to AL to generate flags (essentially AL= ADD AX,originalAL), with the flags becoming the add operation part of it?
Last edited by superfury on 2024-08-15, 19:16. Edited 1 time in total.
And the AAD issue? Right now it's:
8-bit MUL data,AH (8-bits version MUL) for getting the intermediateresult (8-bit)
ADD intermediateresult,AL (intermediateresult*AL->8-bit result)
AX = 8-bit result (AH cleared)
Rather than go through every instruction and flag one by one, perhaps you can look at the source code to that emulator or to MartyPC.
Just adjusted the 808x core BCD AAA/AAS instruction to match yours.
The test386 testsuite is still erroring out on the flags results (when configured to check undefined 80386 flags)?
MS-DOS 6.22 booting from the hard-disk image (the same image I've used for a long time already) can't properly boot anymore still (gets into a LDS/JNZ/JMP-based loop on some (corrupted) non-zero pointer it seems?). It can still load HIMEM, but directly after that (before loading OAKCDROM for example) it crashes into said loop as well? It's looking like some loop that's following some kind of segment:offset chain?
According to the test386.asm testsuite, AAA at least is broken?
The op_add8 function is just the basic ADD instruction's execution using 2 input values and 1 output value (and modifying flags like it automatically).
It's a bit too many macro-logic to simply post here I think. It's based on Dosbox's (or was it Bochs') lazy flags, but un-lazied instead (because they need to be live for the debugger).
The only difference between this and the 80286+ AAA instruction is that the 286+ instruction uses AX instead (adding 6 to AX as a 16-bit operation (documented in Bochs) instead of as a 8-bit operation), flags being determined in the same way, but using flag_add16(oper1,oper2) instead of flag_add8(oper1b,oper2b).
Just ran The Troubleshooter. I ran a CPU core processor test, and it found a problem: String operations apparently, according to the testsuite. I don't know if it's an issue with the actual memory accesses (being skipped somehow or the like) or flags though.
So is one of the string instruction malfunctioning somehow? Or REP/REPZ/REPNZ prefixes somehow?
Edit: Found some issues with 80(1)8x REP instructions and their timings not being recounted properly in subsequent executions, but that isn't the main problem (it mainly affects 808x timings because of delays with string instructions).
Looking at the tests running I see pretty much a bunch of string instructions done in a loop?
Edit: PC Doctor verifies the string instructions to be working? So The Troubleshooter is somehow failing it? Perhaps some single-instruction odd issues? Or IRQ-based interruption issues?
Edit: Adjusted the REP prefix handling a bit, so that (E)CX decrementing to zero immediately finishes the instruction, instead of triggering another instruction for (E)CX being zero (which would of course block). That is correct functionality isn't it? Or is it supposed to execute a final (E)CX zero blocked REP(Z/NZ) instruction that does nothing? Though I doubt that's the case (it should only block the (E)CX zero case when the instruction loop is started and (E)CX is zeroed, doesn't it (so it will be checked after the instruction instead of before after starting (it's only checked before to block when the REP and instruction opcode is fetched, doesn't it))?
Edit: Running FDISK on MS-DOS 6.22's command prompt seems to cause some part of it (at 2xxx:0018) to throw a #GP fault (because of addressing offset 10000h using an ADD instruction), repeatedly ending up at said location with each fault (#GP fault handler)?