flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Add prevision value

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 17 Feb 2024, 13:34
Fasm 1.73
Code:
macro ab [a,b,c,d] {
}

ab   0, 6456,1,0,\
     0, 10233,1,0,\
     0, 31896,1,0,\
     0, 1797,1,0,\
     0, 2376,1,0 
    


I want get this:
Code:
dd   0, 6456,1,0,\
     0, 10233,1,0+6456,\
     0, 31896,1,0+6456+10233,\
     0, 1797,1,0+6456+10233+31896,\
     0, 2376,1,0+6456+10233+31896+1797
    
Post 17 Feb 2024, 13:34
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1041
Location: Russia
macomics 17 Feb 2024, 17:31
Code:
macro ab [a,b,c,d] { common local sum
        sum = 0
    forward dd a, b, c, d + sum
        sum = sum + b
}

ab   0, 6456,1,0,\  ; 6456 = 38 19
     0, 10233,1,0,\ ; 0+6456 = 38 19, 10233 = F9 27
     0, 31896,1,0,\ ; 0+6456+10233 = 31 41, 31896 = 98 7C
     0, 1797,1,0,\  ; 0+6456+10233+31896 = C9 BD, 1797 = 05 07
     0, 2376,1,0    ; 0+6456+10233+31896+1797 = CE C4, 2376 = 48 09

; 00000000  00 00 00 00 38 19 00 00  01 00 00 00 00 00 00 00  |....8...........|
; 00000010  00 00 00 00 f9 27 00 00  01 00 00 00 38 19 00 00  |.....'......8...|
; 00000020  00 00 00 00 98 7c 00 00  01 00 00 00 31 41 00 00  |.....|......1A..|
; 00000030  00 00 00 00 05 07 00 00  01 00 00 00 c9 bd 00 00  |................|
; 00000040  00 00 00 00 48 09 00 00  01 00 00 00 ce c4 00 00  |....H...........|
; 00000050    
Post 17 Feb 2024, 17:31
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1847
Roman 17 Feb 2024, 18:09
Thanks.
Post 17 Feb 2024, 18:09
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.