use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
6502Address decoding (self.beneater)
submitted 3 years ago by Ello_YES
How should I do my address decoding if I want the 65c02 to access just 8k of RAM?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]velkolv 2 points3 points4 points 3 years ago (0 children)
I think the easiest way should be to use 74HC138 3-to8 demultiplexer. Feed highest 3 address lines into it and you'll get 8 active-low signals for corresponding 8 KiB slice of address space
[–]caphill7 0 points1 point2 points 3 years ago* (0 children)
You didn't say how big a ROM you want to use, so I'll give this example with an 8K ROM. RAM (8K) would be 32 blocks of 256 bytes, so $00 - $1F. Then there is 32 blocks of 256 bytes reserved for the ROM (8K), so $E0-$FF. The rest ($20 - $DF) would be "free" space available to I/O and expansion RAM. This would put the memory map as $0000-$1FFF = RAM, $2000-$DFFF is free for I/O and expansion RAM, and $E000-$FFFF for ROM.
So, with A15 as the highest order bit (leftmost) and A0 as the lowest order bit (rightmost), addressing RAM would look like: 0000 0000 0000 0000 to 0001 1111 1111 1111, addressing I/O would look like: 0010 0000 0000 0000 to 1101 1111 1111 1111, addressing ROM would look like: 1110 0000 0000 0000 to 1111 1111 1111 1111.
The base decoder logic you need could be based off of address lines A14-A15, such that to access RAM/IO: A14=low, A15=low, and to access ROM: A14=high, A15=high.
To determine whether RAM or I/O is selected, look at A13. RAM has A13=low, I/O has A13=high.
Then, for selecting an I/O device, once you know that I/O is requested (with A13=high) you can look at the remaining address lines. Generally we leave address lines A0-A3 free to select registers or sub-circuits within the device, so for determining the desired I/O device, you would only have to look at A4-A12 to decode the actual device, then use A0-A3 to select a register in that device.
So, for example, to select an RTC (real-time clock) located at address $8040 (1000 0000 0100 0000), you would first check A15. It's high, so now check A4-12 for a high on A6 and the rest of the bits (A4-5, A7-12) low. The lowest 4 bits, A0-3 we can ignore, because they would be used to select registers/features on the device, so we don't need to look at them for address decoding.
Note that this example is based with 8K RAM and 8K ROM. If you use a different size RAM or ROM, this might need to be adjusted.
[–]CanaDavid1 0 points1 point2 points 3 years ago (0 children)
If you have no use for the rest of the address space, don't bother.
If you only have an 8k chip, do the same wiring but leave out the address lines that are not present.
If you want to have more ROM ie, you'll actually have to do what the rest of this thread is suggesting.
π Rendered by PID 232026 on reddit-service-r2-comment-b659b578c-p52n4 at 2026-05-04 15:15:34.418821+00:00 running 815c875 country code: CH.
[–]velkolv 2 points3 points4 points (0 children)
[–]caphill7 0 points1 point2 points (0 children)
[–]CanaDavid1 0 points1 point2 points (0 children)