flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > 'out' macro

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Nov 2006, 06:16
why such syntax?
Post 15 Nov 2006, 06:16
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dark_teo



Joined: 26 Jul 2005
Posts: 5
dark_teo 15 Nov 2006, 10:43
here new macro.like C

.outport (3f8h,byte 20h)
.outport (3f8h,word 20h)
.inport (byte 3f8h)
.inport (word 3f8h)

macro .outport port,val
{
done equ 0
match (parse@port,port
\{
match =byte parse@val),val
\\{

mov al,parse@val
mov dx,parse@port
out dx,al
done equ 1
\\}
\}

match (parse@port,port
\{
match =word parse@val),val
\\{

mov ax,parse@val
mov dx,parse@port
out dx,ax
done equ 1
\\}
\}

match =0,done
\{display 'OutPort ERROR...'\}
}


macro .inport port
{
done equ 0
match (parse@port),port
\{
match =byte parse@@port,parse@port
\\{

mov dx,parse@@port
in al,dx
done equ 1
\\}
\}

match (parse@port),port
\{
match =word parse@@port,parse@port
\\{

mov dx,parse@@port
in ax,dx
done equ 1
\\}
\}


match =0,done
\{display 'InPort ERROR...'\}
}


ı hope usefull for u.
Post 15 Nov 2006, 10:43
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Nov 2006, 11:24
dark_teo: starting macro name with "." in FASM, isn't a good idea
Post 15 Nov 2006, 11:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 15 Nov 2006, 13:09
vid: or maybe, each label must start with "_"?
for example label:
._end or .__end


dark_teo: done equ 1 is not a good solution.
more memory needed to compile.
(fasm saves each value of "done" in memory, for restore command.)
Post 15 Nov 2006, 13:09
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Nov 2006, 14:52
label "._end" doesn't start with "_"

label names starting with "." have special meaning in FASM. In theory, this doesn't interfere with preprocessing, but in practise, people often use names like ".data" and ".end". These are awaited NOT to be overdefined by macro.
Post 15 Nov 2006, 14:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.