Page 1 of 4

File based Assembler

Posted: Wed Jan 18, 2023 11:11 pm
by desertfish
A file based assembler: it assembles from source files on the disk and saves the resulting program to disk as well.
This allows to assemble large files that can be conveniently edited too as normal text files, and allows to assemble to memory locations that would be problematic otherwise as well. (such as when it would overwrite the assembler program itself)

The source code and a description of the features is on github.

To run the internal self-test you'll need to copy the two TEST-* files from the 'test' directory on github to the x16 disk drive as well.

Screenshot_20230119_000257.png
Screenshot_20230119_000257.png (92.24 KiB) Viewed 21187 times

Re: File based Assembler

Posted: Thu Oct 12, 2023 6:30 pm
by voidstar
Hey this is pretty neat and still seems to work on R44.

What would we call the assembler syntax that this supports? (same as 64tasm?)

The sample all-opcodes program created the PRG, but running it quickly just dumps into the monitor - maybe that's expected at the end of its run time?

Can I get a smaller example - like, just increment/count a memory region, show the content, and loop?

Re: File based Assembler

Posted: Thu Oct 12, 2023 7:16 pm
by desertfish
Yeah I guess it is turboassembler inspired syntax indeed.

It is correct that yhe test all opcodes assembly file is not meant to produce a runnable program, it simply is a sequence of all instructions.

Finally here is an example hello world program that you can type into the editor and assemble:

* = $9000 CHROUT = $FFD2 START JSR PRINTMESSAGE RTS PRINTMESSAGE: LDY #$00 LOOP: LDA MESSAGE,Y BEQ EXIT JSR CHROUT INY BNE LOOP EXIT: RTS MESSAGE: .STRZ "hELLO wORLD!"


Notice that the assembler was already capable to detect a rom-based X16Edit, so when you run a very recent rom.bin you can profit from this even without having to build your own rom.

Re: File based Assembler

Posted: Thu Oct 12, 2023 8:06 pm
by voidstar
Excellent!!!

Thank You

(ah you updated screen shot already)

Re: File based Assembler

Posted: Sun Oct 22, 2023 5:16 pm
by desertfish
Updated the ASSEMBLER.PRG with a non-ancient version.

Re: File based Assembler

Posted: Wed Nov 01, 2023 2:47 pm
by Christophlex
Fantastic. I just got back into x86 assembly after decades away, and this has been perfect.

One question: Is it possible to declare a bunch of bytes easily? As it is now, if I wanted to declare 4 bytes, I could do:

.BYTE $01,$02,$03,$04

Are there any directives that will do a .BYTE(x) = 0. That is, create x number of bytes, and initialize them to zero? Or not even initialize them at all.

Thanks!

Re: File based Assembler

Posted: Wed Nov 01, 2023 6:01 pm
by desertfish

Re: File based Assembler

Posted: Thu Nov 02, 2023 12:24 am
by Christophlex
Thanks for getting back to me. Yes, I'm using .byte just fine, but let's say I wanted to create 64 bytes, but I don't have values immediately to populate them with. I could .byte $00,$00,$00,$00,$00... 64, but I wanted to know if there was a way to use it to create 64 bytes (or any number) without having to populate them.

Thanks!

Re: File based Assembler

Posted: Thu Nov 02, 2023 5:31 pm
by desertfish
Oh, I see what you mean. No there's no .fill (or something like that) yet. I could add that pretty easily I think.

Re: File based Assembler

Posted: Thu Dec 14, 2023 10:47 pm
by desertfish
Updated with a fix for the X16Edit character set issue , and now recognises ".org $xxxx" as an alternative to "* = $xxxx" to change the program counter.