Solar Assembler

From OSDev Wiki
(Redirected from Sol asm)
Jump to: navigation, search

This page is under construction! This page or section is a work in progress and may thus be incomplete. Its content may be changed in the near future.

Solar Assembler (aka Sol_Asm) is a multipass macro assembler written by Bogdan Ontanu. It supports HLL primitives, like procedures, structures/unions, .IF/.ENDIF, .WHILE/.ENDWHILE, .REPEAT/.UNTIL, etc. Sol_Asm can produce binary files, PE executables (32/64-bit), COFF object files (32/64-bit), ELF object files (32/64-bit) and Mach-O object files (32-bit only).

Contents

Sol_Asm syntax

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Syntax comparison

The syntax of Sol_Asm is easy to learn and has similarities with the syntax of TASM or MASM. This table shows the differences between Sol_Asm and other HLL assemblers:

SOL_ASM TASM MASM / JWASM FASM with HLL macros
Procedures
PROC TestProc
     USES eax, ebx
     ARG Var1, Var2
     LOCAL Var3
 
     ...
ENDP
[1]
TestProc PROC
     USES eax, ebx
     ARG Var1:DWORD, Var2:BYTE
     LOCAL Var3:WORD
 
     ...
ENDP
TestProc PROC \
     USES eax, ebx \
     Var1:DWORD, Var2:BYTE
     LOCAL Var3:WORD
 
     ...
TestProc ENDP
proc TestProc \
     USES eax ebx \
     Var1:DWORD, Var2:BYTE
     LOCAL Var3:WORD
 
     ...
endp
Structures
STRUC StructTest
    Var1     db ?
    Var2     dw ?
    Var3     dd ?
ENDS
StructTest STRUC
    Var1:    db ?
    Var2:    dw ?
    Var3:    dd ?
ENDS
StructTest STRUC
    Var1:    db ?
    Var2:    dw ?
    Var3:    dd ?
StrucTTest ENDS
struct StructTest
    Var1:    db ?
    Var2:    dw ?
    Var3:    dd ?
ends
Reserve non initialized data
Buffer:    rb 256
Buffer:    db 256 dup(?)
Buffer:    db 256 dup(?)
Buffer:    db 256 dup(?)
or
Buffer:    rb 256
I/O ports
in   al, [92h]
or   al, 02h
out  [92h], al
in   al, 92h
or   al, 02h
out  92h, al
in   al, 92h
or   al, 02h
out  92h, al
in   al, 92h
or   al, 02h
out  92h, al
.IF/.ENDIF
.IF ( eax == 2 .or. ebx != 3 )
    ; something...
.ENDIF
.IF (eax == 2 or ebx != 3)
    ; something...
.ENDIF
.IF (eax == 2 or ebx != 3)
    ; something...
.ENDIF
.if (eax == 2 or ebx != 3)
    ; something...
.endif

Original features

Sol_Asm also implements some original features.

ENUMs

It is possible to define some constants like C language with the ENUM keyword. This little example will generate: TASK_ZOMBIE equ 0, TASK_READY equ 1, TASK_RUNNING equ 2, etc.

ENUM TASK, 0, 4
    TASK_ZOMBIE
    TASK_READY
    TASK_RUNNING
    TASK_WAITING
    TASK_SLEEPING
ENDE

Resource compiler

Sol_Asm includes a small resource compiler. This little example will define a dialog box:

IDD_DIALOG1 equ 100
IDD_BUTTON1 equ 101
 
IDD_DIALOG1 DIALOGEX 10, 10, 320, 240
CAPTION "Hello!"
STYLE 0x10CF0000
 
BEGIN
    CONTROL "Hello", IDC_BUTTON1, "Button", 0x50010000, 10, 10, 50, 24, 0x00000000
END
  •   by default, arguments and locals are always dwords.

See Also

External Links

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox