flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Idea Macro Smart Regs

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1792
Roman 22 Apr 2021, 07:29
I write on Fasmw 1.73

I want do macro auto regs or mem.
Lets say macro SmartReg
Code:
Sreg 10 ;do mov r13,10. And do EQU regNum+1
Sreg 20 ;do mov r14,20
Smov  rax ;do mov rax,r14
Sreg 30 ;do mov r15,30
Smov  [rdx] ;do mov [rdx],r15
Sreg 40 ;do mov [r16],40  to mem r16
Sreg 50 ;do mov [r17],50  to mem r17
Sreg 60 ;do mov [r18],60  to mem r18
Sreg 40 ;do mov [r19],40  to mem r19
Sreg 80 ;do mov [r20],80  to mem r20
Smov  rax ;do mov rax,[r20]
EndReg ;set EQU regNum-1
Smov  rcx ;do mov rcx,[r19]

    
Post 22 Apr 2021, 07:29
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 23 Apr 2021, 12:10
Any example of real world task where this could be useful would be great.

Also the logic behind the macro is unclear from your example.
Post 23 Apr 2021, 12:10
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 23 Apr 2021, 14:37
Interesting idea to use some kind of own stack, but do not touch the registers.
It can be implemented as macros:
mypush <something>
mypop <something>
Without any worries about stack address or operations quantity. Without size limits of original push-pop. It can be some cyclic buffer as well
Post 23 Apr 2021, 14:37
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1792
Roman 24 Apr 2021, 04:54
I try do this. Work ok
Code:
r16 EQU [memR16]
r17 EQU [memR17]
r18 EQU [memR18]
macro SmrtReg chV { mov FirstSreg,chV
                  FirstSreg equ FirstSreg + 1 }
.data 
        memR16 dq 0
        memR17 dq 0
        memR18 dq 0

.code
        FirstSreg equ r13
        mov     eax,dword r16 ;do mov eax,dword [memR16]
        SmrtReg 10  ;this ok do mov     r13, 10
        SmrtReg 10  ;this get me error: r13+1

    


But my problem increase FirstSreg. Fasm get me error: r13+1
I want get r14 but not r13+1
Post 24 Apr 2021, 04:54
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.