Re: Questions for 65816 (3)

From: Stephen Judd (judd_at_merle.acns.nwu.edu)
Date: 1998-07-11 00:33:20

Hi Ruud!

> 1-   You can get the high- and lowbyte of an address using > and <:
> 
>           lda  #<(Label1)
>           ldx  #>(Label1)
> 
>      Is there a standard for the upper 8 bits?
> 
> I use the ! sign fot the moment:
> 
>      lda  #!($123456)   =   lda  #$12

According to my notes, the 816 syntax for byte selection is

	Operand	     One byte result   Two byte result
	#$01020304	   04              04 03
	#<$01020304	   04              04 03
	#>$01020304        03              03 02
	#^$01020304        02		   02 01

As you can see, ^ is the way to specify the high 8 bits.  Also note
the two-byte result of ^.  The bang ! can be used in place of the 
pipe | character (lucky for us CBM types), which along with < and > is 
used to specify the length of an address:

	<	One byte    (direct page a.k.a. zero page)
	| or !	Two bytes   (absolute)
	>	Three bytes (long absolute)

Thus LDA $0203 and LDA !$010203 are the same thing.
	
> 2-   Is there an other, more easy, way to note this down?
>      (personal use at the moment:   MVN  !(destiny) , !(source) )

The usual format is just

	MVN src,dest

For example, MVN $01,$02.  Note that src comes first, but is assembled
in opposite order (like lo/hi format):

$C000 54 02 01	MVN $01,$02

As you probably know, .A is loaded with the number of bytes-1 to move,
.X contains the low order bits of the source, .Y contains the low 16 bits
of dest, and DBR is set to the destination argument:

MVN srcbnk,destbnk

Instruction:	opcode destbnk srcbnk

Source address: | srcbnk | .X register 16 bits |
Dest address:   |  DBR   | .Y register 16 bits |

destbnk -> DBR
Increment or decrement .X and .Y
Decrement .C if greater than zero, otherwise PC -> PC+3

> 3-   PEA is an immediate instruction:   PEA #$1234 ?

PEA stands for Push Effective Absolute: PEA $1234

> 4-   PEI is a zeropage instruction:     PEI $12    ?

PEI stands for Push Effective Indirect: PEI ($12)

You didn't ask about PER, but I'll tell you about it anyways :)
I think it's one of the niftiest instructions.  It pushes a 16-bit
PC-relative address on the stack, and the format is the same as a 
(long) branch.

	PER Olafsson	;Push relative address of Olafsson
	...code		;but not address of Olafsson's relatives
Olafsson 

This makes it easier to write relocatable programs.

BTW, have you seen Brett Tabke's 65816 document?  It is on the WDC 
webpage, and the CMD webpage has a link to it.  It's pretty useful.

-Steve
-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tcm.hut.fi.

Archive generated by hypermail 2.1.1.