Re: Software 6502-on-6502

From: Cameron Kaiser (spectre_at_stockholm.ptloma.edu)
Date: 2002-10-31 22:34:50

> > Did this actually have any code for the 65C02 emulator? My project is just
> > doing NMOS opcodes.
> 
> Yep it did. Are you interest (all the text commentary is in German
> though...)

Ich kann Deutsch lesen, so bring it on. :-) It sounds like someone's done this
software 6502 idea already, and I'm interested to see their approach.

> > Well, going back to the vector table,
> > I just took the opcode, shifted it left, and used that as an index to get
> > the vector to the servant routine (obviously adding 256 if the high bit
> > were set), and then did an indirect JMP.
> 
> Sorry, but the bit-banging part of my brain is on holidays....
> 
> so:
> clc
> lda (opcode),y ;y=0)
> asl	; two bytes per JMP vector
> sta jmpvector
> bcc +
> ....
> sta jmpvector+1
> + 
> jmp(jmpvector)

Here's the actual code, since I have it open in another window. Opcode is
already loaded in the accumulator. Some code unimportant to the dispatch
routine is omitted. disvecz and disvec are equivalent; disvecz is there
just to force the STAs to be zero-page.

	asl
	bcc gveclo
gvechi	tax
	lda vectab+256,x
	sta disvecz
	lda vectab+257,x
	sta disvecz+1
	:
	:
	jmp (disvec)
gveclo	tax
	lda vectab,x
	sta disvecz
	lda vectab+1,x
	sta disvecz+1
	:
	:
	jmp (disvec)

-- 
----------------------------- personal page: http://www.armory.com/~spectre/ --
 Cameron Kaiser, Point Loma Nazarene University * ckaiser@stockholm.ptloma.edu
-- Everything you think you know is wrong. -- Jack Chalker --------------------

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail 2.1.4.