From 8bit breadboard to 6502
Re: From 8bit breadboard to 6502
To question 1) I'm using one of the inexpensive PL2303HX USB2Serial adapter like this one: http://amzn.to/2vdc2xU. They are strong enough to even power a small system and run on 5V TTL level, so you don't have to use a MAX232 to convert to RS-232 voltage levels.
The PL2303HX is directly supported by MacOS without the need to install a driver like for the CH340 FTDI replacements you find on the cheap Arduino clones.
Mario.
The PL2303HX is directly supported by MacOS without the need to install a driver like for the CH340 FTDI replacements you find on the cheap Arduino clones.
Mario.
How should I know what I think, until I hear what I've said.
-
leepivonka
- Posts: 167
- Joined: 15 Apr 2016
Re: From 8bit breadboard to 6502
nei02: your 64Kbit EEPROM will work OK as long as you don't need to put more than 8192 bytes in it.
You don't need to change your address decoding at all - selecting the EEPROM for any address between $8000 & $FFFF will just repeat the 8KByte EEPROM contents 4 times.
You might consider the "real" copy to be $E000 thru $FFFF and the "extra" copies to be $8000 thru $9FFF, $A000 thru $BFFF, and $C000 thru $DFFF.
When you later replace the 64Kbit EEPROM with a 256Kbit one and connect the additional 2 address lines, there won't be any "extra" copies anymore - $8000 thru $FFFF will access a unique EEPROM byte.
You don't need to change your address decoding at all - selecting the EEPROM for any address between $8000 & $FFFF will just repeat the 8KByte EEPROM contents 4 times.
You might consider the "real" copy to be $E000 thru $FFFF and the "extra" copies to be $8000 thru $9FFF, $A000 thru $BFFF, and $C000 thru $DFFF.
When you later replace the 64Kbit EEPROM with a 256Kbit one and connect the additional 2 address lines, there won't be any "extra" copies anymore - $8000 thru $FFFF will access a unique EEPROM byte.
Re: From 8bit breadboard to 6502
Thanks for this hint with the addresses. I am just trying to digest this.
My EEProm has only 13 address-lines (A0 - A12)
The 65C02 has 16 address-lines.
The first three most significant bits can not be addressed (but the A15 can enable the ROM)
When I now program my EEPROM in address $8600 1000 0110 0000 0000
He actually writes the value in address $0600 0 0110 0000 0000
So i think that not the stored value is doubled but the 65C02 finds the same value with for different addresses:
$0600 (000)0 0110 0000 0000 -> Not since he will read from RAM
$8600 (100)0 0110 0000 0000
$A600 (101)0 0110 0000 0000
$C600 (110)0 0110 0000 0000
$E600 (111)0 0110 0000 0000
What do you think?
My EEProm has only 13 address-lines (A0 - A12)
The 65C02 has 16 address-lines.
The first three most significant bits can not be addressed (but the A15 can enable the ROM)
When I now program my EEPROM in address $8600 1000 0110 0000 0000
He actually writes the value in address $0600 0 0110 0000 0000
So i think that not the stored value is doubled but the 65C02 finds the same value with for different addresses:
$0600 (000)0 0110 0000 0000 -> Not since he will read from RAM
$8600 (100)0 0110 0000 0000
$A600 (101)0 0110 0000 0000
$C600 (110)0 0110 0000 0000
$E600 (111)0 0110 0000 0000
What do you think?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: From 8bit breadboard to 6502
It's not a problem though. If you know you only have 8KB of EEPROM, you won't be writing to the mirrored address ranges. It's like the I/O in the simple address decoding scheme in the 6502 primer which I've been using for 24 years and never had a problem with it.
BTW, a little tip about English: Inanimate objects (like the EEPROM and the processor) are referred to as "it," not "he." Some animate objects are also referred to as "it," but the lines get foggy. We would usually refer a dog as "he" or "she;" but referring to a snake, I might say "I saw it on the road," or referring to a bird, "It flew into the window."
BTW, a little tip about English: Inanimate objects (like the EEPROM and the processor) are referred to as "it," not "he." Some animate objects are also referred to as "it," but the lines get foggy. We would usually refer a dog as "he" or "she;" but referring to a snake, I might say "I saw it on the road," or referring to a bird, "It flew into the window."
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?
Re: From 8bit breadboard to 6502
Thanks for this advise regarding english! I appreciate this!
I wrote a litte program and its working.
Address Hexdump Dissassembly
-------------------------------
$8600 a2 00 LDX #$00
$8602 a9 01 LDA #$01
$8604 8d 01 00 STA $0001
$8607 a9 05 LDA #$05
$8609 8d 02 00 STA $0002
$860c a9 08 LDA #$08
$860e 8d 03 00 STA $0003
$8611 e8 INX
$8612 8a TXA
$8613 8d 04 00 STA $0004
$8616 4c 11 06 JMP $8611
used the arduino to program the EEPROM
=========
byte digits[] = {0xa2 ,0x00 ,0xa9 ,0x01 ,0x8d ,0x01 ,0x00 ,0xa9 ,0x05 ,0x8d ,0x02 ,0x00 ,0xa9 ,0x08 ,0x8d ,0x03 ,0x00 ,0xe8 ,0x8a ,0x8d ,0x04 ,0x00 ,0x4c ,0x11 ,0x86};
int adresse = 0;
for (int value = 0; value <= (sizeof(digits)); value +=1) {
adresse = 0x8600 + value;
writeEEPROM(adresse,digits[value]);
}
==========
Its counting and jumping!
Next step will be Counting storing loading adding jumping.
Thank you very much!
I wrote a litte program and its working.
Address Hexdump Dissassembly
-------------------------------
$8600 a2 00 LDX #$00
$8602 a9 01 LDA #$01
$8604 8d 01 00 STA $0001
$8607 a9 05 LDA #$05
$8609 8d 02 00 STA $0002
$860c a9 08 LDA #$08
$860e 8d 03 00 STA $0003
$8611 e8 INX
$8612 8a TXA
$8613 8d 04 00 STA $0004
$8616 4c 11 06 JMP $8611
used the arduino to program the EEPROM
=========
byte digits[] = {0xa2 ,0x00 ,0xa9 ,0x01 ,0x8d ,0x01 ,0x00 ,0xa9 ,0x05 ,0x8d ,0x02 ,0x00 ,0xa9 ,0x08 ,0x8d ,0x03 ,0x00 ,0xe8 ,0x8a ,0x8d ,0x04 ,0x00 ,0x4c ,0x11 ,0x86};
int adresse = 0;
for (int value = 0; value <= (sizeof(digits)); value +=1) {
adresse = 0x8600 + value;
writeEEPROM(adresse,digits[value]);
}
==========
Its counting and jumping!
Thank you very much!
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: From 8bit breadboard to 6502
GARTHWILSON wrote:
BTW, a little tip about English: Inanimate objects (like the EEPROM and the processor) are referred to as "it," not "he."
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: From 8bit breadboard to 6502
mkl0815 wrote:
I would also suggest using CoolTerm, it is really easy to use and has some nice features.
Beside the Ophis assembler .
Beside the Ophis assembler .
I am struggling with ophis and python.
I copied all the ophis *,py files into documents. But I don't make it
>>> python main.py hello1
File "<stdin>", line 1
python main.py hello1
^
SyntaxError: invalid syntax
>>>
-
DerTrueForce
- Posts: 483
- Joined: 04 Jun 2016
- Location: Australia
Re: From 8bit breadboard to 6502
It looks like you are trying to invoke Python from inside Python. That's not going to work. You need to be at a terminal. Something like bash, where you get a $ prompt.
I imagine you already know this, but to get out of Python, you can enter exit(). If you started Python using a terminal, that will put you back into the terminal. If you started Python using a menu or shortcut, it will probably just close the window.
I imagine you already know this, but to get out of Python, you can enter exit(). If you started Python using a terminal, that will put you back into the terminal. If you started Python using a menu or shortcut, it will probably just close the window.
Re: From 8bit breadboard to 6502
Hi
I now can create an assembled outputfile. But the option -1 doesn't work.
Just downloading an HEX editor to read the outputfile.
Dankeschön
Ralf
I now can create an assembled outputfile. But the option -1 doesn't work.
Just downloading an HEX editor to read the outputfile.
Dankeschön
Ralf
Re: From 8bit breadboard to 6502
Got:
A90185FF
From:
lda #$1
sta $FF
seems to work.
A90185FF
From:
lda #$1
sta $FF
seems to work.
Re: From 8bit breadboard to 6502
Hello,
I made some progress. Learned to assemble with Ophis and emulate with Sysmon.
My little computer has now RAM, ROM. next step is to implement ACIA 65C51 to communicate with a terminal programm.
Ordered the RS232 to USB adapter as proposed. And waiting now for some parts from mouser.
In the meantime I try to teach my BenEater breadboard computer how to detect Carry.
I already set up a status register to store the zero flag. (latches only if Op Code add or Subtract / controlled by microcode)
No I wanted to latch the Carry bit and noticed that there is always a carry out if I make a subtraction.
--> Unsigned Numbers!
(Do the subtraction by adding the 2scomplement)
To latch the Carry flag I now used a XOR-Gate.
Carry / SUBsignal / Carry flag
0 1 1
1 0 1
1 1 0
0 0 0
So if subtraction an carry out is ok. But if no carry out than the result is invalid and the carry flag will be set.
If adding no carry out is ok. But if the adder has a carry out the result is invalid and the carry flag will be set.
Is this the right way to to? I am talking about unsigned numbers.
I made some progress. Learned to assemble with Ophis and emulate with Sysmon.
My little computer has now RAM, ROM. next step is to implement ACIA 65C51 to communicate with a terminal programm.
Ordered the RS232 to USB adapter as proposed. And waiting now for some parts from mouser.
In the meantime I try to teach my BenEater breadboard computer how to detect Carry.
I already set up a status register to store the zero flag. (latches only if Op Code add or Subtract / controlled by microcode)
No I wanted to latch the Carry bit and noticed that there is always a carry out if I make a subtraction.
--> Unsigned Numbers!
(Do the subtraction by adding the 2scomplement)
To latch the Carry flag I now used a XOR-Gate.
Carry / SUBsignal / Carry flag
0 1 1
1 0 1
1 1 0
0 0 0
So if subtraction an carry out is ok. But if no carry out than the result is invalid and the carry flag will be set.
If adding no carry out is ok. But if the adder has a carry out the result is invalid and the carry flag will be set.
Is this the right way to to? I am talking about unsigned numbers.
Re: From 8bit breadboard to 6502
I think the joy of two's-complement arithmetic is that the ALU doesn't have to worry about whether a number is signed or not, for addition and subtraction.
There are two reasonable choices for the convention of what to do with carry and subtraction: either carry is a borrow bit, or it's the opposite. The 6502's choice is to make carry the opposite of a borrow. So, before a subtraction, you set the carry, and afterwards you expect the carry to be set. This consistency makes it easy to string together subtractions on multi-byte values. If, on the 6502, you find the carry isn't set after subtraction, it means there's a borrow, which means the subtraction 'failed' - you computed X-Y and it turns out that Y was bigger.
I've a feeling the 6800 made the opposite choice, so in that case you'd clear the carry before a subtraction and afterwards expect it to be clear. If it's not clear, then you did X-Y and Y was bigger.
Hope this helps.
There are two reasonable choices for the convention of what to do with carry and subtraction: either carry is a borrow bit, or it's the opposite. The 6502's choice is to make carry the opposite of a borrow. So, before a subtraction, you set the carry, and afterwards you expect the carry to be set. This consistency makes it easy to string together subtractions on multi-byte values. If, on the 6502, you find the carry isn't set after subtraction, it means there's a borrow, which means the subtraction 'failed' - you computed X-Y and it turns out that Y was bigger.
I've a feeling the 6800 made the opposite choice, so in that case you'd clear the carry before a subtraction and afterwards expect it to be clear. If it's not clear, then you did X-Y and Y was bigger.
Hope this helps.
Re: From 8bit breadboard to 6502
Yes! This helps! I want to implement a BCC and BCS.
I assume that this is equal to a "less than" .
btw: Do you know a source where I can see the 65C02 micro steps for every instruction?
I assume that this is equal to a "less than" .
btw: Do you know a source where I can see the 65C02 micro steps for every instruction?
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: From 8bit breadboard to 6502
nei02 wrote:
Yes! This helps! I want to implement a BCC and BCS.
I assume that this is equal to a "less than" .
I assume that this is equal to a "less than" .
Quote:
btw: Do you know a source where I can see the 65C02 micro steps for every instruction?
I don't know if this is what you're looking for, but the 65816 datasheet, at http://6502.org/documents/datasheets/wd ... 3_2010.pdf, tells what's on the buses in every cycle of every instruction, starting on page 38 of the .pdf. It's for the '02 as well, and the footnotes tell the difference between the '02 and '816 in different modes.
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?
Re: From 8bit breadboard to 6502
Two's complement subtraction is complement the value to
subtract and add 1, then add to the other value.
Setting the carry before the subtraction on the 6502 does
the +1 for you.
Clever of them.
Tinker Dwight
subtract and add 1, then add to the other value.
Setting the carry before the subtraction on the 6502 does
the +1 for you.
Clever of them.
Tinker Dwight