On 1997-11-06 (00:20) SCOTT MCNAY wrote about JMP $+2
SM> Sorry, but I must agree with Tim; it's poor programming practice. As an
SM> example, I wouldn't care to work with code that looked like this:
SM> jmp $+60
SM> Part2:
SM> xxx
SM> xxx
SM> xxx
SM> xxx
SM> xxx
SM> xxx
SM> jmp $-33
SM> Part3:
SM> xxx
SM> xxx
SM> xxx
SM> ...etc.
As the original question had to do with the jmp $+2 instruction and
you are against it's use because it's hard to read, then try a macro
as in this code snippet.
;
; Delay macro
;
delay macro
jmp $+2
endm
;
; Handy little macro to get the timer 0 value into AX
;
get_timer_0_value macro
mov al,0 ;Latch timer 0
out 43h,al
delay ;Wait for the hardware to respond
in al,40h ;Get LSB
mov ah,al
delay
in al,40h ;Get MSB
xchg ah,al ;Put LSB and MSB into their proper places
endm
SM> Tell me, with code like that, how do you know where the destination
SM> of the jmp is? Furthermore, how do you add more code between the jmp
SM> and it's destination without hand-recalculating everything, and
SM> hoping you don't mis-calculate the size of an instruction or mis-add?
Very easy for a true programmer. You let the assembler compute the
length(s) or offsets.
org 100h
begin: jmp main
crlf db 13,10,"$"
hello db "Hello, Buu Huynh"
len dw $ - hello
main:
Isn't that easy?
Later,
Steve
---
* QMPro 1.53 * steven.read@pcohio.com (in western New York state, USA)
--- InterEcho 1.19
---------------
* Origin: PC-Ohio PCBoard * Cleveland, OH * 216-381-3320 (1:157/200)
|