Skip to content

Commit

Permalink
#21 Fixed 32/16 signed division test.
Browse files Browse the repository at this point in the history
  • Loading branch information
FluBBaOfWard committed Oct 11, 2023
1 parent d415478 commit 6644408
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ If division exception:
AX/AW is not modified.
```

### IDIV / DIV (signed division, 32/16)

```text
If dividing 0x80000000 by 0x0000 you will not get a division exception but a result of 0x00008001.
Normaly:
AuxCarry, Carry, Overflow, Parity & Sign are all cleared.
Zero is set when remainder is zero and bit 0 of result is set.
If division exception:
AuxCarry, Carry, Overflow, Parity & Sign are all cleared.
Zero is set in some weird way (not tested).
AX/AW, DX/DW is not modified.
```

### AAM / CVTBD (8/8)

```text
Expand Down
19 changes: 9 additions & 10 deletions WSCpuTest.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4756,7 +4756,7 @@ testDivs16Single:
and cx, 0xFFBF ; Mask out Zero flag
divs16DoZTst:
cmp cx, 0
; jnz divs16Failed
jnz divs16Failed
mov bl, [es:expectedException]
xor al, bl
jnz divs16Failed
Expand Down Expand Up @@ -4793,7 +4793,7 @@ divs16DoZTst:
and cx, 0xFFBF ; Mask out Zero flag
divs16DoZTst2:
cmp cx, 0
; jnz divs16Failed
jnz divs16Failed
mov bl, [es:expectedException]
xor al, bl
jnz divs16Failed
Expand Down Expand Up @@ -4835,7 +4835,6 @@ calcDivs16Result:
neg bx
den16Pos:
cmp dx, 0
jz divs16Done
jns enum16Pos
not ax
not dx
Expand Down Expand Up @@ -4880,11 +4879,11 @@ rest16Pos:
mov cx, 0xF202 ; Expected flags
mov byte [es:expectedException], 0
divs16SetZ:
; cmp dx, 0
; jnz divs16Done
; test al, 1
; jz divs16Done
; or cl, 0x40
cmp dx, 0
jnz divs16Done
test al, 1
jz divs16Done
or cl, 0x40
divs16Done:
mov [es:expectedResult1], ax
mov [es:expectedResult2], dx
Expand All @@ -4898,10 +4897,10 @@ divs16Error:
jnz divs16ErrCnt
cmp ax, 0x0000
jnz divs16ErrCnt
mov ax, 0x8100
mov ax, 0x8001
xor dx, dx
mov cx, 0xF202 ; Expected flags
jmp divs16SetRes
jmp rest16Pos
divs16ErrCnt:
mov cx, 0xF202 ; Expected flags
mov byte [es:expectedException], 1
Expand Down

0 comments on commit 6644408

Please sign in to comment.