Basic and Assembly, how to?

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
User avatar
robcfg
Posts: 1680
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Basic and Assembly, how to?

Post by robcfg »

Sooooo... I might be trying to put together a big basic program along a decent amount of graphics and some assembly functions together, but I'm struggling a bit.

Do I need to reposition the stack? How much stack space would be nice to have? I guess issue a proper CLEAR xx,yy command, etc...

Any help appreciated!

I'm talking roughly about 14KB Basic code and 19KB binary data and routines.

One obvious thing pops up right away it's that it would need a 64KB machine, and that begs another question: Would you people prefer a tape game that needs a 64KB machine, or would you prefer having it on disk but having to load some data while playing?

Cheers,
Rob
Alastair
Posts: 694
Joined: Fri Jul 18, 2008 11:33 pm

Re: Basic and Assembly, how to?

Post by Alastair »

robcfg wrote: Fri Feb 13, 2026 8:22 pm Would you people prefer a tape game that needs a 64KB machine, or would you prefer having it on disk but having to load some data while playing?
Given that I have a Dragon 32 and no disk drive I prefer neither option :lol:

However, for an emulator I would prefer the 64kiB tape option.
User avatar
rolfmichelsen
Posts: 331
Joined: Wed Apr 08, 2009 8:43 pm
Location: Oslo, Norway
Contact:

Re: Basic and Assembly, how to?

Post by rolfmichelsen »

I use a Dragon 64 with disk drives, and I'd love to see more software using that configuration. At the same time, I expect that limits the audience a bit among gamers preferring to run on real hardware...
User avatar
robcfg
Posts: 1680
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: Basic and Assembly, how to?

Post by robcfg »

Back to my question on mixing assembly routines with basic, if I understand it correctly, CLEAR 200, 19999 (for example) would tell Basic that it has 200 bytes for string somewhere and that I'm free to load my binary data/routines from 20000 until 32767. Is that right?

Where does the stack live?
sixxie
Posts: 1453
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Basic and Assembly, how to?

Post by sixxie »

Yes. For the most part, you can sort of get away with CLEAR200,20000 but I think there's something to do with the operation of VAL() that can overwrite that extra byte. So stick with CLEAR200,19999.

The stack then begins below the allocated string space - seemingly minus another couple of bytes (which I would bet a pint is something to do with not bothering to adjust stack calculations between the 6800 and 6809 versions). So the first byte pushed to the stack will be at address 19999-200-2-1 (that last -1 allowing for the predecrement).

Note: actually the first byte written is one higher (19999-200-2), and is set to 0. Don't know why!
pser1
Posts: 1798
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Basic and Assembly, how to?

Post by pser1 »

Hi!
you are right, Robert
The stack would use from memory 19999-200 downwards, as shown in attached image
The graphics page(s), the Basic, variables and arrays will be able to use up to that 19798
but you should better make sure that the stack doesn't grow down enough to overwrite
your data (variables and arrays)
cheers!
CLEAR.png
CLEAR.png (43.62 KiB) Viewed 374 times
User avatar
robcfg
Posts: 1680
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: Basic and Assembly, how to?

Post by robcfg »

Thank you for your kind replies!

Let's put it to work... :mrgreen:
Post Reply