65ORG16.b Core
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
Hi Ed
I was just trying to get a grasp on how big this core is and only now at the very end of completion do I truly understand all the opcodes and how they work. Details are much clearer now and there's not actually so many opcodes as I originally thought.
I'm not so sure I like attaching the spec's at the head post. I'm not the best writer and I know some things will change and as I found out, in order to change or update a file means one has to copy, delete, then paste and update the post.
I was just trying to get a grasp on how big this core is and only now at the very end of completion do I truly understand all the opcodes and how they work. Details are much clearer now and there's not actually so many opcodes as I originally thought.
I'm not so sure I like attaching the spec's at the head post. I'm not the best writer and I know some things will change and as I found out, in order to change or update a file means one has to copy, delete, then paste and update the post.
- Attachments
-
- 65016.b.zip
- 65Org16.b Spec's
- (180.28 KiB) Downloaded 127 times
-
teamtempest
- Posts: 443
- Joined: 08 Nov 2009
- Location: Minnesota
- Contact:
Re: 65ORG16.b Core
Quote:
TT: would the HXA be able to support two syntaxes for the same opcode, so that
Code: Select all
LDA #$AB
LDA addr
LDA addr,X
LDA addr,Y
LDA (addr),Y
LDA (addr,X)
The macro version has to deal with the same things, of course. The way I handle it is to define a macro with the name of a mnemonic with as many arguments as there could legally be at most:
Code: Select all
LDA .macro ?addr=@, ?ndx=@
..body..
.endmCode: Select all
LDA #$45In short there's no problem defining as many arguments as you want, with as many of them having default values as you want, to make the job of generating code as easy as you want. For example, the only reason '?addr' has a default value at all is so that if someone perchance ever wrote LDA without any arguments at all, the macro code can issue a more-or-less meaningful error message (if '?addr' had no default value HXA would complain about the missing argument itself, though).
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
I just ran a test program that is meant to fill the 4GB ($00010000-$FFFFFFF) worth of addressable memory using the W register in indirect indexed mode. I only let it run slightly past the 1st block to make sure it works properly. It's exactly like the bottom program which is more familiar to most folks.
Code: Select all
START LDWi
.BYTE $0000
STWzp
.BYTE $0000
LDWi
.BYTE $0001
STWzp
.BYTE $0001
LDX #$FFFE
LDA #$00A5
AD LDWi
.BYTE $0000
AA STazpw
.BYTE $0000
INW
BNE AA
INC $0001
DEX
BNE AD
NOP
NOP
lda #$0000
sta $0000
lda #$0001
sta $0001
lda #$00a5
ldx #$fffe
ac ldy #$0000
ab sta ($0000),y
iny
bne ab
inc $0001
dex
bne ac
NOP
NOP-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
I set the stack to be the same page as zero page, I think 64K is plenty for variable and stack. I found one more error in decoding upper 8 bits of PUSH/PULLs. Added some more macro's to github. Now this little programs works:
Code: Select all
START LDA #$00
INC A
PHA
TAB
INCB
PHB
TBC
INCC
PHC
TCD
INCD
PHD
TDE
INCE
PHE
TEF
INCF
PHF
TFG
INCG
PHG
TGH
INCH
PHH
THI
INCI
PHI
TIJ
INCJ
PHJ
TJK
INCK
PHK
TKL
INCL
PHL
TLM
INCM
PHM
TMN
INCN
PHN
TNO
INCO
PHO
TOQ
INCQ
PHQ
LDWi
.BYTE $FFFF
TWA
TWB
TWC
TWD
TWE
TWF
TWG
TWH
TWI
TWJ
TWK
TWL
TWM
TWN
TWO
TWQ
PLQ
PLO
PLN
PLM
PLL
PLK
PLJ
PLI
PLH
PLG
PLF
PLE
PLD
PLC
PLB
PLA
NOP
NOP
NOPRe: 65ORG16.b Core
I am considering that a register for the upper 'byte' of the stack pointer would be a good thing.
Cheers
Ed
Cheers
Ed
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
That's a good idea. Maybe use the unused upper 8 bits of the status register? Now how to go about coding for it... There are really $FFFF-1 possibilities where the stack could be, everywhere except the top due to the NMI/RES/IRQ vectors.
Re: 65ORG16.b Core
ElEctric_EyE wrote:
That's a good idea. Maybe use the unused upper 8 bits of the status register? Now how to go about coding for it... There are really $FFFF-1 possibilities where the stack could be, everywhere except the top due to the NMI/RES/IRQ vectors.
Re: 65ORG16.b Core
I mused out loud a few minutes ago in another thread:
Quote:
I'm wondering about
which exchanges with a numbered Special Register - that allows for extensibility without needing more opcodes if we have more registers. For example, the 65Org16 could have a Stack High Address register, which allows us to overlap stack with zero page, or to place stack at the top of memory as mentioned earlier. Indeed, the 65Org16 could have a relocatable zero page, as the 816 does.
Code: Select all
XSR #literal
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
It seems pretty straightforward. 16 registers is an abundance and without creating more opcodes, I think it would be wise to dedicate 2 existing registers O and Q for the Zero Page Address Register and Stack Page Address Register.
Re: 65ORG16.b Core
Hi Ed,
probably a good idea, because these special registers have to be kept outside the register file, so they won't fit in the regular opcode matrix anyway.
probably a good idea, because these special registers have to be kept outside the register file, so they won't fit in the regular opcode matrix anyway.
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
It appears to work! I ran the push/pull program from the other post when Q = 0 it starts pushing at $0000FFFB, then I put $0001 in the Q Accumulator, ran the program again and it starts pushing at $0001FFFB. I defined the 2 Registers before as 16-bit wide and added this:
Code: Select all
/*
* Zero Page, Stack Address Register update
*
*/
always @*
begin
ZEROPAGEReg <= QAWXYS[SEL_O];
STACKPAGEReg <= QAWXYS[SEL_Q];
end -
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
So now I'm thinking (uh-oh), of using a bit in the processor status register to enable or disable the transfer of data, from O and Q Accumulators to the ZEROPAGEReg/STACKPAGEReg registers, with a status bit. This will enable the O and Q acc's to not be dedicated unless the bit is set first.
I was thinking also there should be 2 new opcodes to set or clear any of the bits in the processor status register. A simple Load Processor Status Register with a value. Then a Store value of Procesor Status Register, because just pushing it on the stack will not suffice wen the stack locaion is changing...
I was thinking also there should be 2 new opcodes to set or clear any of the bits in the processor status register. A simple Load Processor Status Register with a value. Then a Store value of Procesor Status Register, because just pushing it on the stack will not suffice wen the stack locaion is changing...
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 65ORG16.b Core
Quote:
I was thinking also there should be 2 new opcodes to set or clear any of the bits in the processor status register. A simple Load Processor Status Register, and a simple Store Processor Status Register.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
-
ElEctric_EyE
- Posts: 3260
- Joined: 02 Mar 2009
- Location: OH, USA
Re: 65ORG16.b Core
Ah, thanks for that input Garth. I always read about SEP/REP here on 6502.Org, but I never knew what they meant... At one point a year or 2 ago I was about to make the jump from 6502 to 65816, but never did, due to the draw of programmable logic.
So I can probably make this work (with Arlet's watchful eye), as I feel I am learning a new language here and I've not heard his condemnation!
Yet...
So I can probably make this work (with Arlet's watchful eye), as I feel I am learning a new language here and I've not heard his condemnation!
Re: 65ORG16.b Core
SEP and REP is just about worthwhile, although if the bits in the status register are rarely enough changed then you don't need a high-performance way to change them, and fiddling with PHP and PLP with some more macros would be adequate. SEP and REP is extra work.
I really wouldn't make these two special registers subject to mode bits though, or take them from the arithmetic/logical register file. The feature can be kept out of play by leaving the registers at default values of 0 and 1. There's no reason at all why one might need high-performance arithmetic or logical operations on these special registers, and by using the general register pool all that's happened is a shrinking of the pool. You'd be compounding that mistake by adding a mode bit to disable it. As Arlet pointed out earlier, these special registers are accessed in parallel to the register file, so to his thinking and my thinking they should be separate.
Finally, if you do it the right way, the idea is applicable to the original core, and to an 8-register version too. It becomes a feature which is not tied in to the 16-register variation. It's independent. That's the best way to add features!
Cheers
Ed
I really wouldn't make these two special registers subject to mode bits though, or take them from the arithmetic/logical register file. The feature can be kept out of play by leaving the registers at default values of 0 and 1. There's no reason at all why one might need high-performance arithmetic or logical operations on these special registers, and by using the general register pool all that's happened is a shrinking of the pool. You'd be compounding that mistake by adding a mode bit to disable it. As Arlet pointed out earlier, these special registers are accessed in parallel to the register file, so to his thinking and my thinking they should be separate.
Finally, if you do it the right way, the idea is applicable to the original core, and to an 8-register version too. It becomes a feature which is not tied in to the 16-register variation. It's independent. That's the best way to add features!
Cheers
Ed