JMP Table in MASM
From: Bryan Parkoff (bryan.nospam.parkoff_at_nospam.com)
Date: 05/30/04
- Next message: Ben Meyer: "Re: Interesting article by Randall Hyde"
- Previous message: René Kjellerup: "Re: opcode calculator??"
- Next in thread: arargh405NOSPAM_at_NOW.AT.arargh.com: "Re: JMP Table in MASM"
- Reply: arargh405NOSPAM_at_NOW.AT.arargh.com: "Re: JMP Table in MASM"
- Reply: Eduardo: "Re: JMP Table in MASM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 May 2004 18:55:15 +0000 (UTC)
How do I place JMP labels inside "TEST__Run PROC NEAR" rather than
outside "TEST__Run PROC NEAR"? I did try, but the JMP labels are not found
to match JMP TABLE in .DATA. It looks like JMP TABLE in .DATA is always
global while JMP labels inside "TEST__Run PROC NEAR" is always local. How
do local link global that it will work?
"SWITCH(xxx)" already has JMP labels inside function that it is written
in C/C++ source code, but I have MASM source code below. Please fix this or
give some suggestion. Thanks...
; Filename: TABLE.ASM
; Assemble options needed for ML: /c /Cx /coff
.386
.MODEL flat, C
.DATA
TABLE DD ONE
DD TWO
DD THREE
EXTRN A1:DWORD
EXTRN A2:DWORD
EXTRN A3:DWORD
.CODE
ONE:
MOV EAX, DWORD PTR [A1]
RET
TWO:
MOV EAX, DWORD PTR [A2]
RET
THREE:
MOV EAX, DWORD PTR [A3]
RET
TEST__Run PROC NEAR
MOV ECX, OFFSET TABLE
MOV EAX, 01H
JMP [EAX*4+ECX]
TEST__Run ENDP
END
-- Bryan Parkoff
- Next message: Ben Meyer: "Re: Interesting article by Randall Hyde"
- Previous message: René Kjellerup: "Re: opcode calculator??"
- Next in thread: arargh405NOSPAM_at_NOW.AT.arargh.com: "Re: JMP Table in MASM"
- Reply: arargh405NOSPAM_at_NOW.AT.arargh.com: "Re: JMP Table in MASM"
- Reply: Eduardo: "Re: JMP Table in MASM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]