Hi I've been writing a new BBC game in assembly but I only had several old books to reference. I have been doing it old school on a BBC B, and partly via BeebEm.
I think EQU is part of the BASIC 2 assembler. I have the rom, it came with my Turbo MMC reader. Is there a reference and examples so that I may use it on my project. I have never used BeebAsm or worked with EQUB data.
I've been scrolling graphics via direct screen addressing.
Happy to read and study if somebody could point me in the right direction.
EQUB data
Re: EQUB data
See page 439 in the B+ user guide (page 451 of the PDF here: http://bbc.nvg.org/doc/BBCUserGuide-1.00.pdf)
There's not a lot to it though - it just puts a single byte of data of your choice inline in the generated machine code. If you need to insert a lot of data it can be better to use a function or drop out of assembler mode and manually insert the data at P% or O%.
There's not a lot to it though - it just puts a single byte of data of your choice inline in the generated machine code. If you need to insert a lot of data it can be better to use a function or drop out of assembler mode and manually insert the data at P% or O%.
Re: EQUB data
Note that EQUB on beebasm allows you to write EQUB 1,2,3,4 and this will store 4 bytes whereas BBC Basic 2 only takes the first value (AFAIK). Programs on PCs that output the data as EQUBs tend to expect the former behaviour.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
- BeebMaster
- Posts: 7379
- Joined: Sun Aug 02, 2009 5:59 pm
- Location: Lost in the BeebVault!
- Contact:
Re: EQUB data
You've also got EQUW which will take a 2 byte number as its parameter, and EQUD which takes a 4 byte number.
Sometimes it's convenient to store a string of bytes using CHR$, something like $P%=CHR$0+CHR$2+CHR$128, or to set a whole area to a fixed number $P%=STRING$(128,CHR$&FF) etc. That way you can store up to 255 bytes, or as many as the BBC BASIC line length will allow!
Sometimes it's convenient to store a string of bytes using CHR$, something like $P%=CHR$0+CHR$2+CHR$128, or to set a whole area to a fixed number $P%=STRING$(128,CHR$&FF) etc. That way you can store up to 255 bytes, or as many as the BBC BASIC line length will allow!
Re: EQUB data
For multi-byte stuff on BASIC 2 - or anything at all on BASIC 1 - you can use the "OPT FN" macro pattern, something like this:
(Bear in mind that if you're using BASIC 2's relocation support you need to change these things to use both O% and P% appropriately.)
Code: Select all
30 [OPT pass%
...
250 OPT FNequb(5)
260 OPT FNequb3(1,2,3)
270 OPT FNalign(256,&EA)
280 OPT FNerror(42, "My error message")
...
1000 DEFFNequb(N%)
1010 ?P%=N%:P%=P%+1
1020 =pass%
1030 :
1040 DEFFNequb3(A%,B%,C%)
1050 ?P%+A%:P%?1=B%:P%?2=C%:P%=P%+3
1060 =pass%
1070 :
1080 DEFFNalign(N%,op%)
1090 IF (P% AND (N%-1))<>0 THEN ?P%=op%:P%=P%+1:GOTO 1090
1100 =pass%