home *** CD-ROM | disk | FTP | other *** search
- eseg segment at 0000h
- org 4*60h
- irq60ip dw ?
- irq60cs dw ?
- eseg ends
-
- dseg segment
- Header db '╔═════════════════════════════════════════════════════════════════════════════╗',0ah,0dh
- db '║ IBM PC Timing Program - Tests speed of 8088 µProcessor ║',0ah,0dh
- db '║ ───────────────written by Allen Priest──────────────── ║',0ah,0dh
- db '║ ║',0ah,0dh
- db '║ Times are based on the internal clock and are only ║',0ah,0dh
- db '║ accurate to 1/18 of a second. The number of clock ║',0ah,0dh
- db '║ cycles is based on an 8088 µP running at 4.77 MHz. ║',0ah,0dh
- db '╠═════════════════════════════════════════════════════════════════════════════╣',0ah,0dh,'$'
- Last db '╚═════════════════════════════════════════════════════════════════════════════╝',0ah,0dh,'$'
- TotTime dw 0
- E_Time dw ?
- Sec db ' 1/100 seconds $'
- Clocks db ' Clock Cycles/Instruction ║',0ah,0dh,'$'
- LOPMess db '║ Loops: $'
- DivMess db '║ Divides: $'
- IdiMess db '║ Signed Divides: $'
- MulMess db '║ Multiplies: $'
- ImuMess db '║ Signed Multiplies: $'
- AAMMess db '║ Ascii Adjusts for Mul: $'
- AADMess db '║ Ascii Adjusts for Div: $'
- ADDMess db '║ Additions: $'
- SUBMess db '║ Subtractions: $'
- CALMess db '║ Subroutine Calls: $'
- INTMess db '║ Interrupt Calls: $'
- JMPMess db '║ Short Jumps: $'
- CMPMess db '║ Compares: $'
- P_PMess db '║ Pushes and Pops: $'
- LoopCnt dw 0
-
- dseg ends
-
- cseg segment
- assume cs:cseg,ds:dseg,es:eseg
- main proc far
- start: push ds
- xor ax,ax
- push ax
- mov ax,dseg
- mov ds,ax
- mov ax,eseg
- mov es,ax
- mov es:[irq60ip],offset DummyInt
- mov es:[irq60cs],seg DummyInt
- mov dx,offset header
- mov ah,09h
- int 21h
- Call Set_Start
- Call Get_Start
- mov di,4
- LOP: mov cx,0ffffh
- mov bx,00001h
- mov ax,00001h
- mov dx,00000h
- Bloopl: loop bloopl
- dec di
- jnz LOP
- Call Get_Finish
- mov dx,offset LOPMess
- mov ah,09h
- int 21h
- Call Out_Time
- Mov LOOPCnt,ax
- Call Get_Start
- mov di,4
- Div: mov cx,0ffffh
- mov bx,00001h
- mov ax,00001h
- mov dx,00000h
- Bloop1: div bx
- loop bloop1
- dec di
- jnz Div
- Call Get_Finish
- mov dx,offset DivMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- IDiv: mov cx,0ffffh
- mov bx,00001h
- mov ax,00001h
- mov dx,00000h
- Bloop4: idiv bx
- loop bloop4
- dec di
- jnz Idiv
- Call Get_Finish
- mov dx,offset IdiMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- Mul: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop2: mul bx
- loop bloop2
- dec di
- jnz Mul
- Call Get_Finish
- mov dx,offset MulMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- IMul: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop5: imul bx
- loop bloop5
- dec di
- jnz IMul
- Call Get_Finish
- mov dx,offset ImuMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- AAM: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop3: aam
- loop bloop3
- dec di
- jnz AAM
- Call Get_Finish
- mov dx,offset AAMMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- AAD: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop6: aad
- loop bloop6
- dec di
- jnz AAD
- Call Get_Finish
- mov dx,offset AADMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- ADDING: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop7: add ax,[0000]
- loop bloop7
- dec di
- jnz ADDING
- Call Get_Finish
- mov dx,offset ADDMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- SUBING: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop8: sub ax,[0000]
- loop bloop8
- dec di
- jnz SUBING
- Call Get_Finish
- mov dx,offset SUBMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- CALL: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop9: Call Dummy
- loop bloop9
- dec di
- jnz CALL
- Call Get_Finish
- mov dx,offset CALMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- INT: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloop0: Int 60h
- loop bloop0
- dec di
- jnz INT
- Call Get_Finish
- mov dx,offset INTMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- JMP: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloopa: jmp Dumb
- Dumb: loop bloopa
- dec di
- jnz JMP
- Call Get_Finish
- mov dx,offset JMPMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- CMP: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloopb: cmp ax,[0000]
- loop bloopb
- dec di
- jnz CMP
- Call Get_Finish
- mov dx,offset CMPMess
- mov ah,09h
- int 21h
- Call Out_Time
- Call Get_Start
- mov di,4
- P_P1: mov cx,0ffffh
- mov bx,00000h
- mov ax,00001h
- mov dx,00000h
- Bloopc: push ax
- pop ax
- loop bloopc
- dec di
- jnz P_P1
- Call Get_Finish
- mov dx,offset P_PMess
- mov ah,09h
- int 21h
- Call Out_Time
- mov dx,offset last
- mov ah,09h
- int 21h
- Call Set_End
- ret
- main endp
-
- Dummy proc near
- ret
- Dummy endp
-
- DummyInt proc near
- iret
- DummyInt endp
-
- Set_Start proc near
- mov ah,02ch
- int 21h
- xor bx,bx
- mov bl,dl
- mov al,dh
- mov cl,100
- mul cl
- add bx,ax
- mov TotTime,bx
- ret
- Set_Start endp
-
- Set_End proc near
- mov ax,TotTime
- mov cl,100
- div cl
- mov TotTime,ax
- mov ah,02ch
- int 21h
- mov dx,TotTime
- cmp dh,60
- jl SetTime
- inc cl
- sub dh,60
- cmp cl,60
- jl SetTime
- inc ch
- sub cl,60
- cmp ch,23
- jl SetTime
- mov ch,00
- SetTime:
- mov ah,02dh
- int 21h
- ret
- Set_End endp
-
- Get_Start proc near
- mov ah,02ch
- int 21h
- mov dx,0000h
- mov ah,02dh
- int 21h
- ret
- Get_Start endp
-
- Get_Finish proc near
- mov ah,02ch
- int 21h
- mov E_Time,DX
- ret
- Get_Finish endp
-
- Out_Time proc near
- mov ax,E_Time
- mov bx,ax
- xor bh,bh
- mov al,ah
- mov cl,100
- mul cl
- add bx,ax
- add TotTime,bx
- push bx
- call binidec
- mov dx,offset sec
- mov ah,09h
- int 21h
- pop bx
- mov ax,bx
- shl ax,1
- mov dx,0000
- mov cx,11
- div cx
- cmp dx,3
- jl OutDec
- add ax,1
- OutDec: sub ax,LoopCnt ;subtract time of LOOP instruction
- mov bx,ax
- push ax
- call binidec
- mov dx,offset clocks
- mov ah,09h
- int 21h
- pop ax
- ret
- Out_Time endp
-
- include outdec.asm
-
- cseg ends
- end start
-
-
-
-