6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed Oct 23, 2024 6:27 am

All times are UTC




Post new topic Reply to topic  [ 138 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 10  Next
Author Message
PostPosted: Sat Feb 18, 2023 5:42 pm 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
GARTHWILSON wrote:
and3rson wrote:
GARTHWILSON wrote:
The RAM will be active when this input is low, which is the opposite of how you have it.

Not sure if I'm following: all 74x138 outputs & SRAM /CE & /OE are active-low, aren't they? (So the decoder will only ever select one RAM or ROM at a time)

It's that you have the RAM's CS\ (pin 20) wired to Φ2.  You'll need to read or write the RAM (or any other device) while Φ2 is high, not low.  The 65xx bus cycle starts with Φ2 low, and it gets the address and other things set up during this first half cycle, then the read or write happens in the second half, when Φ2 is high.


Thanks - I think I get it now. I kept thinking by mistake that 74x138 outputs float when inactive.

Paganini wrote:
You might find these articles useful, particularly the one about stealing bytes for I/O:

https://www.atarimagazines.com/computei ... /page9.php
https://www.atarimagazines.com/computei ... page17.php
https://www.atarimagazines.com/computei ... page15.php

Since your address space is totally full, you'll have to steal some from someplace if you want any I/O ports! :D


Those are some cool articles, thanks! I can't believe they are actually from 1980!

In the meantime, I've added some plumbing for "mystery" (c) pins and replaced 6502 with 65c02s. Next on my agenda - clock!

EDIT: Considering I'm going to run @ 1MHz, can I simply tie /CE & /OE of EPROM together (as in my schematic)? If I understand correctly, I need to separate them and wire /RD->/OE + ROM/EN->/CE only in case I want to run on higher frequency and make EPROM reads faster, correct? Or do I still need to separate them in my scenario?


Attachments:
v03.png
v03.png [ 251.19 KiB | Viewed 100040 times ]

_________________
/Andrew

deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD


Last edited by and3rson on Sat Feb 18, 2023 9:00 pm, edited 6 times in total.
Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 18, 2023 5:51 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10961
Location: England
GARTHWILSON wrote:
BigEd wrote:
GARTHWILSON wrote:
You'll need a reset circuit. It's not optional.

I don't think everyone is in agreement on that: it's a matter of opinion and judgement, and of course it's a function of how the SBC is supposed to be used. We've discussed this many times, and I'm surprised if you've forgotten.

You cannot leave the RST\ pin open!

Oops, sorry, I over-reacted! I thought you were treading a certain path and I was wrong about that. As noted elsewhere, a simple push button and pull up is enough for many purposes. See here for example. A reset controller is preferred by some but is certainly not always necessary.


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 18, 2023 6:47 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8448
Location: Midwestern USA
and3rson wrote:
Thanks for all your responses! Here’s my second take.

RAM is mapped to 0000-DFFF, ROM is mapped to E000-FFFF. I used 512Kx8 RAM since I didn’t have 128K RAM in my KiCad parts.

I’ve used 74AC08 to select ROM when A13-A15 are high, and RAM otherwise.

Some observations:

  1. Ideally, all chips should be of the same logic family as the MPU. I recommend glue logic parts in your first build be 74HC, not 74AC. On five volts, 74HC propagation speeds are such that your machine should be stable to at least 8 MHz, depending on how you fabricate it, as well as other factors. More importantly, 74HC output edges are relatively “gentle,” a characteristic that makes board layout and other construction details less critical. 74AC has a very aggressive output and is best used in a high-speed system, with the build on a multilayer PCB with internal power and ground planes.

    Use of 74ALS, 74F, 74LS or 74S logic is not recommended.

  2. Pin 37 on the 65C02 is the clock input, and pins 3 and 39 are clock outputs. Your oscillator must be connected to pin 37, not pin 39. WDC recommends the outputs at pins 3 and 39 not be used in new designs and instead left unconnected. Those outputs exist mainly to support use of the modern 65C02 as a replacement for an NMOS 6502 in old hardware.

  3. All unused inputs on the 65C02 must be terminated. /IRQ, /NMI, RDY, /RES and /SO must be pulled up to VCC, typically through 3.3K resistors. Using a resistor on each input instead of a direct connection leaves you with the option to later put the signal to use without having to butcher up your board.

    In any case, do not wire RDY directly to VCC! RDY is bi-directional and there is a specific instruction (WAI) that if executed will cause RDY to be driven low. Even if you didn’t intend to use WAI (it has a very specialized purpose), it could accidentally get executed due to a software error. Hard-wiring RDY to VCC will cause the 65C02 to try to short out the power supply if WAI accidentally gets executed.

  4. All unused outputs on the 65C02 may be allowed to float. It is very rare to find /MLB and /VPB in use (I’ve never seen it). Circuits that include single-stepping via hardware often make use of SYNC, but in your first build, you probably won’t be doing that.

  5. Each device should be paired with a bypass (aka decoupling) capacitor. Time and time again, we have seen unstable or DOA designs that were victims of nothing more than inadequate or non-existing bypassing. Typical practice places a 0.1µF ceramic (MLCC) capacitor so it is as physically close to the device’s VCC pin as possible. Capacitor connections should be as short and direct as possible. I use 50 volt, X7R capacitors in my builds. Bypass capacitors are cheap—don’t be shy about using them. :D

  6. You need to work out how to create address space for I/O, even though you don’t intend to connect any I/O hardware in this first go (an intention that might change after you get the thing running). Doing so will give you an opportunity to work with a 74x138 decoder. This being your first build, I suggest you leave $C000-$CFFF open for that purpose. That reference circuit I put in my previous post does that.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 18, 2023 6:54 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1383
Needless to say, the whole story around a proper reset circuit has been beaten to death. Several folks out here have shared or linked various methods. Bottom line, there are many ways to generate a reset. I would suggest they fall into a few categories:
- proper engineering: (call it best practices if you like) using the specifications in the data sheet and designing a circuit to meet those specifications.
- cheats: using a partial from above, meaning it's not quite the proper deal but will generally suffice most of the time.
- hacks: using a lego approach of extra gates/inverters and other components to get something that works.

In defense of the above, an example of each:
- proper engineering: Any of the old Commodore machines (VIC-20, C64) which used a 555 Timer and surrounding parts to generate a reset signal that feeds a 7406 open collector inverter driving the reset line.
- cheats: Grant's minimal designs along with countless others... but let's be honest, they don't work reliably all of the time.
- hacks: Look at the reset line for the Commodore 1581 diskette drive... a total hack of too many components.

For helping a newbie get started, I'll always take the proper engineering approach, but that's my view on the subject, which goes well beyond the reset line to the rest of the design. On the other side of this, presenting too many oddball circuits just confuses a newbie. When starting something new like a SBC project, there are enough pitfalls to fall into without giving them additional ones to pick from.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 18, 2023 7:11 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8448
Location: Midwestern USA
richardc64 wrote:
Quote:
...and pin 5 is a memory-lock output.

Not to thread-jack, but I've read WDC's description over and over and don't get what its intended purpose is, how it would be used, or of what use -- if any -- it would be in a one processor system.

MLB is asserted during the final steps of R-M-W instructions. Specifically, after the fetch data instruction step has been completed, MLB is driven low to indicate the data is about to be modified and rewritten. In a 65C02/65C816 system with more than one bus master, this is a critical period in the instruction sequence during which an attempt by some other device to claim the bus or access RAM in some way cannot be allowed to happen. Hence the need for MLB.

In a 65C816 system, MLB also indicates the point-of-no-return in an instruction sequence after which asserting /ABORT will fail to prevent data modification.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 18, 2023 8:18 pm 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
BigDumbDinosaur wrote:
You need to work out how to create address space for I/O, even though you don’t intend to connect any I/O hardware in this first go (an intention that might change after you get the thing running). Doing so will give you an opportunity to work with a 74x138 decoder. This being your first build, I suggest you leave $C000-$CFFF open for that purpose. That reference circuit I put in my previous post does that.


Thanks for the details! I was not aware of those differences in 74xx types. Also, I think you're right - I'll reserve space for I/O.
Your diagram has also been extremely helpful - it greatly helped me understand how NANDs can be combined to achieve awesome results!

(...1 hour later...)

Okay, so it's took me some effort to figure out the 74xx puzzle to make proper changes for including I/O in my memory map. I'm not sure if this is a good solution, but here's what I came up with. Let me know what you think!
BTW, for "reserved" I could invert A12 through one remaining NAND gate and drive a second 74x138, thus getting 16 I/O selectors. Not sure if I ever need that many!

Code:
+-------+-----+-----------------------+
| RANGE | TYP | Notes                 |
+-------+-----+-----------------------+
| $0000 |     | NAND(A14, A15)        |
|  ...  | RAM |                       |
| $BFFF | 48k |                       |
+-------+-----+-----------------------+
| $C000 |     | !RAM && !A12 && !A13  |
|  ...  | I/O |                       |
| $CFFF | 4k  |                       |
+-------+-----+-----------------------+
| $D000 |     | !RAM && A12 && !A13   |
|  ...  | n/a | reserved (EEPROM?)    |
| $DFFF | 4k  |                       |
+-------+-----+-----------------------+
| $E000 |     | !RAM && A13           |
|  ...  | ROM |                       |
| $FFFF | 8k  |                       |
+-------+-----+-----------------------+


I wonder if my schematic will work. Looks like it's all correct, but I'd appreciate an extra pair of eyes on it. :)

P. S. Today I learned that NAND is called a universal gate!

EDIT: I'm wondering if RAM's /WE should come from /WD or CPU's R/W? According to the primer, it should be R/W:
> The R/W line will also go to the RAM chips' WE pins.
...but what's the purpose of /WD then? I thought /WD should be the one driving /WE on RAM (since /WD is synchronized with Ф2).
EDIT 2: I wanted to avoid having accidental writes to ROM (which may result in shorted data bus). I've achieved this by passing inverted R/W into ROM's OE. Is this a normal way to have this kind of protection?
EDIT 3: I've made a simple interactive demo for myself to test it around: https://circuitverse.org/simulator/embe ... s-selector
EDIT 4: I think I've already found a use for "reserved" 4k segment: EEPROM! I'll use smth like AT28C64. Persistent segment in 6502 memory map - how cool is that?


Attachments:
v04_addr.png
v04_addr.png [ 25.07 KiB | Viewed 100012 times ]
v04.png
v04.png [ 323.75 KiB | Viewed 100038 times ]

_________________
/Andrew

deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2023 3:32 pm 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 489
and3rson wrote:
Paganini wrote:
You might find these articles useful, particularly the one about stealing bytes for I/O:

https://www.atarimagazines.com/computei ... /page9.php
https://www.atarimagazines.com/computei ... page17.php
https://www.atarimagazines.com/computei ... page15.php

Since your address space is totally full, you'll have to steal some from someplace if you want any I/O ports! :D


Those are some cool articles, thanks! I can't believe they are actually from 1980!
From 1980, the same as me! :D I was sad that that particular magazine and that column only ran for 3 issues. :cry:

I've been a little busy this week with work and didn't have time to post to this thread much; I wanted to say that I've really been enjoying it though! I like how every one of your schematics is better than the previous one. It seems like you are making very fast progress.

Quote:
EDIT: Considering I'm going to run @ 1MHz, can I simply tie /CE & /OE of EPROM together (as in my schematic)? If I understand correctly, I need to separate them and wire /RD->/OE + ROM/EN->/CE only in case I want to run on higher frequency and make EPROM reads faster, correct? Or do I still need to separate them in my scenario?
Quote:
EDIT: I'm wondering if RAM's /WE should come from /WD or CPU's R/W? According to the primer, it should be R/W:
> The R/W line will also go to the RAM chips' WE pins.
...but what's the purpose of /WD then? I thought /WD should be the one driving /WE on RAM.


You *can* do a lot of things. You could, for example, just tie all of your CE\ lines low and juggle read and write signals to make sure that the RAM and ROM aren't fighting over the bus.

Garth's circuit and BDD's circuit don't work the same way, but both of them do work! :) Already at this early stage you're faced with decisions about what makes sense for *your* specific project. At the risk of overwhelming you with homework, it might be a good idea to consider *why* both BDD's and Garth's circuits work, in spite of their differences. Here's something that might help with that:

https://laughtonelectronics.com/Arcana/ ... iming.html

My current favorite memory interface is this one:
Attachment:
minimal memory interface.gif
minimal memory interface.gif [ 4.13 KiB | Viewed 99972 times ]


That diagram comes from an old post here, but for the life of me I can't track down the thread it was originally posted in. If memory serves, it was created by Jeff Laughton (forum member Dr. Jeffyl), who also made the timing diagrams above. My current board uses a variation of this idea and a 74AHC139. It's running at 12.6MHz!

Edit: Hahahahaaaa found it!

viewtopic.php?f=4&t=511&hilit=139&start=15

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2023 4:46 pm 
Offline

Joined: Wed Jun 23, 2021 8:02 am
Posts: 166
Paganini wrote:
My current favorite memory interface is this one:
Attachment:
minimal memory interface.gif


That diagram comes from an old post here, but for the life of me I can't track down the thread it was originally posted in. If memory serves, it was created by Jeff Laughton (forum member Dr. Jeffyl), who also made the timing diagrams above. My current board uses a variation of this idea and a 74AHC139. It's running at 12.6MHz!

Edit: Hahahahaaaa found it!

viewtopic.php?f=4&t=511&hilit=139&start=15


That's quite a nifty little circuit. However it doesn't have any provision for I/O devices - you'll need at least one of those to get a usable system. You could fix that by connecting A14 to input A of the top decoder, then use Y3 to select ROM (addresses C000-FFFF) and Y2 to select I/O (8000-BFFF). Then you can also use A15 directly to select RAM instead of using one of the decoder outputs - that will give RAM between 0000 and 7FFF.


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2023 4:49 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1383
Using the 74139 for I/O decode and read/write with clk2 validation goes way back. I posted Doug Beattie's schematic (dates back to 2000) here:

viewtopic.php?f=4&t=6667&p=84821&hilit=diy6502a#p84821

Jeff converted it to black and white which is much easier to see.

Also, the Commodore 1581 diskette drive did much the same using a 74139, which dates back to 1987:

Attachment:
1581-sch.png
1581-sch.png [ 866.88 KiB | Viewed 99963 times ]


What's old is new :wink:

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2023 6:16 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8448
Location: Midwestern USA
kernelthread wrote:
Paganini wrote:
My current favorite memory interface is this one...

That's quite a nifty little circuit.

However, using the '139 to gate the read/write signals is slower than this circuit:

Attachment:
File comment: Fully-Qualified Read/Write
read_write_qualify_alt.gif
read_write_qualify_alt.gif [ 46.98 KiB | Viewed 99952 times ]

The above is also a one-chip solution, plus leaves a spare gate for some other use, e.g., inverting the reset signal.

Quote:
However it doesn't have any provision for I/O devices - you'll need at least one of those to get a usable system. You could fix that by connecting A14 to input A of the top decoder, then use Y3 to select ROM (addresses C000-FFFF) and Y2 to select I/O (8000-BFFF). Then you can also use A15 directly to select RAM instead of using one of the decoder outputs - that will give RAM between 0000 and 7FFF.

Too wasteful of address space—you don't need 16K just for I/O. Also, 16K of ROM is extravagant—my POC V1.2 and V1.3 units have 12K, and manage to squeeze Supermon 816 in there, with device drivers, BIOS API, interrupt handlers and timekeeping.

You want to maximize available RAM. A couple of discrete gates will produce a more expansive memory map with 48K of contiguous RAM, provision for eight I/O devices, and 12K of ROM:

Attachment:
File comment: Complete 65C02 Glue Logic w/Wait-State Output
mapping_65c02.gif
mapping_65c02.gif [ 41.26 KiB | Viewed 99952 times ]

The above is a four-chip glue logic solution. Add RAM, ROM, 65C02 and a clock source, and you will have a working computer that will easily run at 20-25 MHz on 74AC or 74AHC logic.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 20, 2023 6:19 pm 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
Paganini wrote:
From 1980, the same as me! :D I was sad that that particular magazine and that column only ran for 3 issues. :cry:

I've been a little busy this week with work and didn't have time to post to this thread much; I wanted to say that I've really been enjoying it though! I like how every one of your schematics is better than the previous one. It seems like you are making very fast progress.

Garth's circuit and BDD's circuit don't work the same way, but both of them do work! :) Already at this early stage you're faced with decisions about what makes sense for *your* specific project. At the risk of overwhelming you with homework, it might be a good idea to consider *why* both BDD's and Garth's circuits work, in spite of their differences. Here's something that might help with that:

https://laughtonelectronics.com/Arcana/ ... iming.html


Thanks! I'm learning a lot of new cool stuff, and it's so exciting to be able to share it with someone! :)

I think I finally got the point of having /RD & /WD: it's there just to avoid bus contention at falling edges of Ф2. I had some false understanding of few things (specifically - when did reads/writes happen), but it makes so much sense now. Sometimes I have to wander for miles before I come back to the initial statement and am able to actually comprehend it. I appreciate your patience!

Paganini wrote:
That diagram comes from an old post here, but for the life of me I can't track down the thread it was originally posted in. If memory serves, it was created by Jeff Laughton (forum member Dr. Jeffyl), who also made the timing diagrams above. My current board uses a variation of this idea and a 74AHC139. It's running at 12.6MHz!

Edit: Hahahahaaaa found it!

viewtopic.php?f=4&t=511&hilit=139&start=15


This is so cool, I haven't thought of feeding Ф2 into 74xx138! This seems to be very neat in cases when memory map needs to be easily rearrangeable.

floobydust wrote:
Using the 74139 for I/O decode and read/write with clk2 validation goes way back. I posted Doug Beattie's schematic (dates back to 2000) here:

viewtopic.php?f=4&t=6667&p=84821&hilit=diy6502a#p84821

Jeff converted it to black and white which is much easier to see.

Also, the Commodore 1581 diskette drive did much the same using a 74139, which dates back to 1987:

Attachment:
1581-sch.png


What's old is new :wink:


Cool, I didn't know that. It's so nice that I can now look at real schematics of classic products and actually *understand* what's going on there. Takes one to know one! :D

BigDumbDinosaur wrote:
The above is a four-chip glue logic solution. Add RAM, ROM, 65C02 and a clock source, and you will have a working computer that will easily run at 20-25 MHz on 74AC or 74AHC logic.

This circuit was one of my main sources of inspiration that helped me build my addressing, thanks for sharing! NAND gates feel like they we born for this task. In my case the memory layout is simpler, so all I needed was only 2 NANDs & a 74xx138!

_________________
/Andrew

deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2023 12:55 am 
Offline

Joined: Fri Mar 18, 2022 6:33 pm
Posts: 489
BigDumbDinosaur wrote:
kernelthread wrote:
Paganini wrote:
My current favorite memory interface is this one...

That's quite a nifty little circuit.

However, using the '139 to gate the read/write signals is slower than this circuit:


True, but not by much. Max propagation delay for the AHC139 is about 9ns, which is one ns slower than AC00. :)

ETA: Not strictly on topic, but:
floobydust wrote:
What's old is new :wink:
In this case, what's old is old, as the linked thread is from 2004! (Or maybe what's new is old?) When I first started reading 6502.org about 3 years ago, that nearly 20 year old thread was one that really helped my understanding of Ø2 and memory read/write timing "click." So much so that I still had that diagram from it saved on my desktop! And here I am, 3 years later, sharing it with another new person who will hopefully benefit from it as much as I did. This is one of my favorite features of this forum.

_________________
"The key is not to let the hardware sense any fear." - Radical Brad


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2023 11:59 am 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
Paganini wrote:
ETA: Not strictly on topic, but:
floobydust wrote:
What's old is new :wink:
In this case, what's old is old, as the linked thread is from 2004! (Or maybe what's new is old?) When I first started reading 6502.org about 3 years ago, that nearly 20 year old thread was one that really helped my understanding of Ø2 and memory read/write timing "click." So much so that I still had that diagram from it saved on my desktop! And here I am, 3 years later, sharing it with another new person who will hopefully benefit from it as much as I did. This is one of my favorite features of this forum.


I'm actually really impressed that this forum has been around for more than 20 years now (oldest post I could find is from Oct 28, 2002). This is a rare breed in a modern world of pseudo-social-networks like tiktok or facebook. I cherish the fact I found this place and that it's still alive!

Few updates:

- I've started prototyping my design on a breadboard (mostly for testing things around, since in the past I've had some really bad luck with parasitic capacitances, wobbly connections & shitty chinese jumpers). As soon as I get the desired layout & selection of components, I'm going to move everything to a perfboard for a functional prototype before going for the PCB.

- Primer suggests to use 74LS04 for oscillator specifically. I disregarded that and used my 74HC00 with a 3.072 MHz crystal I've had around. Needless to say, it didn't work. :D As soon as I replaced it with 74LS04, I could get the oscillation like a charm.

- I can't wait for my W65C02S from Mouser, but I feel like it's going to take forever: their processing is slow, and the mail has also been rather slow recently.

Here's a mess I've made out of my breadboard so far. My next stop is caps, RAM & the CPU itself. Might take a while before I have those parts on me...


Attachments:
File comment: DS1813 reset
ds1813_reset.png
ds1813_reset.png [ 2.09 KiB | Viewed 99875 times ]
File comment: Clock probe
clock.png
clock.png [ 2.34 KiB | Viewed 99875 times ]
mess2.jpg
mess2.jpg [ 212.81 KiB | Viewed 99879 times ]

_________________
/Andrew

deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2023 1:30 pm 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 588
Location: Michigan, USA
You could also use an Uno or a Nano as a temporary clock source;

Code:
   void beginClock(uint8_t mhz)       // ****************************************
   { DDRB |= PORTB3;                  // set OC2A (D11/PB3) to 'output'         *
  /*                                                                            *
   *  TCCR2A settings for 'normal' or 'CTC' (non-PWM) mode                      *
   *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              *
   *  COM2A1:COM2A0 '01' - Toggle OC2A on Compare Match                         *
   *  WGM22:WGM20  '010' - CTC mode (clear timer on compare match)              *
   *                       (WGM22 bit is in TCCR2B register)                    *
   *                                                                            */
     TCCR2A = (1 << WGM21) | (1 << COM2A0);
     TCCR2B = (1 << CS20);            // prescale = 1:1 (WGM22 = 0)             *
     TIMSK2 = 0;                      // no interrupts                          *
   //OCR2A = 3;                       // match value (0/1/3/7 --> 8/4/2/1 MHz)  *
     OCR2A = (8/mhz-1);               // match value (0/1/3/7 --> 8/4/2/1 MHz)  *
   }                                  // ****************************************


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 21, 2023 2:58 pm 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
Michael wrote:
You could also use an Uno or a Nano as a temporary clock source;

Code:
   void beginClock(uint8_t mhz)       // ****************************************
   { DDRB |= PORTB3;                  // set OC2A (D11/PB3) to 'output'         *
  /*                                                                            *
   *  TCCR2A settings for 'normal' or 'CTC' (non-PWM) mode                      *
   *  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              *
   *  COM2A1:COM2A0 '01' - Toggle OC2A on Compare Match                         *
   *  WGM22:WGM20  '010' - CTC mode (clear timer on compare match)              *
   *                       (WGM22 bit is in TCCR2B register)                    *
   *                                                                            */
     TCCR2A = (1 << WGM21) | (1 << COM2A0);
     TCCR2B = (1 << CS20);            // prescale = 1:1 (WGM22 = 0)             *
     TIMSK2 = 0;                      // no interrupts                          *
   //OCR2A = 3;                       // match value (0/1/3/7 --> 8/4/2/1 MHz)  *
     OCR2A = (8/mhz-1);               // match value (0/1/3/7 --> 8/4/2/1 MHz)  *
   }                                  // ****************************************


Actually, I was just thinking how painful it will be to remove EPROM, since every time I want to update the code I'll need to re-flash it. Your suggestion of using one of those boards for clock actually gave me an idea to use Nano as a simulator for DIP-28 ROM! I think there *should* be enough pins (12 addr + 8 data + /CE & /RD interrupts) for the task. Also, I'm not sure if 16MHz will be enough for this, I'll see if I manage to write a code that will take less than 8 CPU cycles of Nano to read the data (and I have serious doubts about this). As a last resort, I can just underclock my W65C02S so that Nano has more time to assert the data line.

I have a whole lot of ESP-based boards (NodeMCU, etc), but there's not enough pins on them. Might consider ESP32 for this, though it feels like an overkill. But hey - as long as it works!

EDIT: Note to future self - "never put EPROMs in the middle of the board with too many jumpers around, you'll need to remove it pretty often..."

EDIT 2: OK, so atmega328p & ESP-32 are off the table: the former takes 11 cycles to jump into ISR (687.5ns, source: https://www.embeddedrelated.com/showthr ... 1437-1.php) and the latter takes astounding 500 (!) cycles fo this - i. e. ~2us (source: https://www.esp32.com/viewtopic.php?t=422)... And that's the time it takes them just to start executing ISR.


Attachments:
mess3.jpg
mess3.jpg [ 655.01 KiB | Viewed 99858 times ]

_________________
/Andrew

deck65 - 6502 slab with screen and keyboard | ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) | leo80 - simple Z80 SBC
nice65 - 6502 assembly linter | My parts, footprints & 3D models for KiCad/FreeCAD
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 138 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 10  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 22 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: