i tried to compile thie source code but it showed error message with
unmatched blocked nesting : code
am i missing out anything??
here i include the source code..
Code segment word public "CODE"
assume cs:Code , ds:nothing
extrn ZTimerOn:near
extrn ZTimerOff:near
extrn ZTimerReport:near
BASE_8253 equ 40h
TIMER_0_8253 equ BASE_8253 + 0
MODE_8253 equ BASE_8253 + 3
OCW3 equ 20h
IRR equ 20h
MPOPF macro
local p1,p2
jmp short p2
p1: iret
p2: push cs
call p1
endm
DELAY macro
jmp $+2
jmp $+2
jmp $+2
endm
OriginalFlags db ?
TimedCount dw ?
ReferenceCount dw ?
OverflowFlag db ?
memvar db ?
OutputStr label byte
db 0dh, 0ah, "Timed count: ",5 dup(?)
ASCIICountEnd label byte
db "microseconds",0dh , 0ah
db "$"
OverflowStr label byte
db 0dh, 0ah
db "****************************************************"
db 0dh, 0ah
db " * The timer overflowed, so the interval timed was *"
db 0dh, 0ah
db " * too long for the precision timer to measure. *"
db 0dh, 0ah
db " * Please perform the timing test again with the *"
db 0dh, 0ah
db " * long-period timer. *"
db 0dh, 0ah
db "****************************************************"
db 0dh, 0ah
db "$"
start:
push cs
pop ds
call ZTimerOn
rept 1000
mov al,
endm
call ZTimerOff
call ZTimerReport
mov ah,4Ch
int 21h
end start
ZTimerOn proc near
push ax
pushf
pop ax
mov cs:, ah
and ah,0fdh
push ax
sti
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
rept 10
jmp $+2
endm
cli
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
MPOPF
pop ax
ret
ZTimerOn endp
ZTimerOff proc near
push ax
push cx
pushf
mov al,00000000b
out MODE_8253,al
mov al,00001010b
out OCW3,al
DELAY
in al,IRR
and al,1
mov cs:,al
sti
in al,TIMER_0_8253
DELAY
mov ah,al
in al,TIMER_0_8253
xchg ah,al
neg ax
mov cs:,ax
mov cs:,0
mov cx,16
cli
RefLoop:
call ReferenceZTimerOn
call ReferenceZTimerOff
loop RefLoop
sti
add cs:,8
mov cl,4
shr cs:,cl
pop ax
mov ch,cs:
and ch,not 0fdh
and ah,0fdh
or ah,ch
push ax
MPOPF
pop cx
pop ax
ret
ZTimerOff endp
ReferenceZTimerOn proc near
push ax
pushf
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
MPOPF
pop ax
ret
ReferenceZTimerOn endp
ReferenceZTimerOff proc near
push ax
push cx
pushf
mov al,00000000b
out MODE_8253,al
DELAY
in al,TIMER_0_8253
DELAY
mov ah,al
in al,TIMER_0_8253
xchg ah,al
neg ax
add cs:,ax
MPOPF
pop cx
pop ax
ret
ReferenceZTimerOff endp
ZTimerReport proc near
pushf
push ax
push bx
push cx
push dx
push si
push ds
push cs
pop ds
assume ds:Code
cmp ,0
jz PrintGoodCount
mov dx,offset OverflowStr
mov ah,9
int 21h
jmp short EndZTimerReport
PrintGoodCount:
mov ax,
sub ax,
mov si,offset ASCIICountEnd - 1
mov dx,8381
mul dx
mov bx,10000
div bx
mov bx,10
mov cx,5
CTSLoop:
sub dx,dx
div bx
add dl,"0"
mov ,dl
dec si
loop CTSLoop
mov ah,9
mov dx,offset OutputStr
int 21h
EndZTimerReport:
pop ds
pop si
pop dx
pop cx
pop bx
pop ax
MPOPF
ret
ZTimerReport endp
Code ends
unmatched blocked nesting : code
am i missing out anything??
here i include the source code..
Code segment word public "CODE"
assume cs:Code , ds:nothing
extrn ZTimerOn:near
extrn ZTimerOff:near
extrn ZTimerReport:near
BASE_8253 equ 40h
TIMER_0_8253 equ BASE_8253 + 0
MODE_8253 equ BASE_8253 + 3
OCW3 equ 20h
IRR equ 20h
MPOPF macro
local p1,p2
jmp short p2
p1: iret
p2: push cs
call p1
endm
DELAY macro
jmp $+2
jmp $+2
jmp $+2
endm
OriginalFlags db ?
TimedCount dw ?
ReferenceCount dw ?
OverflowFlag db ?
memvar db ?
OutputStr label byte
db 0dh, 0ah, "Timed count: ",5 dup(?)
ASCIICountEnd label byte
db "microseconds",0dh , 0ah
db "$"
OverflowStr label byte
db 0dh, 0ah
db "****************************************************"
db 0dh, 0ah
db " * The timer overflowed, so the interval timed was *"
db 0dh, 0ah
db " * too long for the precision timer to measure. *"
db 0dh, 0ah
db " * Please perform the timing test again with the *"
db 0dh, 0ah
db " * long-period timer. *"
db 0dh, 0ah
db "****************************************************"
db 0dh, 0ah
db "$"
start:
push cs
pop ds
call ZTimerOn
rept 1000
mov al,
endm
call ZTimerOff
call ZTimerReport
mov ah,4Ch
int 21h
end start
ZTimerOn proc near
push ax
pushf
pop ax
mov cs:, ah
and ah,0fdh
push ax
sti
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
rept 10
jmp $+2
endm
cli
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
MPOPF
pop ax
ret
ZTimerOn endp
ZTimerOff proc near
push ax
push cx
pushf
mov al,00000000b
out MODE_8253,al
mov al,00001010b
out OCW3,al
DELAY
in al,IRR
and al,1
mov cs:,al
sti
in al,TIMER_0_8253
DELAY
mov ah,al
in al,TIMER_0_8253
xchg ah,al
neg ax
mov cs:,ax
mov cs:,0
mov cx,16
cli
RefLoop:
call ReferenceZTimerOn
call ReferenceZTimerOff
loop RefLoop
sti
add cs:,8
mov cl,4
shr cs:,cl
pop ax
mov ch,cs:
and ch,not 0fdh
and ah,0fdh
or ah,ch
push ax
MPOPF
pop cx
pop ax
ret
ZTimerOff endp
ReferenceZTimerOn proc near
push ax
pushf
mov al,00110100b
out MODE_8253,al
DELAY
sub al,al
out TIMER_0_8253,al
DELAY
out TIMER_0_8253,al
MPOPF
pop ax
ret
ReferenceZTimerOn endp
ReferenceZTimerOff proc near
push ax
push cx
pushf
mov al,00000000b
out MODE_8253,al
DELAY
in al,TIMER_0_8253
DELAY
mov ah,al
in al,TIMER_0_8253
xchg ah,al
neg ax
add cs:,ax
MPOPF
pop cx
pop ax
ret
ReferenceZTimerOff endp
ZTimerReport proc near
pushf
push ax
push bx
push cx
push dx
push si
push ds
push cs
pop ds
assume ds:Code
cmp ,0
jz PrintGoodCount
mov dx,offset OverflowStr
mov ah,9
int 21h
jmp short EndZTimerReport
PrintGoodCount:
mov ax,
sub ax,
mov si,offset ASCIICountEnd - 1
mov dx,8381
mul dx
mov bx,10000
div bx
mov bx,10
mov cx,5
CTSLoop:
sub dx,dx
div bx
add dl,"0"
mov ,dl
dec si
loop CTSLoop
mov ah,9
mov dx,offset OutputStr
int 21h
EndZTimerReport:
pop ds
pop si
pop dx
pop cx
pop bx
pop ax
MPOPF
ret
ZTimerReport endp
Code ends
end start
Should be at the end of your source file (after Code ends).
it works ady!
thanks a lot!! :D
thanks a lot!! :D
I'm going to chime in here, since a couple of beginners have asked me about this post.
That last statement in your source (END label) is particularly important, because the label whose name you give there is assumed to be your Program EntryPoint.. it's that last line which tells the assembler 'Hey Assembler, see this Label I just mentioned? That's where I want program execution to begin from".
It does not have to be called 'start', it could be anything you wanted, provided it's been defined someplace previously.
Note, it can identify a Procedure, rather than simply a code label.
Furthermore, any Logical Blocks which are 'open' will be Closed by the END statement, and this includes Segments.. even though your sourcecode may contain more lines after that END statement, they will be disregarded by the assembler.
I believe these behaviours are standard for 99% of 'modern' assemblers.
That last statement in your source (END label) is particularly important, because the label whose name you give there is assumed to be your Program EntryPoint.. it's that last line which tells the assembler 'Hey Assembler, see this Label I just mentioned? That's where I want program execution to begin from".
It does not have to be called 'start', it could be anything you wanted, provided it's been defined someplace previously.
Note, it can identify a Procedure, rather than simply a code label.
Furthermore, any Logical Blocks which are 'open' will be Closed by the END statement, and this includes Segments.. even though your sourcecode may contain more lines after that END statement, they will be disregarded by the assembler.
I believe these behaviours are standard for 99% of 'modern' assemblers.
unmatched blocked nesting
It is familiar to me.It could be lost .endif or end start or .endw.
;)
The "endm" statement within your ZTimerOn proc near could also cause your assembler to complain.
Raymond
Raymond