Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I made one 2 years ago, with nasm, can self-assembly

here's its readme info


This x86 assembler only output plain binary image. Support 16/32bits code.
support available x86 instruction sets.

command-line syntax: x86

keyword/directive:

equ - define label, [ label_01 equ 1234 ], label_01 is 1234
org - program origin, [ org 0x100 ], set program origin to 0x100
bss - enter bss section (default is code section)
times - repeatly assemble current statement, [ times 10 db 'abcd' ]
bits16 - 16bits code generation
bits32 - 32bits code generation
db - define byte, [ db 1, 2, 1 + 2, 3 + label_01, 10 * 4 ], byte alignment
dw - define word, [ dw 1, 2, 1 + 2, 3 + label_01, 10 * 4 ], word alignment
dd - define dword, [ dd 1, 2, 1 + 2, 3 + label_01, 10 * 4 ], dword alignment
dq - define dword, [ dq 1.234 ], qword alignment
dt - define dword, [ dt 1.234 ], tword alignment
resb - reserve byte, [ resb 100 ], reserve 100 bytes uninitialized space
resw - reserve byte, [ resw 100 ], reserve 200 bytes uninitialized space
resd - reserve byte, [ resd 100 ], reserve 400 bytes uninitialized space
resq - reserve byte, [ resq 100 ], reserve 800 bytes uninitialized space
rest - reserve byte, [ rest 100 ], reserve 1000 bytes uninitialized space

constant:

support a variety of bases number constant, string constant and floating point constant.
such as: 0x12, $12, #12, 12h ;hexadecimal number
12 ;decimal number
12o, 12q ;octal number
1010b ;binary number
"abc" ;string
'abc' ;string
1.234 ;fp constant
1.234e2 ;fp constant
1.234e!2 ;fp constant, the '!' character denotes '-' sign

operator:

<< >> & ^ | * / + - with priority.

effective address:

Only Recognize the following forms:

[bx]
[bx+1]
[bx+si]
[bx+si+1]
[eax]
[eax+1]
[eax+ebx+1]
[eax+ebx*2]
[eax+ebx*2+1]
[123]

Others, like [ebx*5] doesn't work, you must write [ebx+ebx*4]

You can specify displacement size, i.e. [word bx+1]
You can specify segment prefix, i.e. [es:bx+1]
or both, i.e. [word es:bx+1]

example:

bits16
org 100h

blue equ 1
green equ 2
cyan equ 3
red equ 4
magenda equ 5
brown equ 6
white equ 7
gray equ 8

font_color equ green

mov ah,3h
mov bh,0
int 10h

mov ah,13h
mov al,1
mov bh,0
mov bl,font_color
mov bp,msg
mov cx,11
int 10h

mov ax,4c00h
int 21h

msg db 'hello world'

Comments

  • rajivbansalrajivbansal Member Posts: 3
    Hi

    I am a software developer. I have started a project to develop 80x86 assembler. Could u plz tell me early steps to develop a assembler in C/C++.

    -bye-
Sign In or Register to comment.