nasm - Assembly near jmp/far jmp to mnemonic real mode -
i apologize, problem simple i'm not coming solution. i've tried read articles, tutorials, , previous questions on matter (tried looking previous post on topic, if there one, must've used wrong vocab looking, , sincerely apologize); new , must missing small , simple.
i writing assembly , code works near jumps (like following, instructions executed)
org 0x500 jmp main %include "smallfile.inc" main: ;start instructions, these instructions executed
however, when include multiple files, larger files (following), doesn't make jump, instructions not executed. i've tried play around adding addresses before "main" mnemonic, understanding may off. in real mode, if helps.
how make following situation work?
org 0x500 jmp main %include "smallfile1.inc" ;couple bytes assembled , linked in %include "smallfile2.inc" ;couple bytes assembled , linked in %include "smallfile3.inc" ;couple bytes assembled , linked in %include "largefile.inc" ;couple hundred bytes assembled , linked in %include "largefile2.inc" ;couple hundred bytes assembled , linked in main: ;start instructions, these never reached
so doing more digging, stumbled across following resource:
to saw there called near jump...jmp near
in code. don't know how missed in previous hours of looking. when entered code resolved issue...
short jumps +- 127 relative bytes. near jumps 2gb within segment. far jumps or outside of segment; think may have been trying use far jump incorrectly.
the following fixed code;
org 0x500 jmp near main %include "smallfile1.inc" ;couple bytes assembled , linked in %include "smallfile2.inc" ;couple bytes assembled , linked in %include "smallfile3.inc" ;couple bytes assembled , linked in %include "largefile.inc" ;couple hundred bytes assembled , linked in %include "largefile2.inc" ;couple hundred bytes assembled , linked in main: ;start instructions, these instructions reached.
thank looked @ in attempts resolve issue. hope helps someday.
Comments
Post a Comment