flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Command Prefix?

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 670
l4m2 07 Aug 2016, 16:05
Code:
macro let param* {
  local status
  define status 0
  match =0 dest+==src , status param \{
     add dest,src
     define status 1
  \}
  match =0 dest==src , status param \{
     mov dest,src
     define status 1
  \}
  match =0 dest++ , status param \{
     inc dest
     define status 1
  \}
  match =0 any , status param \{
     err "SYNTAX ERROR"
  \}
}
let ax=3
let bx++
let cx=1024    

Large number of let makes it annoying. Can I make it shows like ?
Code:
letlist
  ax=3
  bx++
  cx=1024
end letlist    
Post 07 Aug 2016, 16:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20656
Location: In your JS exploiting you and your system
revolution 07 Aug 2016, 16:12
Code:
irp x,\
  ax=3, \
  bx++, \
  cx=1024 \
  {let x}    
To make it that way you suggest would probably require defining ax, bx and cx as macros. And that would interfere with them as registers.
Post 07 Aug 2016, 16:12
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8427
Location: Kraków, Poland
Tomasz Grysztar 07 Aug 2016, 18:23
Alternatively, you can use fasmg:
Code:
include '80286.inc'

macro letlist
        macro ? param&
                match =end =letlist, param
                        purge ?
                else match dest+==src, param
                        add dest,src
                else match dest==src, param
                        mov dest,src
                else match dest++, param
                        inc dest
                else match any, param
                        err "SYNTAX ERROR"
                end match
        end macro
end macro

macro end?.letlist      ; I have found a small bug while writing this example.
end macro               ; These two lines are not needed if you use the latest, fixed fasmg.

letlist
  ax=3 
  bx++ 
  cx=1024 
end letlist    
This gave me an idea what should become the topic of few next sections of my introduction to fasmg.
Post 07 Aug 2016, 18:23
View user's profile Send private message Visit poster's website Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 670
l4m2 08 Aug 2016, 02:48
Tomasz Grysztar wrote:

Alternatively, you can use fasmg:

Maybe I mistaked fasm and fasmg Very Happy
Post 08 Aug 2016, 02:48
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


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