Solar Assembler: Difference between revisions

use cite extension
[unchecked revision][unchecked revision]
(use cite extension)
 
(8 intermediate revisions by 4 users not shown)
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, .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 only) and Mach-O object files (32-bit only).
 
==Sol_Asm syntax==
{{Stub}}
The syntax of Sol_Asm is easy to learn and has similarities with the syntax of [[TASM]] or [[MASM]].
 
===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:
 
Line 14:
! SOL_ASM
! [[TASM]]
! [[MASM]] / [[JWASM]]
! [[FASM]] with HLL macros
|-
| Procedures
| <sourcesyntaxhighlight lang="asm">
PROC TestProc
USES eax, ebx
Line 26:
...
ENDP
</syntaxhighlight><ref group="Note">By default, arguments and locals are always dwords.</ref>
</source>
| <sourcesyntaxhighlight lang="asm">
TestProc PROC
USES eax, ebx
Line 35:
...
ENDP
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
TestProc PROC \
USES eax, ebx \
Line 44:
...
TestProc ENDP
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
proc TestProc \
USES eax ebx \
Line 53:
...
endp
</syntaxhighlight>
</source>
|-
| Structures
| <sourcesyntaxhighlight lang="asm">
STRUC StructTest
Var1 db ?
Line 62:
Var3 dd ?
ENDS
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
StructTest STRUC
Var1: db ?
Line 69:
Var3: dd ?
ENDS
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
StructTest STRUC
Var1: db ?
Line 76:
Var3: dd ?
StrucTTest ENDS
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
struct StructTest
Var1: db ?
Line 83:
Var3: dd ?
ends
</syntaxhighlight>
</source>
|-
| Reserve non initialized data
| <sourcesyntaxhighlight lang="asm">
Buffer: rb 256
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
Buffer: db 256 dup(?)
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
Buffer: db 256 dup(?)
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
Buffer: db 256 dup(?)
or
Buffer: rb 256
</syntaxhighlight>
</source>
|-
| I/O ports
| <sourcesyntaxhighlight lang="asm">
in al, [92h]
or al, 02h
out [92h], al
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
</source>
| <sourcesyntaxhighlight lang="asm">
in al, 92h
or al, 02h
out 92h, al
</syntaxhighlight>
</source>
|-
| .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==