1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync; 7zAsm.asm -- ASM macros 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync; 2009-12-12 : 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 16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_numParams equ numParams 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ifdef x64 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_name equ name 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync name PROC 20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_fastcall_name equ @CatStr(@,name,@, %numParams * 4) 22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync public proc_fastcall_name 23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_fastcall_name: 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync endif 25baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 27baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_ENDP macro 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ifdef x64 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ret 30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync proc_name ENDP 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync ret (proc_numParams - 2) * 4 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync endif 34baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 36baa3858d3f5d128a5c8466b700098109edcad5f2repo syncifdef x64 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REG_SIZE equ 8 38baa3858d3f5d128a5c8466b700098109edcad5f2repo syncelse 39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync REG_SIZE equ 4 40baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendif 41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0 equ EAX 43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1 equ ECX 44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2 equ EDX 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3 equ EBX 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x4 equ ESP 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x5 equ EBP 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x6 equ ESI 49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x7 equ EDI 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0_L equ AL 52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1_L equ CL 53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2_L equ DL 54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3_L equ BL 55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x0_H equ AH 57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x1_H equ CH 58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x2_H equ DH 59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync x3_H equ BH 60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 61baa3858d3f5d128a5c8466b700098109edcad5f2repo syncifdef x64 62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r0 equ RAX 63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r1 equ RCX 64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r2 equ RDX 65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r3 equ RBX 66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r4 equ RSP 67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r5 equ RBP 68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r6 equ RSI 69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r7 equ RDI 70baa3858d3f5d128a5c8466b700098109edcad5f2repo syncelse 71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r0 equ x0 72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r1 equ x1 73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r2 equ x2 74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r3 equ x3 75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r4 equ x4 76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r5 equ x5 77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r6 equ x6 78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync r7 equ x7 79baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendif 80baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 81baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_PUSH_4_REGS macro 82baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r3 83baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r5 84baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r6 85baa3858d3f5d128a5c8466b700098109edcad5f2repo sync push r7 86baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 87baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 88baa3858d3f5d128a5c8466b700098109edcad5f2repo syncMY_POP_4_REGS macro 89baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r7 90baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r6 91baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r5 92baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pop r3 93baa3858d3f5d128a5c8466b700098109edcad5f2repo syncendm 94