1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync; 7zAsm.asm -- ASM macros 2cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky; 2012-12-30 : Igor Pavlov : Public domain 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 4baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_ASM_START macro 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ifdef x64 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync .code 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync .386 9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync .model flat 10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync _TEXT$00 SEGMENT PARA PUBLIC 'CODE' 11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync endif 12baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 14baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_PROC macro name:req, numParams:req 15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync align 16 16cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky proc_numParams = numParams 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ifdef x64 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_name equ name 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 20cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky proc_name equ @CatStr(@,name,@, %numParams * 4) 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync endif 22cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky proc_name PROC 23baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 25baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_ENDP macro 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ifdef x64 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ret 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 29cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky if proc_numParams LT 3 30cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky ret 31cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky else 32cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky ret (proc_numParams - 2) * 4 33cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky endif 34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync endif 35cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky proc_name ENDP 36baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 38baa3858d3f5d128a5c8466b700098109edcad5f2repo syncifdef x64 39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REG_SIZE equ 8 40cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky REG_LOGAR_SIZE equ 3 41baa3858d3f5d128a5c8466b700098109edcad5f2repo syncelse 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REG_SIZE equ 4 43cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky REG_LOGAR_SIZE equ 2 44baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendif 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0 equ EAX 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1 equ ECX 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2 equ EDX 49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3 equ EBX 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x4 equ ESP 51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x5 equ EBP 52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x6 equ ESI 53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x7 equ EDI 54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0_L equ AL 56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1_L equ CL 57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2_L equ DL 58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3_L equ BL 59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0_H equ AH 61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1_H equ CH 62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2_H equ DH 63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3_H equ BH 64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 65baa3858d3f5d128a5c8466b700098109edcad5f2repo syncifdef x64 66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r0 equ RAX 67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r1 equ RCX 68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r2 equ RDX 69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r3 equ RBX 70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r4 equ RSP 71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r5 equ RBP 72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r6 equ RSI 73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r7 equ RDI 74cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x8 equ r8d 75cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x9 equ r9d 76cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x10 equ r10d 77cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x11 equ r11d 78cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x12 equ r12d 79cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x13 equ r13d 80cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x14 equ r14d 81cd66d540cead3f8200b0c73bad9c276d67896c3dDavid Srbecky x15 equ r15d 82baa3858d3f5d128a5c8466b700098109edcad5f2repo syncelse 83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r0 equ x0 84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r1 equ x1 85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r2 equ x2 86baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r3 equ x3 87baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r4 equ x4 88baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r5 equ x5 89baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r6 equ x6 90baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r7 equ x7 91baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendif 92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 93baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_PUSH_4_REGS macro 94baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r3 95baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r5 96baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r6 97baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r7 98baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 99baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 100baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_POP_4_REGS macro 101baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r7 102baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r6 103baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r5 104baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r3 105baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 106