mas86 - First Public Release & Test Request

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
User avatar
SoLDMG
Member
Member
Posts: 96
Joined: Wed Jul 23, 2014 8:00 am
Location: The Netherlands
Contact:

mas86 - First Public Release & Test Request

Post by SoLDMG »

Hello everyone!

Quite some time ago I was talking about creating my own toolchain (and later an OS), and well, today is the day that my assembler is released to the public. It's under the GPLv3. It's by far not ready for use, or OS development for that matter (doesn't have the capability to handle numbers bigger than a byte: 255, and some other quirks), but it's coming together very nicely.

So why release it if it's not ready? To test, break, and discover unexpected behavior of course! 3 times hurray!

I'd really appreciate it if you guys could maybe write your own little programs, especially the ones you would expect would break it, but don't be surprised if the instructions you enter don't get assembled into the final binary. Some of them aren't implemented yet.

So how do you write programs?

- Well, I'm glad you asked. It's an assembler, and some, if not most of you, are familiar with assembly language. It has AT&T-esque directives but Intel-esque instructions. It has '.asciz "Hello world!"' but can handle 'mov al, 16' just fine as well.

Using the assembler
First you have to get the source code here. Then, untar it and make it, by simply typing "make".

Now you´ve got to provide it with a source file, 6 so called temporary files and a file to output the binary in.

Code: Select all

./mas86 test.asm temp0 temp1 temp2 temp3 temp4 temp5 out.bin
Why not use tmpfiles? Well, temporary files are temporary, and you can't view their contents after, something which is vital to be able to see to fix a potential bug. These will be used afterwards though, if the preprocessor and lexer are 100% bug-free.

The directives
.ascii "string" - inserts a ASCII-formatted string into the binary. (implemented)
.asciz "string" - inserts a null-terminated ASCII-formatted string into the binary. (implemented)
.comment 'comment character' - changes the comment character on the fly, it CAN'T be a period ('.'). (implemented)
.dec x - inserts a decimal-represented value into the binary. (half-implemented)
.fill x y - puts the value of 'y' 'x' times in the binary, no matter the size. (implemented)
.hex x - inserts a hexadecimal-represented value into the binary. (half-implemented)
.include "file path"- includes a separate assembly source file. (not implemented)
.incbin "file path" - includes a separate binary file. (not implemented)
.size x y - makes the binary up to that point the size of 'x' in bytes and 'y' is the value it uses to fill the void. (not implemented)

Comment characters
The standard comment character is an exclamation mark ('!'), but the comment characters are completely changeable on the fly, as you might have seen when you read the directives part.

So, now that that is out of the way: a sample:

Code: Select all

.comment ';'	; A comment is now a ';', like with NASM. Probably makes it more readable for you guys ;-)
; Bootsector that makes a cool effect on the screen.

main:
	mov ah, 00	; Set the video mode.
	mov al, 141	; Set the video mode to 320x200, 256 colors (13h), with 128 added to it, so it doesn't clear the screen. Creates a cool effect.
	int 16		; Call the BIOS.
	cli			; Clear interrupts.
	hlt			; Halt.

.fill 502 0		; Fill it up with 502x0.
.hex 0x55		; Boot signature.
.hex 0xAA		; Boot signature.

Happy hacking everyone!
~SoLDMG
My post is up there, not down here.
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: mas86 - First Public Release & Test Request

Post by no92 »

Looks great so far! I see only 1 problem so far: it seems to produce flat binaries. Do you plan to add support for ELF or PE?

Also, putting it on GitHub may make things a little bit easier.
User avatar
SoLDMG
Member
Member
Posts: 96
Joined: Wed Jul 23, 2014 8:00 am
Location: The Netherlands
Contact:

Re: mas86 - First Public Release & Test Request

Post by SoLDMG »

no92 wrote:Looks great so far! I see only 1 problem so far: it seems to produce flat binaries. Do you plan to add support for ELF or PE?
Thanks! And yes! Of course! I chose flat binaries because they're easy to view in hex editors, and well, they're easy to create. I'm firstly going to implement all the features that I want in it, but then I'm going to go for ELF and PE and maybe if there is a demand for it, COFF.
no92 wrote: Also, putting it on GitHub may make things a little bit easier.
I do have GitHub for Windows, but I find the UI a little confusing. I do plan to use it if someone else wants to contribute to the project regularly, because tarballs simply aren't as flexible, but for now, it's good enough. It's not going to be used daily anytime soon so I don't and won't put out regular and small patches. It distracts from the programming itself.
My post is up there, not down here.
no92
Member
Member
Posts: 307
Joined: Wed Oct 30, 2013 1:57 pm
Libera.chat IRC: no92
Location: Germany
Contact:

Re: mas86 - First Public Release & Test Request

Post by no92 »

The GitHub for Windows client also offers a Git Shell you can use - provided that you like to use command lines.
User avatar
SoLDMG
Member
Member
Posts: 96
Joined: Wed Jul 23, 2014 8:00 am
Location: The Netherlands
Contact:

Re: mas86 - First Public Release & Test Request

Post by SoLDMG »

no92 wrote:The GitHub for Windows client also offers a Git Shell you can use - provided that you like to use command lines.
Really? Oh, I'm gonna go on GitHub right now.
My post is up there, not down here.
Post Reply