English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 21 August 2011, 23:22   #1
jman
Registered User
 
Join Date: Nov 2010
Location: .
Posts: 351
Short branch converted to NOP

Hello,

I've enabled all compile warnings on DevPac and I see a couple of interesting things, for example this (meaningless) code:

Code:
main:
    moveq    #0,d0
    bra.s    .here
.here
    moveq    #1,d0
    rts
    
    end
triggers the warning mentioned in the subject: "short branch converted to NOP".

Inserting a NOP between the BRA and the local label solves. Or remove the branch.
The DevPac warning that manages this is "NULL branches to NOP - ON/OFF/WARN".

But what it is exactly that is bothering the assembler? Is it just a "style" suggestion?

thx
jman is offline  
Old 22 August 2011, 00:10   #2
Siggy999
Registered User
 
Siggy999's Avatar
 
Join Date: Mar 2008
Location: Las Vegas/Nevada
Posts: 103
I don't think it's bothering it, more trying to do you a favor.

'Hey, you have this statement here you don't need.. I can just do nothing and it will be more efficient'

You're just 'branching' to the next instruction - if you insert the nop, you have thing to jump-over, something to branch to.

or the alternative: remove the statement that does nothing.

(I actually get this one come up on me from time to time as I have a habit of putting in a branch and a label when I'm working on something with a comment 'blah blah' goes here - so the branch is going to be eventually needed, I've just not coded that little bit - I've taken to doing a nop followed by the 'blah blah' comment...)
Siggy999 is offline  
Old 22 August 2011, 08:05   #3
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Instruction:

bra.s label
label:

does not exist!

It would have instruction opcode of 6000 (60 XX where XX = 8-bit jump offset) which is reserved for bra.w (two word instruction 6000 xxxx where xxxx = 16-bit offset)

Also 60FF = bra.l (three word instruction 60FF xxxx xxxx where xxxx xxxxx = 32-bit offset), 68020+ only. (Some cracktro or trainer used 60FF to cause address error, on 68020+ it jumped to some random memory instead..)
Toni Wilen is online now  
Old 22 August 2011, 08:22   #4
jman
Registered User
 
Join Date: Nov 2010
Location: .
Posts: 351
Quote:
Originally Posted by Toni Wilen View Post
It would have instruction opcode of 6000 (60 XX where XX = 8-bit jump offset) which is reserved for bra.w (two word instruction 6000 xxxx where xxxx = 16-bit offset)

Also 60FF = bra.l (three word instruction 60FF xxxx xxxx where xxxx xxxxx = 32-bit offset), 68020+ only. (Some cracktro or trainer used 60FF to cause address error, on 68020+ it jumped to some random memory instead..)
Amazing! Thank you Toni.
jman is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
68060 branch prediction documentation Nut Coders. General 12 01 December 2016 21:51
Anyone for CD32 isos to be converted to .ccd's ? NewDeli support.Games 26 11 February 2016 13:45
Games which were converted more than once antonvaltaz Nostalgia & memories 15 04 June 2015 12:12
Games that you wished were converted to the Amiga. 7-Zark-7 Nostalgia & memories 166 30 May 2012 12:06
Converted amiga fonts thinlega Amiga scene 11 20 January 2003 17:58

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:09.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.34999 seconds with 13 queries