6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Sep 22, 2024 2:40 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sat Aug 24, 2024 2:12 pm 
Offline

Joined: Tue Jul 30, 2024 6:20 pm
Posts: 72
I've been using FASM (x86) and FASMARM for well over a decade, and mostly enjoying it for its very flexible (though quirky) macro system.

FASMG came out more recently as a universal assembler engine, where you can build your own assembler for any architecture with macros. I just rediscovered it and coded up a J1 CPU assembler in a page of code (though crumby as I haven't really figured out how to do it well)

I just came across a 6502 assembler someone put together https://board.flatassembler.net/topic.php?t=18136

Haven't used it yet, but probably will give it a try, as every 6502 assembler I've used has some awful quirk that drives me crazy.


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 24, 2024 7:17 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
Just what the world needs: yet another 6502 cross-assembler.  :shock:

What I’d like to see is a portable, syntactically-compliant¹ assembler that can be hosted on a 6502-powered contraption like what we build around here.  Conjuring an assembler that runs in a high-level language on a Linux or Windows box has been done over and over and over and...over again.  Accomplishing the same in pure 6502 assembly language, with it written so it can be tailored to the available I/O of a 6502 homebrew machine like Daryl’s SBC series or Flooby’s Pocket PC unit...now that would be an achievement and worth some major bragging rights!  8)

————————————————————
¹“Syntactically-compliant” means it implements the 6502 assembly language as defined by MOS Technology and WDC—alternate syntax would be okay as long as the MOS/WDC standard is primary.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 24, 2024 8:31 pm 
Offline

Joined: Tue Jul 30, 2024 6:20 pm
Posts: 72
Yeah, I know.

Although I still can't find a workflow/tools that I actually enjoy.

We've gotten spoiled... Back in the day I'd feel happy to have _an_ assembler, and figure out all the tricks of how to use it like a real hacker. Now I download one thing after another, and abandon it after not liking some or other feature. Or worse yet, have a dozen projects each using slightly different syntax, and be unable to pick up where I left off

One thing fasmg has going for it is that it is pretty easy to change the syntax to your liking. And strong macro processing


Top
 Profile  
Reply with quote  
PostPosted: Sat Aug 24, 2024 9:03 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
enso1 wrote:
Yeah, I know.

Although I still can't find a workflow/tools that I actually enjoy.

I’ve settled on the Kowalski package, despite it being a Windows-only environment.  Ever since Daryl enhanced it to work with the 65C816, it has become as good as anything else available and can plow through 30,000 lines of source code in literally an eyeblink.  It would be cool if I could develop an assembler that I could host on my POC unit.  That’s a major undertaking, however, and time in general is getting short for me.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Aug 25, 2024 1:33 pm 
Offline

Joined: Tue Sep 26, 2023 11:09 am
Posts: 97
BigDumbDinosaur wrote:
What I’d like to see is a portable, syntactically-compliant¹ assembler that can be hosted on a 6502-powered contraption like what we build around here.

Sounds like fun. But aren't there already lots of native 6502 assemblers? Or are they lacking somehow?

What kind of editing workflow do you use on your 6502 systems? I guess it would be enough to assemble from a big string in memory somewhere to whatever target address? Then you could use remote editor or some local system like forth screens or whatever?

[edit]

A couple of times I've wished that the cross assembler (c65, 64tass etc) could run 6502 code as part of the assembly process, e.g. to calculate a hash or populate a data table. Perhaps allowing native code callouts would be a simple/powerful alternative to traditional assembler macros, keeping the assembler itself simple?


Top
 Profile  
Reply with quote  
PostPosted: Sun Aug 25, 2024 9:53 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
pdragon wrote:
BigDumbDinosaur wrote:
What I’d like to see is a portable, syntactically-compliant¹ assembler that can be hosted on a 6502-powered contraption like what we build around here.

Sounds like fun. But aren't there already lots of native 6502 assemblers? Or are they lacking somehow?

The only assemblers I know of that run on a 6502-based machine are those that were written back during the era of eight-bit home computers, such as Commodore’s MADS, the Buddy Power Assembler, the Wagner assembler that was used on the Apple ][, and the like.  Those were not portable, in that they depended on a specific machine’s operating environment in order to function.  For example, MADS was only usable on the Commodore 64.

What I’m referring to when I say “portable assembler” is software that has no specific operating system and/or hardware dependencies (other than a 6502/65C02/65C816), with just some I/O calls to read source code, write object code and if desired, diagnostic files (e.g., a listing).  Optionally, there would be a way for the assembler to write to the console if a gross error arises during assembly and no other means of communicating that to the user is available.

Quote:
What kind of editing workflow do you use on your 6502 systems?

I do all my work in the Kowalski editor/assembler/simulator, as greatly extended by Daryl (8Bit).  With it now capable of simulating the 65C816 in native mode, I can test algorithms without having to try running them on POC V1.3 and risking a crash.

Quote:
I guess it would be enough to assemble from a big string in memory somewhere to whatever target address? Then you could use remote editor or some local system like forth screens or whatever?

My thinking is that of being able to edit and assemble on the 6502 machine, not using another machine to do any of the work.  An obvious prerequisite of a self-hosted development environment is the existence of some sort of local operating system with filesystem support, as well as some sort of “human interface.”

Quote:
A couple of times I've wished that the cross assembler (c65, 64tass etc) could run 6502 code as part of the assembly process, e.g. to calculate a hash or populate a data table. Perhaps allowing native code callouts would be a simple/powerful alternative to traditional assembler macros, keeping the assembler itself simple?

Macros were originally devised to automate repetitive code sequences; use of conditional assembly directives is often part of writing a macro.  What you are wanting, e.g., calculating a hash, is something that would have to be implemented, I’d think, with a series of algebraic expressions and assembly-time variables (which are not symbols in the usual sense), possibly called from within a macro.  The ability to do so would, of course, be dependent on the assembler’s ability to do more than simple left-to-right arithmetic, as well as store intermediate and/or final results into variables for subsequent use by later statements.

In the Kowalski assembler, I have developed assembly-time code that is able to calculate stack frame structures, build data tables from some constants defined early in the source code, etc..  Typical data tables are things such as pointers into various structures, or vectors for directing program execution in a fashion like that of the ON - GOTO statement in BASIC.  The Kowalski assembler supports the usual four-function math, plus a set of Boolean expressions, assembly-time variables, and so forth.  I’d expect that more-complex math could be carried out with the basics combined with .REPEAT loops and conditional statements.  I’ve not gotten to where I’ve had to get that fancy, but there may come a time...  :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Aug 25, 2024 11:42 pm 
Offline

Joined: Tue Jul 30, 2024 6:20 pm
Posts: 72
Quote:
A couple of times I've wished that the cross assembler (c65, 64tass etc) could run 6502 code as part of the assembly process, e.g. to calculate a hash or populate a data table. Perhaps allowing native code callouts would be a simple/powerful alternative to traditional assembler macros, keeping the assembler itself simple?


That's the exactly the kind of thing Lisp shines at! There is at least one 6502 assembler/simulator I've come across years ago.

BDD, is https://github.com/jdimeglio/6502-Simulator the place to get Kowalski with all the goodies?

I am not looking forward to yet another layer of dealing with windows emulation, but...


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 12:44 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
enso1 wrote:
BDD, is https://github.com/jdimeglio/6502-Simulator the place to get Kowalski with all the goodies?

Actually, that is an older, “unofficial” version.  The most-recent “official” version, and the one I am currently running, is right here.  Daryl’s (8Bit) Kowalski web page is at https://sbc.rictor.org/kowalski.html.  Scroll to the bottom to see links to the available versions, including source code.  Also note that we have a running topic here on the Kowalski package.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 4:33 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 844
Location: Potsdam, DE
BigDumbDinosaur wrote:
My thinking is that of being able to edit and assemble on the 6502 machine, not using another machine to do any of the work.  An obvious prerequisite of a self-hosted development environment is the existence of some sort of local operating system with filesystem support, as well as some sort of “human interface.”


This is exactly my thinking with the latest Neolithic.

As a complete system, it's only become practical with an external video memory space and external storage: I'm using (planning) a pi pico for the video and IO and a FAT16 compact flash card in 6502 memory space. Because of the way the video works, diverting to serial IO is easy; the file system allows me to use multiple files both as source and as temporary files if required, as well as a destination for the final executable.

There are of course a lot of assumptions behind that system; I'm currently building and testing them as I go before I stick them all together... it'll take a while, but I've still got a few years left in me :mrgreen:

Neil


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 11:58 am 
Offline

Joined: Tue Jul 30, 2024 6:20 pm
Posts: 72
One idea I've been toying with for decades is a hybrid approach: cross-assembling directly into the target 6502 system running a small monitor, interactively. Interaction feels like a forth, but assembly, but you can assemble bits and pieces and run things to test them. I had something like that running on an Apple ][ maybe 20 years ago.


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 3:14 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1467
Location: Scotland
The Apple II comes with a built-in mini assembler... F666G to make it work. It was part of the original Integer Basic ROM set, or loaded from disc with the Apple II+ systems which came with the Applesoft Basic ROM set.

It was literally one line at a time with no source code storage or editing.

Latterly I used the TED II+ assembler on the Apple II for many projects. It had a built-in editor and assembler and supported Sweet 16 too, but I really don't remember if it allowed separate assembly or linkage.

After that; BBC Basic has a built in assembler. It's quirky, but it lets you use BASIC subroutines/functions as a macro. I understand there is now a standalone BeebAsm program which more or less emulates it.

In the BBC Micro world I also used a relocatable assembler that was part of the Acornsoft BCPL package - sadly the sources to it are lost along with all the other Acornsoft stuff, but I have made a start to write one in BCPL under my 65816 BCPL system although I may not finish it as I'm currently happy enough with ca65 for 6502/65C02/65C816 and Sweet 16 work.

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 3:24 pm 
Offline

Joined: Tue Jul 30, 2024 6:20 pm
Posts: 72
Anyway, the reason I posted is that fasmg makes it easy (or at least possible) to create an assembler with a syntax you like, and even add fairly complicated logic to the assembler. I've used the old, less capable fasm macros (on x86) to build pretty complicated external dictionaries for Forth-like systems, and create relocation bitmaps. etc.

Not that we need a new assembler, but it can be useful to do things otherwise not possible without a lot of work reinventing the wheel.


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 26, 2024 7:25 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
barnacle wrote:
BigDumbDinosaur wrote:
My thinking is that of being able to edit and assemble on the 6502 machine, not using another machine to do any of the work.  An obvious prerequisite of a self-hosted development environment is the existence of some sort of local operating system with filesystem support, as well as some sort of “human interface.”

This is exactly my thinking with the latest Neolithic...There are of course a lot of assumptions behind that system; I'm currently building and testing them as I go before I stick them all together...

In other words, your Neolithic’s design isn’t set in stone.  :P

Quote:
it'll take a while, but I've still got a few years left in me :mrgreen:

Probably a lot more years than have I.  :mrgreen:  The left-hand digit in my age will increment next May...it will be the same as the number of bits in a byte.  :cry:  Yikes!!!

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 29, 2024 5:16 am 
Offline

Joined: Mon Jan 19, 2004 12:49 pm
Posts: 844
Location: Potsdam, DE
Whereas I had my fortieth birthday this year. Though my colleagues at the office were unkind enough to point out that hex is not the usual way of counting birthdays. :mrgreen:

Neil

p.s. you know me: nothing is ever set in stone. Except my delight in puns...


Top
 Profile  
Reply with quote  
PostPosted: Thu Aug 29, 2024 1:26 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8390
Location: Midwestern USA
barnacle wrote:
Whereas I had my fortieth birthday this year. Though my colleagues at the office were unkind enough to point out that hex is not the usual way of counting birthdays. :mrgreen:

Give your colleagues your age in binary and see how they react to that.  :D  After all, there are %10 kinds of people: those who understand binary and those who don’t.

Quote:
p.s. you know me: nothing is ever set in stone. Except my delight in puns...

Radical Brad having made some posts about his Skycycle reminded me that the reason a bicycle can’t stand up by itself is because it’s too tired.  :shock:

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 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: