RSS Forums RSS
Please support our Assembly advertiser: Programming Forums
Views: 2093 | Replies: 2
Reply
Join Date: Apr 2007
Posts: 1
Reputation: amrbekhit is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
amrbekhit amrbekhit is offline Offline
Newbie Poster

Understanding the 8088/86 JMP command

  #1  
Apr 29th, 2007
Hi all,

I've been trying to understand how an assembler assembles the JMP command. Consider the following code:

AGAIN:
    OUT 0,AL
    JMP AGAIN

The assembler turns this into the following hex:

E6 00 EB FC

The FC at the end corresponds to a displacement of -4. I would have thought that the displacement would only need to be -3 (FC->EB, EB->00, 00->E6). What is the reason for this extra move? I'm guessing this is related to the 8088 parallel fetch and execution.

Thanks

--Amr
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2005
Posts: 3,899
Reputation: Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of Salem has much to be proud of 
Rep Power: 23
Solved Threads: 442
Colleague
Salem's Avatar
Salem Salem is offline Offline
Senior Poster

Re: Understanding the 8088/86 JMP command

  #2  
Apr 29th, 2007
Maybe because PC is already pointing at the first byte of the next instruction, rather than the last data byte of the JMP instruction.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Reply With Quote  
Join Date: Sep 2006
Posts: 293
Reputation: Colin Mac is on a distinguished road 
Rep Power: 3
Solved Threads: 18
Colin Mac Colin Mac is offline Offline
Posting Whiz in Training

Re: Understanding the 8088/86 JMP command

  #3  
May 4th, 2007
Originally Posted by amrbekhit View Post
Hi all,

I've been trying to understand how an assembler assembles the JMP command. Consider the following code:

AGAIN:
    OUT 0,AL
    JMP AGAIN

The assembler turns this into the following hex:

E6 00 EB FC

The FC at the end corresponds to a displacement of -4. I would have thought that the displacement would only need to be -3 (FC->EB, EB->00, 00->E6). What is the reason for this extra move? I'm guessing this is related to the 8088 parallel fetch and execution.

Thanks

--Amr

Yeah, the program counter automatically points to the next instruction before the actual execution, so the jump back to FC is counted as well.
Last edited by Colin Mac : May 4th, 2007 at 12:26 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:00 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC