Big machine code programs

bbc micro/electron/atom/risc os coding queries and routines
Post Reply
AJW
Posts: 906
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Big machine code programs

Post by AJW » Thu Jul 16, 2020 10:12 am

What do you prefer when flling thhe memory with machine code when the assembler listing gets too big for one assemble to memory? Multiple listings then *load from main BASIC program or *load from another machine code program e.g with OSFile or JSR&FFF7?

julie_m
Posts: 233
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Big machine code programs

Post by julie_m » Thu Jul 16, 2020 2:43 pm

Well, for BCP, I broke the source code down into chunks, which can be assembled separately in order. There are several separate BASIC programs, each of which assembles a part of the code using OPT 4 / OPT 7. Entry points and workspace locations that need to be referred to in another part of the code are exported using *SPOOL / *EXEC. The code is *SAVEd specifying the correct reload address. All the resulting files fit together, so they can be *LOADed into their rightful location and *SAVEd as a single file.

User avatar
sweh
Posts: 2262
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: Big machine code programs

Post by sweh » Thu Jul 16, 2020 3:21 pm

Back in the day I used a ROM assembler; originally ASM but then the free Lancs 65C02 assembler. This reads and writes to disk, so size isn't an issue.

Modern development I do on Linux with beebasm and then just copy the result to the Beeb.
Rgds
Stephen

User avatar
roland
Posts: 4050
Joined: Thu Aug 29, 2013 9:29 pm
Location: Born (NL)
Contact:

Re: Big machine code programs

Post by roland » Thu Jul 16, 2020 3:46 pm

Nowadays I also develop on Linux of Mac with CA65 or Beebasm. The editors are much nicer to work with (e.g. forward and backward scrolling through the source code) and assembling is much faster. Also porting code between Beeb/Elk and Atom is much easier with modern tools. I can use the same source code base and use variables to choose between the target platform.

Soon I can transfer my machine code over WiFi to my Atom or Electron :lol:
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN :shock:

julie_m
Posts: 233
Joined: Wed Jul 24, 2019 9:53 pm
Location: Derby, UK
Contact:

Re: Big machine code programs

Post by julie_m » Thu Jul 16, 2020 7:53 pm

I'm thinking of using BeebAsm for BCP, but hoping to keep it buildable on a real or emulated BBC Micro. My cunning plan is to write some scripts to help with the variable export process, by selecting only labels preceded by a blank line or contrived comment for export .....

User avatar
tricky
Posts: 4676
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Big machine code programs

Post by tricky » Thu Jul 16, 2020 9:30 pm

Back in the day, several BASIC programs each *SAVEing its bit and then loading the next and GOTO 10.
At the end, *LOAD all the bits and *SAVE the final "EXE".

Now beebasm it on the PC, straight to .SSD and auto boot in emulator for preliminary testing and debugging.

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: Big machine code programs

Post by Naomasa298 » Thu Jul 16, 2020 9:42 pm

AJW wrote:
Thu Jul 16, 2020 10:12 am
*load from another machine code program e.g with OSFile or JSR&FFF7?
I'm actually curious as to what you mean by this.

User avatar
kieranhj
Posts: 921
Joined: Sat Sep 19, 2015 11:11 pm
Location: Farnham, Surrey, UK
Contact:

Re: Big machine code programs

Post by kieranhj » Fri Jul 17, 2020 9:32 am

The thought of trying to build a massive program like POP on a real BBC Micro brings me out in a sweat. :shock:
Bitshifters Collective | Retro Code & Demos for BBC Micro & Acorn computers | https://bitshifters.github.io/

AJW
Posts: 906
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Big machine code programs

Post by AJW » Fri Jul 17, 2020 10:07 am

tricky wrote:
Thu Jul 16, 2020 9:30 pm
Back in the day, several BASIC programs each *SAVEing its bit and then loading the next and GOTO 10.
At the end, *LOAD all the bits and *SAVE the final "EXE".

Now beebasm it on the PC, straight to .SSD and auto boot in emulator for preliminary testing and debugging.
That would require some care and tricks to pass information from one code to another eg the music on and off locations which are in code2 and the key input routine which calls them in code1.

Also does beebasm remove assembler comments?

AJW
Posts: 906
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Big machine code programs

Post by AJW » Fri Jul 17, 2020 11:46 am

Naomasa298 wrote:
Thu Jul 16, 2020 9:42 pm
AJW wrote:
Thu Jul 16, 2020 10:12 am
*load from another machine code program e.g with OSFile or JSR&FFF7?
I'm actually curious as to what you mean by this.
have a main macine code profmgram that loads in other blocks of machine code using osfile or the CLI (see User Guide).

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: Big machine code programs

Post by Naomasa298 » Fri Jul 17, 2020 11:58 am

AJW wrote:
Fri Jul 17, 2020 11:46 am
have a main macine code profmgram that loads in other blocks of machine code using osfile or the CLI (see User Guide).
But you're not going to need the assembler listing in memory when you execute the program, so why do you need to load it from machine code? Why not just load it all in one go from a BASIC loader program?

Or just concatenate the different chunks into one file?

Unless the assembled code itself is too big for memory.

User avatar
jgharston
Posts: 4121
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: Big machine code programs

Post by jgharston » Fri Jul 17, 2020 1:04 pm

I similarly use a tool to assemble from disk, *ASSEM uses the BBC BASIC assembler to assemble from source files.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.32
(C) Copyright J.G.Harston 1989,2005-2020
>_

AJW
Posts: 906
Joined: Sun Feb 15, 2004 2:01 pm
Contact:

Re: Big machine code programs

Post by AJW » Fri Jul 17, 2020 1:13 pm

Naomasa298 wrote:
Fri Jul 17, 2020 11:58 am
AJW wrote:
Fri Jul 17, 2020 11:46 am
have a main macine code profmgram that loads in other blocks of machine code using osfile or the CLI (see User Guide).
But you're not going to need the assembler listing in memory when you execute the program, so why do you need to load it from machine code? Why not just load it all in one go from a BASIC loader program?

Or just concatenate the different chunks into one file?

Unless the assembled code itself is too big for memory.
*load I mean.

Naomasa298
Posts: 391
Joined: Sat Feb 16, 2013 12:49 pm
Contact:

Re: Big machine code programs

Post by Naomasa298 » Fri Jul 17, 2020 2:06 pm

AJW wrote:
Fri Jul 17, 2020 1:13 pm
*load I mean.
Yes, I got that bit. I'm just not sure I see the need to load it in chunks via OSFILE calls. Just concatenate them and load the whole lot once.

User avatar
tricky
Posts: 4676
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Big machine code programs

Post by tricky » Fri Jul 17, 2020 7:35 pm

My friend bought ADE (I think that is the right name) and a second disc drive because one was too slow.
I can't remember his name, but he wrote an excellent millipede with sine wave GAME OVER iirc.
I think we went to a bbc micro fair or something in london and both bought sideways RAM, disc interfaces and floppy drives iirc.

Post Reply

Return to “programming”