• It's only about 90% working, but...

    From Steve Nickolas@21:1/5 to All on Wed Aug 10 21:34:35 2022
    https://github.com/buricco/lemur

    I'm having trouble with the CPU core (there's two slightly different
    variants of the core in the source). There's some other less significant
    bugs. I'm trying to teach myself 8086 ASM, but with that said, I think
    I've had the same issue with my C attempt at a 6502 core.

    -uso.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From peter.ferrie@gmail.com@21:1/5 to All on Thu Aug 11 11:16:57 2022
    Do you have test-cases that reproduce the wrong behaviour(s)?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Nickolas@21:1/5 to peter....@gmail.com on Thu Aug 11 18:11:29 2022
    On Thu, 11 Aug 2022, peter....@gmail.com wrote:

    Do you have test-cases that reproduce the wrong behaviour(s)?

    The monitor is unusable at this point.

    With an Integer ROM, negative numbers result in a >32767 error.

    With FPBASIC, decimals are computed incorrectly; NEXT results in NEXT
    WITHOUT FOR even if there is a FOR; whole numbers that result in
    scientific notation (i.e., 1000000000 or higher) cause FPBASIC to go off
    the rails and appear to freeze.

    -uso.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From peter.ferrie@gmail.com@21:1/5 to All on Thu Aug 11 18:26:32 2022
    Your overflow checking is wrong. That's causing the >32767 issue.
    V is the result of the XOR of bits 6 and 7, not simply the value of bit 6.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From peter.ferrie@gmail.com@21:1/5 to All on Thu Aug 11 18:56:11 2022
    mov ah, bl
    xor ah, 0x80
    and ah, [ra] ; but output differs, set V.
    and ah, 0x80
    jnz %%5 ; Output is different sign: skip.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From peter.ferrie@gmail.com@21:1/5 to All on Thu Aug 11 18:32:07 2022
    or, rather, result ^ 0x80 & original value & 0x80.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Nickolas@21:1/5 to peter....@gmail.com on Thu Aug 11 21:48:19 2022
    On Thu, 11 Aug 2022, peter....@gmail.com wrote:

    or, rather, result ^ 0x80 & original value & 0x80.

    Current code has same issue (non-macro version shown, macro version uses
    %%4 and %%5 and "jmp" is omitted from the final line):

    .4: or byte [rp], FLAG_V ; Unless [ra] and AL were same sign
    mov ah, [ra] ; but output differs, set V.
    and ax, 0x8080
    xor ah, al
    jnz .5 ; Inputs not the same sign: skip.
    mov ah, bl
    and ah, 0x80
    xor ah, al
    jnz .5 ; Output not the same sign: skip.
    and byte [rp], ~FLAG_V
    .5: mov al, bl
    mov [ra], bl
    jmp _setzn ; Set Z+N flags, then we're outtie

    I've tested a couple ADCs' overflow bits (63+63, 64+64) between MAME and
    my core.

    -uso.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From peter.ferrie@gmail.com@21:1/5 to All on Thu Aug 11 19:30:53 2022
    My service provider has issues with newsgroups. The double-posting is not on purpose.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Nickolas@21:1/5 to peter....@gmail.com on Thu Aug 11 22:38:30 2022
    On Thu, 11 Aug 2022, peter....@gmail.com wrote:

    My service provider has issues with newsgroups. The double-posting is not on purpose.


    Ah, I've been using Eternal September since my *previous* ISP dropped them
    (my current ISP dropped them around the same time but I wasn't with them
    then).

    -uso.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Vladimir Ivanov@21:1/5 to peter....@gmail.com on Fri Aug 12 23:30:41 2022
    On Friday, August 12, 2022 at 4:56:12 AM UTC+3, peter....@gmail.com wrote:
    mov ah, bl
    xor ah, 0x80
    and ah, [ra] ; but output differs, set V.
    and ah, 0x80
    jnz %%5 ; Output is different sign: skip.

    Interesting topic.

    One funny approach I used when developing Apple II emulator on a XT circa 1990 was to directly keep N/V/Z/C/ in their 8086 counterparts, then use POPF/PUSHF and get free results whenever possible. There was also code to do fixups now and then, as
    expected.

    Example of ROL:

    // ...
    popf
    rcl byte ptr [bx], 1
    pushf
    // ...

    Same holds true for bunch of other ALU operations.

    Looking back, I could've went with more profiling and compare this approach to others, but then again I was just a kid - learning and having fun.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Steve Nickolas@21:1/5 to Vladimir Ivanov on Sat Aug 13 08:56:55 2022
    On Fri, 12 Aug 2022, Vladimir Ivanov wrote:

    On Friday, August 12, 2022 at 4:56:12 AM UTC+3, peter....@gmail.com wrote:
    mov ah, bl
    xor ah, 0x80
    and ah, [ra] ; but output differs, set V.
    and ah, 0x80
    jnz %%5 ; Output is different sign: skip.

    Interesting topic.

    One funny approach I used when developing Apple II emulator on a XT
    circa 1990 was to directly keep N/V/Z/C/ in their 8086 counterparts,
    then use POPF/PUSHF and get free results whenever possible. There was
    also code to do fixups now and then, as expected.

    Example of ROL:

    // ...
    popf
    rcl byte ptr [bx], 1
    pushf
    // ...

    Same holds true for bunch of other ALU operations.

    Looking back, I could've went with more profiling and compare this
    approach to others, but then again I was just a kid - learning and
    having fun.


    I believe that's what Randy Spurlock's emulator also did.

    -uso.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)