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.
File based Assembler
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
File based Assembler
- Attachments
-
- assembler.prg
- (16.27 KiB) Downloaded 336 times
Last edited by desertfish on Tue Apr 02, 2024 8:38 pm, edited 5 times in total.
Re: File based Assembler
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?
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?
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: File based Assembler
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.
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
Excellent!!!
Thank You
(ah you updated screen shot already)
Thank You
(ah you updated screen shot already)
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: File based Assembler
Updated the ASSEMBLER.PRG with a non-ancient version.
-
- Posts: 2
- Joined: Wed Nov 01, 2023 2:43 pm
Re: File based Assembler
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!
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!
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: File based Assembler
Yes with .byte, see https://github.com/irmen/cx16assem#features
-
- Posts: 2
- Joined: Wed Nov 01, 2023 2:43 pm
Re: File based Assembler
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!
Thanks!
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: File based Assembler
Oh, I see what you mean. No there's no .fill (or something like that) yet. I could add that pretty easily I think.
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: File based Assembler
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.