6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 5:49 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Oct 07, 2013 12:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
See http://www.retrosoftware.co.uk/wiki/index.php/BeebAsm (open source, cross-platform)

This assembler has a number of features inherited from BBC BASIC's built-in assembler, and also has local labels and macros. By using the BASIC-like features you can use loops and conditionals in your source. Output can be to plain binary or can write into a disk image suitable for a Beeb. The FOR loop syntax is a bit odd.

Example:
Code:
.multiply
    \\ multiplies A*X, puts result in product/product+1
    CPX #0:BEQ zero
    DEX:STX product+1
    LSR A:STA product:LDA #0
    FOR n, 0, 7
        BCC skip:ADC product+1:.skip   \\ would break BBC BASIC!
        ROR A:ROR product
    NEXT
    STA product+1:RTS
.zero
    STX product:STX product+1:RTS


Features:
Quote:
Uses standard 6502 syntax
Supports 65C02 instruction set
Denote hex literals with '&' or '$'
Denote binary literals with '%'
Multiple statement lines, statements separated by colons
Define labels with .label, like BBC BASIC
Assign variables with addr=&70, like BBC BASIC
Add bytes, words and strings with EQUB, EQUW, EQUD and EQUS - as an extension to BBC BASIC, these can take a comma-separated list
FOR...NEXT
IF...ELIF...ELSE...ENDIF
Supports all of the BBC BASIC functions and operators in expressions, e.g. SIN, COS, SQR, DIV, MOD, etc etc
Save object code to a disc image or to a standalone file
INCLUDE "file" to include another source file
Ability to set a guard on a memory address so it will warn you if it is assembled over
Use braces { } to enclose blocks of code so that all labels and variables defined within will be local to that block.
INCBIN command to include a binary file in the object code.
SKIPTO <addr> to move the address pointer to the specified address, generating an error if we are already beyond this address.
MAPCHAR command to allow strings to be assembled using non-ASCII codes (this is maybe more useful than it sounds; there's an example in the documentation).
Warns if there is no SAVE command in the source code.


Last edited by BigEd on Mon Oct 07, 2013 1:42 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 1:03 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
The save command does need a small change as it always sets the high order bytes set to $00 which means it will load in the second processor if one is active. I think they need to add an IOSAVE command which forces $FF into these.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 2:31 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10986
Location: England
Good point! RichTW is on the forum here.
(To the uninitiated: the BBC OS allows for many and various architectures to be hooked up as a "second processor" which was initially conceived of as the main processor - the BBC Micro was merely the I/O processor. The I/O processor sits at the top of a nominally 32-bit address space for the purpose of file I/O operations, whereas the second processor memory map starts at the bottom. So the top 16 bits of an address ought to be FFFF if referring specifically to the I/O processor, or 0000 if the aim is to load in the main processor. Conveniently, if there's no second processor fitted, the top bytes of addresses are ignored, and the BBC micro itself acts as both main processor and I/O processor.)


Top
 Profile  
Reply with quote  
PostPosted: Mon Oct 07, 2013 10:35 pm 
Offline

Joined: Sun Feb 22, 2004 9:01 pm
Posts: 111
BitWise wrote:
The save command does need a small change as it always sets the high order bytes set to $00 which means it will load in the second processor if one is active. I think they need to add an IOSAVE command which forces $FF into these.
Or just allow ORG to take a 32-bit value, which is what I do:
Code:
ORG &FFFF0900
etc.

_________________
--
JGH - http://mdfs.net


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 12, 2015 10:36 pm 
Offline

Joined: Sun Jan 20, 2013 6:44 pm
Posts: 10
I've used it for a couple of complete BBC games and another couple of incomplete ones, I find it works, just the way I want it to :wink:
I just dropped it into my favourite dev environment and perfect combo, my favourite editor and 6502 code :D


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 13, 2015 9:44 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Feature-wise, this assembler is much like mine (called 6502CA and under development), although the FOR NEXT and IF ELSE ENDIF are not present in mine.
Glad to see that .labels and the ampersand (&) used by someone apart from me ;) :D


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 11, 2015 8:35 am 
Offline

Joined: Sun Jan 20, 2013 6:44 pm
Posts: 10
One minor missing feature in the released version is global labels, so if you have "local" code, you can't jump into the middle of it without some hackery:

.routine
{
.loop
...
dex
bne loop
.would_like_to_jump_here ; for no apparent reason
dey
bne loop
rts
}


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 11, 2015 9:02 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
richard.broadhurst, you can put [code] and [/code] around your code to force monospacing and keep the forum software from removing your intentional extra spaces, so you get this:
Code:
.routine
{
.loop
    ...
    dex
    bne loop
.would_like_to_jump_here ; for no apparent reason
    dey
    bne loop
    rts
}

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: