OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:34 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: mas86 - First Public Release & Test Request
PostPosted: Sun Nov 30, 2014 3:42 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 23, 2014 8:00 am
Posts: 96
Location: The Netherlands
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:
./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:
.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.


Top
 Profile  
 
 Post subject: Re: mas86 - First Public Release & Test Request
PostPosted: Sun Nov 30, 2014 4:12 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
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.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: mas86 - First Public Release & Test Request
PostPosted: Sun Nov 30, 2014 4:49 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 23, 2014 8:00 am
Posts: 96
Location: The Netherlands
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.


Top
 Profile  
 
 Post subject: Re: mas86 - First Public Release & Test Request
PostPosted: Sun Nov 30, 2014 5:07 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
The GitHub for Windows client also offers a Git Shell you can use - provided that you like to use command lines.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: mas86 - First Public Release & Test Request
PostPosted: Sun Nov 30, 2014 5:47 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 23, 2014 8:00 am
Posts: 96
Location: The Netherlands
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 33 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group