Dragon Cartridges + BASIC...

A place to discuss everything Dragon related that doesn't fall into the other categories.
Post Reply
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Dragon Cartridges + BASIC...

Post 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.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Dragon Cartridges + BASIC...

Post 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.
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: Dragon Cartridges + BASIC...

Post by Rink »

Cheers Zephyr, I think I'm slowly piecing this all together now. :D
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Dragon Cartridges + BASIC...

Post 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
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: Dragon Cartridges + BASIC...

Post by Rink »

That's fantastic!!! Cheers mate - you are an absolute diamond.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Dragon Cartridges + BASIC...

Post 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
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: Dragon Cartridges + BASIC...

Post 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.
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: Dragon Cartridges + BASIC...

Post 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. :)
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

Re: Dragon Cartridges + BASIC...

Post 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.
Rink
Posts: 236
Joined: Mon Sep 05, 2011 7:01 pm

Re: Dragon Cartridges + BASIC...

Post by Rink »

Cheers fella. I'll take another look shortly.
Post Reply