OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 9:40 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: What is good documentation for OS development with FASM?
PostPosted: Fri Jan 27, 2017 2:16 pm 
Offline

Joined: Wed Jan 25, 2017 8:16 am
Posts: 23
Hey guys! What would be good documentation for operating system development with FASM? I can't really find anything on the internet. Please help.

_________________
One day in the future... computers will be holograms...


Top
 Profile  
 
 Post subject: Re: What is good documentation for OS development with FASM?
PostPosted: Fri Jan 27, 2017 2:20 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
stevej150 wrote:
Hey guys! What would be good documentation for operating system development with FASM? I can't really find anything on the internet. Please help.

It's the same concepts as using GCC or NASM; the difference is just that the code is written in a different language (and therefore is tightly bound to one CPU family architecture, x86/x86_64 in your case.) FASM uses Intel syntax (like NASM) and not AT&T. If you want to learn the various feature of the assembler itself, consider reading the documentation.
EDIT: IMHO, FASM is an excellent assembler for doing OSDev entirely in assembly language, because it's easily portable to other systems. My OS is written entirely in FASM-style assembly. :)

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: What is good documentation for OS development with FASM?
PostPosted: Fri Jan 27, 2017 2:32 pm 
Offline

Joined: Wed Jan 25, 2017 8:16 am
Posts: 23
Is the documentation really good for learning about the FASM syntax? Can you use all the instructions? By the way, how would I print a string in 32 bit? The tutorial on the Wiki has lea instruction and it doesn't work.

_________________
One day in the future... computers will be holograms...


Top
 Profile  
 
 Post subject: Re: What is good documentation for OS development with FASM?
PostPosted: Fri Jan 27, 2017 3:43 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
stevej150 wrote:
Is the documentation really good for learning about the FASM syntax? Can you use all the instructions?

You can use all instructions supported on the CPU you're using. You may need to detect specific instruction sets using CPUID; for example, SSE, AVX, VT-x and other things are not present on all CPUs and you need to detect their existance.
stevej150 wrote:
By the way, how would I print a string in 32 bit? The tutorial on the Wiki has lea instruction and it doesn't work.

Copying and pasting is a very bad practice, even for a beginner. It doesn't get you anywhere useful. [-X
Instead, read on the theory of printing to the screen. The theory is that the screen (in standard VGA text mode 0x03) has 80 columns and 25 rows and the video RAM starts at 0xB8000. Each video RAM "entry" is a 16-bit word, the low byte is the character to display and the high byte is the attribute. The low 4 bits of the attribute is the foreground color. The high 4 bits of the attribute is the background color (or bit 7 may be the blink bit, it depends on how you configure the VGA controller, but this is off-topic.)
Knowing that the screen resolution is 80x25, you should be able to calculate the address of a specific character on your own, knowing that each character takes up two bytes of video memory (i.e. at 0xB8000 is the character and attribute at position 0, 0, at 0xB8002 is the character and attribute at position 0, 1, etc...)

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: What is good documentation for OS development with FASM?
PostPosted: Sat Jan 28, 2017 4:04 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
stevej150 wrote:
Hey guys! What would be good documentation for operating system development with FASM? I can't really find anything on the internet. Please help.


I don't think you did your homework/research. The documentation is reasonably good. There's also a forum, where you can ask questions and get good answers. There's even a section specifically dedicated to OS Construction.

If it helps at all, FASM syntax is very similar to that of NASM and YASM. I actually support all three assemblers for compiling the assembly code generated by my Smaller C compiler. I only need to do the following when translating from NASM syntax to FASM syntax (the translation is done by a separate tool (n2f), the compiler emits asm code in NASM syntax):
  • combine fragments of the same section under the same section header (FASM puts fragments into separate sections, so without combining you end up with multiple .text (or .data or .bss or .rodata) sections in the ELF file, which isn't something Smaller C expects; NASM combines section fragments for us)
  • 'section .text' -> 'section ".text" executable'
  • 'section .rodata' -> 'section ".rodata"'
  • 'section .data' -> 'section ".data" writable'
  • 'section .bss' -> 'section ".bss" writable'
  • 'section something_else' -> 'section "something_else"'
  • 'bits 32/16' -> 'use32/use16'
  • 'alignb number' -> 'align number'
  • 'global symbol' -> 'public symbol'
  • 'resb/resw/resd number' -> 'rb/rw/rd number'
  • 'extern symbol' -> 'extrn symbol'


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: Bing [Bot], JustVic and 128 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