Well, I won't say it's the best thing ever but here's something new (for me):
First is the Assembler.cpp. What is it? It's an assembler for the '816, but with my own flavor added I guess. I am not following a lot of standard conventions here, but it works pretty well and has some cool features that I find helpful. It's not 100% tested out and probably has a bug or two, but as of now it seems to be working great!
Second is an example code for it, my Bootloader + Mini-Monitor. It fits in 512 bytes, and includes all that's necessarily for booting from a PIC + SD card, and in case that doesn't work, a 'rescue' mini-monitor that barely is usable at all. This would actually work with any of my current boards, given that I'm using a VIA for the PS/2 Keyboard and have bitmap style graphics somewhere directly accessible in memory. The 512 bytes contains all of the character bitmap data along with PS/2 to "hex" conversion tables. The monitor itself only displays zero page, but you can navigate around it using space, backspace, and return.
The C++ code isn't well commented, but the ASM code is pretty heavily commented. I'm also adding a screenshot of what my mini-monitor looks like from my old Acolyte Simulator. The characters are SUPER tiny so that I can fit everything in memory. The inverted character is where your 'cursor' is, and you can either alter it or move the cursor. You can run the code from the top of zero page by pressing escape.
An odd little thing indeed. It was this, or text-based Tetris. :/ What do you use as a 'rescue' monitor? A last ditch effort in case all else fails?
I went looking through the lists of '816 assemblers, but have been unimpressed. Maybe I didn't look into them well enough. What '816 assembler do you use? What do you like about it? What do you not like about it?
Thanks everyone!
Chad
'816 Assembler, & 512 byte Bootloader + Mini-Monitor!
'816 Assembler, & 512 byte Bootloader + Mini-Monitor!
- Attachments
-
- MiniMonitorScreenshot.png (2.4 KiB) Viewed 2730 times
-
- Assembler.cpp
- (30.74 KiB) Downloaded 86 times
-
- MiniMonitor.asm
- (8.8 KiB) Downloaded 82 times
- GARTHWILSON
- Forum Moderator
- Posts: 8773
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
sburrow wrote:
I went looking through the lists of '816 assemblers, but have been unimpressed. Maybe I didn't look into them well enough. What '816 assembler do you use? What do you like about it? What do you not like about it?
I use Cross-32 (C32 for short), originally from Universal Cross Assemblers in Canada, later sold by Data Sync Engineering and MPE Forth, but now Data Sync Engineering's site is gone and MPE Forth no longer has C32 on their site and I've been trying to get a response about where someone can get it, or whether I can distribute it myself, not to make any money but just to keep a good thing going.
C32 is a great macro assembler that comes with the files to work for dozens of different processors, and the manual tells you how to write the files for a processor of your own design. It says it's about a 40-hour job to adapt it to a new processor. For the '816, something I really like about it is that for immediate operands, you specify the size, whether 8- or 16-bit (like LDA #foobar for 16-bit, or LDA #<foobar for 8-bit), which has two advantages: 1.) it keeps you mindful of what size you're dealing with, and 2.) you can write a routine knowing it will always be called with the accumulator and the index registers a certain size, and not waste unnecessary REP and SEP instructions like other assemblers require just so the assembler knows how big an operand to lay down. One bug I have found in it, after decades of use, is that a comma in a quoted string in a macro parameter line makes it think it's a delimiter to the next macro parameter, even though the closing quote mark has not been reached yet. Another is that INCLude files in a macro's definition don't get included until the macro is finished. Hopefully these bugs were fixed after I got the version I'm using. One feature I liked in the 2500AD assembler that I wish were also in C32 is that 2500AD allowed you have a varying number of macro parameters, and then in the conditional assembly in the macro, use the directive IFMA followed by a number, which says, in essence, "If a 4th parameter exists, do this with it...If a 5th macro parameter exists, do this with it..." A nice C32 feature that 2500AD lacked was a bit-wise OR of a couple of values and put the result in the operand for an LDA # for example.
Edit, after others' comments below about linkers: The 2500AD assembler used a linker. The other engineer in the company, who chose the assembler and put in the requisition for it, had a lot of trouble getting the linker working. Myself, I never understood it either, and only used commands he came up with with the help of 2500AD's technical-help people, and then I used those as a template and only changed file names in those commands for later applications. C32 doesn't have that complication.
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?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
- BigDumbDinosaur
- Posts: 9427
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
sburrow wrote:
The C++ code isn’t well commented...
Understatement of the month...and it’s only December 3.
Quote:
What do you use as a ’rescue’ monitor? A last ditch effort in case all else fails?
All my POC units have Supermon 816 embedded in the firmware. If mass storage can’t be accessed or if an OS can’t be loaded from the boot disk, control automatically drops into the monitor.
Quote:
I went looking through the lists of ’816 assemblers, but have been unimpressed. Maybe I didn’t look into them well enough.
For which operating system?
Quote:
What ’816 assembler do you use?
I use the Kowalski editor/assembler as modified by Daryl Rictor to handle 65C816 assembly language.
Quote:
What do you like about it?
It works well, has a good macro language, programs can be assembled from within the editor and assembly is fast. It can assemble my partition editor program, which has over 30,000 lines of source, in about one second, running on my rickety Windows XP box.
Quote:
What do you not like about it?
It runs on Windows.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
I have in mind to assemble some tiny snippets of '816 code, and I plan to use BBC Basic as a native assembler - I believe the version for the Acorn Communicator should be usable, as disassembled by dominicbeesley.
I haven't used either of these, but two '816 assemblers are tagged on github: Rsar in Rust, and HIEPA in python.
I haven't used either of these, but two '816 assemblers are tagged on github: Rsar in Rust, and HIEPA in python.
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
BigEd wrote:
I have in mind to assemble some tiny snippets of '816 code, and I plan to use BBC Basic as a native assembler - I believe the version for the Acorn Communicator should be usable, as disassembled by dominicbeesley.
I haven't used either of these, but two '816 assemblers are tagged on github: Rsar in Rust, and HIEPA in python.
I haven't used either of these, but two '816 assemblers are tagged on github: Rsar in Rust, and HIEPA in python.
Communicator Basic has been on my radar for a while; I've been thinking about porting it to the C256Foenix (FMX), but I'm too easily distracted by other shiny things.
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
GARTHWILSON wrote:
Did you look at the list of assemblers on my links page? http://wilsonminesco.com/links.html#assem
GARTHWILSON wrote:
(like LDA #foobar for 16-bit, or LDA #<foobar for 8-bit)
BigDumbDinosaur wrote:
Quote:
sburrow wrote:
The C++ code isn’t well commented...
The C++ code isn’t well commented...
BigDumbDinosaur wrote:
For which operating system?
BigEd wrote:
and HIEPA in python.
rwiker wrote:
The C256Foenix project uses 64tass
By the way, I'm planning on using a PIC + SD card bootloader configuration, similar to Garth's: viewtopic.php?p=91876#p91876 The difference between Garth's and mine would be he is using the I2C module for mass storage while I'm using an SD card, aside from that it's pretty similar in concept. I think he is also planning on using the PIC to 'spoon feed' the '816 with whatever memory it needs, while I will 'spoon feed' this 512 bytes and then wait for the '816 to ask for SD card memory.
Thanks everyone!
Chad
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
Let me add xa65 to the mix of 816 cross assemblers.
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
kinda surprised the C256Foenix doesn't use Calypsi C's Assembler as the compiler suite has a built-in target for the C256Foenix, so i thought they would just fully switch to that.
anyways, skimming through the code i notice a few things.
you already mentioned the lack of comments but i've also spotted some consistently inconsistent whitespace between operators. what i mean is that specifically in for loop initiations you don't place any whitespace characters between operators (example: "i=0") but almost everywhere else you do add whitespace (example: "value = 0"). personally i would always recommend having whitespace characters between operators for readability sake.
I'm also somewhat questioning the choice of using a giant 16MB array to hold the generated code instead of either a tmporary file or a dynamic array that is only roughly as large as it needs to be.
besides that and some long if-else chains that could be replaced by switch statements, and other more minor details, it looks pretty clean.
i mean that's what MSYS2 is for nowadays. as long as someone doesn't use functions that are too POSIX-y or too Windows-y, a program will very likely compile and run fine on both OSes. especially true for programs that don't go far beyond the standard C libraries.
anyways, skimming through the code i notice a few things.
you already mentioned the lack of comments but i've also spotted some consistently inconsistent whitespace between operators. what i mean is that specifically in for loop initiations you don't place any whitespace characters between operators (example: "i=0") but almost everywhere else you do add whitespace (example: "value = 0"). personally i would always recommend having whitespace characters between operators for readability sake.
I'm also somewhat questioning the choice of using a giant 16MB array to hold the generated code instead of either a tmporary file or a dynamic array that is only roughly as large as it needs to be.
besides that and some long if-else chains that could be replaced by switch statements, and other more minor details, it looks pretty clean.
sburrow wrote:
Linux of course
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
sburrow wrote:
I went looking through the lists of '816 assemblers, but have been unimpressed. Maybe I didn't look into them well enough. What '816 assembler do you use? What do you like about it? What do you not like about it?
Thanks everyone!
Chad
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
sburrow wrote:
I went looking through the lists of '816 assemblers, but have been unimpressed. Maybe I didn't look into them well enough. What '816 assembler do you use? What do you like about it? What do you not like about it?
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
Proxy wrote:
you already mentioned the lack of comments but i've also spotted some consistently inconsistent whitespace between operators. what i mean is that specifically in for loop initiations you don't place any whitespace characters between operators (example: "i=0") but almost everywhere else you do add whitespace (example: "value = 0"). personally i would always recommend having whitespace characters between operators for readability sake.
I'm also somewhat questioning the choice of using a giant 16MB array to hold the generated code instead of either a tmporary file or a dynamic array that is only roughly as large as it needs to be.
besides that and some long if-else chains that could be replaced by switch statements, and other more minor details, it looks pretty clean.
I'm also somewhat questioning the choice of using a giant 16MB array to hold the generated code instead of either a tmporary file or a dynamic array that is only roughly as large as it needs to be.
besides that and some long if-else chains that could be replaced by switch statements, and other more minor details, it looks pretty clean.
Off topic, I find programming like art. It's like I'm painting a picture. Sometimes I want to use this particular stroke, this particular brush, this particular pigment, this particular oil-base. My last two versions were more 'modular' with a lot of sub-functions. This one was like 2 functions outside of main(), which is just hilarious but totally fine. When I program with data at work, I use classes (read: fancy structs) all the time, but only because it's easy to use pointers as records.
Thanks for the programming analysis!
fachat wrote:
Let me add xa65 to the mix of 816 cross assemblers.
drogon wrote:
I use ca65 from the cc65 suite to assembler 6502, 65C02 and 65C816 stuff.
Thank you for the suggestions.
beethead wrote:
I use a homemade assembler with the concept from Table Assembler
Thanks everyone.
Chad
Re: '816 Assembler, & 512 byte Bootloader + Mini-Monitor!
Hi folks, I used CA65 myself a while ago. I'm programming for a VIC 20. I have to figure it out again, it's been so long. I will figure it out again. I can assemble but I can link going by my notes. It's a good assembler.