Microprocessor Tutorial? - Page 1
Forum section: electronics / beginners

author: bostonman
author_rank: Super Contributor
timestamp: October 07, 2021, 03:55:39 am
content: I know the general functions of a microprocessor, RAM, ROM, address lines, etc..., but I've never found (or understood) a relatively step-by-step process of how they all work together and/or which create which signals.The reason I'm asking is because I'm addressing the repair of my old C64. I'm not asking for help with the C64 itself, and want to avoid this turning into a C64 repair thread, but I'm a bit confused how the chips interact with each other.I read a nice write up where the person broke down the pins of the 6510, but I'm still lost on simple things like: does the 6510 generate the addresses for the address bus?Does anyone know where I can find a simple step-by-step write up that maybe explains adding two single digit numbers that arrive from the keyboard?I assume the micro constantly scans the keyboard waiting for input, and then say the number '2' arrives which is on the data bus as (remember this is an 8-bit system) 00000010. Where does it go from here?

author: DC1MC
author_rank: Super Contributor
timestamp: October 07, 2021, 04:31:04 am
content: Hi, get Ben Eater channel on youtube, all his videos about microprocessors are EXTREMELY well done and informative, here are two quick samples:https://youtu.be/yl8vPW5hydQCheers,DC1MC

author: james_s
author_rank: Super Contributor
timestamp: October 07, 2021, 04:33:18 am
content: The 6502 is an extremely popular and well documented CPU.Have you seen this?http://www.visual6502.org/There is a LOT more involved in entering two numbers on the keyboard, there are BIOS routines that read the keyboard. The address bus is driven by the CPU itself, you give the CPU an instruction that causes it to access a specific address. There is a course on Udemy for programming the 6502 in assembly language, it's centered around the Atari 2600 but the CPU core is the same as used in the C64. I think I paid $10 for it on one of the frequent sales they have, it was well worth it.

author: Ian.M
author_rank: Super Contributor
timestamp: October 07, 2021, 04:55:57 am
content: The 6810 is basically a 6502 core with an on-chip I/O port, and wasn't used much except in the C64 and related machines, so lets take a step back and look at the 6502, as there are many more resources for it. You could do a lot worse than work your way through Ben Eater's video series:https://eater.net/6502where he builds a 6502 based computer from the ground up on solderless breadboard. I see DC1MC has also recommended it.However lets try to answer one of your specific questions:"Does the 6510 generate the addresses for the address bus?"Generally yes, by a program counter inside the 6810 that increments sequentially except when modified by an instruction that changes the flow of control, however it tristates its address bus for approximately half of each clock cycle allowing another device to interleave access to shared memory (e.g. to generate video output) and its possible for another device to take over control for bulk access to shared memory, leaving the 6810 effectively halted till it regains control of the bus.

author: Kerlin
author_rank: Regular Contributor
timestamp: October 07, 2021, 06:05:29 am
content: Just some possible helpful and useful advice.You definitely dont need to know all about the registers, programming and hardware functioning of all the components in your C64 to fix it, the pinouts are all you need. Even if do you spend the time on learning that it wont help much.The absolute only way to learn about such stuff is turn off the internet pick up the big heavy books on the stuff and read it. You cant learn that here, would take decades.The 6502 may be fun but it is way gone, it cant do much anyway. Better to move on, make some progress and get yourself and Arduino, Much better for beginners.

author: Ian.M
author_rank: Super Contributor
timestamp: October 07, 2021, 06:24:43 am
content: I'd beg to differ - although an Arduino is great for novices getting into embedded system programming and interfacing, it hides too much of the register level and instruction execution details required to understand 8 bit microprocessor and microcontroller systems at a fundamental level. It is *POSSIBLE* to use one as an AVR MCU development platform, coding in assembler, and working from the ATmega328P datasheet, but the Arduino IDE and libraries get in the way of doing so and 99% or more of Arduino users never leave the comfortable easy Arduino environment 'playground'.If you understand in detail ONE 8 bit MCU or MPU, you will find you can easily adapt your skills to any other 8 bit chip in a fraction of the time it took you to become competent with your first. You also wont get so badly lost the first time you try to understand the complexities of a 32 bit processor.

author: ledtester
author_rank: Super Contributor
timestamp: October 07, 2021, 07:38:03 am
content: Quote from: bostonman on October 07, 2021, 03:55:39 amThe 6510 has a built-in GPIO port but on the C64 I understand it is used for memory bank selection.This page describes how the C64 keyboard works:http://www.c64os.com/post/howthekeyboardworksBasically the C64 incorporates two CIA I/O port controller chips. By reading and writing specific addresses a program can control the GPIO pins on these chips some of which are connected to the C64's keyboard matrix.Every 50th or 60th of a second an interrupt routine is called and keyboard scanning is performed. Keys found to be pressed are entered into a queue maintained by the C64's kernel. An assembly language program can read from that queue using the CHRIN or GETIN kernel calls:http://c64os.com/post/c64kernalromThe GETIN call will return 0 in the A register if the keyboard queue is empty. The typical assembly code used to (busy) wait for a keypress would look like this:Code:;WAIT FOR A CHARACTERWAIT JSR GETINCMP #0BEQ WAIT(taken from:https://www.pagetable.com/c64ref/kernal/#GETIN)You can use other kernel calls (like CHROUT) to write characters to the screen.

author: Kerlin
author_rank: Regular Contributor
timestamp: October 07, 2021, 08:09:49 am
content: Then for 6502 projects he will need -An EPROM eraserAn EPROM programmerSome 2114 ramSome 2716 or 2732 epromsA PIO chipADC chipA timer counter IC CTCA UART ICA pile of passive parts.A compiler for 6502, unsupported.Some 40 pin wire wrap socketsA wire wrap tool for the 400/500 odd connections he's going to makeAll processor and peripheral registers are fully accessible in Arduino.The IDE does not get in the way of accessing registers and just don't use the libraries if you don't like them.You do know you can use it for ASM, C and C++ ........don't you ? Now it even does live debugging.Do you recommend he hacks out an I2C for a display in ASM on a 6502 instead ?And lets face it - is he going to do anything?The only thing he needs to fix a C64 is a logic probe and a multimeter.45 years ago, misinformed, I imagined I may need a logic analyzer to fix an IBM AT, so the boss bought one.They were $10Ks then, are a few dollars now.I found out the hard way it didn't help and I got fired, lucky it was only my part time job.How do you adapt 8 bit ASM to 32/64 bit ARM, your going to have massive fun doing ASM on that and they are cheaper than 8 bit and have everything on board.Arduino allows you to use 1Ghz ARM.I am a Pro programmer with many products on the market and I use it for home projects, I just don't tell my boss.Yes I still have amateur radio gear that uses valves.

author: armandine2
author_rank: Frequent Contributor
timestamp: October 07, 2021, 11:46:29 am
content: The Ben Eater recommended text is somewhat pricey (after his recommendation no doubt) but is available online as a pdf from a good (imo) "archive source".

author: Ian.M
author_rank: Super Contributor
timestamp: October 07, 2021, 12:34:34 pm
content: Why would you mess around with old UV EPROMS unless you were restoring a vintage system?For any learning and experimenting, you'd be far better served by a 64Kx8 parallel EEPROM in PDIP-28 pakage, e.g.https://www.microchip.com/en-us/product/AT28C64BBen Eater has an Arduino based programing circuit for them, which if you use a Uno or similar also needs 2x 74HC595 SIPO shift registers to handle the address bus:https://github.com/beneater/eeprom-programmeror roll your own based on an Arduino Mega with no extra chips required (although a P-MOSFET or SPST switch to gate EEPROM Vdd would be helpful, so you don't have to unplug it to change chips).

author: bostonman
author_rank: Super Contributor
timestamp: October 07, 2021, 01:31:23 pm
content: I'll check out the Ben Eater channel tonight.As for the feedback from everyone. I feel I've stirred up some opinions about the technology in general rather than my intentions of gaining an understanding. In my opinion, spending an exorbitant amount of time on a C64 has benefits because it's simple enough to gain a foundation in microprocessors. At the same time, spending too much time means I'm falling behind on current technology.Anytime I've dealt with a piece of equipment with a micro, RAM, ROM, and some sort of programmable device such as a NVROM, I always find myself confused. I'm trying to take this opportunity to understand how the chips all communicate with each other, which chips generate the signals, and which chips are a slave to the signals. Although a logic probe is probably useful (although I almost never used one), I always used a scope because I like to see the signals rather than a beep/light.In any case, I get overwhelmed with computer circuits. Sure I can measure the R/W line and see activity, but then I look at the data bus and question if what I see is junk going out or junk coming in.I'm not looking to dive into registers, programming, etc... maybe it's necessary and I'm not realizing it, but I'm looking for an overview of say driving from the east coast to the west coast, not how my transmission works while driving.In the case of a computer based circuit, I always resort to basic chip swapping without learning anything. While some guess work may still be required, if I can at least chase down a signal that's not correct thus narrowing it down to two chips, then I can feel better knowing I'm actually following the signal path correctly.In my example of inputting a number '2', I thought an easier explanation would exist rather than diving deep into the micro.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 07, 2021, 06:30:16 pm
content: Quote from: bostonman on October 07, 2021, 01:31:23 pmEveryone has their own interests and learning style - so I'd say keep following your interests and passions while looking for what resonates with you.+1 for Ben Eater's videos, projects, and most likely whatever book(s) he might recommend.Here is another book that is worth a look-see:The Elements of Computing Systems: Building a Modern Computer from First PrinciplesNoam Nisan, Shimon SchockenThere is a 2nd edition that might be more up to date but the 2nd edition might be somewhat more directed at Operating Systems than the hardware and the overall stack.Search for the first version on Amazon and it will give you a "Look Inside". Read the first couple pages (Preface/Scope) - the authors have a very good writing style. The Preface/Scope introductory pages are definitely worth a read. Additionally, there is a web site that is full of resources including interactive tools:https://www.nand2tetris.org/bookhttps://www.nand2tetris.org/coursehttps://www.nand2tetris.org/demos

author: james_s
author_rank: Super Contributor
timestamp: October 07, 2021, 07:59:04 pm
content: Quote from: Kerlin on October 07, 2021, 08:09:49 amWhat are you talking about? I built a 6502 system entirely within a $15 FPGA board, memory contents is loaded from a file into block RAM. For one made of real hardware there are multiple different PCBs available, just solder in a handful of DIP sockets and passives. Nobody uses UV EPROMs anymore for development work, electrically erasable EEPROMs are much easier. Using a compiler for the 6502 would be ridiculous, these early systems are programmed in assembly, the only software tool you need is DASM. You can even do the whole thing virtually online although I much prefer working with real hardware.I have been developing for microcontrollers, mostly AVR for more than 20 years now and I did not truly understand how a microprocessor works internally until I took the 6502 programming course. The 6502 in addition to being iconic is a fantastic way to learn the general concepts because it is so incredibly elegant and minimalist and yet there are so many thousands of examples out there using it and loads of iconic classic computers based on it. If I wanted to design an embedded system just to get a job done would I use a 6502? Of course not, but if my goal was to learn how computers work and familiarize myself with vintage hardware? Absolutely. It's hard to think of a more suitable platform for that.

author: brucehoult
author_rank: Super Contributor
timestamp: October 07, 2021, 09:02:51 pm
content: Quote from: Ian.M on October 07, 2021, 12:34:34 pmIt seems to me that this is even better:https://www.digikey.co.nz/en/products/detail/microchip-technology/SST39SF010A-70-4C-PHE/2297826128k x 8 parallel flash in DIP32 for NZ$2.41 (US$1.67). Cheaper than EEPROM. Faster than EEPROM (so you can run your 14 MHz 65C02 at full speed). 256 KB and 512 KB versions are only a little more if you want to do some bank switching.You can treat it as ROM, but the 6502/Z80/whatever processor itself can write to it if you want. Or hook it to an Arduino to do the programming.

author: daveho
author_rank: Newbie
timestamp: October 07, 2021, 09:58:36 pm
content: What finally made microprocessor systems "click" for me many years ago was "The Microcontroller Idea Book" by Jan Axelson. It's now available as a free PDF on her website:http://janaxelson.com/files/microcontroller_idea_book.pdfThe 8051 series microcontrollers have enough similarity with 8-bit microprocessors that nearly everything hardware-related in the book is relevant. The explanations of busses, address decoding, glue logic, etc. are excellent.Anyway, that's my $.02. I do agree with the suggestion of watching Ben Eater's videos, of course.

author: bostonman
author_rank: Super Contributor
timestamp: October 08, 2021, 03:24:21 am
content: During my electronics engineering courses, I'd get an introduction about microprocessors and always thought I'd get the overview I was hoping for.It always resulted in a general overview with it turning into binary math, but never got into laying out a micro, ROM, RAM, and whatever else, and explained how the four or five chips all talked to each other.I'll check out the video(s).

author: ledtester
author_rank: Super Contributor
timestamp: October 08, 2021, 03:23:58 pm
content: Quote from: bostonman on October 08, 2021, 03:24:21 amReal brief description...It's all done with "memory-mapped I/O". The I/O chips (like the CIA in the C64) appears just as RAM to the CPU. They respond only when the CPU reads and writes to certain addresses. Each chip (RAM/ROM/CIA/etc.) has a CE (chip-enable) signal which tells when it should respond to reads and writes on the data bus. The CE signal for each chip is derived from the current address being accessed using digital logic chips (NAND/NOR/etc.) For any given memory address only one CE signal should be active at a time.

author: james_s
author_rank: Super Contributor
timestamp: October 08, 2021, 07:50:55 pm
content: To elaborate a little on that, the peripheral chips are all wired in parallel on the data bus, and typically there is some sort of read/write line, the state of which selects whether whatever chip is active should expect to be read from or written to. When it was said that the enable signals are derived from the address it means there is an address decoder, this circuit will result in various outputs going active when there is a specific range of addresses on the address bus.Complicating matters somewhat, a lot of simpler systems do not have fully decoded addresses, the decoder circuit may only look at a few of the address lines and the ultimate effect is that some of the peripherals are "mirrored" at multiple address ranges. Writing to 0x80AA may activate the same chip as writing to 0x00AA for example because in that example the state of the highest bit on the address bus is not even looked at.

author: westfw
author_rank: Super Contributor
timestamp: October 08, 2021, 09:40:02 pm
content: You could dig up the oldPopular Electronics,Radio Electronics, andByte Magazinearticles from the days when building your own computer was believed to require some knowledge in those areas. The Altair 8800 was described (starting?) inPopular Electronics, Jan 1975(page 33)

author: HobGoblyn
author_rank: Unknown
timestamp: October 08, 2021, 10:03:42 pm
content: I’ve watched a load of the Ben Eater vids over the months. I have almost all the parts to follow his “building an 8 bit bread board computer”Might build it at some point, think I will learn a lot along the way.

author: westfw
author_rank: Super Contributor
timestamp: October 09, 2021, 12:39:16 am
content: QuoteNote that building a computer from logic chips, as Ben does, is a significantly different project than building a computer from a microprocessor and "high-level" peripheral chips. It's probably really educational, but may be pretty useless if you're aiming at a Commodore-64 class machine... (and building something like an Arduino from a Microcontroller with internal peripherals is yet another "level.")

author: gcewing
author_rank: Regular Contributor
timestamp: October 09, 2021, 03:46:16 am
content: Quote from: westfw on October 09, 2021, 12:39:16 amHe also has a series where he plays around with a 6502 on a breadboard, you may find that instructive.

author: BrokenYugo
author_rank: Super Contributor
timestamp: October 09, 2021, 04:06:17 am
content: I found it got to be fairly intuitive after dabbling in 6502 assembly on my Atari 2600. Assembly has you talking to the hardware directly, so learning to program is learning how the hardware works down to the data/address bus level. Once I knew the opcodes and memory map it just kinda clicked. I'm not sure how well documented or easy to work with the C64 is for such things, but 2600 has some good guides, a cycle perfect emulator, and is simple to a fault.

author: brucehoult
author_rank: Super Contributor
timestamp: October 09, 2021, 06:22:07 am
content: Quote from: BrokenYugo on October 09, 2021, 04:06:17 amI like the 6502. It's what I taught myself when I was 17, from the reference material (opcode map, ROM listing) in the back of the Apple ][ manual. It's really amazing that you can still buy them new for a reasonable price today ($8 for a 14 MHz 65C02).While I think the 6502 is better and easier to learn than 8080/z80, in some ways it is a complex little beast to master. The 6800 is significantly easier to understand than any of those, though as a result has significantly bigger and slower programs and is a bit more tedious to use. It's a pity they've got basically no mindshare now.

author: westfw
author_rank: Super Contributor
timestamp: October 09, 2021, 06:58:58 am
content: QuoteAlso note that a lot of the "magic" of vintage computers like the C64 or 2600 or Apple ][ was in clever peripherals (either built from logic code from custom-made ICs.) It's relatively trivial to build a Z80 computer capable of running CP/M (four chips!), or a similar 6502 or 6809 system, but they're sort-of boring without the neat-o graphics engines and such :-(

author: bostonman
author_rank: Super Contributor
timestamp: October 09, 2021, 01:50:24 pm
content: Keeping in mind, I'm hardware, so I'm uncertain if spending time on learning the addresses and just exactly what is occurring inside the 6502 is applicable to repairing a broken C64 (i.e. 6502 based system).I'm somewhat asking the question above and not trying to assume it's a fact. It's that I get the feeling more answers are based on software engineering than voltage/scope measuring.Ignoring the fact the data bus flies around quickly (or at least for me it's too quick to understand), I feel my level and needs is more of (using an example): when I'm measuring an address line (let's assume A1), and I question why it's not going 0-5v, is that because the 6502 is generating A1 and I need to focus on the 6502, or does it mean the ROM chip is telling the 6502 to generate a signal on A1 but something is loading it down. Or if the signal is 0-5v, is the 6502 the one generating A1, or is another chip telling the 6502 what to do?If a chip (let's say the ROM chip) has a R/W line, I'm guessing I need to simultaneously measure the R/W line and the data bus to see when it's being told to read and when it's being told to write. If this is true, then I've been measuring wrong because I just use a single probe (although someone above mentioned a logic probe and meter is all that's needed).On another note, most often times I don't see nice 0-5v signals when measuring microprocessor circuits. As of recently, I learned I need sync the scope to the microprocessor clock in order to not see ghost images. I haven't got to the point where I've started measuring again, so I haven't taken the step(s) to sync the scope.In school we were always taught signals go 0-5v (ignoring that nowadays they are lower voltage levels), but, when I measure any data bus signal(s), they are always messy, sloppy, and seem to break the rules of 0-5v levels. This always confuses me and makes me question whether the bus is being loaded down by a chip, and, if it's a chip, which one.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 09, 2021, 05:20:27 pm
content: Quote from: bostonman on October 09, 2021, 01:50:24 pmI empathize with and admire your approach to investigating and learning, and I think you are doing a nice job of breaking things down to questions regarding what you want to understand next.It seems that you are working to understand how chips communicate (send/receive and read/write), and maybe, also, how at an even more fundamental level to discern a high vs a low - particularly when the signal is not clean (ie, when it's noisy). Clearly, until we can confidently determine a high or low it will be hard to get to binary, hex, decimal, etc. and without accurately determining how the bits form bytes it will be hard to get to op codes such as Chip Enable, etc, and without the op codes it will be hard to get to the protocols for managing the the interactions that form communication protocols. It seems therefore, that very rightfully, you are sitting at the intersection of hardware and firmware/software. fwiw I think there are lots of people who would like to understand computer and networking (IT) architecture from the ground up and who are looking for videos, articles, books, discussions, and projects that can help them progress from the foundation of electrical circuits to more intermediate and advanced knowledge - especially as it relates to how voltage leads to bits, bytes, logic, and the many layers of building blocks above the foundation.The good news is that as we frame and reframe questions there are lots of helpful people here that help us figure out how to get from where we are to where we'd like to go next.Regarding high low and transitions this article and the discussion of noise margin might be helpful - or you might be beyond this, in which case, time for some more questions.https://www.allaboutcircuits.com/textbook/digital/chpt-3/logic-signal-voltage-levels/In any event, keep asking questions. I think you are on a good very good path.

author: james_s
author_rank: Super Contributor
timestamp: October 09, 2021, 05:38:48 pm
content: The address lines are always driven by the microprocessor, they are outputs that come from the program counter. If the value of a particular address line isn't changing it's possible that the CPU has not processed an instruction to do something at that address, or it is possible something is loading it down, that can be tricky to determine.Yes you will need to monitor the R/W line, and the address bus, and the data bus, and sample on the clock transitions if you want to get a meaningful picture of what data is being written/read and where. That is precisely what logic analyzers are designed to do and the reason they have so many inputs.In an ideal world TTL logic levels are 0 or 5 volts, but in the real world things are somewhat more analog. The threshold voltages vary depending on the logic family but you can look those up. Things are complicated somewhat by tristate buffers that individual devices use to interface to the data bus. They will let go of the bus when they are not using it so that other devices can communicate and when that happens it is possible to have times when nothing is on the bus and the voltage on one or more lines will drift to indeterminate levels. Any time the enable line on a particular chip is active, the data on the bus had better be valid at the moment the system clock transitions.I think there is great value in understanding how the 6502 works internally and a gaining at least a rough idea of how to program it in assembly in order to understand how the system as a whole works. Software and hardware work hand in hand at this level, neither will do anything at all without the other.

author: BrokenYugo
author_rank: Super Contributor
timestamp: October 09, 2021, 07:46:59 pm
content: One tool that may interest you is a "NOP generator", this replaces the ROM and forces the data bus to the NOP instruction (do nothing and advance to next address), which forces the processor to loop through every address one at a time, so you have (if everything is working right) very predictable signals on the address bus you can check for (just binary counting), can see that any address decoders are working properly, etc.This video gives an alright introduction, and the channel is very C64 repair heavy.https://youtu.be/-gDKl15WYuc?t=1050

author: westfw
author_rank: Super Contributor
timestamp: October 09, 2021, 11:06:57 pm
content: Also, many of the non-ancient CPUs can be clocked down to DC, so if you want to put an LED on every signal and feed the clock with a (debounced) pushbutton, it will probably work. (I say "probably" because I've seen strange "requirements" that the clock period not change significantly over short periods of time on some CPUs.)This is only likely to be interesting on a CPU that takes multiple clocks to execute a single instruction, and has a bunch of signals that show up externally. Like a Z80m 1802, or 8051 in "external program memory mode."

author: ledtester
author_rank: Super Contributor
timestamp: October 09, 2021, 11:13:22 pm
content: Quote from: bostonman on October 09, 2021, 01:50:24 pmIt turns out that the following chips on in a C64 could assert addresses on the address bus:- the CPU- the video interface chip (VIC) for video generation and DRAM refreshes- the ram expansion unit (REU) which has a DMA controllerThis article does a decent job of explaining the details of how memory is accessed in the C64:http://www.c64os.com/post/flitiming1It turns out the VIC chip is pretty much in control of the address/data bus.QuoteI probably would just probe the CE (sometimes called "CS") signal for the chip to see if it was being interrogated.A logic analyzer might be a good tool to use for what you want to do. Here is a video of someone using one of those cheap USB logic analyzers to debug the PLA chip in a C64:- How the C64 PLA works! Debugging the Programmable Logic Array in the Commodore 64, Logic Analyzer -- ACs 8-Bit Zonehttps://youtu.be/OgFxB-P8SqE

author: BrokenYugo
author_rank: Super Contributor
timestamp: October 10, 2021, 12:07:00 am
content: Quote from: westfw on October 09, 2021, 11:06:57 pmThe original NMOS 6502 (and derivatives thereof, presumably) has a minimum clock speed, but can be single stepped/cycled via the sync and rdy pins. Steve Wozniak published a handy circuit in the Apple 1 manual for doing this.https://old.reddit.com/r/beneater/comments/foezld/wozs_circuit_to_singlestep_nmos_6502/

author: gcewing
author_rank: Regular Contributor
timestamp: October 10, 2021, 09:06:20 am
content: Quote from: BrokenYugo on October 10, 2021, 12:07:00 amAlso, if the system uses dynamic RAM, as most 8-bit machines of that era did, even if the CPU will work at a low clock frequency, the memory won't.

author: brucehoult
author_rank: Super Contributor
timestamp: October 10, 2021, 03:44:33 pm
content: Quote from: gcewing on October 10, 2021, 09:06:20 amFortunately for modern experimenters, you can now get 128k x8 of 55 ns static RAM in a 32DIP for $6https://www.digikey.co.nz/en/products/detail/alliance-memory-inc/AS6C1008-55PCN/4234576Or 512k x8 for $10.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2021, 01:32:33 am
content: I watched the YouTube video with the guy using a logic analyzer. That analyzer looks pretty sweet and I may buy it. I came across a 16 channel 100MHz model for about $80 I think, so I may buy that one instead.I'm torn because I expect that this can be fixed with an oscilloscope, but I really want a new toy to play with.I think being able to see many logic lines simultaneously would be really cool and educational.Anyway, I'm confused. I wanted to use my Agilent scope to save waveforms of a good C64, but, due to not getting clear waves, I don't want to waste time saving junk waveforms. I'm trying to ask my questions based on the origin of this topic which is microprocessors and not turn this into a C64 repair thread (I dislike when I'm reading a thread and it deviates without solving the issue in hand). If I seem to deviate, feel free to call me out on it.I took a working C64 and measured a single address line. In the attached, it's several pictures of the exact same pin (i.e. address line) of a good unit. If you notice, it jumps around constantly (flip quickly between the pages) thus eliminating the possibility of trying to figure out when it's on or off. I tried taking the clock from the C64 into the scope, but, as I learned many years ago, clipping on the crystal directly causes it to stop clocking. If I clipped onto a clock signal from an IC (which is technically buffered), I didn't get a cleaner signal on the scope.Without deviating too much, how can I measure the microprocessor signals correctly if I can't see them?

author: james_s
author_rank: Super Contributor
timestamp: October 11, 2021, 03:23:09 am
content: Looking at a single address line doesn't tell you anything though, it's going to depend very heavily on what the computer is doing and without knowing what the rest of the address lines are doing at the same time the only thing you can tell from one of the address lines is whether it has some sort of activity and reasonable looking logic levels.Something to remember about a computer is there is a program running all the time at a very low level even when there is no user software loaded at all. This is the BIOS, it is what the CPU loads from ROM the moment power is applied. It contains routines that write characters to the video controller, scan the keyboard, access storage devices to load an operating system and handle other very low level stuff. Because this low level stuff is going on constantly, the address and data buses are going to have constant activity. You can check the enable lines on various other chips but most of those too will have constant activity. A scope will show you the waveform but beyond checking that you're getting some kind of reasonable logic levels that waveform isn't very useful. It shows addresses are being accessed, but which addresses? You can't tell that without seeing all the rest of the address lines, at the moment of each clock transistion.You may be able to get something intelligible from a scope but you'll want to hook up external triggering to trigger the scope from the clock.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2021, 03:31:27 am
content: QuoteThe single address line was to show what I'm seeing on the oscilloscope and questioning how to trigger the scope with the microprocessor, however, I agree and it secures my limited knowledge of measuring microprocessor circuits that I need to look at more lines. I just ordered a USB logic analyzer and it should be arriving Friday.Triggering the scope with the C64 didn't seem to make a difference. I was expecting to see some clean clock pulses, but all I got was constant jumping.Any advice on where to pick up a trigger point on the C64?

author: james_s
author_rank: Super Contributor
timestamp: October 11, 2021, 03:36:02 am
content: What are you seeing? If you're trying to look at the data bus you're going to have to do a single shot capture because it isn't going to be a repeating waveform, it will be going high and low at different times, if you have a repeating sweep it will draw a different waveform with every sweep.You should be able to trigger off of the CPU clock, although that's still going to have the problem where you'll only see something reasonable if you do a single sweep capture.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2021, 03:38:37 am
content: I posted a PDF above on what I'm seeing.Oh, just a single shot? I have the scope in regular mode and I'm seeing (as I've seen many times in the past), lots of jumping around.If you look at the PDF, not only is the waveform changing, but it changes amplitude too (this adds more confusion).

author: james_s
author_rank: Super Contributor
timestamp: October 11, 2021, 04:34:28 am
content: Well of course it's going to be jumping around if you're doing a repeating sweep, the pattern is constantly changing so it's going to draw a different pattern with each sweep and that's just going to look like noise. Repeating sweep only works on a repetitive signal, the waveform on one of the lines in a digital system is going to be more like random noise unless you write some test code for the CPU to execute that runs in a tight repeating loop. This is exactly why analog scopes are rarely used for troubleshooting digital systems and logic analyzers were invented. Digital scopes can do a single shot capture like a logic analyzer, albeit with fewer channels.

author: gcewing
author_rank: Regular Contributor
timestamp: October 11, 2021, 05:35:38 am
content: There are a couple of reasons you might be seeing varying voltages. One is, as mentioned, there may be periods when nothing is driving the bus and you just see whatever random voltage it happens to float at.The other is that different logic families have slightly different ideas about what "high" and "low" logic levels are. CMOS tends to drive its outputs very close to the rails, whereas a high TTL output is usually somewhat lower than 5V. So if the bus is sometimes being driven by a CMOS chip and sometimes by a TTL chip, you can get varying high levels like you're seeing. There could also be minor variations betwen different chips in the same family, chips from different manufacturers, etc.Your traces also show some examples of "ringing", where an output changes suddenly, and due to inductance and capacitance of the wiring the signal oscillates around a bit before settling down.

author: bostonman
author_rank: Super Contributor
timestamp: October 11, 2021, 01:11:29 pm
content: QuoteI'll hopefully get my 16 channel logic analyzer by the weekend (and hopefully will have time to use it). Back to my original question, the above quote is actually the input I was looking for. It's the first step in what happens when power is applied.If I understand correctly and assume what happens, the CPU (microprocessor) gets power and I imagine is sends a S (send) signal to the ROM along with applying the correct address on the address bus in order to tell which chip to access. At that point the ROM receives the 'send' signal, knows it's being talked to because it's being addressed, and places data on the data bus, is this correct?

author: ledtester
author_rank: Super Contributor
timestamp: October 11, 2021, 04:05:38 pm
content: Quote from: bostonman on October 11, 2021, 01:11:29 pmFor a ROM there are three kinds of pins:- address pins which are inputs- data pins which are outputs (and may be high impedance)- control pins which are inputsThe data pins will be high-z unless the control pins are set up in a certain way and in that case the data pins will reflect the data stored are the address presented on the address pins. When you change the address the output on the data pins is updated pretty instantaneously -- there is no need to inform the ROM chip that you've changed the address.This is a pretty good blog post on how to read a bare ROM chip with an Arduino:https://danceswithferrets.org/geekblog/?p=315The protocol for RAM chips is more complicated.

author: rstofer
author_rank: Super Contributor
timestamp: October 11, 2021, 04:16:20 pm
content: Bitsavers.org has copies of the 6502 hardware and programming manuals from way back whenhttp://www.bitsavers.org/components/mosTechnology/When uCs first came out, around '75 or so, the manuals were excellent. The factory had to produce useful manuals or there wouldn't even be a market for the chips. Chicken and egg problem re: introduce the chip, create a market.

author: rstofer
author_rank: Super Contributor
timestamp: October 11, 2021, 04:29:04 pm
content: Quote from: bostonman on October 11, 2021, 01:11:29 pmThe CPU, on startup, first forces a branch to the start address. On early 8 bit CPUs, this was address 0. For the 8086, it is address 0xFFFF0, others may vary... This may just be the default setting of the Program Counter at startup. No actual jump instruction is required. In any event, the CPU fetches its first instruction from this boot address.Then it starts the routine of fetch an instruction, decode the instruction, fetch operands, perform operation, store results and increment the program counter. The timing of all this stuff is given in the hardware manual. Some steps may be omitted for some instructions (NOP, for example, doesn't do anything and need not fetch or store anything).All this assumes that there is already code in memory at boot time. So, a small EPROM was temporarily mapped into the boot address, say, address 0x0000, and contains enough code to relocate a loader to high memory. This loader would first map out the EPROM and replace it with RAM and then bring in the operating system and initialize all of the hardware.

author: james_s
author_rank: Super Contributor
timestamp: October 11, 2021, 05:23:08 pm
content: Quote from: bostonman on October 11, 2021, 01:11:29 pmWhen the microprocessor comes out of reset, it jumps to the reset vector, this is a memory location 0xFFFC in the case of the 6502, in other words the address bus will jump to the state 1111111111111100 and the processor will read whatever appears on the data bus at that point. The way this generally works is the address decoding activates the ROM and the data placed within it at that address is the first of the series of instructions that gets executed as the system boots. The reset vector is hardwired and integral to the particular family of microprocessor, it will ALWAYS try to start executing from that address when it is reset. I'm not sure what you mean by Send signal, the CPU sets the address lines to 0xFFFC and the address decoding circuitry responds to that combination of high and low address lines and asserts the enable pin on the ROM, which itself is also connected to the address bus and the data corresponding to that address appears on the IO pins of the ROM which are connected to the data bus that the CPU is also connected to.This is the course I mentioned earlier, all of this is very well explained in it.https://www.udemy.com/course/programming-games-for-the-atari-2600/If you keep an eye on it they have sales all the time, I think I paid under $10 for it.

author: jmelson
author_rank: Super Contributor
timestamp: October 11, 2021, 05:44:20 pm
content: Quote from: bostonman on October 11, 2021, 01:32:33 amI checked out the first instruction fetch of a Z-80 board a LONG time ago with a scope. I hooked up a timer to reset the CPU very quickly, and triggered the scope from that. I then took a sheet of paper and drew out the address and other lines for the first few CPU clocks.So, this was essentially a human logic analyzer. It worked, but was quite tedious. A logic analyzer is QUITE handy for checking out things with many important signals. Also, obscure defects are MUCH more easily spotted with one.Jon

author: brucehoult
author_rank: Super Contributor
timestamp: October 11, 2021, 07:56:46 pm
content: Quote from: jmelson on October 11, 2021, 05:44:20 pmSome friends and I debugged a 6809 board we'd built the same way. Dual-trace oscilloscope, and continually resetting the CPU. Tedious but it only took a couple of hours to figure out what was wrong.

author: rstofer
author_rank: Super Contributor
timestamp: October 11, 2021, 08:28:43 pm
content: Quote from: bostonman on October 11, 2021, 03:31:27 amFrom your scope image, you can see the signal actively pulled high or floating tri-state or actively pulled to ground. I don't know enough about the CPU to know why the address lines go to tri-state but that's what it looks like. Read the hardware manual, it will explain all of this stuff.If you probe a low address bit (like A0), it will constantly be changing. If you probe a high address bit (like A15), it may never change.If you can come up with a way to attach the probes, a logic analyzer will be a great help.

author: BrokenYugo
author_rank: Super Contributor
timestamp: October 11, 2021, 10:07:35 pm
content: Quote from: bostonman on October 11, 2021, 01:32:33 amI think it may need to be emphasized that when talking at the bus level of a microcomputer like a C64 there is a great deal of overlap between understanding the assembly/machine code, and understanding what's actually happening electrically between the chips. If you know one you just about know the other, and if you know both then things like how to take effective measurements and diagnose the hardware come naturally. The meandering to C64 repair is a given if you just want to figure out how to measure something and not learn the relevant engineering behind the generation of those signals, because then we need to know what exactly you're trying to see and what you expect to achieve with that information.A logic analyzer is more or less the ultimate tool for the job, the biggest hammer in the toolbox, but I don't think you'll have much fun with one if you have no understanding of the opcodes and memory map of the system you're working on.

author: westfw
author_rank: Super Contributor
timestamp: October 11, 2021, 11:45:30 pm
content: The old computers (Altair, COSMAC Elf) (which I've mentioned before) were REALLY GOOD for learning some of this stuff, because those famous "front panels" with all the switches and lights - those were essentially connected directly to the microprocessor buses. To load a program into memory, you'd set some switches to the address, and some to the data you wanted to put there, and then flip a momentary switch to activate the "write" and chip-select lines of the memory (all while holding the CPU chip itself in a "don't access the bus" state.)Good front panels had the address lines on counters, so you could just do "next address" instead of loading more switches.Modern "simulations" may have things that LOOK like front panels, but they usually just interface to software, and you don't learn as much

author: Electro Fan
author_rank: Super Contributor
timestamp: October 12, 2021, 01:26:18 am
content: Quote from: westfw on October 11, 2021, 11:45:30 pmSomewhat off topic but it might be cool if someone marketed a current day kit version of what you describe - with the parts and educational instructions - sort of as a next step up or a diagonal step up from Ben Eater’s breadboard kits. Or maybe it’s something Ben might offer. Might be hard for some enthusiasts to turn down a chance to learn while playing with a front panel full of switches and lights - might make learning computer architecture more interesting and fun than using a keyboard.

author: brucehoult
author_rank: Super Contributor
timestamp: October 12, 2021, 02:05:12 am
content: Quote from: Electro Fan on October 12, 2021, 01:26:18 amIt's very very boring entering things using front panel switches. I've done it to enter the initial bootstrap for a Burroughs B1700. Fortunately it was only a couple of instructions. I don't know what they were! We only had the binary values for them. I want to say those instructions were enough to read the next stage bootloader from cassette, but that seems improbable. More likely there was a small punched card deck that had code to read the cassette. The code on the cassette for sure then allowed reading from a 5 MB removable disk pack and loading code from there.It was possible to halt or single-step the CPU and use a big rotary knob to choose which register was displayed on the lights.All this kind of thing went away with the development of cheap and large and fast semiconductor PROM and EPROM to boot from.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 12, 2021, 02:31:01 am
content: Ok, fair point. Maybe it would be less nostalgic but more useful to start somewhere abouthere.

author: bostonman
author_rank: Super Contributor
timestamp: October 12, 2021, 03:33:37 am
content: QuoteI'll admit, my mind goes into a loop when I being reading extensively about the opcodes and memory map. It's quite a bit to process because it's hard to visualize what's going on.I'd learn better if I could (as it's been suggested) see changes on individual clock cycles. Once I put a logic analyzer on, I expect that I'll gain a much better understanding of whether a chip is functioning correctly.As for being able to clip onto the ICs, I have those IC clips (although I've never liked them because I feel they apply too much clamping force).As far as I know, manually cycling the C64 can't be done unless I do things like remove the crystal - but I'm obviously inexperienced, else I wouldn't have needed to start this thread.I can just swap ICs until I fix the unit, however, just about all of them are soldered, and, the only donors I have are perfectly good working units (I have some spare questionable spares). So I somewhat need to be correct in finding a bad IC before I go through the trouble of unsoldering them.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 12, 2021, 03:41:38 am
content: bostonman do you have a link to your new logic analyzer?

author: bostonman
author_rank: Super Contributor
timestamp: October 12, 2021, 03:46:57 am
content: I got the LA2016 (description is below in case Amazon link doesn't work).https://www.amazon.com/Inno-Maker-Analyzer-Channels-KingstVIS-Instrument/dp/B07D21GG6J/ref=sr_1_3?dchild=1&keywords=LA1010+USB+Logic+Analyzer&qid=1634010344&sr=8-3LA1010 USB Logic Analyzer 16 Input Channels 100MHz with The English PC Software Handheld Instrument,Support Windows (32bit/64bit),Mac OS,Linux

author: james_s
author_rank: Super Contributor
timestamp: October 12, 2021, 03:52:33 am
content: Memory map is not a difficult concept, it all boils down to the address decoder logic. Are you familiar with how a decoder works? If you aren't, read up on it, once you've seen one you've seen them all. The 74LS47 is a simple one, it's designed to drive a 7 segment display from a 4 bit binary input but the concept is the same. The simpler 74LS138 is a common part used in real world address decoders. In a nutshell the decoder will assert (make active) one enable line for each range of address values. If you have a 2k ROM chip that you want to connect to the microprocessor you would wire up a decoder chip that activates the output connected to the ROM whenever any one of a block of 2048 consecutive values are present on the address bus.Part of the address bus feeds directly to the address inputs on the ROM itself, and the rest of the address bus is used to determine which of several chips on the bus is active at a time. The ROM can be said to be "mapped" at any arbitrary place within the 16 bit address space, which ranges from x0000 to xFFFF, 65,536 possible addresses.

author: brucehoult
author_rank: Super Contributor
timestamp: October 12, 2021, 06:12:12 am
content: Quote from: bostonman on October 12, 2021, 03:46:57 amNot expensive, but also frustratingly limited! 16 channels seems like not really enough -- ideally for poking around in a C64 etc you'd want to capture 16 address plus 8 data plus R/W and a few other control signals. 32 inputs would be perfect.Also, when using all 16 inputs it's only 16 MHz. Which to be fair is more than enough for the 8 bit micros.It seems this one doesn't have any significant internal storage, but has to stream everything to the PC in real time. Which USB3 is more than fast enough for.Is there a way to synchronise two or more of them?

author: Ian.M
author_rank: Super Contributor
timestamp: October 12, 2021, 06:54:03 am
content: In practice, the 16 channels isn't as much of a limitation as you would think. Eight for the data bus, R/W, ø2, SYNC, and RDY is sufficient to fully trace 6502 instruction execution*leaving you four for <whatever>, e.g. decoded enable signals of one or more memory mapped chips, latched port output bits, or even if you must, address lines.* See:http://forum.6502.org/viewtopic.php?f=4&t=4963

author: bostonman
author_rank: Super Contributor
timestamp: October 15, 2021, 03:47:28 am
content: I found this online. Although this is a 'microprocessor' thread, thought I'd share the block diagram.

author: james_s
author_rank: Super Contributor
timestamp: October 15, 2021, 05:47:11 am
content: Unfortunately that doesn't really tell you a whole lot, it's pretty much like any other 8 bit computer at that level, save for a few special chips.The address decoder in the case of the C64 is a PLA, so it can be considered a black box that activates one of a number of enable lines depending on the state of the address bus, that diagram doesn't show which addresses activate which chips, although that information is available elsewhere in the form of the memory map.

author: bostonman
author_rank: Super Contributor
timestamp: October 15, 2021, 01:37:16 pm
content: I agree, but at my level, this colorful visual is a nice help to see the actual flow.

author: james_s
author_rank: Super Contributor
timestamp: October 15, 2021, 09:55:40 pm
content: The important thing to remember is that all of the addressable parts are connected to the address bus which the CPU drives, and to the data bus which is either an input or output depending on what the CPU has set it to, and this will be indicated by the state of the R/W line. One device can be active on the data bus at any given time and the address decoder determines which device this is. To write to anything the CPU sets the address bus to an address within that device, sets the R/W line to write, and then puts the data on the data bus. When the next clock transition occurs this data is latched into the device and the CPU moves on to execute the next instruction.

author: bostonman
author_rank: Super Contributor
timestamp: October 28, 2021, 02:37:09 am
content: I'm uncertain how deep I should go with this before it turns into a C64 repair thread, so I'll try remaining on track with the origin of how this thread began.Something isn't clicking with me or maybe I'm making too much out of this, but I feel I'm chasing my tail with looking at the bus with a logic analyzer because I'm jumping from chip to chip and constantly changing the wire configuration on the analyzer. So far I've confirmed the address bus is basically not moving, or, if activity does exist, it's sporadic/random/seldom.Stop me if I'm going off track and deviating towards a C64 repair discussion. Although the PLA seems to be a main interface between the other chips and the address bus, I've replaced this sometime ago.Besides not seeing activity on the address bus, I noticed (with an oscilloscope) that the CS (chip select) on the Character ROM has very little activity. The activity I saw was a few 200ns pulses compared to a good one that is 50ns pulses occurring every 100ns.The Character ROM chip has an address of D000-DFFF.My first question: this is decimal 53248 - 57343 or binary 1101000000000000 - 1101111111111111This is two bytes long, but the address bus for this ROM chip is 12 bits. If the address bus was (for simplicity) one byte, how does two bytes get fed in? To use the ideal issue, how does 16 bits get fed into a 12 bit address bus?I assume this address is what is placed onto the address line to access this particular IC, and, from there, data is placed onto the data bus.Obviously the address lines don't exist at the moment, but figured I'd start with one (hopefully) easier question.If the CPU drives the whole address bus, and the address bus isn't working, although this seems too easy, why would the issue not be the obvious (the CPU)?

author: brucehoult
author_rank: Super Contributor
timestamp: October 28, 2021, 03:01:05 am
content: Quote from: bostonman on October 28, 2021, 02:37:09 amThere will be a circuit that detects when the top 4 bits of the address are 1101 and set the CS for the character ROM chip to 0, or to 1 otherwise. (I'm assume the CS is active low, which is often the case) The remaining address lines are connected to the character ROM as is.Let's call the top address bits a15, a14, a13, a12, a11, a10. There will often be a "hex inverter" chip that takes those and creates ~a15, ~a14, ~a13, ~a12, ~a11, ~a10. Then a 4-input NAND gate fed with a15, a14, ~a13, a12 will produce the proper (active low) CS for the ROM.CS signals for the various other ROM, RAM, and IO chips are created similarly.

author: bostonman
author_rank: Super Contributor
timestamp: October 28, 2021, 03:30:28 am
content: Makes a bit more sense because A12 to A15 go into the PLA, and the pin labeled CHARROM of the PLA goes into the CS of the Character ROM.The two other chips utilize A15 as part of the address bus, but assume the PLA handles the other three bits.It's not to say I would be wrong, but I considered un-soldering the Character ROM thinking it's pulling down the CS pin, but, if the address line isn't working, then neither is the PLA.Guess I'll stop looking at the ROM chips on the Logic Analyzer and move onto another chip.

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2021, 03:37:09 am
content: Quote from: bostonman on October 28, 2021, 02:37:09 amSince we're talking about hardware, everything is fundamentally binary. Typically it would be represented in hex for human readability but you could use decimal or octal or anything else you wanted, it's still binary at the hardware level. When discussing memory addresses, you're always describing the state of those 16 address lines and each of those lines can have exactly one of two states, ie binary. The address bus is 16 bits wide, the lower 12 bits address the specific cell in the ROM whenever the ROM is enabled, the remaining address bits are what get decoded to activate the ROM. If you were to pull out the CPU and hardwire the address bus to xD111 (1101000100010001) the top 4 bits (1101) are going to cause the enable line on the ROM to go active, the lower 12 bits are then what the ROM uses to select the specific byte stored in it. Any time bits 16 downto 13 of the address bus are 1101 the ROM will be enabled. Any other combination of those top 4 lines is going to enable something else.For example if you added another ROM, you'd connect bits 12 downto 0 to the new ROM, it would be wired in parallel with the one you have. You could then decode the top four address lines so that whenever they are 1111 it would enable that ROM, and you have now mapped a ROM to xF000 to xFFFF. Any time the microprocessor jumps to an address in that range it's going to be reading from that new ROM because that ROM is enabled any time the top four address lines are all high.

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2021, 03:49:06 am
content: Quote from: bostonman on October 28, 2021, 03:30:28 amIf the address line is not working, it's probably because the CPU is not trying to access that address. As I mentioned before, when the CPU resets it jumps to the reset vector which is a specific memory address and it executes the instruction that it finds there. The reset vector normally points to a location in ROM, this is determined by the way the hardware is designed, and the ROM needs to contain code that will instruct the CPU to do a sensible sequence of events. This will typically be something like zero out all of the locations in RAM, initialize some peripheral chips, and then start trying to load the operating system, which may be a disk operating system or something like BASIC in ROM. Now what can happen is there can be a fault, say a bad ROM, or a bad RAM or some other fault that causes the wrong instruction to be executed, maybe even an invalid instruction (illegal opcode) that does something that isn't useful. What happens then is instead of following the path and executing the desired sequence of instructions, the CPU runs off the road into the weeds and starts executing garbage. Sometimes it will just lock up, other times it will end up stuck in a loop, what the address bus does at this point depends on what instructions the CPU happens to be executing. It's possible it will only be a small number of addresses leaving most of the address bus dead. Not because there's anything wrong with the address line, but because the CPU is confused and not trying to access anything mapped to locations that use those address lines.This is why I've said that when looking at this level, hardware and software (in the form of ROM) are intimately intertwined. To separate them you would need to remove or disable the CPU and then you could use a row of switches (or an ardruino or something) to manually drive the address bus and confirm that the expected chip goes active when you access its address range.

author: bostonman
author_rank: Super Contributor
timestamp: October 28, 2021, 03:58:33 am
content: Will I harm anything if I pull the 6510 (MPU as marked on the schematic) and place 0s and 1s on the address bus only?If so, I think using less than 5v, maybe 3.5v would be safer.

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2021, 04:01:07 am
content: No, and no it won't make any difference. It is not a bad idea to use a resistor to drive each line, anything from around 100 ohms to a few k ought to be fine. Then if you accidentally connect to a line that is driven by something else you won't damage anything.

author: bostonman
author_rank: Super Contributor
timestamp: October 28, 2021, 04:11:37 am
content: I might be fairly lucky because the MPU is in a socket.Which other chips drive an address line?

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2021, 04:29:50 am
content: Nothing else drives an address line, but it's easy to attach something to the wrong pin.

author: bostonman
author_rank: Super Contributor
timestamp: October 28, 2021, 02:31:16 pm
content: This is a valuable suggestion. The MPU is in a socket, and I'll be able to use my 16 channel Logic Analyzer to look at all the pins on an IC without occupying the majority for the address bus because I'll know their state since they won't be moving (after I confirm my address bus settings are present).I don't have an Ardruino, all I have is a Raspberry Pi (and obviously a laptop to run the Logic Analyzer), so I'll probably end up making one with manual switches since I don't know programming to create a program for either.I'll look in my stash of parts, however, I doubt I have sixteen switches or a dip switch, so I won't be able to provide an update for some time.

author: james_s
author_rank: Super Contributor
timestamp: October 28, 2021, 07:54:30 pm
content: Dip switches are cheap, and if you don't have switches you can just poke wires into a breadboard. An arduino mega is only around $20 and programming some IO pins to a specific state is trivial. I saw at some point someone had developed a CPU simulator for this kind of work but I don't remember where I saw it.

author: brucehoult
author_rank: Super Contributor
timestamp: October 28, 2021, 09:49:34 pm
content: Quote from: james_s on October 28, 2021, 07:54:30 pmAnyone who hasn't already done so should obviously go back and watch the video linked in the very first reply in this topic, where Ben Eater uses an Arduino for exactly this purpose.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 02:32:22 am
content: Good call, I forgot about that video.It was very informative when I first saw it, but I think actually tinkering in real time caused me to get overwhelmed.The responses from James_s actually allowed me make some mental connections that I didn't grasp prior.I like the Audrino, however, I may keep the address bus much simpler and just go with manually toggling the address lines rather than go down a rabbit hole in areas I'm unfamiliar with.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 03:26:56 pm
content: Looks like all I have are 3.3 and 5v fixed regulators. I feel feeding 5v into the address bus may be too high since most lines seem to be around 3.8 - 4. Think 5v is still safe or should I use a power supply at 4?Also, I tend to get confused on grounds when rigging up stuff like this. If I supply the switches with an external supply, do I tie the grounds from the C64 ground and supply together and make them common?

author: james_s
author_rank: Super Contributor
timestamp: October 29, 2021, 07:20:42 pm
content: Why would you use an external supply? You have 5V available right there at the CPU socket, you already know that's properly referenced to ground. You can absolutely feed 5V from that supply directly into those address lines. An IC can't drive a line all the way up to Vcc but switches and buttons and stuff will, it's no problem at all.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 07:37:13 pm
content: Actually, I was trying to get too fancy and add LEDs figuring the external supply would benefit the fixture for current needs, but you’re absolutely correct, just use the 5v at the chip. I’m using the same 5v, same ground, no question about exceeding the 5v, etc…I’ll skip the LEDs most likely. Unfortunately I still need to visit the electronics store tomorrow to get DIP switches. It’s not too far, and a nice little ride.

author: james_s
author_rank: Super Contributor
timestamp: October 29, 2021, 07:39:02 pm
content: Running LEDs from the existing power source should be no problem at all. Especially modern LEDs that will be plenty bright on well under 1mA.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 07:58:21 pm
content: Damn, I’m swearing now. I realized the microprocessor is soldered. I had been looking at the VIC chip that is heat sunk to the ground shield for so long that I began thinking of this as the micro.I mean I knew which was the actual micro, but I’ve been looking at strictly address lines on the schematic that I haven’t paid attention to some of the chip names.Looks like I’ll have to unsolder this, clean the pins, and socket it for future removal - assuming this micro isn’t the culprit.

author: james_s
author_rank: Super Contributor
timestamp: October 29, 2021, 08:00:19 pm
content: That is quite surprising that it's soldered to the board. As long as you have a proper vacuum desoldering tool it isn't hard to remove. Be sure to take proper ESD precautions, early CMOS parts like that were a lot more fragile.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 08:10:24 pm
content: My working test bed has several ICs in a socket; my sentimental C64 has far less in sockets - it’s just my luck.Had more been in sockets, I would have just swapped ICs - which I wouldn’t have been happy at myself for because I feel it’s cheating.Although I have lots of equipment, my only soldering/desoldering is an iron, solder braid, manual suction, and a hot air pencil. An electric solder sucker is on my list.

author: james_s
author_rank: Super Contributor
timestamp: October 29, 2021, 10:07:53 pm
content: I would get one or at least borrow one before attempting this. Desoldering a 40 pin DIP from a double sided board without a desoldering tool is an exercise is masochism, and a good way to destroy vintage hardware.

author: bostonman
author_rank: Super Contributor
timestamp: October 29, 2021, 10:40:14 pm
content: I have unsoldered many double sided boards over the years, but you’re correct, it’s an exercise in masochism; which is a very creative way of putting it.I’ll look at what the electronics store sells when I go tomorrow, but know their prices are higher than online.I’ve looked at those desoldering guns before, but saw threads on here with various opinions on models, so I’ve always just stuck with good old braid.

author: brucehoult
author_rank: Super Contributor
timestamp: October 29, 2021, 11:34:46 pm
content: Quote from: james_s on October 29, 2021, 08:00:19 pmYeah, Apple used to put out videos scaring service people!It seems like it's just not a big problem now, with school kids handling AVRs and stuff all over the place, and they never seem to die.Perhaps they just figured out to add protection to the pins.

author: BrokenYugo
author_rank: Super Contributor
timestamp: October 30, 2021, 12:16:31 am
content: Have you ever done one this big? I'd say past DIP-16 a vacuum desoldering gun starts to become a requirement to guarantee survival of both the chip and board, or at least a good hot air station (some actually prefer this for IC desoldering). Only time I've had any luck desoldering big DIPs with wick and a sucker is if I got lucky and the board was all vias with no plated through holes.

author: james_s
author_rank: Super Contributor
timestamp: October 30, 2021, 04:24:54 am
content: I got by for years with wick and one of those Radio Shack suction bulb irons. I could often succeed but I damaged a few boards and ICs too. Then I got a Hakko 808 and suddenly I could pull a 40 pin DIP in a few minutes on a whim with very little risk of damage. Wished I had bought it years earlier. Now there are cheaper Chinese tools that are decent but the Hakko has still been a bargain.

author: bostonman
author_rank: Super Contributor
timestamp: October 30, 2021, 01:22:55 pm
content: QuoteI may have. I've worked on many boards over the years, however, things are different when you're at a company that has hundreds of spare parts versus a personal one-off item.I've researched some solder suckers and the Hakko (which has been recommended to others on here in messages I've read). The price had scared me off because I wasn't sure how good they are, but, also, I had a sucker at my old job and it was more work than they were worth (I don't remember the model - but it was older).If it successfully sucked the solder, I'd be lucky if it was enough to free the pin. With a fresh filter, completely clean nozzle, etc... I may get enough suction to clear another three or so pins before stopping to clear it. At this point it was a matter of wondering why, after cleaning it, was the solder still not getting sucked. Finally, due to not successfully sucking the solder on pins the first time, I'd pull up pads due to overheating from repeatedly trying to suck the solder.It got to the point where it was easier to cut pins, heat each pin, remove it, and then wick the remaining solder. If I knew the MPU was bad, obviously that's the approach I'd take.I'll try solder wick on a few pins and stop if it gets messy, but I agree, messing with a forty-pin IC is voodoo. I was somewhat successful removing the PLA chips which is less pins, however, just my luck, I think pin 24 broke at the edge. This is something I plan to address going forward, for now, I'm using a PLANKton in place of the PLA.The PLA is a common failure and why I attempted to replace it first. Unfortunately I began this repair a few years ago and then got side tracked with other important stuff - but now I'm hoping to keep at this until I fix it.

author: james_s
author_rank: Super Contributor
timestamp: October 30, 2021, 06:23:19 pm
content: Vacuum desoldering tools require maintenance, the Hakko (arguably one of the best on the market) comes with a little tool for reaming the nozzle tube. The tips wear out too and need to be replaced, my last one corroded out on the inside so it no longer made a good thermal connection and didn't work well. Also there is some technique required, you don't just melt the solder and pull the trigger, you do that and then follow it with a little swirl motion that pulls the pin away from the side of the hole and sucks out the remaining solder. Once you get all the pins desoldered give the IC a little tug and see if there are any stragglers and go back and give those another shot. With practice it is very effective and works extremely well.

author: Electro Fan
author_rank: Super Contributor
timestamp: October 30, 2021, 09:04:18 pm
content: Quote from: james_s on October 30, 2021, 06:23:19 pm+1 for Hakko FR-301https://www.tequipment.net/Hakko/FR-301/Desoldering-Equipment/Rework-Stations/?v=0It works well. Key is to know in advance which tips to have on hand. With the right tip it can produce consistent results following the technique described by James.

author: BlackICE
author_rank: Regular Contributor
timestamp: October 30, 2021, 09:31:49 pm
content: I used to dread desoldering things with braid or solder sucker. I had a project and broke down and bought a Hakko fr-301. Night and day difference a pleasure to use. I can remove 40 pin dips for fun. I replaced a 28 pin seven segment LED on a pool controller. That alone paid for the desoldering gun. It was the second failure of the controller board which cost over $300. I said these must be defective so decided to just replace the LEDs instead of buying another board that was just going to break again. I removed large filter capacitors on a power supply easily as well. Of course you have to buy a variety of tips to fit the job at hand.

author: james_s
author_rank: Super Contributor
timestamp: October 30, 2021, 10:37:56 pm
content: The one I have is the 808, it was $199 back when I bought it although that was quite a bit of money for me at the time, I have never regretted it. I've never used the FR-301 but I've never heard anything bad about it. The FR-301 looks like the same basic design as the old 808.I only have two tips, I forget what size but there's a bigger one and a smaller one, both conical. I've never needed anything else.

author: bostonman
author_rank: Super Contributor
timestamp: October 31, 2021, 03:47:01 pm
content: I'll try a few pins first and decide whether to go with purchasing a sucker. Currently one isn't in my budget, and, any hobby projects/repairs are usually surface mount. If I spent the money, at the moment it would be exclusively for this project.Anyway, yesterday I bought x2 eight position DIP switches, and, although I have plenty, bought a package of 220ohm resistors to take your advice about placing a series resistor should I accidentally make a wrong connection. Also I bought a bunch of IC sockets (miraculously they had 40 pin, but I planned to buy 24s or 28s which I also did, use two, and cut the extra pins).Unfortunately I didn't give thought to a capacitor. The 5v from the board will be coming through a wire onto the board I'm making with the DIP switches. Should I be concerned about noise? All I have are electrolytic capacitors in my inventory (10uF, 220uF, etc...) and somewhat stuck if I need 0.1uF because the electronics store isn't close to me. I may have them on junk boards I've saved if need be.Also, once I get this set up, and assuming I successfully remove the MPU, the address lines are going to have manual switches (the DIP switches). Does a possibility exist that switch bouncing, noise, or a neutral state (when going from a 0 to a 1 or vice versa) will damage the old ICs?I was thinking about placing a switch between 5V in and the DIP switches, this way I can turn off power, flip the DIP switches, and turn on power so the address bus is in the state I chose, but then I'm adding another mechanical switch that will induce noise.I have switch deboucer ICs from Maxim (MAX6817EUT+) but the output wouldn't be idea to supply power to the address bus (or at least I don't believe it will).Anyway, thought to ask before I risk damaging anything.

author: james_s
author_rank: Super Contributor
timestamp: October 31, 2021, 06:40:54 pm
content: You're greatly overthinking this. A capacitor is not necessary at all, nor is debouncing or anything like that, you are going to be setting the address lines to static states so there's not going to be any noise to worry about. One thing you will need to do is add either pullup or pulldown resistors if they are not already part of the design. When a switch is off you want it to pull to a known state rather than float, and when the switch is on it will pull it either up to 5V or down to ground.

author: brucehoult
author_rank: Super Contributor
timestamp: October 31, 2021, 10:15:10 pm
content: Quote from: james_s on October 31, 2021, 06:40:54 pmAlso, all of this seems like a LOT more equipment and tedious work than just grabbing an Arduino Mega clone for $16 with 54 input/output pins (better for this than the 19 on an Uno)https://www.amazon.com/ELEGOO-ATmega2560-ATMEGA16U2-Projects-Compliant/dp/B01H4ZLZLQAnd some ribbon cables with breadboard pins already on the endshttps://www.amazon.com/Elegoo-EL-CP-004-Multicolored-Breadboard-arduino/dp/B01EV70C78You can split them into individual wires, groups of 8 or 16 (so much tidier than individual wires for the address or data bus) ... whatever you want.Programming the Arduino to read or write signals from all those pins is drop dead simple -- and it's all shown in Ben Eater's videos.

author: bostonman
author_rank: Super Contributor
timestamp: November 01, 2021, 12:07:08 am
content: QuoteI tend to have this problem. Although I've been doing electronics/engineering for years, I tend to over think basic stuff and make a bigger deal than needs to be. Sometimes simply talking about problems/questions helps me too because I get better ideas on approaching issues and/or input based on experience. Other times, such as this C64, I want to be careful because it's sentimental. This causes me to reduce any gambling approaches I would possibly take (although due to lack of troubleshooting microprocessors, I'm uncertain which direction I would have went without the help of this board - probably would have swapped ICs until I fixed it).Sometimes included with a response is basic and something I knew, so I get a bit worried when others read the posts, they'll think I'm a newbie.James_s, you've answered a few of my posts, and it amazes me how diverse you are and your knowledge. Plus, you seem patient and willing to take time to explain things - makes me feel guilty because you of the time you devote to this board.QuoteI'm sure many ways, and much easier ways exist. Also, I'm certain the Arduino is easy to program. I felt acquainting myself with the Arduino, learning how to program the outputs, and, if I come across any anomalies, would result in trying to figure out whether the C64 is causing issues or it's the Arduino.Although this is more work, I feel it's always best to keep things simple until it's time to add necessary circuitry. If I had experience with an Arduino, and had confidence in using it, I'd take this approach. At least now I can say I'm placing 0v on an address line or 5v - there isn't any saying: well maybe my Arduino is oscillating - it's just a 1 of 0.On another note, I used a manual solder sucker plunger type (the spring loaded one) to un-solder the MPU. After I used my microscope to check the pins. Most of the pins were cleaned, but still stuck to the side of the barrel. Simply pushing them with a pick unstuck them. About five or six pins needed heat to get unstuck, and, at that point, I would wiggle the pin allowing the barrel to cool so the pin doesn't re-solder itself. About three or four pins needed additional solder removal - used wick for these.After that, I could see other pins move freely when I wiggled one indicating the IC was quite lose. When I flipped the board over, I gently pulled the IC with my finger and thumb, and the whole IC lifted out without hesitation.Most likely I've removed 40+ pin chips in my time, so I had a feeling I'd get this, but can't say I wasn't a bit nervous.I remember my first electronics job I replaced an IC and accidentally bent a pin. I had to un-solder the entire IC. Now I make sure all pins are through before I start soldering.

author: bostonman
author_rank: Super Contributor
timestamp: November 01, 2021, 02:43:13 am
content: QuoteI forgot to add that yes, I will be using a pull-up resistor (probably 10k) and a 150 ohm resistor (I stated earlier I bought 220 ohms and originally went to buy this value which is why I made that error) in series with the address line connections.

author: bostonman
author_rank: Super Contributor
timestamp: November 03, 2021, 02:21:28 pm
content: QuoteI'm always first to admit when I'm wrong, and, I'll say this much, I've built stuff on perf boards before, but you're correct, 16 pull up resistors, 16 150ohm series resistors in line with the address channels, two x8 DIP switches, and 18 wires (one for power and one for ground), was more time consuming than I had considered.Still need to solder wires to a socket so I can plug in and out of the socket I'll install in place of the MPU.In any case, although this method is apparently longer, it's a safer road because now I'll have just a simple pull up circuit that can only be a 0 or 1 without wondering if I did something wrong in the programming.

author: RJSV
author_rank: Super Contributor
timestamp: November 08, 2021, 04:09:48 am
content: If you focus on the 6502 itself, or the 6510 variation, there is an 'automatic' portion that does not vary.Firstly, the 6502 has control. Ignore for a moment that other processes can assume control, of the system BUS for writing or reading a byte.Now, starting an example instruction, say LOAD a byte. As you should view the 6502 as the center of this in terms of issuing an address, that's 16 lines or bits, so the range, simply, is somewhere within 64k, that's 64 X 1024 = actually decimal 65,xxx whatever.Then, while holding that address on the 16 pins dedicated to that, strobe the 6502 'read' line output (pin). I don't need to get totally literal here; it might be another similar signal, but result is a mem chip gets a 'CS' chip select, and then a read signal. At that point the system BUS has the 8 bit data content sitting on it, voltage wise.It the remains, for the processor (6502) to 'latch' that whatever that set of 8 voltages is sitting on the BUS.Likely the processor has an 8 bit latch right immediately, for then to distribute internally, now for the IC internal data BUS.For whichever instruction, this example is LDA, but does not matter, yet. That's because I am describing what is called instruction 'FETCH' and that is automatic: those address output and other external BUS control perform an automatic read of the byte, ultimately passing it on to the main internal INSTRUCTION DECODER.If as this example, that's a LDA 3503 the first byte getting decoded, indicates, to the automatic part of the 6502 IC , that the processor needs to complete another two FETCHES; get the next two bytes from memory, automatically, and stuff those into a couple temporary latches, inside the 6502 IC. That's the address the programmer had specified, the two bytes to form the desired address, to load from.All this is still automatic, and considered to be the reading if three bytes, in 3 separate, simple system BUS actions. Each time, the address BUS presents simply the next address, like 1004, 1005, 1006.Seems silly and redundant.So NOW that 6502 IC can do the actual instruction, but realize there was a lot done automatically to get things set up. The temporary memory address is gated to the IC output pins, the external (64k) ram is pointing to the target byte, and chip select enabled, the RAM chip now electrically drives the 8 bit C-64 BUS and the 6502 temporary input buffer will latch that.Then, that buffer drives the 6502 internally, and the byte value gets latched into the 'ACCUMULATOR'.That is 'LDA 3503' but you can see a lot of automatic steps to accomplish that one micro-code instruction.What was that, 3 memory reads just to prepare for that one READ. When programming, you are mainly just concerned about your actions, not the automatic cycles that FETCH and execute any general instruction.You can imagine, some shorter instructions, only FETCH one byte, and that's what you see, electrically in the BUS. However, it's kind of a mess to just scope out raw signals; You really need an analyzer that has smarts to follow those multiple automatic reads that are right there, intertwined with BUS cycles of interest.A good analyzer will know the 6502 behavior, and list an address, and the data read at that address, all part of the 4 BUS cycles needed, to get that one programmed BUS cycle of interest.(That's the LDA 3503 acc load example).The other stuff, yes, is present and complicates a full understanding of a particular 6502 based device.One other thing: Most 6502, 6800 processor types generally 'MAP' any if the input / output to a memory address, and so will use some of those 16 address output lines (pins). Those cycles look like a regular memory (IC) is being accessed. Programmer just writes to a memory spot, or reads I/O chip byte, exactly same as if it was a memory IC.

author: bostonman
author_rank: Super Contributor
timestamp: November 08, 2021, 02:05:19 pm
content: I have connected the DIP switch board that I built to a 40-pin socket, soldered a socket where the MPU was, and plugged the DIP switch board socket into that socket.I'm seeing some less than expected results.My DIP switch board has a 5V bus rail taken from the MPU pin and a GND rail also taken from the MPU. Each channel has the same setup: a 10k resistor is soldered to the 5V rail, goes into the DIP switch, and the other side of the DIP switch is connected to the GND rail. Between the 10k resistor and DIP switch is a 150ohm resistor and the other end is connected to Ax.This way when the switch is open, the 5V goes through the 10k, to the 150ohm, and onto Ax. When the switch is shorted, the 5V is pulled to ground, and Ax is pulled low through the 150ohm.Although I didn't need to explain this circuit, figured I would just so there isn't any confusion. I think the 150ohms is causing the Ax line(s) to float because I measured 1.8V when the switch was closed and 4.9V with it open.Forgetting I didn't need to monitor the address lines because I should know their state (0 or 1), I accidentally placed the logic analyzer on the address lines of the data select IC (LS257) that controls the RAM chips. This chip seems to use the high bits on the address lines (i.e. A15, A14, etc..). Realizing I didn't need to do this, I figured I'd take the opportunity to check (although I measured the DIP switch board prior to connecting it) if the Ax lines are changing state.They all seemed to change state correctly, however, when I placed all the 16 DIP switches to open (i.e. all Ax lines are at a logic level 0), I got clocking on the address lines of LS257 that was previously showing A15 (focusing on a single address line at the moment) was changing state correctly when I flipped the DIP switch..I'm thinking the 150ohm is causing weird things to happen. Maybe a chip is causing issues on the address bus, or my thought is the 150ohm is causing triggering when it shouldn't because it's keeping the address line at close to an in between state; although I don't know why the high bits seemed fine until I flipped every DIP switch.I'll take more measurements today, but I was thinking of either trying the DIP switch board in a working C64 (the working test unit has the MPU in a socket already) or shorting the 150ohm resistors (which could cause issues should the address bus have issues due to a faulty chip).

author: RJSV
author_rank: Super Contributor
timestamp: November 08, 2021, 06:55:49 pm
content: Hi, I'm trying to decide your last post, it would help to know what you plan to check, with your manual entry headboard...Sounds interesting.You have a signal pull-up situation, so any 'open' dip switch should show as a '1', not a '0'. Also, it sounds like two sources of signal are connected: the microprocessor IC address lines, and dip switch arrangement would conflict, if say, the uP is putting out a 0 and you were to 'close' the corresponding dip sw, like on Address but 15.Your 150 ohm could possibly be protecting the uP, but not allowing a VALID low enough voltage to be considered a logical 0. Does your setup look like it works for the logical '1' case ? It might.BUT, careful about taking out that 150 ohms. TTL logic may tolerate grounding an output, but that's not here.Go ahead and start 'grounding' output pins...NOT.As to the memory control, did you mean, one of that IC outputs, decoded and connected to actual RAM chip? Or are you referring to monitoring that decoder IC input(s), say Address bit 15 ?First, though, you should only be using one source for driving component inputs, like EITHER the dip sw, sans 150 ohm resistor, OR the uP. You almost will need to completely lift the 6502 out. (Can't do that repeatedly or you will break/bend pins...)I'm not sure what is to gain, w dip sw. Putting a static voltage input, into a very dynamic setting, signals up at 1 MHZ. What kind of analyzer, and does that have a decent documentation, what modes of use, processors supported, etc.Thanks.Rick B.

author: bostonman
author_rank: Super Contributor
timestamp: November 08, 2021, 07:52:39 pm
content: The micro is removed (I stated above it’s a socket) and I’m using the DIP switches to control the address bus.This will hopefully allow me to look at individual chips to determine if they are working correctly.

author: RJSV
author_rank: Super Contributor
timestamp: November 08, 2021, 08:41:31 pm
content: On the C-64 there will be two processes sharing the C-64 system, BUS and individual RAM control lines, so expect to see activity, even with nothing in the CPU socket. I'm guessing, but generally the 'Phase1' should be active (pin 3 on some 6502s.).The 'Phase2' signal (6502 pin 39) is the uP time to own the BUS and some other control signals.During Phase1, is a kind of automatic reading, of RAM to get some video (screen dot info) along a video scan (horizontal trace line). In older TV sets that was roughly synchronized with the actual 'beam' of electrons, but these days the timing is retained, baseband video, while the screen devices are solid state (LCD etc).So, during each Phase1 the VIDEO IC has BUS system control and will sneak in, in between processor cycles, to read a byte, just in time for output to the C-64 baseband video output. I believe that would show up on scope, as 0 to 2 or 3 MHZ.Similarly, the video control chip will need to get a color description byte, from C-64 color ram. That's a 1 IC that, interestingly, is only 4 bits wide.(The screen memory contains 'dots', while the color ram has corresponding color for the little piece of horizontal 'scan' being built at any moment.)So, anyway, that breadboard (sorry, my previous typo says 'headboard') that breadboard with dip switches probably STILL has conflicts with the VIDEO IC....(hilarious text editor keeps, also, changing my' decode', text entry to 'devide...'.)At any rate, now you have to shut down the video controller, too, as that probably shows BUS signal activity. I think maybe you want a DC situation, but there are two controlling devices need removal first.Try take out the system crystal, then you can single step everything... (That's a bogus suggestion, sorry I wise-crack...).Still got that high voltage 'zero' to deal with... Those 150 ohm resistors may be protecting the video IC outputs, now.(text editor does not like 'IC', either; changes that to 'I'.)At any rate, for processor actions, you want to scope things during Phase2.I'm not a C-64 repair expert. But that is a great machine to hold onto.

author: bostonman
author_rank: Super Contributor
timestamp: November 09, 2021, 12:10:29 am
content: I'm uncertain I understand.Previous posts mentioned that the only thing driving the address bus is the microprocessor. This means if I remove the microprocessor (which I did), inject my own 0 and 5 volts onto each address line (A0 to A15), I should be able to access each chip individually and check the output of other chips based on the address bus settings.Are you saying more than one chip drives the address bus?Attached is the schematic for the DIP switch board I built and a Logic Analyzer screen capture for a GOOD C64. I just realized I didn't get the channel names in the picture, but it's (from top to bottom) the G line (pin 15), SELA (pin1) or A/B according to the datasheet, Y0, Y1, Y2, Y3, of U13, with all associated address lines for this chip set to a 1 (i.e. 5V).First of all, I would expect that Y0 - Y3 should all remain in the same state since the address lines are stagnant. This isn't the case as they are moving. Maybe if I look at things closer, I'll see they are changing because of timing points of G and SELA, but in any case, keeping in mind, this is a working C64, the truth table for this chip states:G = 0, SELA =1, A=X (I assume 'don't care'), and B=1, then the output should be 1.If you look at the purple line (G) when it first goes to 0, SELA is already a 1, both A and B are 1 based on the DIP switch settings, so that means Y0 - Y3 should be a 1, yet, they are all 0.Maybe I'm missing something such as rising edges and/or timing of when each signal rises.After measuring the address bus voltages, it looks like I'm measuring about 0.8V when I am "grounding" each address line. For some reason I measured 1.8V yesterday, but maybe there was some anomaly.Now I'm trying to understand if this logic diagram is correct. If it's not, then something is wrong somewhere because this is a working C64, micro removed, and replaced with just 16 DIP switches.

author: RJSV
author_rank: Super Contributor
timestamp: November 09, 2021, 02:52:09 am
content: Hey. Thanks for question:Suggesting a use for also putting in 8 more dip switches for the DATA BUS pins. One web site mentions a way to 'force' the processor to simply step one by one through memory, for diagnosing things.By forcing a 'NOP' byte, all 0's, that dip switch board enables the uP to simply proceed to next 'instruction'...or so it thinks. But the address put out will sequence, in binary... more in a bit

author: bostonman
author_rank: Super Contributor
timestamp: November 09, 2021, 03:28:41 am
content: I don't necessarily feel right directing the advice being given since I am the person who started this thread, however, I feel those two posts are geared more towards moving the micro through instruction set(s).Maybe this is the best way to go, maybe it's quicker, or maybe it's correct, but I feel controlling the address bus makes more sense.This allows me to address each chip exclusively, analyze the logic states of the other pins (whether data or some sort of other controlling pins) and see if the chip is producing junk.I don't know instruction sets to save my life, but I do know (to a degree) how to read logic states. I'll admit, the more involved chips are uncharted territory for me. I'm sure some logic levels change states based on timing factors, rise, etc.. and are not as simple as reading a truth table from left to right.I've never dealt with looking at logic levels at this speed. Maybe I've looked at (just to use a simplified example) an AND gate and saw one pin was a high and the other was a low, so the output was low; or whatever states.In this example, I didn't need to look at well, if input A goes high, B will go high on the rising edge, blah blah.

author: RJSV
author_rank: Super Contributor
timestamp: November 09, 2021, 03:41:13 am
content: I did gaagle search on 'NOP GENERATOR', it puts a hexadecimal value of EA h. That would be in binary would look like: 1110 1010 b.Now, as to your point, about getting 'mostly software' oriented responses, well...try this:Suppose you got hired, hardware design, and the request is, "Could you build us a NOP SIMULATOR for use on the factory bench" ?You can start the special board, but a question comes up: Will that start fetching instructions from 0000 h and then just keep going...up to FFFF h ?I don't think so, and can't remember where from reset the uP program counter starts, but likely that's a 2 byte word somewhere. Like, if it is 334E h then that's where the program starts walking. But as a hardware person, you don't know that, so maybe you look that up. That's just a general concept, a software detail you didn't think you need. Sooo, you call down to 3rd floor, ask them... "Hey, what's the program start location ?"Maybe takes another hour, but you needed that, as you can start checking things out, on your newly built hardware. Helps to have overview.Web searched binary 0 voltage levels: generally .8 V and plus they recommend don't be hovering right at the edge...(S/ B maybe .5 assures a margin). So I still concerned, but having that good C-64 helps tremendously. REMEMBER: that's coming from your experimental device, so could be a problem with either C-64 you try things with.And, yes, I did mention, to ignore other processes while description covered the case of a single process using the BUS. Can't discuss DMA, or Video processes accessing memory on their own, without causing more confusion. The DMA device(s) are extra plug in accessories so you can forget that, but the internal video access is also DMA. Direct Memory Access.Just a preference. But the video I C is going to do trading access to system BUS, and better to learn 6502 instruction fetch, decode, execute first, while aware that Phase 1 time is for DMA and does get used, interleaved with the micro-code byte reads during Phase 2.Anyway, my understanding is, for building the VIDEO output, one byte is read, and placed into a serial shift register. Imagine those 8 bits, as pixels shifted out by a so-called 'Dot Clock' actually, notice this description is tending towards hardware knowledge as many micro-code programmers don't care to study a shift register chip, an automatic portion of the video sub-systen.C-64 is quite dense, to study, but Arduino is much much more complex.At any rate, that DOT CLOCK can probably be scoped out, try trigger on the horizontal pulse that starts each line, if there is one...This single color mode uses the color ram, but within every byte (shift register content) it is one color.For multi-color mode, the system groups that shift register output, into pairs of bits. Then, there are 3 colors plus the fourth color is background.The way multi-color works, in detail, will twist your mind but it serves to allow a really busy screen for stunning vivid colors, circa 1983 at least.I bought mine at Toys R Us, including a manual. Try get a manual on ebay, suggested.Thanks, for presenting a great project, there.P.S. Perhaps one of the gaming companies, Atari-Namco for one, try ask if they have info you can use...

author: bostonman
author_rank: Super Contributor
timestamp: November 09, 2021, 04:25:40 am
content: You're not wrong, but the approach is a complex direction filled with areas I'm completely unfamiliar with.To take your direction, it may be best to take the micro, place it in some sort of home built circuit, and measure the data flow.My point: I feel your direction will tell me if the micro is working, but with the cost of an extensive amount of time. Obviously the above is a bit exaggerated, however, following your path may lead me to discover a data line isn't correct. What does this tell me? It tells me any IC that is connected to that specific (or multiple) data lines could be pulling down that line.I've already used a scope to measure clocks, voltage levels, and done a crude feel of any chips that may be hot.I really think the advice about injecting my own addressing was extremely valuable. To say whether I can piggyback onto data lines or whether piggybacking will provide accurate results, leaves room for lots of anomalies.Look at it this way, I built a simple pull-up circuit, measuring a voltage of 0.8V on the address line when pulled 'low', and don't know whether I should gamble with shorting those 150ohm series resistors so I get a true '0'.

author: RJSV
author_rank: Super Contributor
timestamp: November 09, 2021, 08:24:54 pm
content: OK, I'm done, after this last, repeat."I know all the general functions of Microprocessor, RAM, ROM, etc..."NO, you don't seem to have much, there."...from my Engineering courses..."What course work ? Fundamentals of digital circuitswould be a valid course. I'm reading, more flailing about, for weeks on end.Test:. Did you follow, the advice about '0x80AA' vs '0x00AA' being decoded ? In the sense of hexadecimal number use?You need to, stop posting more incomplete rants, and just read, one by one the posts here.And get a solder less breadboard, and play with 2 or 3 simple IC's. Still haven't engaged the issue of if that dip switch setting .8 volts is a valid zero.A month, and described failure, for REPAIR, is unclear. Fails how ? Screen blank ? Garbage on screen ? Those types of clues can help, such as suspecting the CHAR ROM. And pleaaaaaaase don't run off to de-solder that CHAR ROM. Whatever, it's still a free country.Best advice I can give, in positive vein: ' Please re-read all previous advice..."!!! Thank you.

author: bostonman
author_rank: Super Contributor
timestamp: November 10, 2021, 12:26:52 am
content: Although it's your "final" post, I feel the need to address the group based on your hostility that may taint whatever image others may have of me.If at anytime I've ever offended anyone by not taking their advice in any question I've posted or giving the assumption I'm ignoring it, please always let me know. This forum (all the categories) is a great place to exchange knowledge and is full of experienced people who take time to provide answers to strangers across the world. I for one have gained valuable knowledge by nothing more than people willing to take time from their day to post replies.Obviously when a group of minds get together, each one will have their opinion, some provide professional responses that will gracefully let another contributor realize why that person is incorrect; or suggest an alternative/easier method.One reason this forum is valuable: sometimes people (such as I) post relatively simple questions. An example would be someone asking where to buy a quality ribbon cable. Sure they can purchase something, decide whether it's durable, and possibly lose money because it's poor quality. Therefore, why not ask a group of people who may have valuable input based on experience? It saves time and money.To address some things in this last post. Are you really inquiring about my education - because I was unaware this was a measurement of male package sizes.The voltage of 0.8V being the threshold and being a 'low', of course I read the datasheet. By that statement, and your ability to focus more on instruction sets, alludes me to believe you're not an analog guy. My point about 0.8V is simply: if I'm pulling an address line to ground, the theoretical voltage should be 0V and NOT 0.8V, however, there is an anomaly introduced which is a 150ohm resistor.Did you stop and think that having a voltage of 0.8V on a line that needs 0.8V to be a valid low may cause an issue? Maybe my meter isn't calibrated correctly and it's really 0.81V and this is causing a middle/unknown state causing oscillations on the address lines?This topic began as the subject states: Microprocessor Tutorial. If you, or anyone would like me to deviate into how my C64 is failing, I will be more than happy to provide such details. If you read my previous posts, I respectively stated that I didn't want to deviate the topic. How do you like when you read these topics on forums, they begin as one thing, deviate to something completely different, someone mentions a completely different problem, and the topic ends without the solution posted?Therefore, I was/am trying to keep this topic exclusively on Microprocessor Tutorials; sadly these last few posts have reluctantly forced it into a whirl and forced me to also deviate. To please you, I'll gladly state how the C64 is failing: blank screen. Now I feel either this failure topic should be in a new topic under 'repair' or on a C64 forum such as Lemon64Maybe my reluctance to follow instruction sets is completely wrong, maybe a few who initially contributed have abandoned this topic as a result of my responses, maybe some are in full agreement and don't want to continue responding as a result of your replies.Generally speaking, I've noticed that solutions seem to gear towards COTS items rather than good old interface building. While a pull-up resistor circuit is quite simple, the art of building interface circuits seems to be fading and rather Aurduino usage seems to be ramping. I'm sure it makes life much easier, but rather than critique the suggestions I've followed by others and my responses to your post(s) (manually toggle the address bus), I'd suggest you use your time more wisely like acknowledge the time people take to contribute to this forum; much like I appreciated your input until you felt the need to go off the deep end.Also, in closing, you're asking me to learn instruction sets. I'm trying to kill a fly and think a fly swatter is adequate, however, you feel I should be using a Magnum 44 and therefore I should devote time to taking gun lessons, obtaining a permit, etc...For now, let me learn a bit about microprocessor circuits based on the project in hand as I've wanted to learn more about the basic flow of simple computers. If the answer is a Magnum 44, I'm sure more than one person would have made such a suggestion by now and aborted this topic long ago, but contributors hung in there and continued providing advice.

author: james_s
author_rank: Super Contributor
timestamp: November 10, 2021, 01:29:26 am
content: There is some middle ground here. If your goal is just to fix the computer, then there are easier ways to fix it than digging in deep and analyzing things like this. If your goal is to learn something about how the computer works, then yes you're going to have to learn at least parts of the instruction set and familiarize yourself with the way a microprocessor works internally, there is no way around that. I have mentioned several times that when dealing with a machine like this at a low level, hardware and machine level code are inextricably linked, it is impossible to properly understand one without the other. It isn't using a handgun to kill a fly, it's learning how to properly use a flyswatter and enough about fly behavior to predict how it is going to act so that you don't smash up your whole house randomly flailing about with the swatter.If you just want to get the machine working, get some parts and start swapping until it works, I'd start with RAM. You've already confirmed the clock is working and all the voltages are present, and the state of the reset pin I assume.

author: bostonman
author_rank: Super Contributor
timestamp: November 10, 2021, 02:08:43 am
content: You're absolutely correct about there being a middle ground.I never liked randomly swapping and have worked with many over the years who succeeded by not knowing anything and got away with fixing things by way of swapping.In the past, I've worked on product that had a micro, RAM, ROM, etc.. whenever this section failed, or was in question, I was lost. Some who were a bit higher level than I would help and could use nothing more than an oscilloscope to analyze the issue.A desire to understand microprocessors has been a desire. In my case, I have never been mentally geared to think in terms of instruction sets. My thought process is always looking at components to see if they are doing what they should. Maybe this is why I'm narrow minded in this situation and not seeing the larger picture. In my mind, I should be able to measure each IC to see if the outputs match the truth table, and the only way I know how is to control the address bus. This does, however, fall under the category of shot gunning whereas the instruction set method would be a more rewarding direction.I thought being able to "freeze" the address bus would provide the middle ground I seek: fix the C64 and be able to see the outputs of individual chips which will provide a general overview of data flow. Unfortunately I'm not getting the results I anticipated.I have fought the desire to randomly swap, but you're correct again, RAM chips seem to be a common failure. I was also trying to avoid swapping so I don't hack up the board.At this point I either need to take a step back and go through instruction sets, short the 150ohm resistors so I can pull address lines directly to ground, or randomly swap chips.

author: Ian.M
author_rank: Super Contributor
timestamp: November 10, 2021, 03:27:21 am
content: Build a NOP injector (opcode 0xEA) and let the 6510 be responsible for driving the address bus with the correct timing not to clash with the video chipset, cycling through all possible addresses so you can check decoding etc. I recommend one that fits in the CPU socket, between the CPU and the main board, isolated the data bus as if you inject via a ROM socket, it has limited address range, depends on the ROM address decoding being good and will cause data bus contention when the 6510 is not supposed to be driving it.

author: james_s
author_rank: Super Contributor
timestamp: November 10, 2021, 04:36:30 am
content: Quote from: bostonman on November 10, 2021, 02:08:43 amBut therein lies the problem, a microprocessor system is a form of state machine, you can measure many of the ICs under static conditions but unless you can isolate them from the rest of the circuit this may not be enough. The entire operation of the computer is completely dependent on fetching instructions from ROM, executing them and performing whatever action they are supposed to do. If anywhere along this sequence of events something doesn't go right it derails the entire process.Perhaps an analogy will help, say you have a map to a treasure (or whatever) that gives you a starting location (your reset vector) and then has a list of instructions like take 100 paces North, then 50 paces East, then 20 paces North then walk toward such and such landmark, then from there 250 paces West, and so on, if any one of these steps gets corrupted somehow or one of the landmarks is missing you are now completely lost, you cannot recover without starting over (reset). It's impossible to troubleshoot the process without some focus on the instructions because the instructions are fundamental to the entire thing working. How do you know which landmark is the problem if you don't understand the instructions? The same is true of the computer. Somewhere something is going wrong, the code is crashing or getting stuck in a loop and the boot process is not completing. Sometimes you will get lucky, like finding a gate or latch or something that has activity on the input but an output that is stuck, other times you have to take an educated guess and swap out a part that experience says is a likely failure point, RAM in particular is something I see fail a lot in older equipment. It helps greatly to have an idea of what parts need to be working for the computer to do something recognizable, for example most of the arcade boards I work on have a CPU section and a video section and in a lot of cases if the program ROM, RAM and CPU are ok the game will run but the video will be messed up, in other cases the video circuitry is working, evidenced by properly formed but random characters and sprites on the screen but the CPU isn't running. Sometimes though nothing is obvious and the only option is either swap parts until it works, remove and test parts in isolation, or really understand how the system works at a low level, and that means understanding the instruction set and how a microprocessor works. You don't need to memorize the whole instruction set but you need to understand it. Fortunately a 6502 is an excellent place to start, it is one of the most simple and elegant microprocessors ever made.

author: bostonman
author_rank: Super Contributor
timestamp: November 10, 2021, 03:18:33 pm
content: Your analogy absolutely makes sense.Depending on the circumstances, randomly swapping, or swapping based on symptoms, is necessary. I worked at a company that repaired old CRT monitors and we had common failure sheets for different models. It was much better than reinventing the wheel because we didn't have schematics for many monitors. We had the go to parts based on symptoms such as the horizontal transistor, etc...As for my C64, I guess my reluctance to swap ICs, experiment too much, etc... comes down to trying to keep the C64 as original as possible. This doesn't mean I should be against diving into the instruction set, I'm just stating that I want to avoid having my original C64 be a PCB full of randomly swapped ICs because then I feel the original feel is lost (I know, call me crazy).In a way, I'm going against myself because my approach is a shot gun approach where I'm looking at individual chips and hoping to get lucky by seeing an output in the incorrect state based on the address bus setting(s). So I am guilty of not wanting to randomly swap or guess, yet, I'm looking at chips randomly.I can give you a perfect example of why I understand your analogy: yesterday I 'randomly' looked at U15 (LS139). I placed the logic analyzer on all the pins and saw pin 1 was sitting high. When I looked at the datasheet, I saw the truth table shows when pin 1 is high, it doesn't care the state of the address bus, and all outputs should be a high. Ironically, this isn't the case as pin 6 is actually a low.My first thought (prior to looking at the datasheet) was: why is the PLA that feeds pin 1 not clocking? The PLA has been temporarily replaced with a PLANton or whatever it's called, so I know the PLA is 'good', however, if I knew the instruction set, I can (hopefully) know why the PLA is feeding a constant 1.Now, with your analogy, I understand the point(s) you're trying to make.In any case, did I get lucky and discover U15 is the culprit (or maybe it's one of a few) since it clearly doesn't match the truth table? I plan to look at it closer today, and, as silly as this sounds because the truth table is cut and dry, measure it on a working C64 under the same conditions (having my DIP switch board plugged in with the same states).Maybe this will also show pin 1 is sitting high, but, if it shows it's clocking (or a low), you stating why I need to understand the instruction set is going to be much more of a punch in the face.

author: Electro Fan
author_rank: Super Contributor
timestamp: November 10, 2021, 03:22:29 pm
content: No doubt bostonman can speak for himself as can all the other posters in this thread - but here is an effort to try to translate. It might only be close to a correct translation but hopefully it helps in some way.I think what this thread shows is that we can have a bunch of people passionate about the same subject and doing their best to discuss, learn, and teach the subject but as great is this forum is (and it is GREAT), it is sometimes hard with the forum's back and forth chat/text style of communications to convey some types of complexity (and some subtleties), which can sometimes lead to misunderstandings and frustrations.Everyone in this thread probably is way ahead of me on microprocessor architectures and step by step instruction management but I think what we have is a slight disconnect regarding what bostonman is trying to do and what he potentially could be doing.As a very rough analogy, some people used to say that a network consists of three or more nodes and therefore a point to point connection consisting of just two nodes is not a network.I think if we look at bostonman's questions he is trying to figure out how to get one point to point connection to toggle a signal from a high to a low or a low to a high and do so with substantially more consistency by removing the ambiguity of a floating condition (through the use of an appropriately sized resistor). Once he can ping a leg on a microprocessor and toggle an input and the resulting output in a manner that consistently gets the expected result then he would presumably like to move on to doing the same sort of thing with other legs/parts of the microprocessor and the overall circuitry. To use the analogy, he is working on harnessing his ability to manage a point to point circuit. In parallel, others here who have more experience are somewhat farther down the road passed this step and are pointing out that there are more simultaneous inputs and outputs that are occurring in the "network" (with 3 or more nodes).My guess is that if someone can start back closer to the point to point ground floor where bostonman is and gently get him from his desire to reliably tickle one input-output at a time in a way that produces consistent results, then someone could take him over the threshold to what happens at the next layer of complexity - if that layer is presented in a very slightly incremental manner. Once over the threshold my guess is that bostonman might be an eager and capable student ready to try to harness microprocessor instructions. For now, I think he is still at the intersection of electricity and hardware with a strong desire to reliably harness the toggling of ones and zeros so that he can see toggles as expected on a logic analyzer.Having said all that, I might be wrong about all this. If so, please don't shoot the messenger who is bringing a well intended but possibly misguided message.Edit: in looking at bostonman's post just above I think it's possible that in addition to moving more incrementally from a basic "point to point" approach to a more complex "network" approach (remember, it's just an analogy) there might be some underlying part failures or intermittent circuit issues that are inhibiting progress, and once those problems are found and corrected and the results of the truth tables and the overall logic aligns as expected it might become possible to move forward to instruction sets, etc. I think what's needed is agreement on a more methodical approach - which is somewhat difficult via text. If everyone was together looking at the test bed on a bench it would probably go much easier. I'm betting this thread gets to a successful conclusion.

author: bostonman
author_rank: Super Contributor
timestamp: November 11, 2021, 02:05:18 am
content: QuoteI'll follow up to this towards the end.I appreciate your translation. One single problem I've always had is the inability to open a book (textbook, manual, etc..) for something I've never seen before, read it, and learn, without ever having seen what I'm reading about. I learn better by first experimenting (whether it's working on the engine of a car, electronic circuits, etc...) because I get to see each part and I get to move it by hand allowing me to visualize what it's doing when working. Once I open the book to read about it, I can retain names of parts easier because I can visualize each part in my head and "see" it working as I read.In any case, I also learn better when I have a good overview of how something works without diving into the tiny elements too quickly. As an example, I may want to learn how a car works, so I first need to learn the pathway of how gas flows from the tank to the exhaust. Once you begin explaining things too deep, I lose mental site of where the gas is going because now I'm stuck visualizing say the crankshaft turning.This is why I began this thread, it was in hopes that I could read: the power switch is turned on, the component A calls on component B, etc... this chip can only read address lines, this chip can only do this, etc.. Although.... such a general overview has been made clearer due to the help within all the replies. A big help was stating that the micro drives the address bus and that I can remove the micro and drive the address bus myself (more on this when I reveal the "successful conclusion").Maybe some of you are experienced enough that a one-channel oscilloscope will have solved the issue. With me, signals were moving much too fast and I needed them to stop. The logic gates on the board (AND, OR, etc...) are easy (for me) to measure and know what they do. The simpler chips (like the LS139) can be interpreted much easier with the logic analyzer I have.As for experimenting with injecting my own address signals, etc... If this was a junker C64, I may have attempted it on my own without asking first. Well, I also didn't know the micro drives the address bus exclusively. Having said all this, certain direct approaches I was apprehensive about performing due to trying to not damage anything and why the help of others was useful.Now.... for the successful conclusion: the suggestion of driving the address bus on my own indirectly helped me get my C64 working again. If not for unsoldering the micro in my unit, I may never have had the guts to remove it and plug in a known good micro. Tonight I wanted to check U15 again before anything and found all outputs were working per the truth table (must have been a bad connection on the IC clip). At this point, for fun, I wanted to see what the good C64 did in the exact set up and got the same results. As I looked at my C64 and the good C64, I began thinking about James_s and got antsy about trying a known good micro in my broken C64 since I now soldered a socket there.What do you know, the C64 came to life (with the exception of the original the PLA is temporarily replaced with a PLANKton so maybe the original PLA is also bad).There seemed to be ever slight jitter (maybe it was my imagination) when compared to the working one, however, it doesn't have a shield around it.Edit: ever so slight jitter in the video I meantAt this stage I plan to find a replacement micro to use (I'll have to search online), reinstall the original PLA (I actually plan to ask a question in a new thread because a pin is broken), I've already "re-capped" it, clean any solder joints from installing the socket, and piece it together. I do, plan to learn more about the instruction set, and, if need be, use my backup C64 as the experimental unit.Now, just to address the..... address bus issue so I can learn. If this is a "refer to the instruction set" answer, then I apologize ahead of time. When I was looking at the four address lines on U15 (A8 - A11), and had my DIP switch board plugged in, I saw activity on these address lines. To confirm it wasn't the logic analyzer toggling for no reason, I checked them on an oscilloscope and saw activity in when both a 0 or a 1 was placed on the lines.I'm willing to accept the 150 ohm is causing the address line to not be pulled to 0v ground when I'm injecting a 0, but, if I'm injecting 5V (really 4.89), why is the line toggling if the micro (which is removed) is suppose to be the only thing driving the address bus?This goes against my expected results of thinking that if I cared to look at all 16 bits of the address bus simultaneously, I'd see nothing but the logic levels I'm injecting. This is why I built the board, I thought as long as I set the DIP switches to which chip I want to address, then I don't need to worry about double checking the state of the address bus. I remain confused as to why the address bus changes state, and, excluding the 150ohms, injecting the 5V (through the 10K pull-up) should drive that particular address line to be a constant 1.

author: Ian.M
author_rank: Super Contributor
timestamp: November 11, 2021, 03:13:07 am
content: The VIC-II chip is also a bus master like the 6510 CPU. Seehttps://en.wikipedia.org/wiki/MOS_Technology_VIC-IIAccessThe 6810 only accesses the bus when its clock output ϕ2 is high and releases the bus when ϕ2 is low,the complementary non-overlapping ϕ1 output goes high within ϕ2 low to signal the bus is available. The VIC-II thus can access the bus without conflicting with the 6510. Seehttps://dustlayer.com/c64-architecture/2013/5/7/hardware-basics-part-2-a-complicated-relationshipfor details.Therefore if you want to drive the bus with static levels for testing you need to also remove the VIC-II chip, hence my suggestion above to inject NOPs at the CPU socket and simply let the address bus cycle, counting from 0x000 to 0xFFFF, and live with the fact the bus will be driven by the VIC-II during the ϕ1 clock phase.Its very difficult to make sense of 8 bit computer bus waveforms on a CRO if you can't stabilize the trace by triggering at a known point in the instruction cycle, and preferably also at a known address. On a multi-channel scope it isn't quite so bad as you can pick a signal to trigger, then examine other signals and their respective timing with reference to it.On a single channel scope itrs much more of a PITA. Does your scope have external trigger? If so you can trigger on a suitable signal connected to the Ext trigger input, and then probe around looking at other signals. However to avoid confusion, you'll probably have to mark the edges of your trigger signal on the screen (protect it with a sheet of acetate cut to size and use a fine dry-wipe pen or a grease pencil), and occasionally check back that the trigger signal is still good and the scope timebase is still locked to it.Edit: I was confusing it with the 6502 which has ϕin as the clock source and non-overlapping ϕ1 and ϕ2 outputs. 6510 saves a pin by using ϕ1in as the clock source and only outputs ϕ2.

author: brucehoult
author_rank: Super Contributor
timestamp: November 11, 2021, 04:44:21 am
content: Quote from: Ian.M on November 11, 2021, 03:13:07 amYup.In 1983 some friends and I built a wire-wrapped 6809 computer. We debugged it in an afternoon, using just a dual-trace oscilloscope and I think a 555 resetting the CPU 100 or 1000 times a second. We wrote down the values seen on each data line and some of the address lines. Fixing a couple of problems so we could see the CPU get into the monitor ROM and send the prompt out to the UART and be displayed on a VT100 was enough to bring the machine up. If you get that far then most things are working!

author: bostonman
author_rank: Super Contributor
timestamp: November 11, 2021, 05:04:27 am
content: Although I'm happy that my C64 has finally booted, I'm a bit upset that it was the result of "swapping" that solved the issue.I know sometimes it just makes sense to swap, but feeling like I cheated by swapping.In any case, I am interested in tinkering a bit more and will remove the VIC to tinker with the address bus a bit. I'd at least like to see myself finally having full control over the address bus after taking time to build this DIP switch board.I didn't realize 6510s were so expensive (I found some on eBay, and also found some through an older link on Lemon64 about someone who needed some).Not sure I'll order as many as I intended at first, maybe just two (one spare).

author: brucehoult
author_rank: Super Contributor
timestamp: November 11, 2021, 05:32:48 am
content: Quote from: bostonman on November 11, 2021, 05:04:27 amLooks like they're going for $25 to $35. I presume they're salvaged.You can get brand new unused warranted 17 MHz 6502s for $8.

author: james_s
author_rank: Super Contributor
timestamp: November 11, 2021, 07:08:09 am
content: Well it's tricky to test a microprocessor without swapping, you could build a test rig but then you're essentially swapping it into that. I don't think the 6510 was used in much other than the C64 and it's a long out of production part so yes it'll be somewhat expensive. It could be replicated with a small FPGA and level shifters but that's gonna cost more than current 6510 prices.

author: bostonman
author_rank: Super Contributor
timestamp: November 11, 2021, 02:21:19 pm
content: I plan to take a bit of time to clean the area where I soldered the microprocessor socket into, fix the solder on the 556 as I initially removed it thinking it wasn't providing reset, and a few other odds and ends.Obviously I'll be ordering some 6510s.I'm glad the C64 booted because it broke a few years ago and due to other things, never got to address repairing it. Finally I devoted an area to just this project in hopes to fix it. Maybe I'll buy (or build) a test cart to test all the functions of this (and my other one).At some point I'll start reading the instruction set for the micro too in hopes it sheds light on data flow.I'm sure I'll provide an update in this thread, but thanks for the assistance.

author: Peabody
author_rank: Super Contributor
timestamp: November 11, 2021, 03:34:04 pm
content: Back in the day, I did a project to burn new PLA chips for the C64 using the 82S100. The PLA is essentially just a fast ROM. In fact, you can read out its contents as a 64KB ROM. All it does is switch in the appropriate RAM and ROM banks and I/O stuff depending on the state of the inputs. The other thing that was interesting about the C64 was that the processor and the video chip appear to have access to the addresss bus on alternate phases of the system clock. So they can effectvely run at the same time, and in particular the video chip could be reading the video ram all the time without interfering with the processor. I was impressed with how clever the design was for the whole system. But the PLA seemed to be the key to it because it allowed a whole bunch of bank switching options without needing a bunch of additional decoding logic chips. And of course MOS Technology could just make them up as ROM chips for next to nothing.

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2021, 02:58:59 am
content: Quote from: bostonman on November 11, 2021, 02:21:19 pmThis is a very very simple microprocessor. Easy to understand how it works.Not quite as simple as the 6800 the same team worked on before they left Motorola -- the 6502 added quite a bit of complication in addressing modes, but a lot of performance too, at the cost less generality and often having to use nested loops for something the 6800 could do (more slowly, and possibly even more bytes of code too) with a single loop.This 6800 trainer board just came up on our local NZ auction site. It's almost tempting! I've never had a 6800. Looks to be in pretty good condition. Of course emulators are sooo much easier...https://www.trademe.co.nz/a/marketplace/computers/vintage/listing/3338073964This very early 6502 board (UK version of the Ohio Scientific Superboard) looks like it needs a bit more work :-(https://www.trademe.co.nz/a/marketplace/computers/vintage/listing/3336729590

author: james_s
author_rank: Super Contributor
timestamp: November 12, 2021, 03:07:40 am
content: Quote from: brucehoult on November 12, 2021, 02:58:59 amI have an original Heathkit ET-3400 which is a 6800 trainer of the same general idea, it's fun to play with although programming it is certainly tedious. I built a replica of it using a cheap FPGA boardhttps://github.com/james10952001/Heathkit-ET-3400It's not quite as much fun as the real deal but you can build it for about $20 and it does offer a great deal more flexibility since additional add-on circuitry is free and you can program it by just throwing a ROM image into the project before you compile.That UK-101 board actually looks pretty good to me, it's just dusty and missing the CPU, both easy problems to solve. Grant Searle made a FPGA version of that using exactly the same board I used for my ET-3400 replica.http://searle.x10host.com/uk101FPGA/index.html

author: bostonman
author_rank: Super Contributor
timestamp: November 12, 2021, 03:48:45 am
content: Just for kicks, I removed the VIC and looked at some logic lines. I was unaware just how little activity the bus would have with both the micro and VIC removed.Needless to say, I didn't learn anything just by seeing an address line flip states because I flipped the associated DIP switch.I got to see the LS257 that drives the RAM chips flip its output pin based on flipped an address, but, I'll admit, it was quite uneventful.At this point, I think setting aside the logic analyzer is probably a good idea, move forward with cleaning solder connections on the C64, buy/install a 6510, and then kick back during a snow storm to read the instruction set.

author: james_s
author_rank: Super Contributor
timestamp: November 12, 2021, 03:56:59 am
content: Aren't the micro and the VIC the only devices that can drive the bus? In a lot of systems it's only the micro, I'd forgotten the VIC could do it too. At any rate without the micro there are no instructions being executed so nothing much is going to be happening.

author: bostonman
author_rank: Super Contributor
timestamp: November 12, 2021, 04:13:00 am
content: The lack of activity actually was a nice eye opener to see just what doesn't happen without a micro (and VIC). Kind of fascinating to see a board full of chips remain stagnant all because of two chips are removed.The instruction set looks like it's just the abbreviations of the instructions carried out inside the micro (I've browsed this before).In order to see what it places on the bus, would an ideal device be something that replaces the crystal and clocks the micro X times to move the first set of instructions onto the bus so it can be measured?

author: james_s
author_rank: Super Contributor
timestamp: November 12, 2021, 06:04:09 am
content: Well those two chips run the whole show, if you look at a simpler system without a built in video subsystem and remove the microprocessor absolutely nothing will happen. Since the microprocessor drives the address bus, if you pull it out nothing drives the bus so nothing is addressed and everything just sits there.The instruction set consists of a list of mnemonics, these are just human readable abbreviations, it's a lot easier for a human to read 'LDA x04" (load the value 0x04 into the accumulator) than "10101001 00000100" which the microprocessor understands. When you write a program in assembly it will be written as a series of mnemonics followed by a numerical value for instructions that need a value to work with. The assembler goes through and replaces each of these mnemonics with the binary value the microprocessor understands. When the 6502 jumps to the reset vector and that addresses the program ROM, if the first instruction stored in the ROM at that location is the value 10101001, that binary value will appear on the data bus of the ROM which the CPU sees and it will act on that particular instruction, which means the address bus will increment by one causing the value stored in the next ROM cell to appear on the data bus and that value will be loaded into the accumulator register within the microprocessor because that's what that particular instruction does.If you are a masochist, or some kind of savant, you could write a program directly in machine code and it would work fine, but most people are going to have a real hard time reading a list of binary values and remembering which value means what instruction, and even which values are instructions and which are data.

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2021, 07:45:29 am
content: Quote from: james_s on November 12, 2021, 03:07:40 amYes, I've seen much worse. The back of the board looks ok. There's a bit of rust on the transformer and the power transistor, but maybe nothing serious.I would have thought the 6502 is in the center, between ROM and RAM. I don't know what the empty 40 pin socket is, but it's empty on every UK-101 photo I looked at.

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2021, 07:50:01 am
content: Quote from: bostonman on November 12, 2021, 04:13:00 amYou can't stop the clock on a 6502 (or most other chips of that era) without it going insane and forgetting what it is doing.You can stop a CMOS 65C02, but that's not a 5610.Woz designed a circuit that keeps the 6502 clock running but tells it to not execute new instructions.https://www.reddit.com/r/beneater/comments/foezld/wozs_circuit_to_singlestep_nmos_6502/I don't know how easy that would be to apply to a C64.

author: james_s
author_rank: Super Contributor
timestamp: November 12, 2021, 08:35:06 am
content: Quote from: brucehoult on November 12, 2021, 07:45:29 amYou might be right, I only glanced at it and assumed it was the CPU, maybe nothing important is missing.

author: bostonman
author_rank: Super Contributor
timestamp: November 12, 2021, 02:50:59 pm
content: Many years ago I had done mnemonics (if I'm using the correct term to explain what I did).We had emulators in class or whatever. We entered some basic commands like loading a number in the a memory location or whatever, adding two numbers, etc... We didn't spend much time with them, however, over the years, looking at random code in various languages and working with software engineers, I have a 'general' idea of what needs to happen in order to just add two single digit numbers; and a good idea of what is occurring inside a computer.Any digital courses I took always did a brief discussion about a theoretical visual of binary numbers being stored, general terms, etc... Obviously I've worked with digital circuits (and of course analog) over the years and know how to measure chips in their say quiescent state (I'm talking regular gates, flip-flops, counters, etc...). As I stated above, I've never actually got the entire picture of the data flow from which chips are calling on which other chips at which times, and often times got overwhelmed looking at basic computer circuits.At an old job the computer section of our main product consisted of a micro, RAM, EEPROM, and I think that was it (i.e. no video, audio, etc...). Maybe three times in all my years doing repair did I see this section fail, and, when it failed, I couldn't mentally see how things were flowing to know how to measure them. I'd look at data lines on an oscilloscope and ask myself what the heck does it all mean.All I'm saying is I'm aware of mnemonics, basic (I'll emphasize that word) data flow, the basic need to have each chip (i.e. why a RAM chip is needed, why a ROM is needed, etc..) but this is the first time I've got this far with looking at data flow; or maybe I should say trying to bring everything together. The fact I have a (is it safe to use the word simple?) computer that I can tinker with helps rather than working on stuff that I don't have any knowledge of the proprietary firmware.One thing I've certainly learned is general measurements are not going to tell me which chip is bad.I guess this is a silly question, maybe it's the advice that's been given to me in more words than I interpreted, but does having a list of mnemonics (and reading through them) the difference between looking at the data bus and knowing what is happening?As an example, if the first thing the micro does is retrieve info from the ROM by some HEX command (I know it's actually binary data), how do I see if this occurred if millions of bits have already flown through the data bus in a split second?Just to clarify what I meant about clocking the micro X times. I meant a device where you can maybe enter a number and that number clocks the micro. As an example, if the micro needed 1000 clock cycles before it placed 01H onto the bus, and then another 5000 clock cycles before 02H was placed, etc... The question got answered already, but I wanted to clarify what I had asked.I plan to re-read this thread too because I'm sure some of the advice has been forgotten to a degree due to having less of an understanding of the suggestions offered.

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2021, 09:44:31 pm
content: Quote from: bostonman on November 12, 2021, 02:50:59 pmThere is a new address and new data (read or write) on the bus EVERY clock cycle.The majority of the data is instructions being fetched from the program in RAM or ROM to execute.I really really suggest going and watching the video series pointed to by the very first reply in this topic. Spend $8 on a 65C02 (and a little bit more on the other bits and pieces) if you prefer hands-on learning yourself.This will be much much easier than trying to figure out a complex machine such as a C64 yourself, and everything you learn will be directly relevant.

author: james_s
author_rank: Super Contributor
timestamp: November 12, 2021, 09:52:01 pm
content: Absolutely everything in a computer is binary, and in an 8 bit computer all of the instructions and data consist of 8 bit values, represented by the binary state of the data bus at that instant in time. The reason hex is used is that it is easier for humans to read, 0xCA is much clearer to most people than 11001010 but it's exactly the same thing. When the CPU accesses the ROM and sees a binary value corresponding to a valid instruction, it will do what that instruction does. Maybe that is loading a value from ROM, in which case it will increment to the next address and grab whatever value appears on the bus. Maybe it's writing a value from one of the internal registers to RAM, in which case the address bus will change to whatever addresses that particular location in RAM and the data bus will present that value which is then written in RAM.Absolutely everything the CPU does is dictated by the instructions it executes, and each instruction will be something along the lines of read data from a location, write data to a location, perform a mathematical operation on some data, or jump to another location in memory and execute from there. This low level stuff is not aware of file systems or peripherals or any of that stuff, it is entirely reading, writing, arithmetic and shuffling bytes from one address to another, everything.Mnemonics are nothing more than human readable abbreviations for binary values that represent instructions. They are aliases, you write the mnemonic and the assembler replaces it with the corresponding binary value, that's it. They exist only to enable a human to read the code and make sense of it, the microprocessor has no concept or awareness of them, it only understands binary.Seeing what is going on with a bus is where a logic analyzer comes in, and it usually requires some familiarity with the code that is being executed. You can set up a trigger on a logic analyzer so that when it sees a specific instruction or a specific address it will start capturing. For example if you're having trouble with a specific peripheral chip, you could have the analyzer start capturing when a byte is written to that chip's address, and then you can look at the sequence of values written to the various registers. Or you can have it trigger when a specific instruction is fetched from ROM, and when it sees the binary value representing that instruction on the data bus it will start capturing. This once again comes down to the fact that if you want to understand what is going on, it is mandatory to understand the instructions being executed and what the microprocessor is doing. Otherwise it's just going to look like noise, even a 1MHz microprocessor is going to be executing hundreds of thousands of instructions per second so without really understanding what's going on and being able to trigger on something specific, all you can really do is check for stuck lines and stuff like that. Or as others have suggested, you can make a no-op adapter that forces the CPU to just keep incrementing the address bus and then you have a known, repeating pattern to work with.

author: Peabody
author_rank: Super Contributor
timestamp: November 12, 2021, 10:37:26 pm
content: Some modern microprocessors will let you single-step through the instructions one at a time, and let you look at the resulting register values. I don't remember the 6502 having that feature, but if you're running a program out of ram, you can replace an instruction with a zero, and that becomes a BRK (break) instruction which if your firmware is set up for it can display all the register values.You might want to look at the Naken Assembler. It's a command line assembler for a variety of micros, including the 6502/6510 and the 65C02. It also has a disassembler, and a simulator which I believe lets you do pretend single step. Completely free.https://www.mikekohn.net/micro/naken_asm.php

author: brucehoult
author_rank: Super Contributor
timestamp: November 12, 2021, 11:01:54 pm
content: Quote from: Peabody on November 12, 2021, 10:37:26 pmThey really don't. Register values are internal to the chip. You can't access them from outside. A BRK instruction just transfers control to a different program -- the debugger or monitor -- which continues to run a million instructions a second.This doesn't help someone poking at the external address and data lines at ALL.The only things useful when looking at the external buses is to either run the CPU clock very very slow -- which you can't do with an NMOS 6502 or 6510 but can with a CMOS 65C02 -- or have external hardware (a "logic analyser") that can capture the values on the buses very quickly while the CPU is running.QuoteThat requires the chip to be running and running the debug software. Even JTAG generally requires the chip to be running, just in a special "debug" mode where the JTAG adaptor pokes a few instructions into a special debug code buffer and then runs them.Some CPUs have a status bit "break after executing one instruction", which is a substitute for inserting a BRK instruction after the next instruction (and also at the possible alternate destination if it's a conditional branch, assuming you don't simply emulate that outright). This is most useful when you're debugging code that is in ROM not RAM. But 6502 doesn't have that.

author: bostonman
author_rank: Super Contributor
timestamp: November 14, 2021, 05:13:49 pm
content: Yesterday I checked my solder connections on the sockets I installed (along with other solder connections), properly installed the 556, fixed the broken pin on the PLA that I broke, installed the PLA, installed the micro from the working C64, and re-tested the unit.Thankfully it seems to boot fine, shows the proper amount of available memory, and doesn't appear that it has any intentions of producing some funny/odd stuff. That micro must have been ready to clunk out for some amount of time because I vaguely remember odd characters appearing, but then it began working fine, and then it just produced a blank screen.QuoteFrom my understanding, I can't use a 6502 because it doesn't have the seven (?) ports. Does anyone have any suggestions on where to avoid buying the 6510s? Obviously the only way to get these is 'used' unless I want to replace them with some modern 3rd party design.In any case, I'm seeing some from China and other countries, so I want to make sure to get at least an original and not some fake knock off.But I wanted to follow up on the repair just in case anyone follows this thread in hopes to repair their C64. Unfortunately I don't have much technical input in closing since I got lucky by swapping in a good micro. Hopefully soon I'll devote time to the op codes and tinkering with my backup working (once I get some 6510s) test C64.

author: james_s
author_rank: Super Contributor
timestamp: November 14, 2021, 06:06:26 pm
content: I vaguely remember someone telling me that the CPU in the C64 is particularly vulnerable to ESD due to some signals being tied directly to external ports. Also CMOS chips of that era lacked the protection that modern parts have so they are very fragile. It's not uncommon to get weird partial failures.

author: Peabody
author_rank: Super Contributor
timestamp: November 14, 2021, 06:16:29 pm
content: Do you have a working disc drive, and a way to transfer files to it from your PC? I have some C64 files I wrote that I could post on Github if you have any interest. They include an ML Monitor, and an assembler that runs on the C64.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 15, 2021, 06:19:33 pm
content: Quote from: james_s on November 14, 2021, 06:06:26 pmThat was a common issue on home computers back in the days. Many had expansion ports which had all, or at least some signals directly tied to the CPU, with sometimes no protection against ESD whatsoever. In hindsight, it was a miracle those things didn't fail more often.

author: bostonman
author_rank: Super Contributor
timestamp: November 16, 2021, 05:32:29 am
content: QuoteI have an extra disk drive I purchased purposely to convert it for transferring between floppy disks and PC emulator. I'll have to dig out all the hardware to convert it.Maybe ESD is the cause of the micro failing. Would have been nice if it was a chip that is readily available rather than having to buy used.