Dragon emulator written in Python ???

A place to discuss everything Dragon related that doesn't fall into the other categories.
Sarah
Posts: 177
Joined: Wed Apr 13, 2011 3:36 pm
Contact:

Re: Dragon emulator written in Python ???

Post by Sarah »

This is what to do at reset:
  • Set mapmode0 and reinstate the mapmode0 ROM
  • Set DP to #0
  • Set the I and F flags in CC to mask interrupts
  • Load PC from $FFFE
That's all. You shouldn't need a value for S as code executing after reset cannot assume it to be set.
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: Dragon emulator written in Python ???

Post by tormod »

Sarah wrote:You shouldn't need a value for S as code executing after reset cannot assume it to be set.
Note also that after reset, NMI stays disabled until a program sets S.
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

That's a little to hight for me, at the moment. e.g. what is "mapmode0" ?

Beside implementing more Opcode i have only implement some "Dummy" objects for PIA 1 & 2 and SAM...: https://github.com/jedie/DragonPy/blob/ ... #L336-L463

And without unittests for the new implemented Opcodes, i consider there are a few bugs ;)

The current debug output is this: https://gist.github.com/jedie/6779646

I raised a NotImplementedError while writing to text screen:

Code: Select all

$ba7e read pc byte: $e7 from $ba7e
$ba7e	STB	INDEXED instruction_ST8	| $ba7e: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba7f read pc byte: $80 from $ba7f
$ba80 addressing 'indexed' with postbyte: $80 == 10000000
$ba80 indexed addressing mode ea=$401 	| $401: $400-$5ff - Default Text screen
$ba80 get 'indexed' byte: ea = $401 m = $0
$401 instruction_ST8 kwargs: ea=$401 m=$0 opcode=$e7 operand=<B (8-Bit):96>
$ba80 ST8 store value $60 from B at $401 	| $401: $400-$5ff - Default Text screen
 **** TODO: write $60 '`' to text screen address $401

If i don't raise it will stay in this loop:

Code: Select all

$ba7e read pc byte: $e7 from $ba7e
$ba7e	STB	INDEXED instruction_ST8	| $ba7e: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba7f read pc byte: $80 from $ba7f
$ba80 addressing 'indexed' with postbyte: $80 == 10000000
$ba80 indexed addressing mode ea=$401 	| $401: $400-$5ff - Default Text screen
$ba80 get 'indexed' byte: ea = $401 m = $60
$401 instruction_ST8 kwargs: ea=$401 m=$60 opcode=$e7 operand=<B (8-Bit):96>
$ba80 ST8 store value $60 from B at $401 	| $401: $400-$5ff - Default Text screen
 **** TODO: write $60 '`' to text screen address $401
 **** write $60 to $401 - mem info:
      $60: $5c-$61 - Floating Point Accumulator Num 2
      $401: $400-$5ff - Default Text screen
-------------------------------------------------------------------------------
$ba80 read pc byte: $8c from $ba80
$ba80	CMPX	IMMEDIATE instruction_CMP16	| $ba80: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba81 read pc word: $05ff from $ba81
$ba81 addressing 'immediate word' value: $5ff
$ba81 instruction_CMP16 kwargs: ea=$ba81 m=$5ff opcode=$8c operand=<X (8-Bit):1024>
$ba83 CMP16 X $400 - $5ff = $-1ff
-------------------------------------------------------------------------------
$ba83 read pc byte: $23 from $ba83
$ba83	BLS	RELATIVE instruction_BLS	| $ba83: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba84 read pc byte: $f9 from $ba84
$ba85 addressing 'relative' ea = $ba85 + -7 = $ba7e 	| $ba7e: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba85 get 'relative' byte: ea = $ba7e m = $e7
$ba7e instruction_BLS kwargs: ea=$ba7e m=$e7 opcode=$23
$ba85 BLS branch to $ba7e, because C|Z==0 	| $ba7e: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
-------------------------------------------------------------------------------
$ba7e read pc byte: $e7 from $ba7e
$ba7e	STB	INDEXED instruction_ST8	| $ba7e: $ba79-$ba85 - Clears text screen with value in B (CoCo $a92a)
$ba7f read pc byte: $80 from $ba7f
$ba80 addressing 'indexed' with postbyte: $80 == 10000000
$ba80 indexed addressing mode ea=$401 	| $401: $400-$5ff - Default Text screen
$ba80 get 'indexed' byte: ea = $401 m = $60
$401 instruction_ST8 kwargs: ea=$401 m=$60 opcode=$e7 operand=<B (8-Bit):96>
$ba80 ST8 store value $60 from B at $401 	| $401: $400-$5ff - Default Text screen
 **** TODO: write $60 '`' to text screen address $401
 **** write $60 to $401 - mem info:
      $60: $5c-$61 - Floating Point Accumulator Num 2
      $401: $400-$5ff - Default Text screen
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Sarah
Posts: 177
Joined: Wed Apr 13, 2011 3:36 pm
Contact:

Re: Dragon emulator written in Python ???

Post by Sarah »

jedie wrote:That's a little to hight for me, at the moment. e.g. what is "mapmode0" ?
The map mode basically controls the configuration of RAM and ROM for a system using an MC6883 (SAM). You can read full details about how it decodes addresses in the data sheet:
http://images.ihscontent.net/vipimages/ ... -5-323.pdf

Or perhaps take a look at 'What can be done with it all' here:
http://archive.worldofdragon.org/index. ... 4K_Upgrade#

It's not really something you need to be concerned about whilst your emulator is in the early stages of development.
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

Sarah wrote:Or perhaps take a look at 'What can be done with it all' here:
http://archive.worldofdragon.org/index. ... 4K_Upgrade#
Thanks! That's interesting!
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

I ask myself if it's make more fun to start with a simpler hardware. e.g.: http://searle.hostei.com/grant/6809/Simple6809.html So i have only to implement a virtual RS232 interface ;)
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Dragon emulator written in Python ???

Post by sixxie »

The way I started with XRoar was to have some RAM, load the ROMs and periodically dump the state of 0x0400 - 0x05FF to the console using VT100 escape codes. Then I implemented CPU instructions basically in the order they're encountered in the BASIC ROM (obviously doing the "easy" stuff that was similar at the same time).

As things progress you need to flesh out a bit of the hardware at a time or fake it for the time being. Seeing the initial copyright message was really rewarding :)

Sadly I wasn't using version control beyond "copy the old files somewhere safe" at the time, so I can't trace through and see what got implemented when. Suspect once it sat there with a cursor flashing, some sort of proper video and keyboard input would have been next. It was good fun...
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

sixxie wrote:The way I started with XRoar was to have some RAM, load the ROMs and periodically dump the state of 0x0400 - 0x05FF to the console using VT100 escape codes. Then I implemented CPU instructions basically in the order they're encountered in the BASIC ROM (obviously doing the "easy" stuff that was similar at the same time).
That's simmilar to my way. I get writes to 0x0400 (see post above):
jedie wrote:$ba80 ST8 store value $60 from B at $401 | $401: $400-$5ff - Default Text screen
**** TODO: write $60 '`' to text screen address $401
But i think '`' is a "wrong" char, isn't it?
sixxie wrote:Seeing the initial copyright message was really rewarding :)
Yes, is hope to get it at least to this point...

Currently i work on the support for Simple6809 and Dragon by changing the CLI arguments.
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Dragon emulator written in Python ???

Post by sixxie »

jedie wrote: But i think '`' is a "wrong" char, isn't it?
It's just what 0x60 is in ASCII. On the VDG 0x60 is an empty character cell. The VDG character set is not a direct ASCII mapping - the BASIC ROM does the interpretation when you PRINT CHR$(...). For intelligible output you'll have to do a certain amount of translating values.
Last edited by sixxie on Mon Oct 07, 2013 10:49 am, edited 1 time in total.
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

sixxie wrote:
jedie wrote: But i think '`' is a "wrong" char, isn't it?
It's just what 0x60 is in ASCII. On the VDG 0x60 is an empty character cell. The VDG character set is not a direct ASCII mapping - the BASIC ROM does the interpretation when you PRINT CHR$(...). For intelligable output you'll have to do a certain amount of translating values.
Ah! that's good news! Thanks!

I have started to support for Simple6809 with: https://github.com/jedie/DragonPy/commi ... a03c5d7a9c
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Post Reply