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:

http://books.google.com/books?id=vemtopapezkc&pg=pt327&lpg=pt327&dq=how+to+far+jump+to+label+assembly&source=bl&ots=_jhsgrwdfg&sig=c63qurl0flvhdv_ffrdm1oevbfs&hl=en&sa=x&ei=zowsubwxgcwdyah77icoca&ved=0cdwq6aewajgk

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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -