BeebAsm

handy tools that can assist in the development of new software
SteveF
Posts: 823
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: BeebAsm

Post by SteveF »

Thanks for taking a look at that, I've built your branch and works fine.

Shall I create an issue for this and link to your branch so this doesn't get forgotten for the next release?
User avatar
ctr
Posts: 235
Joined: Wed Jul 16, 2014 3:53 pm
Contact:

Re: BeebAsm

Post by ctr »

That would be great, thank you.
SteveF
Posts: 823
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: BeebAsm

Post by SteveF »

6502
Posts: 41
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: BeebAsm

Post by 6502 »

Just a quick question, does BeebAsm support string variables?
Such as:

Code: Select all

CONSTANT_NAME = "FOOBAR"

ORG &1900
.start
    EQUS CONSTANT_NAME
.end
User avatar
sweh
Posts: 2360
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: BeebAsm

Post by sweh »

I'm willing to be proved wrong, but I don't think so.

However, macros may meet the requirement, depending,

Code: Select all

MACRO CONSTANT_NAME 
  EQUS "FOOBAR"
ENDMACRO

ORG &1900
.start
    CONSTANT_NAME
.end
Off the top of my head, I can't think of a scenario where a string isn't used in an EQUS so the macro may suffice.
Rgds
Stephen
6502
Posts: 41
Joined: Sat Mar 17, 2018 1:04 pm
Location: London
Contact:

Re: BeebAsm

Post by 6502 »

sweh wrote:
Thu Nov 05, 2020 1:20 am
I'm willing to be proved wrong, but I don't think so.

However, macros may meet the requirement, depending,

Code: Select all

MACRO CONSTANT_NAME 
  EQUS "FOOBAR"
ENDMACRO

ORG &1900
.start
    CONSTANT_NAME
.end
Off the top of my head, I can't think of a scenario where a string isn't used in an EQUS so the macro may suffice.
Yes just tested it and that works. Using a macro is a little clunky, but I guess it does the job.
ReubenS
Posts: 45
Joined: Thu Jun 16, 2011 4:32 pm
Contact:

Re: BeebAsm

Post by ReubenS »

I need a little help getting Beebasm to build Starquake from source...

Starquake is basically one big file that contains 1 large chunk and 3 small chunks, all concatenated together. This big file loads from disc at &1200 and the large chunk is immediately relocated to &E00, while the 3 smaller chunks are relocated to other addresses.

I think I understand the relocdemo sample but I can't see how to go about doing *multiple* relocations. Should I be aiming to do a different SAVE for each chunk? If so, then what loads them all?
VectorEyes
Posts: 402
Joined: Fri Apr 13, 2018 2:48 pm
Contact:

Re: BeebAsm

Post by VectorEyes »

ReubenS wrote:
Wed Dec 16, 2020 11:44 pm
I need a little help getting Beebasm to build Starquake from source...

Starquake is basically one big file that contains 1 large chunk and 3 small chunks, all concatenated together. This big file loads from disc at &1200 and the large chunk is immediately relocated to &E00, while the 3 smaller chunks are relocated to other addresses.

I think I understand the relocdemo sample but I can't see how to go about doing *multiple* relocations. Should I be aiming to do a different SAVE for each chunk? If so, then what loads them all?
So it's one big file that gets loaded, then some code is executed that relocates the big chunk and the 3 smaller chunks, and then you jump to the 'main game start' code, something like that?

One approach might be to assemble the chunks at the 'destination' locations, SAVE all four of them out (to the local filesystem, not to the SSD) ... then have a second assembly pass that uses INCBIN to include each of them at the place they're meant to go when they're part of the one big file... then SAVE out the big file (along with the code that does the runtime relocation etc).

There are various other ways to do it but that approach seems simple and easy to implement.
User avatar
Rich Talbot-Watkins
Posts: 1719
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: BeebAsm

Post by Rich Talbot-Watkins »

There's also a COPYBLOCK <start>, <end>, <dest> command which you might be able to use to shift blocks of code around after they've been assembled. That might work for you, though you'd need to be careful that you copy them in such an order that you don't overwrite anything you need to preserve. Generally, the trick would be to copy the block with the highest address destination first.

Code: Select all

ORG &400
.block1
\\ stuff
.block1end

ORG &900
.block2
\\ stuff
.block2end

ORG &E00
.block3
\\ stuff
.block3end

load = &1200
block1load = load
block2load = block1load + (block1end - block1)
block3load = block2load + (block2end - block2)
entryload = block3load + (block3end - block3)
COPYBLOCK block3, block3end, block3load
COPYBLOCK block2, block2end, block2load
COPYBLOCK block1, block1end, block1load

ORG entryload
.entry
\\ relocation code here
JMP start
.end

SAVE "Code", load, end, entry
I have no idea if that will actually work, but it looks as though it might.

(Note: this is a different technique to the relocdemo, which assembles to its final location but patches address references in the entry point code which will be loaded at a higher position. This makes use of the fourth parameter in SAVE, to supply a reload address.)
ReubenS
Posts: 45
Joined: Thu Jun 16, 2011 4:32 pm
Contact:

Re: BeebAsm

Post by ReubenS »

Thanks for the pointers, guys.

I was considering hacking at the "SAVE" command so that "SAVE+" (or something like that) appends to the previously saved file...
User avatar
alastairhm
Posts: 15
Joined: Fri Nov 22, 2019 1:28 pm
Contact:

Re: BeebAsm

Post by alastairhm »

I've recently got a new Mac laptop from work with Catalina installed, the version of beebasm I previously downloaded didn't work I assume because it was 32 bit.

So I had to compile my own 64 bit version.

If you need a MacOs 64 bit version as well you can download it from here http://blog.0x32.co.uk/posts/beebasm/
julie_m
Posts: 288
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: BeebAsm

Post by julie_m »

Would it be possible to add a feature to BeebAsm where PUTTEXT, INCBIN et al can launch a shell with two extra environment variables, one containing all the source code seen so far and the other with -v output so far; run an external command; and use its STDOUT in the disc image?
Post Reply

Return to “development tools”