flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Fill Matrix4x4 using rept.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 01 Jul 2023, 13:27
fasmw 1.73
My variant. But maybe this not best solution.
Code:
matScale:  rept 16  {  
                .ll = 0
                .ll2 = 0
                forward              
                if .ll = 0
                dd 1.0
                ;display '1;'            
                else
                dd 0
                end if
                .ll = .ll +1
                if .ll+.ll2 > (3+.ll2+1)
                .ll = 0
                .ll2 = .ll2+1
                end if

                }
;create matrix
1.0,0,0,0
0,1.0,0,0
0,0,1.0,0
0,0,0,1.0
    

This method good for big data. For 2d level or matrix32x32
Post 01 Jul 2023, 13:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20486
Location: In your JS exploiting you and your system
revolution 02 Jul 2023, 07:44
All macros start in forward mode. So your rept block initialises .ll and .ll2 16 times.
Code:
matScale:  rept 16  { 
                forward  ;  <--- this is implicit at the start of rept (and all macros)
                .ll = 0
                .ll2 = 0
                forward              
;...    
Post 02 Jul 2023, 07:44
View user's profile Send private message Visit poster's website 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.