PDA

View Full Version : Tangerine Microtan 65 - 6502



pullmoll
05-18-2010, 10:30 PM
I thought I should post what I've done, just in case my HD crashes...

Actually I could use some help fixing the q6502 core I wrote. The machine I'm trying to emulate is the Microtan (http://en.wikipedia.org/wiki/Tangerine_MICROTAN_65), a very simple 6502 computer. The CPU core is based on MAME's 6502 implementation, which is actually a 6510. The 6510 has only a few really invalid opcodes and a lot of rather obscure opcodes. The C64 demo folks certainly know them.

Anyway, the current state is this: The code seems to start up the TANBUG in ROM, which prints a TANBUG logo in the last line and scrolls the screen. Then an empty line with a cursor is displayed and the screen is scrolled again.

The first bug to find is why the 2nd half of the screen gets filled with 00s (square glyph) instead of the contents of the rows below. This could be due to an error in indirect addressing or the INC/DEC opcodes. I haven't disassembled the code to see how the scroll loop is done.

The screen memory is 512 bytes at $200..$3ff, which gives an amazing 32x16 character resolution. Each character position has a 9th bit associated with it that tells, if instead of text a block graphics should be displayed. If this is the case, a 2x4 block graphics consisting of 4x4 size poxels (= 8x16 font size) is displayed. The "graphics" resolution thus is 64x64 pixels.
The graphics mode is enabled by reading $BFx0/4/8/c and disabled by writing $BFx3/7/b/f, where x = c/d/e/f, i.e. incomplete decoding of the address lines.

The ROM and the character generator are included. If you put the MICROTAN.CHR on the SD, it will be loaded. This isn't necessary as the default font is hard coded in the VGA driver.

There currently is a waitcnt(clkfreq/256) in the fetch opcode loop, so you can see how the display is scrolled. You can remove it in q6502.spin if you fix the bug http://forums.parallax.com/images/smilies/smile.gif

Enjoy!

v0.1.2: Add keyboard support. You can enter commands into Tanbug now.
v0.1.3: Included support to load *.M65 files. A few are included. Unfortunately all games require a PIA setup connected to some digital (Atari) Joystick, which isn't emulated yet.
v0.1.4: The scrolling bug vanished after I tried to add debug code to m6502. Is the output of Tanbug giving the command "LC000,0" supposed to be as slow as it is?
v0.1.5: Fixed the slowdown. It was caused by not clearing the IRQ when the interrupt was taken. Probably a missing acknowledge for the keyboard interrupt!?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Post Edited (pullmoll) : 6/3/2010 5:17:52 PM GMT

heater
05-18-2010, 11:52 PM
Good grief PullMoll. I've been scratching my head since you posted this trying to remember where I know the Microtan from. Well of course it's from the old days of hanging around the famous Henrys Radio shop on the Edgeware Road in London. About the only place that had them. In the days when Henrys used to sell TTL chips and Nixie tubes and other useful stuff. After 65 years there is still a Henrys Shop there www.henrys.co.uk/shopinfo.htm (http://www.henrys.co.uk/shopinfo.htm)

edit: I need not have scratched my head so hard just noticed you have the wiki link there that says exactly that.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Leon
05-19-2010, 12:00 AM
Henry's was still there last year when I had some time to kill in London. I used to buy components there in the late 1950s, when I was at school; I remember buying a couple of red spot (surplus) germanium transistors for 10/- each.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM

pullmoll
05-19-2010, 12:25 AM
Leon said...
Henry's was still there last year when I had some time to kill in London. I used to buy components there in the late 1950s, when I was at school; I remember buying a couple of red spot (surplus) germanium transistors for 10/- each.


We have a probably similar institution over here in Bonn. My liq^H^H^Helectronics shoppe is P+M Elektronik (http://www.pm-elektronik-bonn.de/). I've been going there since I was 8 or 9, so that was mid 70s, and the shop existed (perhaps long) before. I got an electronics experimenting kit for christmas. I don't remember what I bought. It was something I ruined on that kit (Cosmos Electronic).

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Post Edited (pullmoll) : 5/18/2010 5:30:58 PM GMT

Ale
05-19-2010, 12:38 AM
Pullmoll: luckily COSMOS is still doing some kits. I saw them at Müller http://forums.parallax.com/images/smilies/smile.gif. My local electronics shop does not have that sort of thing :(, not that I needed one (now) http://forums.parallax.com/images/smilies/wink.gif.
We toyed with the idea of a 6502 core a while back... I'm always so short of time these days :(. Good work...
Btw I've been to Bonn yesterday... the Rhine valley is quite nice :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH (http://propeller.wikispaces.com/MATH)
pPropQL: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
pPropQL020: propeller.wikispaces.com/pPropQL020 (http://propeller.wikispaces.com/pPropQL020)
OMU for the pPropQL/020 propeller.wikispaces.com/OMU (http://propeller.wikispaces.com/OMU)
pPropellerSim - A propeller simulator for ASM development sourceforge.net/projects/ppropellersim (http://sourceforge.net/projects/ppropellersim)

mikediv
05-19-2010, 01:38 AM
pullmoll that is awesome I was waiting for something like this as much as I like CPM I cut my teeth on the 6502 and was actually in the process of wire wrapping a board ,without much luck I was hoping I could run Flex but I have no schematics showing a floppy interface.

trodoss
05-19-2010, 01:49 AM
@pullmoll

In the Hydra section, there was a NES emulation that emulated the 6502.· It may/may not be useful to you on this project.

http://forums.parallax.com/showthread.php?p=871551

--trodoss

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the Propeller Powered SIG (http://www.savagecircuits.com/forums/forumdisplay.php?29-Propeller-Powered)·fourm kindly hosted at Savage Circuits (http://www.savagecircuits.com/)


Game(s) Mythic Flight
(http://forums.parallax.com/showthread.php?p=766328)Utilities Font Editors (http://forums.parallax.com/showthread.php?p=833043) (AIGeneric, Potato_Text, etc.)

Toby Seckshund
05-19-2010, 02:01 AM
Leon

The first transistor I used to play with was a White Spot. I think it was that situation, of having just one transistor, which started my habit of scrounging and then using everything over, and over ....

My father wanted to get me off of valve stuff, I should have stuck with them, there's good money in bottle amps now.

Transmitters had a few of the giant jam jars, so all was not lost

Wan't the Mirco tan something to do with Elektor?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

pullmoll
05-19-2010, 02:03 AM
trodoss said...
In the Hydra section, there was a NES emulation that emulated the 6502. It may/may not be useful to you on this project.


Thanks! The NES didn't have a 6502, but a N2A03. Very similar, and yet different in many regards. Most importantly it had no decimal mode.

No, what I need is a clue at the code that is going wrong. I found the function that does the scrolling:

0000FA38: A2 00 ldx #$00
0000FA3A: BD 20 02 lda $0220,x
0000FA3D: 9D 00 02 sta $0200,x
0000FA40: E8 inx
0000FA41: D0 F7 bne $FA3A
0000FA43: BD 20 03 lda $0320,x
0000FA46: 9D 00 03 sta $0300,x
0000FA49: E8 inx
0000FA4A: E0 E0 cpx #$E0
0000FA4C: D0 F5 bne $FA43
0000FA4E: 86 0A stx $0A
0000FA50: A9 03 lda #$03
0000FA52: 85 0B sta $0B
0000FA54: A9 20 lda #$20
0000FA56: A8 tay
0000FA57: 88 dey
0000FA58: 91 0A sta ($0A),y
0000FA5A: D0 FB bne $FA57
0000FA5C: 60 rts



So for some reason the second part with lda $0320,x and sta $0300,x goes wrong. I don't yet know if the 00s are read or written. I have to trace that piece of code.

Edit: I didn't even know that STA ABS,X doesn't do a page wrap when LO(ABS)+X > $ff. This isn't the cause of the problem, though.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Post Edited (pullmoll) : 5/18/2010 7:14:31 PM GMT

pullmoll
05-19-2010, 02:32 AM
Toby Seckshund said...
Wan't the Mirco tan something to do with Elektor?


I don't think so, or otherwise the Wikipedia article would have mentioned that fact.

The Elektor had an even earlier, pre-microprocessor project to run games. I don't remember the name of that thing. It was too expensive anyway with dozens of TTLs.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

trodoss
05-19-2010, 02:47 AM
pullmoll said...
Thanks! The NES didn't have a 6502, but a N2A03. Very similar, and yet different in many regards. Most importantly it had no decimal mode.


I will be the first to admit my ignorance ;)
Just goes to show that there were so many clones/variants to the 6502.

Here's hoping that the next one is the Apple ][ ;)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the Propeller Powered SIG (http://www.savagecircuits.com/forums/forumdisplay.php?29-Propeller-Powered)·fourm kindly hosted at Savage Circuits (http://www.savagecircuits.com/)


Game(s) Mythic Flight
(http://forums.parallax.com/showthread.php?p=766328)Utilities Font Editors (http://forums.parallax.com/showthread.php?p=833043) (AIGeneric, Potato_Text, etc.)

Toby Seckshund
05-19-2010, 02:51 AM
I think I was remembering their Junior Computer, which could look a bit like it with a motherboard attached.

I never got on with 6502 etc, I was too locked into Z80 (thoughtwise, and moneywise http://forums.parallax.com/images/smilies/sad.gif )

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

Leon
05-19-2010, 02:57 AM
Toby:

Henry's sold white spot ones as well as the red spots. The white spots were intended for IF amps, IIRC, the red spots were AF only.

I always preferred the Z80, as well. It made a much better embedded controller.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM

Ahle2
05-19-2010, 04:03 AM
I have done an emulation of the HuC6280 CPU a couple of years ago for my PCe / Turbo Grafx 16 emulator (btw, soon to be ported to android).
It's a variant of the 6502 with a MMC, PSG, Timer and some extra opcodes.
Then I have done two 6502 cores for my SID-player.

My experience with 6502 emulation is as follows:
If you have an error in your cpu emulation, it's 90% certain to be an addressing mode issue.

Toby Seckshund
05-19-2010, 05:32 AM
Leon

Now you mention it was a red spot that I had. When I wanted another they had stopped stocking them in the Half width shop in Bristol and were supplying GET45, I think, I bought an OC71 but it was nothing better than a noise generator.

The GET45 was so leaky that it was self biasing, with a couple of coils, and nothing else, I had a 100KHz osc. The youth of today just do not know how much things have progressed ( and I'm "only" 52 )

My father had some MATxxx transistors which were ok to 150MHz, at that time, I think that they were still a bit "militry" then. I wasn't allowed to use them.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

Peter Jakacki
05-19-2010, 09:41 AM
While reading this thread I tracked down the N2A03 and found this interesting link with a whole stack of disassemblers for different processors written in C for the MAME project. I have had a great deal of experience with 6502 8 and 16-bit variants but one of the first processors that I played with was the Signetics 2650. Guess who on this thread wrote it?



/************************************************** *************************
*
* Portable Signetics 2650 disassembler
*
* Written by J. B?????????? (pullmoll@t-online.de)
* for the MAME project
*
************************************************** ************************/


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

pullmoll
05-19-2010, 10:17 AM
Peter Jakacki said...
While reading this thread I tracked down the N2A03 and found this interesting link with a whole stack of disassemblers for different processors written in C for the MAME project. I have had a great deal of experience with 6502 8 and 16-bit variants but one of the first processors that I played with was the Signetics 2650. Guess who on this thread wrote it?



Yep, that was one of Aaron's goals: a universal disassembler. I used it to disassemble the Microtan code fragment. It has an impressive list of supported CPUs:

Supported architectures:
adsp21xx hyperstone x86_64 m68000 mips3be sh2 tms57002
alpha8201 esrip konami m68008 mips3le sh4 tms7000
arm f8 lh5801 m68010 psxcpu sharc upd7810
arm7 g65816 lr35902 m68020 r3000be sm8500 upd7807
arm7thumb h6280 m37710 m68030 r3000le spc700 upd7801
asap h8 m6502 m68040 nec ssem upd78c05
avr8 hd6309 m65sc02 m6805 pdp1 ssp1601 v60
ccpu i386 m65c02 m6809 tx0_64kw t11 v70
cdp1802 i4004 m65ce02 mb86233 tx0_8kw tlcs900 v810
cop410 i8008 m6510 mb88xx pic16c5x tms0980 z180
cop420 i8085 deco16 mcs48 pic16c62x tms1000 z80
cop444 i80286 m4510 upi41 powerpc tms1100 z8
cp1610 i8086 m6800 i8051 rsp tms32010
cquestsnd i960 m6801 i8052 s2650 tms32025
cquestrot jaguargpu m6802 i80c51 saturn tms32031
cquestlin jaguardsp m6803 i80c52 sc61860 tms32051
dsp32c x86_16 hd63701 ds5002fp scmp tms34010
dsp56k x86_32 nsc8105 minx se3208 tms34020




Signetics 2650 is among the CPUs what Forth is among the programming languages. I can't understand how anyone can understand its weird addressing modes.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

pullmoll
05-19-2010, 10:24 AM
Ahle2 said...
If you have an error in your cpu emulation, it's 90% certain to be an addressing mode issue.


Perhaps, yes, though I suspect the memory handler that dispatches on reads from the frame buffer range. Unfortunately I'm rather drunk now and even worse is that I ran out of coffee, so no chance to fix it tonight :/

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Peter Jakacki
05-19-2010, 10:48 AM
Now the 2650 I never really programmed in assembler, no no no, that wasn't good enough or maybe it was just too expensive. Good ol' machine code in hex, that's what I remember. Most programs were small so the program page thing never became a problem but the indirect bit was a very useful feature as was the auto inc/dec indexing modes. What's weird about that? (or with Forth).

The 2650 could be clocked all the way down to DC which was a notable feature at the time. At the time the local electronics store "TechniParts" IIRC sold them for $26.50 which was also quite cheap, nothing like the 32-bit ARM chips now with internal memory for $1 (in 2010 $) though.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

TonyD
05-19-2010, 03:45 PM
pullmoll said...

Toby Seckshund said...
Wan't the Mirco tan something to do with Elektor?


I don't think so, or otherwise the Wikipedia article would have mentioned that fact.

The Elektor had an even earlier, pre-microprocessor project to run games. I don't remember the name of that thing. It was too expensive anyway with dozens of TTLs.

The Elektor_TV_Games_Computer (http://en.wikipedia.org/wiki/Elektor_TV_Games_Computer) (Signetics 2650A) was from 1979 and the Elektor Junior (6502) (http://en.wikipedia.org/wiki/Elektor_Junior_Computer) was published from 1980 onwards. There was an Elektor SC/MP computer as well, published in 1978. Glory Days http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Tony

http://zuzebox.wordpress.com/

Leon
05-19-2010, 05:08 PM
I quite liked the SC/MP chip, it had a shift register which made serial comms very easy. The instruction set was rather limited, though.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Leon Heller
Amateur radio callsign: G1HSM

pullmoll
05-19-2010, 05:43 PM
TonyD said...
The Elektor_TV_Games_Computer (http://en.wikipedia.org/wiki/Elektor_TV_Games_Computer) (Signetics 2650A) was from 1979 and the Elektor Junior (6502) (http://en.wikipedia.org/wiki/Elektor_Junior_Computer) was published from 1980 onwards. There was an Elektor SC/MP computer as well, published in 1978. Glory Days http://forums.parallax.com/images/smilies/smile.gif


Hmm.. perhaps it was the Junior Computer, while I thought it was an even earlier video game system without a CPU. Some years ago I still had the issue where it was described.
I wrote an 2637 video driver for an Arcadia emulation in C some time ago. Fun stuff.. The Arcadia could probably be "propelled".

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

TonyD
05-19-2010, 08:57 PM
pullmoll said...
Hmm.. perhaps it was the Junior Computer, while I thought it was an even earlier video game system without a CPU. Some years ago I still had the issue where it was described.

There was, it was a TV Tennis game from 1975 made using 555's and other discrete components. There were a couple of updates published for it over the years. Elektor also published a TV Game (1977) based on the popular AY-3-8500 chip (http://en.wikipedia.org/wiki/AY-3-8500). The AY-3-8500 was found in many of the dedicated Pong and Tennis consoles of the time such as the Coleco Telstar and Magnavox Odyssey.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Tony

http://zuzebox.wordpress.com/

potatohead
05-19-2010, 09:36 PM
Where the circuit was the game. I loved those, and for years kept a size "D" hand drawn "Pong" schematic on my wall. Lost it in a move and am still kind of pissed about it. All the gates, triggers, counters... and the neat annotations from the engineer were cool too. People with good vision and some ability to communicate it are always intriguing to me.

I just read about this machine, and got an answer to something that has bothered me. On some computers, other devices like graphics chips can access the memory without interrupting the CPU. This was true on Apple and CoCo, for example, but not true on C64 / Atari. I never did hear a solid explanation for why that is the case, when it's clear those devices can operate, leaving the CPU at full speed. Atari and C64 machines are slowed considerably when the user requests the more advanced graphics features. Was this cost of RAM, or something else?

Anyway, this is kind of a cool old computer, and I'm excited to see a 6502 build up.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)
8x8 color 80 Column NTSC Text Object (http://obex.parallax.com/objects/550/)
Safety Tip: Life is as good as YOU think it is!

Toby Seckshund
05-20-2010, 02:34 AM
When I was building up my Nascom, 4KB of SRAM chips was two weeks wages. The choise of chips for the Nascom2 (4118,s I think) caused the company to go bust when they went scarce and they had to give away 16KB expantion boards instead.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

pullmoll
05-20-2010, 06:01 PM
Toby Seckshund said...
When I was building up my Nascom, 4KB of SRAM chips was two weeks wages. The choise of chips for the Nascom2 (4118,s I think) caused the company to go bust when they went scarce and they had to give away 16KB expantion boards instead.


I think by cost potatohead meant the expense of time or CPU cycles it takes to have more complicated graphics.
I can only speak for the Atari 800 and its ANTIC chip (and GTIA). They also used the 6502 clock state where the CPU puts nothing on the address or data bus to fetch the video RAM data. Writing to the video RAM or display list was thus asynchronous to the ANTIC fetching the same data and could be flicker-free.
The Colour Genie OTOH had Z80 wait states inserted by the CRTC accessing memory, so it would become a little slower if you increased the number of characters per line. The character generator RAM was not synchronized, so writing it caused flicker (tiny white dots) spread across the display, which was a major refutation for animated graphics.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Toby Seckshund
05-21-2010, 01:23 AM
Ah the delights of the "Snow". There were a couple of attemps to hide it, on the favourite Z80 computer of mine, in the end they just replaced the white snow with black snow, so it didn't show up as much (in their oppinion)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point

pullmoll
05-21-2010, 04:22 AM
The keyboard is working now - with the (almost) default Keyboard.spin code. The Microtan had an ASCII keyboard, so I can use the standard object.
The wrong data in the 2nd screen half during the initial scroll is still there and I couldn't find out where it comes from. It's not the data returned by the io.spin code.
When entering commands, the TANBUG always only prints a ? after the command, which probably means it didn't understand the command.
The commands from the Wikipedia Tanbug page seem to work. The hex dump is exceptionally slow.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Post Edited (pullmoll) : 5/22/2010 3:19:15 PM GMT

pullmoll
05-22-2010, 10:10 PM
I can't the heck find a bug in the 6502 emulation.

Either the LDA abs16,X ($BD LL HH) or the STA abs16,X ($9D LL HH) opcodes are wrong, yet they are so simple.
The sequence of subroutines (vector) for the first is


rd_abx_p = read absolute plus X, with page wrap adjustment, into alu
stores X in XY
calls calc_abs_xy_p which reads the opcode word at PC, adds X and allows the result to be in the next page
calls rd_byte to read to alu
m_lda = store alu in A and set N and Z flags accordingly



The second opcode is handled by


m_sta = store A in tmp
wr_abx_np = store tmp in absolute plus X, no page wrap adjustment
stores X in XY
calls calc_abs_xy_np which reads the opcode word at PC and adds X to the lower byte only (page wrap)
copies tmp to alu
calls wr_byte to write from alu




Somewhere along the code execution alu is damaged (set to $00), but only for the 2nd half of the screen memory ($300..$3ff), which is very odd in itself, since there is just one handler doing both.

I verified that reading $300 to $3ff through the I/O handler actually returns the screen memory contents and not $00, so I assume that either A is destroyed by fetching the next opcode, or that the store does it under certain circumstances. Also writing to the screen using the io_command and io.spin handler works as expected.

I posted it on the previous page already: the code that causes the bug to manifest itself:

0000FA38: A2 00 ldx #$00
0000FA3A: BD 20 02 lda $0220,x
0000FA3D: 9D 00 02 sta $0200,x
0000FA40: E8 inx
0000FA41: D0 F7 bne $FA3A
0000FA43: BD 20 03 lda $0320,x
0000FA46: 9D 00 03 sta $0300,x
0000FA49: E8 inx
0000FA4A: E0 E0 cpx #$E0
0000FA4C: D0 F5 bne $FA43
0000FA4E: 86 0A stx $0A
0000FA50: A9 03 lda #$03
0000FA52: 85 0B sta $0B
0000FA54: A9 20 lda #$20
0000FA56: A8 tay
0000FA57: 88 dey
0000FA58: 91 0A sta ($0A),y
0000FA5A: D0 FB bne $FA57
0000FA5C: 60 rts



The opcodes at $FA43 and $FA46 are the ones that fail.
The almost identical loop, except for the abs16 values, at $FA3A does work. What the heck can cause a bug dependency on an absolute address?


Anyone willing to take a look at my code?

Could I trace this kind of code with one of the Spin/PASM debuggers?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Post Edited (pullmoll) : 5/22/2010 3:31:44 PM GMT

Chas
05-23-2010, 06:17 AM
Quote from above: from Pullmoll
*
Yep, that was one of Aaron's goals: a universal disassembler. I used it to disassemble the Microtan code fragment. It has an impressive list of supported CPUs: including TMS1000
**

Who can tell me who has accessed the TMS1000 to dump the code and use disassembler ?

I am looking at a TMS1000 in a Hornby Zero One train controller that used the TMS1000 in the 1980's. Would like to update with some minor changes onto a new processor.

Comments welcome
Charlie

pullmoll
05-23-2010, 11:57 PM
Chas said...

Who can tell me who has accessed the TMS1000 to dump the code and use disassembler ?


I don't know if this has happened. According to the author of the tms1000 CPU core it is incomplete and not very well tested. It was capable of running a calculator example code from some technical manual, though.



Chas said...
I am looking at a TMS1000 in a Hornby Zero One train controller that used the TMS1000 in the 1980's. Would like to update with some minor changes onto a new processor.


I have no idea of the requirements to do this, sorry.

Juergen

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

pullmoll
06-03-2010, 09:09 AM
Updated the source after the previous bug in addressing the videoram vanished. I tried to add Cluso99's PASM debugger to q6502.spin and in the course broke the emulation. After reverting to the q6502 from version 0.1.3 and applying some of the changes I had done for the debugger, now the bug is gone. I don't have a clue yet which of the changes made the difference. It could be one of moving the io_command and irq variables to the DAT section, or moving the videoram and graphicsram into the io.spin object instead of microtan.spin.

Anyway, now scrolling works as expected. However the output of Tanbug listing memory with e.g. LC000,0 is ultimately slow. I don't know if this is due to another emulation bug, or if perhaps Tanbug itself is slowing down the output. Does anyone remember using Tanbug?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Dr_Acula
06-03-2010, 03:50 PM
Did you say you needed a joystick for this emulation? Just brainstorming what could be done with 8 new digital inputs and 8 digital outputs on a new board design...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller (http://www.smarthome.viviti.com/propeller)

pullmoll
06-03-2010, 04:19 PM
Dr_Acula said...
Did you say you needed a joystick for this emulation? Just brainstorming what could be done with 8 new digital inputs and 8 digital outputs on a new board design...

All available programs rely on two 6522 VIAs and one or two joysticks connected to the parallel ports. I have yet to emulate the 6522 registers and their function: timers, parallel in/out, interrupts on trigger pins etc. - not easy to squeeze this into io.spin.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

pullmoll
06-04-2010, 12:18 AM
I found the cause for the tremendous slowdown: the interrupt request wasn't cleared by the take interrupt function, because usually an interrupt handler de-asserts the IRQ on its own. For some reason this doesn't seem to be the case with the keyboard IRQ (the only one in Microtan) and so the interrupt code was executed over and over again, executing only one non-interrupt instruction in between IRQs.

Now the output of listing a memory block is reasonably fast.

Next thing to do is add the VIA 6522 emulation to get the joystick(s) simulated.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)

Baggers
06-04-2010, 12:41 AM
excellent progress pullmoll :D nice find too.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

Dr_Acula
06-13-2010, 02:13 PM
How are things progressing on this project?

I just saw a post by Holly about the 6502 and the Apple over on the sandbox forum. Back in the day, like VHS vs Beta, you were 65xx or xx80 and I fell into the latter group - 8080, Z80, 8086 etc, so I'm not as familiar with the 65xx group of computers.

But from my limited recall, I think it was this Microtan, Apples, Commodores? and I'm sure there are others.

When pullmoll got CP/M working, suddenly we saw new computer emulations every few days. So I'm eagerly looking forward to the microtan working as I think it might pave the way for another burst of activity and new emulations.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller (http://www.smarthome.viviti.com/propeller)

pullmoll
06-13-2010, 05:43 PM
The Microtan is basically working. There are most probably bugs to fix in the 6502 (6510) emulation. I should look out for some 6502 exerciser program to run and see where it fails. The second thing to do is to emulate the VIA 6522, because it seems to be vital for the existing games on the Microtan.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects (http://pmbits.ath.cx/prop/)