NEED HELP USING THE BBC BASIC ASSEMBLER

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
jrybak
Posts: 2
Joined: Fri 03 Sep 2021, 19:54

NEED HELP USING THE BBC BASIC ASSEMBLER

Post by jrybak »

i have BBC BASIC for SDL 2.0 installed and it runs regular BBC BASIC programs just fine. However, I also want to run the BBC BASIC Assembler. When I try running the following:

10 REM
20 REM *SIMPLE ASSEMBLY PROGRAM*
30 REM
40 MODE 7
50 LET Start_of_Program =&3000
60 LET Output_letter =ASC("A")
70 LET Screen_start =HIMEM
80 LET Offset =250
90 REM
100 LET P% = Start_of_program
110 [ OPT3
120 .Prog LDA #Output_letter
130 STA Screen_start + Offset
140 RTS
150 ]
160 REM
170 INPUT" press return "A$
180 CALL Start-of-program
190 END

I get syntax errors on everything after line 90. Does BBCSDL not support use of the BBC Assembler? What about BBC BASIC for Windows?

Thanks for any help you can provide.
David Williams

Re: NEED HELP USING THE BBC BASIC ASSEMBLER

Post by David Williams »

Those assembly language mnemonics (LDA, STA, RTS) look like 6502 (8-bit) microprocessor instructions, so they are only meaningful if being processed by a 6502 CPU (like the one in a BBC Micro). BBC BASIC for SDL2.0 runs on several platforms (powered by 32-bit and 64-bit Intel and ARM CPU architectures), but certainly not on any 6502-based platforms. For instance, the Raspberry Pi versions of BBC BASIC for SDL2.0 run on 32-bit and 64-bit ARM architectures, and so they feature assemblers capable of compiling assembly language for those two architectures (32-bit and 64-bit ARM instruction sets are actually very different to each other). BBC BASIC for Windows only runs on Intel/AMD-based systems (using Intel's 32-bit x86 instruction set architectures), and so it features an assembler capable of assembling the Intel x86 instruction set. I don't know which version of BBC BASIC for SDL2.0 you're using, but it cannot assemble 6502 CPU instructions. That program you listed is for a BBC Micro.
jrybak
Posts: 2
Joined: Fri 03 Sep 2021, 19:54

Re: NEED HELP USING THE BBC BASIC ASSEMBLER

Post by jrybak »

Thank you very much for clearing this up for me.
nvingo
Posts: 41
Joined: Sat 28 May 2022, 22:40

Re: NEED HELP USING THE BBC BASIC ASSEMBLER

Post by nvingo »

I have BeebEm (BBC Micro emulator for Windows) installed and after cleaning up the inconsistencies in the program's format in Windows Notepad I was able to paste it into BeebEm and successfully run it.
Started using BASIC circa 1981 with CP/M, Video Genie, Sinclair ZX81, Acorn Atom, and progressed with ZX Spectrum, BBC Micro and Sinclair QL, Cambridge Z88, DOS, Windows. Wrote A-level project using school's BBC Micro with dual 800K floppy drive.
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: NEED HELP USING THE BBC BASIC ASSEMBLER

Post by KenDown »

I presume that you are aware that the word LET is redundant?

x%=4

is identical in funtion to

LET x%=4

but uses an extra byte. Its sole purpose is that some people find it easier to understand if the assignment is spelled out in full.
Hated Moron

Re: NEED HELP USING THE BBC BASIC ASSEMBLER

Post by Hated Moron »

KenDown wrote: Mon 30 May 2022, 03:33 I presume that you are aware that the word LET is redundant?
LET may be "redundant" but some people prefer it for clarity and I don't think its use should be discouraged. On a simple measurement here adding the LET actually results in the code running faster: :lol:

Code: Select all

      TIME = 0
      FOR I% = 1 TO 10000000
        a = PI
      NEXT
      PRINT TIME

      TIME = 0
      FOR I% = 1 TO 10000000
        LET a = PI
      NEXT
      PRINT TIME
YMMV.