Page 1 of 1

Dragon Cartridges + BASIC...

Posted: Mon Jul 02, 2012 2:51 pm
by Rink
Hi there,

Bit of a techie question here. I'm just wondering how the cartridges work - or to be specific, I'll give a theoretical example: :)

If I had a cartridge which offers nothing more than a few extra BASIC commands, how would this work? Would the cart identify itself as a disk controller and then in the $C002 initialisation routine extend the reserved word table etc? Or would you have an auto-starting (non-disk) cartridge that does the same thing then RTI/Reset?

Cheers.

Re: Dragon Cartridges + BASIC...

Posted: Wed Jul 04, 2012 4:04 pm
by zephyr
If the Dragon (or CoCo) finds $444B ("DK") at $C000-$C001, it then jumps to the next location at $C002. If "DK" is not found, and the cartridge is wired to auto start, the interrupts are enabled and the FIRQ handler does a hardware init, clears the reset flag at $71, and jumps to $C000.

Re: Dragon Cartridges + BASIC...

Posted: Wed Jul 04, 2012 4:23 pm
by Rink
Cheers Zephyr, I think I'm slowly piecing this all together now. :D

Re: Dragon Cartridges + BASIC...

Posted: Wed Jul 04, 2012 5:24 pm
by zephyr
Here are a couple of quick examples for you:

"DK" auto-start:

Code: Select all

         ORG     $C000
         FCB     $44,$4B
         CLRA
L1       LDX     #$0400
L2       STA     ,X+
         CMPX    #$05FF
         BLS     L2
         INCA
         BNE     L1
         JMP     $B43E
FIRQ auto-start:

Code: Select all

         ORG     $C000
         CLRA
L1       LDX     #$0400
L2       STA     ,X+
         CMPX    #$05FF
         BLS     L2
         INCA
         BNE     L1
         RTI

Re: Dragon Cartridges + BASIC...

Posted: Wed Jul 04, 2012 6:37 pm
by Rink
That's fantastic!!! Cheers mate - you are an absolute diamond.

Re: Dragon Cartridges + BASIC...

Posted: Wed Jul 04, 2012 8:40 pm
by zephyr
Take a look at pages 238 to 242 of "Inside The Dragon" for a good example of adding new commands to BASIC.

Regards,
Steve

Re: Dragon Cartridges + BASIC...

Posted: Thu Jul 05, 2012 12:53 pm
by Rink
Unhelpfully, the Inside The Dragon book seems to have a typo - STUB2 hasn't been defined. I haven't had a chance to try and guess where it's supposed to go yet. Lol.

Cheers Steve.

Re: Dragon Cartridges + BASIC...

Posted: Thu Jul 05, 2012 2:39 pm
by Rink
If anyone is curious - I think
STUB2 EQU $0134
is the missing line.

Seemed to work... kinda. One of the two commands added in that example worked anyway. :)

Re: Dragon Cartridges + BASIC...

Posted: Tue Jul 10, 2012 11:17 am
by zephyr
Rink wrote:If anyone is curious - I think
STUB2 EQU $0134
is the missing line.
That is correct!
Rink wrote: Seemed to work... kinda. One of the two commands added in that example worked anyway. :)
You must have made a mistake somewhere because I typed in that example during the 80's and I clearly remember that both commands worked perfectly.

Re: Dragon Cartridges + BASIC...

Posted: Tue Jul 10, 2012 11:44 am
by Rink
Cheers fella. I'll take another look shortly.