Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!freezer!gdtltr From: gdtltr@freezer.it.udel.edu (Gary Duzan) Newsgroups: comp.sys.atari.8bit Subject: Re: 6502 error conditions Message-ID: <30842@nigel.ee.udel.edu> Date: 18 Sep 90 15:57:01 GMT References: <30828@nigel.ee.udel.edu> Sender: usenet@ee.udel.edu Reply-To: gdtltr@freezer.it.udel.edu (Gary Duzan) Distribution: comp Organization: Brain Dead Innovations (BDI) Lines: 53 Nntp-Posting-Host: mocha.it.udel.edu In article lennox@minilove.diag.stratus.com (Craig Scott Lennox) writes: =>In article <30828@nigel.ee.udel.edu> gdtltr@freezer.it.udel.edu (Gary Duzan) writes: => => In article lennox@minilove.diag.stratus.com (Craig Scott Lennox) writes: => =>What does the 6502 do when it encounters an illegal => =>opcode? Does it just halt, as in a BRK, or can you have => =>it branch to a trap address? => => I believe the result is undefined. In fact, some early 6502's had some => desirable side-effects of using an undocumented opcode, so programmers would => use them. Obviously a bad thing. Newer chips like the 65802 and the 65816 => actually use all 256 bit patterns for opcodes. (Well, just about anyway.) => Answer: Don't do that. (0.5 :-) => => =>Well that's depressing. I was hoping there would be an illegal opcode =>trap to implement new opcodes. => =>Guess I won't even ask if there's an illegal memory ref trap address =>to use to implement virtual memory. (0.125 :-) ) => The 65816 could possibly handle Virtual Memory with some extra hardware since it has an ABORT input signal to abort the current instruction and jump through an additional interrupt vector. I wouldn't think it possible on a 6502, however. =>The really depressing thing is: How tough could it have been? I =>realise that the 6502 microcode really packs 'em in, but it's =>pretty poor programming style not to handle error conditions. => Well, I think they at least made sure that the thing doesn't get stuck in a funny state when the illegal opcodes are refernced. I can't speak to the complexity issue; I gave up EE long ago. (Three whole years. :-) The only argument I can give for their decision was to keep the chip simple. By the way, I'm pretty sure the 65C02 made all the unused opcodes NOP's. => =>|"Oh boy, virtual memory! Now I'm gonna make myself a REALLY BIG ram disk!" | Sounds good to me. The Bullet File System (Amoeba) does something pretty close to this. It seems to be getting more popular. Gary Duzan Time Lord Third Regeneration -- gdtltr@freezer.it.udel.edu _o_ -------------------------- _o_ [|o o|] An isolated computer is a terribly lonely thing. [|o o|] |_O_| "Don't listen to me; I never do." -- Doctor Who |_O_|