Re: A89: dumb question


[Prev][Next][Index][Thread]

Re: A89: dumb question




In a message dated 99-06-18 17:12:21 EDT, you write:

> clr.w would clear that byte, and whatever byte is stored after.
>  
>  
>  so if you have 
>  
>  whatever dc.b xx
>  foo      dc.b yy
>  
>  then clr.w whatever would clear both whatever and foo.
>  
>  clr.l would clear the byte, and the 3 bytes after..
>  
>  You see.. it is like this..  a label is nothing more (or less) than a name 
> of an
>  address.
>  dc.b does no more (or less) then to put in a  byte of that value in your
>  compiled program at that point.
>  
>  so what you do, with 
>  whatever dc.b xx
>  is that you put in a byte with the value xx an address that you name "
> whatever".
>  
>  then when you write clr.w whatever, the compiler first translates 
"whatever" 
> to
>  the memoryaddress it is equal to, and puts it with the clr.w opcode.
>  
>  to take another example.. the compiled code for 
>  
>  move.w d0,d1 
>  rts
>  
>  is $32004e75
>  
>  so it is perfectly leagal to write
>  
>  pointless_sub: dc.w $3200,4e75
>  
>  and then anywhere in your code do a "bsr pointless_sub"
>  it will work just perfectly.
>  
>  the fun thing with this is that you in you program then can write "move.w
>  #3210,pointless_sub"
>  and suddenly your little subroutine has morfed itself into
>  
>  move.w (a0),d1
>  rts
>  
>  !!
>  
>  It is that simple..  no magic at all.. :)
>  
thanks olle...i seem to keep ignoring memory addresses (probably do to the 
fact that this is the first language i have tried to program in where you 
have to worry about where certain things are in memory)...one "pointless" (i 
would say "dumb but some idiot may give a speech about no dumb questions-just 
dumb people) question though...you wrote:

" to take another example.. the compiled code for 
 move.w d0,d1 
 rts
 is 
 $32004e75"
i know you took a random address, but which part of this ($32004e75) is the 
hex opcode for move???and how would you distinguish what you are talking 
about (b/w/lw) when doing hex???