Search code examples
testingemulationromintel-8080

Unexpected Result in Intel 8080 Test ROM TST8080.ASM


I am creating an Intel 8080 and was running a test ROM named TST8080.ASM that I found at this Webiste. I am failing when this block of code runs:


CPOI:   RPE     ;TEST "RPE"

    ADI 010H    ;A=99H,C=0,P=0,S=1,Z=0

    CPE CPEI    ;TEST "CPE"

    ADI 002H    ;A=D9H,C=0,P=0,S=1,Z=0

    RPO     ;TEST "RPO"

    CALL    CPUER

I just don't understand why on the ADI instruction the parity flag is not set. When converting 99H to binary I get 10011001 which is an even number of bits yet the tests seems to expect the parity flag to not be set. If anyone could shed some light I would be grateful... Thx

I have read the Intel 8080 Manual which states "Byte "parity" is checked after certain operations. The number of 1 bits in a byte are counted, and if the total is odd, "odd" parity is flagged; if the total is even, "even" parity is flagged. The Parity bit is set to 1 for even parity, and is reset to 0 for add parity.


Solution

  • Try this online 8080 emulator

    Enter the code:

    mvi a, 89h
    adi 10h
    

    Press step and observe that the parity bit is set: screenshot of online 8080 emulator