Solar Assembler: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
New page: Solar Assembler (aka Sol_Asm) is a multipass macro assembler written by Bogdan Ontanu. It supports HLL primitives, like procedures, structures/unions, .IF/.ENDIF, .REPEAT/.UNTIL, etc. Sol_...
 
use cite extension
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{In Progress}}
Solar Assembler (aka Sol_Asm) is a multipass macro assembler written by Bogdan Ontanu. It supports HLL primitives, like procedures, structures/unions, .IF/.ENDIF, .REPEAT/.UNTIL, etc. Sol_Asm can produce binary files, PE executables (32/64-bit), COFF object files (32/64-bit), ELF object files (32-bit only) and Mach-O object files (32-bit only).

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).

==Sol_Asm syntax==
{{Stub}}

===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:

{| {{wikitable}}
!
! SOL_ASM
! [[TASM]]
! [[MASM]] / [[JWASM]]
! [[FASM]] with HLL macros
|-
| Procedures
| <syntaxhighlight lang="asm">
PROC TestProc
USES eax, ebx
ARG Var1, Var2
LOCAL Var3

...
ENDP
</syntaxhighlight><ref group="Note">By default, arguments and locals are always dwords.</ref>
| <syntaxhighlight lang="asm">
TestProc PROC
USES eax, ebx
ARG Var1:DWORD, Var2:BYTE
LOCAL Var3:WORD

...
ENDP
</syntaxhighlight>
| <syntaxhighlight lang="asm">
TestProc PROC \
USES eax, ebx \
Var1:DWORD, Var2:BYTE
LOCAL Var3:WORD

...
TestProc ENDP
</syntaxhighlight>
| <syntaxhighlight lang="asm">
proc TestProc \
USES eax ebx \
Var1:DWORD, Var2:BYTE
LOCAL Var3:WORD

...
endp
</syntaxhighlight>
|-
| Structures
| <syntaxhighlight lang="asm">
STRUC StructTest
Var1 db ?
Var2 dw ?
Var3 dd ?
ENDS
</syntaxhighlight>
| <syntaxhighlight lang="asm">
StructTest STRUC
Var1: db ?
Var2: dw ?
Var3: dd ?
ENDS
</syntaxhighlight>
| <syntaxhighlight lang="asm">
StructTest STRUC
Var1: db ?
Var2: dw ?
Var3: dd ?
StrucTTest ENDS
</syntaxhighlight>
| <syntaxhighlight lang="asm">
struct StructTest
Var1: db ?
Var2: dw ?
Var3: dd ?
ends
</syntaxhighlight>
|-
| Reserve non initialized data
| <syntaxhighlight lang="asm">
Buffer: rb 256
</syntaxhighlight>
| <syntaxhighlight lang="asm">
Buffer: db 256 dup(?)
</syntaxhighlight>
| <syntaxhighlight lang="asm">
Buffer: db 256 dup(?)
</syntaxhighlight>
| <syntaxhighlight lang="asm">
Buffer: db 256 dup(?)
or
Buffer: rb 256
</syntaxhighlight>
|-
| I/O ports
| <syntaxhighlight lang="asm">
in al, [92h]
or al, 02h
out [92h], al
</syntaxhighlight>
| <syntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
| <syntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
| <syntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
|-
| .IF/.ENDIF
| <syntaxhighlight lang="asm">
.IF ( eax == 2 .or. ebx != 3 )
; something...
.ENDIF
</syntaxhighlight>
| <syntaxhighlight lang="asm">
.IF (eax == 2 or ebx != 3)
; something...
.ENDIF
</syntaxhighlight>
| <syntaxhighlight lang="asm">
.IF (eax == 2 or ebx != 3)
; something...
.ENDIF
</syntaxhighlight>
| <syntaxhighlight lang="asm">
.if (eax == 2 or ebx != 3)
; something...
.endif
</syntaxhighlight>
|}

==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.
<syntaxhighlight lang="asm">
ENUM TASK, 0, 4
TASK_ZOMBIE
TASK_READY
TASK_RUNNING
TASK_WAITING
TASK_SLEEPING
ENDE
</syntaxhighlight>

===Resource compiler===
Sol_Asm includes a small resource compiler. This little example will define a dialog box:
<syntaxhighlight lang="asm">
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
</syntaxhighlight>

<references group="Note" />


==See Also==
==See Also==

Latest revision as of 11:57, 17 June 2024

This page is a work in progress.
This page 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).

Sol_Asm syntax

This page is a stub.
You can help the wiki by accurately adding more contents 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
[Note 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
  1. By default, arguments and locals are always dwords.

See Also

External Links