flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Roman 22 Jul 2020, 11:56
Code: macro Var chN,chSz,chTp { chN EQU Vars_offs chN#_tp EQU chTp Vars_offs EQU Vars_offs+chSz } macro CopyVar chF,chT { if chF#_tp = TypeFlt & chT#_tp = TypeFlt movss xmm0,dword [chF] movss dword [chT],xmm0 end if if chF#_tp = TypeFlt & chT#_tp = TypeDD cvtss2si eax,dword [chF] mov dword [chT],eax end if if chF#_tp = TypeDD & chT#_tp = TypeFlt cvtsi2ss xmm0,dword [chF] movss dword [chT],xmm0 end if if chF#_tp = TypeDB mov al,[chF] mov [chT],al end if if chF#_tp = TypeDW mov ax,word [chF] mov word [chT],ax end if if chF#_tp = TypeDD mov eax,dword [chF] mov dword [chT],eax end if if chF#_tp = TypeDQ movsd xmm0,qword [chF] movsd qword [chT],xmm0 end if if chF#_tp = TypeMatrix4 LDDQU xmm0,dqword [chF] LDDQU xmm1,dqword [chF+16] movups dqword [chT],xmm0 movups dqword [chT+16],xmm1 LDDQU xmm0,dqword [chF+32] LDDQU xmm1,dqword [chF+48] movups dqword [chT+32],xmm0 movups dqword [chT+48],xmm1 end if } macro SetVar chV,chOf,chNum { if chV#_tp = TypeDB mov byte [chV+chOf],chNum end if if chV#_tp = TypeDW mov word [chV+chOf],chNum end if if chV#_tp = TypeDD mov dword [chV+chOf],chNum end if if chV#_tp = TypeDQ mov qword [chV+chOf],chNum end if if chV#_tp = TypeMatrix4 mov dword [chV+chOf],chNum end if } Last edited by Roman on 22 Jul 2020, 14:01; edited 1 time in total |
|||
![]() |
|
Roman 22 Jul 2020, 11:58
In code write:
Code: Vars_offs EQU Vars_Tabl Var hndl,Sz_Adr*1,TypeDD Var hndl2,Sz_Adr*4,TypeDD rept 3 n:1 { Var mat#n,64,TypeMatrix4 } SetVar mat3,0,10.0 SetVar hndl,0,8 CopyVar mat1,mat3 CopyVar hndl,hndl2 Var a1,4,TypeFlt Var a2,4,TypeFlt CopyVar a1,hndl CopyVar a1,a2 CopyVar hndl,a1 section '.bss' readable writeable Vars_Tabl rb 1000 Last edited by Roman on 22 Jul 2020, 14:03; edited 1 time in total |
|||
![]() |
|
Roman 22 Jul 2020, 11:59
No need write in data section many names.
Only cuple: Vars_Tabl rb 1000 VarsInterfaces_Tabl rb 1000 Last edited by Roman on 22 Jul 2020, 12:20; edited 1 time in total |
|||
![]() |
|
Roman 22 Jul 2020, 12:20
You can include file.
And in include file we can write: Code: Var a1,Sz_Adr*1,TypeDD Var a2,Sz_Adr*4,TypeDD And no need comment in data section a1 and a2 |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.