Skip to content

Commit

Permalink
Added test of IRQ timing. Sorted some of the newer tests a bit better.
Browse files Browse the repository at this point in the history
  • Loading branch information
FluBBaOfWard committed Jan 14, 2023
1 parent 34c3445 commit 6ce13f9
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The normal cycle count is achieved when:
3. There is no bus hold request.
4. Word data is allocated to even addresses. (Word access to odd address adds 1 cycle)
5. Registers required for calculating effective addresses (BX, BP, SP, SI, DI, etc.) do not change at immediately preceding instruction.
6. There is only 1 register required for calculating effective addresses. (All tested instructions adds 2 cycles except LEA, LDS & LES which only adds 1 cycle).
6. There is only 1 register required for calculating effective addresses. (All tested instructions adds 2 cycles except LEA, LDS, LES & POP Word which only adds 1 cycle).
7. The branching destination of a branch instruction is an even address. (Branching to odd address adds 1 cycle)

## Credits
Expand Down
56 changes: 32 additions & 24 deletions testcalls.asm
Original file line number Diff line number Diff line change
Expand Up @@ -393,29 +393,37 @@ execute 5, 58, teststringA84, test_A84
execute 6, 58, teststringA85, test_A85
execute 7, 58, teststringA86, test_A86
execute 8, 58, teststringA87, test_A87
execute 9, 74, teststringEA11, test_EA11
execute 10, 78, teststringEA69, test_EA69
execute 11, 66, teststringEA89, test_EA89
execute 12, 62, teststringEA8D, test_EA8D
execute 13, 74, teststringEA8F, test_EA8F
execute 14, 82, teststringEAC4, test_EAC4
execute 15, 82, teststringEAC5, test_EAC5
execute 16, 74, teststringEAFF, test_EAFF
;execute 17, 86, teststringEAC4, test_EAC42
execute 17, 86, teststringEAC5, test_EAC52
test20end:

testgroup 21
execute 1, 74, teststringEA11, test_EA11
execute 2, 78, teststringEA69, test_EA69
execute 3, 66, teststringEA89, test_EA89
execute 4, 62, teststringEA8D, test_EA8D
execute 5, 66, teststringEA8D, test_EA8DX
execute 6, 62, teststringEA8D, test_EA8DY
execute 7, 74, teststringEA8F, test_EA8F
execute 8, 82, teststringEAC4, test_EAC4
execute 9, 82, teststringEAC4, test_EAC42
execute 10, 82, teststringEAC5, test_EAC5
execute 11, 86, teststringEAC5, test_EAC52
execute 12, 74, teststringEAFF, test_EAFF
execute 13, 70, teststringA00, test_A00X
execute 14, 66, teststringA04, test_A04X
test21end:

testgroup 22
execute 1,300, teststringEx62,test_Ex62
execute 2,281, teststringExCE,test_ExCE
execute 3,281, teststringExD4,test_ExD4
execute 4,289, teststringEI36,test_EI36
execute 5,300, teststringEI37,test_EI37
execute 6,289, teststringEI3E,test_EI3E
execute 7,300, teststringEI3F,test_EI3F
test21end:
execute 8,293, teststringExIrq,test_ExIrq
test22end:

testgroup 22
testgroup 23
execute 1, 78, teststringR6C0,test_R6C0
execute 2,101, teststringR6C1,test_R6C1
execute 3, 23, teststringR6C, test_R6C
Expand All @@ -428,18 +436,18 @@ execute 9, 23, teststringR6E, test_R6E
execute 10, 78, teststringR6F0,test_R6F0
execute 11,101, teststringR6F1,test_R6F1
execute 12, 23, teststringR6F, test_R6F
test22end:
test23end:

testgroup 23
testgroup 24
execute 1, 78, teststringRA40,test_RA40
execute 2,105, teststringRA41,test_RA41
execute 3, 27, teststringRA4, test_RA4
execute 4, 78, teststringRA50,test_RA50
execute 5,105, teststringRA51,test_RA51
execute 6, 27, teststringRA5, test_RA5
test23end:
test24end:

testgroup 24
testgroup 25
mov si, 0
mov di, scratchspace
mov cx, TESTCOUNT
Expand All @@ -456,9 +464,9 @@ execute 9, 39, teststringRA7, test_RA7
execute 10, 78, teststringQA70,test_QA70
execute 11,117, teststringQA71,test_QA71
execute 12, 39, teststringQA7, test_QA7
test24end:
test25end:

testgroup 25
testgroup 26
execute 1, 78, teststringRAA0,test_RAA0
execute 2,101, teststringRAA1,test_RAA1
execute 3, 23, teststringRAA, test_RAA
Expand All @@ -471,9 +479,9 @@ execute 9, 23, teststringRAC, test_RAC
execute 10, 78, teststringRAD0,test_RAD0
execute 11,101, teststringRAD1,test_RAD1
execute 12, 23, teststringRAD, test_RAD
test25end:
test26end:

testgroup 26
testgroup 27
mov ax, 0x1212
mov di, scratchspace
mov cx, TESTCOUNT
Expand All @@ -490,13 +498,13 @@ execute 9, 35, teststringRAF, test_RAF
execute 10, 78, teststringQAF0,test_QAF0
execute 11,113, teststringQAF1,test_QAF1
execute 12, 35, teststringQAF, test_QAF
test26end:
test27end:

testgroup 27
execute 1,117, teststringZ62, test_Z62
testgroup 28
;execute 1,117, teststringZ62, test_Z62
execute 2, 58, teststringZ8C, test_Z8C
execute 3, 58, teststringZ8D, test_Z8D
execute 4, 62, teststringZ8E, test_Z8E
execute 5, 86, teststringZC4, test_ZC4
execute 6, 86, teststringZC5, test_ZC5
test27end:
test28end:
80 changes: 63 additions & 17 deletions tests_op.asm
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ dest_op7A:
ret

test_op7B:
mov bl, 0
xor bl, bl
align 2
repeat_op7B:
fill_prefetch
Expand Down Expand Up @@ -1014,7 +1014,7 @@ dest_opE2:
ret

test_opE3:
mov cx, 0
xor cx, cx
mov bx, TESTCOUNT
align 2
repeat_opE3:
Expand Down Expand Up @@ -1126,7 +1126,7 @@ test_opF4:
mov al, INT_SERIAL_SEND | INT_VBLANK_START
out IO_INT_ENABLE, al
dotest hlt, opF4
mov al, 0
xor al, al
out IO_COMM_DIR, al
out IO_INT_ENABLE, al
dec al
Expand Down Expand Up @@ -1468,6 +1468,18 @@ test_EA8D:
dotest {lea ax, [bx + si]}, EA8D
ret

test_EA8DX:
and bx, 0xFFFE
and si, 0xFFFE
dotest2 {add bx, 2}, {lea ax, [bx + si]}, EA8DX
ret

test_EA8DY:
and bx, 0xFFFE
and si, 0xFFFE
dotest2 {add si, 2}, {lea ax, [si]}, EA8DY
ret

test_EA8F:
and bx, 0xFFFE
and si, 0xFFFE
Expand All @@ -1482,6 +1494,18 @@ test_EAC4:
pop es
ret

test_EAC42:
and bx, 0xFFFE
and si, 0xFFFE
push ds
push es
mov ax, 0xFFFF
mov ds, ax
dotest {les ax, [bx + si]}, EAC42
pop es
pop ds
ret

test_EAC5:
mov bx, mySegmentPtr
sub bx, 0x100
Expand All @@ -1491,30 +1515,29 @@ test_EAC5:
pop ds
ret

test_EAC52:
mov bx, 0x0300
mov si, 0x4760
push ds
dotest {lds ax, [bx + si]}, EAC52
pop ds
ret

test_EAFF:
and bx, 0xFFFE
and si, 0xFFFE
dotest2 push word [bx + si], {add sp, 2}, EAFF
ret

test_EAC42:
test_A00X:
and bx, 0xFFFE
and si, 0xFFFE
push ds
push es
mov ax, 0xFFFF
mov ds, ax
dotest {les ax, [bx + si]}, EAC42
pop es
pop ds
dotest2 {add bx, 2}, {mov al, [bx + si]}, A00X
ret

test_EAC52:
mov bx, 0x0300
mov si, 0x4760
push ds
dotest {lds ax, [bx + si]}, EAC52
pop ds
test_A04X:
and si, 0xFFFE
dotest2 {add si, 2}, {mov al, [si]}, A04X
ret


Expand Down Expand Up @@ -1590,6 +1613,29 @@ repeat_EI3F:
jnz repeat_EI3F
ret

test_ExIrq:
mov al, COMM_ENABLE | COMM_SPEED_38400
out IO_COMM_DIR, al
mov al, INT_SERIAL_SEND
out IO_INT_ENABLE, al

align 2
.loop:
fill_prefetch
nop
sti
mov al, 0
dec cx
jnz .loop

cli
xor al, al
out IO_COMM_DIR, al
out IO_INT_ENABLE, al
dec al
out IO_INT_ACK, al
ret

;#################################################################
;############ Group Repeat
;#################################################################
Expand Down
2 changes: 2 additions & 0 deletions texts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ teststringA84 : db "Adr EA84 :", 0
teststringA85 : db "Adr EA85 :", 0
teststringA86 : db "Adr EA86 :", 0
teststringA87 : db "Adr EA87 :", 0

teststringEA11: db "ADC[2r],r:", 0
teststringEA69: db "MUL [r+r]:", 0
teststringEA89: db "MOV[2r],r:", 0
Expand All @@ -364,6 +365,7 @@ teststringEI36: db "F6 6 DIV :", 0
teststringEI37: db "F6 7 IDIV:", 0
teststringEI3E: db "F7 6 DIV :", 0
teststringEI3F: db "F7 7 IDIV:", 0
teststringExIrq: db "IRQ :", 0

teststringR6C0: db "RepINSB 0:", 0
teststringR6C1: db "RepINSB 1:", 0
Expand Down
32 changes: 27 additions & 5 deletions timingtest.asm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ initialize:
mov byte [es:pageCounter], 0

;-----------------------------------------------------------------------------
; register our vblank interrupt handler
; register our interrupt handlers
;-----------------------------------------------------------------------------
mov ax, INT_BASE
out IO_INT_BASE, al
Expand All @@ -91,15 +91,29 @@ initialize:
mov word [es:di], vblankInterruptHandler
mov word [es:di + 2], MYSEGMENT

mov di, INTVEC_SERIAL_SEND
add di, ax
shl di, 2
mov word [es:di], serialTxInterruptHandler
mov word [es:di + 2], MYSEGMENT

mov di, 0*4 ; Division error vector
mov word [es:di], divisionErrorHandler
mov word [es:di + 2], MYSEGMENT

mov di, 3*4 ; int 3 vector
mov di, 1*4 ; Trap/Brk vector
mov word [es:di], trapHandler
mov word [es:di + 2], MYSEGMENT

mov di, 2*4 ; NMI vector
mov word [es:di], nmiHandler
mov word [es:di + 2], MYSEGMENT

mov di, 3*4 ; Int 3 vector
mov word [es:di], int3Handler
mov word [es:di + 2], MYSEGMENT

mov di, 4*4 ; brkv vector
mov di, 4*4 ; BrkV vector
mov word [es:di], brkvHandler
mov word [es:di + 2], MYSEGMENT

Expand Down Expand Up @@ -188,6 +202,14 @@ boundErrorHandler:
vblankInterruptHandler:
iret

align 2
serialTxInterruptHandler:
add sp, 4
pop ax ; flags
and ah, 0xFD ; Clear Interrupt
push ax
sub sp, 4
iret

waitLine:
in al, IO_CUR_LINE
Expand Down Expand Up @@ -255,7 +277,7 @@ divrepeat:
; common test macros
;-----------------------------------------------------------------------------

%macro fill_prefetch 0
%macro fill_prefetch 0
nop
nop
nop
Expand Down Expand Up @@ -341,7 +363,7 @@ runtest:
call printnumber
xor dx, dx

;set up timer test
; set up timer test
xor al, al
out IO_TIMER_CTRL, al
mov ax, 350
Expand Down

0 comments on commit 6ce13f9

Please sign in to comment.