BeebAsm

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

Re: BeebAsm

Post by SteveF »

Well, the example closest to hand would be David Given's CP/M-65 source code, such as the code here. I haven't personally written any code in this style, but looking at this I do like the reduction in the number of single-use labels visible in the code and my interest in the technique has increased.

I'm aware structured assembly is not particularly popular (CP/M-65 is the first time I've seen a project in the wild which uses it) and I would never even try to get direct support into beebasm; if nothing else, agreeing on the names of the commands would be a nightmare, even among structure aficionados. :-)

Garth Wilson's website has a page on structured assembly, including some implementation notes. He implements it in an assembler with no native stack datatype by redefining labels, but that isn't possible in beebasm IIUC. (I only skimmed this, to be honest, so I may be missing some implementation details.)

I am not in any desperate need of structured assembly support, but I found myself wondering if I could have the option for when I do want it. I agree the preprocessor approach is probably best, but to make that work without too much pain something like #line is needed, and I think that's something which would be more generally useful as well. (My interest is sufficiently theoretical I may not even try to implement "#line" in beebasm, at least not yet...)
User avatar
TobyLobster
Posts: 618
Joined: Sat Aug 31, 2019 7:58 am
Contact:

Re: BeebAsm

Post by TobyLobster »

tass64 looks like an interesting alternative. I've not used it myself, but it looks like it has a lot of options judging by the manual:
https://tass64.sourceforge.net
tom_seddon
Posts: 889
Joined: Tue Aug 30, 2005 12:42 am
Contact:

Re: BeebAsm

Post by tom_seddon »

TobyLobster wrote: Fri Apr 26, 2024 11:31 pm tass64 looks like an interesting alternative. I've not used it myself, but it looks like it has a lot of options judging by the manual:
https://tass64.sourceforge.net
I've been using this for a few years now, and it's the best! Full of great features. I rambled on about this in another thread the other day: https://www.stardot.org.uk/forums/viewt ... 98#p423598

I don't know for sure whether you could use its macro language to create repeat/until (etc.) macros, but I would expect it will be possible. Mutable variables are supported, and it has sequences and tuples, so you could probably maintain a stack of open constructs (including a tags for each one, so you can check the closing construct matches). It does as many passes as required to make things work, and I've yet to see it issue its "too many passes" error.

--Tom
SteveF
Posts: 1663
Joined: Fri Aug 28, 2015 9:34 pm
Contact:

Re: BeebAsm

Post by SteveF »

Thanks guys! I was intrigued by Tom's mention of it in that other thread and while I've only skimmed the manual, it sounds like the sequences and tuples would probably be capable of the kind of assembly time stack I'd need to do structured assembly. However, I was put off by this:
tom_seddon wrote: Wed Apr 24, 2024 12:22 am It's a bit annoying having to put 1 instruction per line, but I got over it.
I would really miss this if I didn't use beebasm, it just feels so much more expressive to be able to convey the grouping of some instructions by putting them on a single line. I suppose I could write a preprocessor to split multi-statement lines before feeding them into tass. :-)

(I was delighted to find acme supports multi-statement lines relatively recently, although no one seems to use them when I've seen other acme code. I guess multiple instructions per line is another one of those niche tastes, albeit one which is probably more common than usual in the BBC community.)
User avatar
tricky
Posts: 7694
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: BeebAsm

Post by tricky »

VectorEyes wrote: Fri Apr 26, 2024 7:10 pm Right, having read up on the 1982 paper on structured assembly (https://dl.acm.org/doi/10.1145/800066.801367) it honestly sounds like the sort of thing that would be better handled by a preprocessor step...
Once I understood what SteveF was asking for I thought the same as I write assembler to have minute control of everything ;)
There are times whe boiler plate type stuff gets boring, but one time labels don't have to polute:

Code: Select all

lda is_special_A
{
	bne nope
	...
.nope
}
And I find myself doing this sort of thing because the loop lable doesn't need to document anything:

Code: Select all

ldx #sprite_count { .lp : lda ball_speed,x : sta ball_old_speed,x : dex : bpl lp }
I have thought occasionally of using the c pre-processor for some tasks, but in the end, I am usually generating the data in a program and can reformat as I like.

If I had to pick two features to add to beebasm, it would be:

1. specifying 16 bit addresses in zero page although, I think that there has only been one time when I changed my code to avoid the issue and another when I was doing self modifying code and the first pass at startup was in ZP so I did a hack and used an address outside ZP and then ORG and EQUB to put a zero in the msB.

2. A way to have a table of 16bit addresses and have it output as all the low bytes, then all the high bytes.

Both of these are supported by other assemblers, but the others that I have tried have more annoying aspects to them and aren't as easily modded as beebasm if you want to add features :)

Maybe if RichTW ever gets time to finish beebasm2 it will be perfect and please all the people all the time ;)
I have tried doing 6502 for other platforms and I have found beebasm easier than the recommended assmeblers for those platforms although this is probably just familiarity and the annoying bits mentioned earlier, with the exception being where the platform has a fully integrated IDE that doesn't support beebasm!
Post Reply

Return to “development tools”