6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 12, 2024 7:51 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Dec 01, 2010 12:51 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
Hallo allemaal,


First this question: is there a VHDL core available of the 65816? AFAIK none. (T65 is incomplete; see its own comment)

Working at my own code I wondered if there is an advantage having a mixed 8/16-bit mode for the various registers. IMHO only 8/8 and 16/16 are sufficient. I realise that sometimes you are only allowed to read/write one specific byte because reading/writing the next byte as well could cause havoc (think of reading/writing of/to registers of an IC). But I cannot imagine reading/writing data byte-wise over a bigger range then 256 bytes. This would mean that 8/8 will do. But any good argument in favour of the 8/16 is welcome!

@ André:
I haven't found anything in your specs that support a mixed mode. So IMHO it won't hurt to think about it in case someone comes with a valid reason.

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 01, 2010 1:49 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 993
Location: near Heidelberg, Germany
Ruud wrote:
Hallo allemaal,
@ André:
I haven't found anything in your specs that support a mixed mode. So IMHO it won't hurt to think about it in case someone comes with a valid reason.


In my 65k specs the register width is determined with every opcode independently (using the prefix bytes), so there is no "mode" as such

André


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 01, 2010 2:52 pm 
Offline
User avatar

Joined: Fri Dec 12, 2003 7:22 am
Posts: 259
Location: Heerlen, NL
fachat wrote:
In my 65k specs the register width is determined with every opcode independently (using the prefix bytes), so there is no "mode" as such

OK, maybe "mode" wasn't the right word in this case. But you only provide two bits, RS0 and RS1, for the register size. So what about "LDA $1234,X"? "LDA.W $1234,X" means both (or at least A) registers are 16 bits wide. How can I tell the CPU to use the 8/16 combination?

_________________
Code:
    ___
   / __|__
  / /  |_/     Groetjes, Ruud
  \ \__|_\
   \___|       URL: www.baltissen.org



Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 01, 2010 3:14 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 993
Location: near Heidelberg, Germany
Ruud wrote:
fachat wrote:
In my 65k specs the register width is determined with every opcode independently (using the prefix bytes), so there is no "mode" as such

OK, maybe "mode" wasn't the right word in this case. But you only provide two bits, RS0 and RS1, for the register size. So what about "LDA $1234,X"? "LDA.W $1234,X" means both (or at least A) registers are 16 bits wide. How can I tell the CPU to use the 8/16 combination?


Ah, I see, I didn't get it the first time. The index registers are always full width. The "width" of the index register value is determined by the width of the opcodes you manipulate them with.

If you load an 8-bit value, the index register has the upper bits set to zero (see ZE prefix though...), so it's 8-bit. If you INX/INY with 8 bits width only, the index register value stays 8-bit. This takes advantage of the fact that index registers are not signed.

But you could also do:

Code:
    ; load "1" into X (with the operand being 8 bit,
    ; upper bits set to zero by default
    LDX #1
    ...
    ; increment X in 64 bit mode
    INX.Q


When used in an addressing mode, the index registers are always full length. So you could
Code:
    LDX.W #$1000
    LDA $F800,X

which would actually read a byte (LDA is not width-prefixed) from address $10800 (no bank boundaries)

This is exactly to avoid the double mode setting problem you asked about.

André


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: