forked from rxwei/x86-assembly-textmate-bundle
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f7649fd
commit a8da25e
Showing
6 changed files
with
430 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
%xdefine asdf %abs(-42) | ||
|
||
%define a 1 | ||
%xdefine astr %cond(a,%str(true),"false") ; %define astr "true" | ||
%xdefine empty %count() ; %define empty 1 | ||
%xdefine one %count(1) ; %define one 1 | ||
%xdefine two %count(5,q) ; %define two 2 | ||
%define list a,b,46 | ||
%xdefine lc1 %count(list) ; %define lc 1 (just one argument) | ||
%xdefine lc2 %count(%[list]) ; %define lc 3 (indirection expands) | ||
|
||
%assign a 2 | ||
%assign b 3 | ||
%defstr what %expr(a+b,a*b) ; equivalent to %define what "5,6" | ||
|
||
; Instead of !%isidn() could have used %isnidn() | ||
%if %isdef(foo) && !%isidn(foo,bar) | ||
db "foo is defined, but not as 'bar'" | ||
%endif | ||
|
||
%define | ||
|
||
%define b 2 | ||
%xdefine bstr %sel(b,"one","two","three") ; %define bstr "two" | ||
|
||
; The following lines are all equivalent | ||
%define test 'TEST' | ||
%defstr test TEST | ||
%xdefine test %str(TEST) | ||
|
||
; The following lines are all equivalent | ||
%define charcnt 9 | ||
%strlen charcnt 'my string' | ||
%xdefine charcnt %strlen('my string') | ||
|
||
; The following lines are all equivalent | ||
%define mychar 'yzw' | ||
%substr mychar 'xyzw' 2,-1 | ||
%xdefine mychar %substr('xyzw',2,3) | ||
%xdefine mychar %substr('xyzw',2,-1) | ||
%xdefine mychar %substr('xyzw',2) | ||
|
||
; The following lines are all equivalent | ||
%define test TEST | ||
%deftok test 'TEST' | ||
%define test %tok('TEST') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
bits 64 | ||
add eax,edx | ||
{rex} add eax,edx | ||
add al,dl | ||
{rex} add al,dl | ||
add ah,dl | ||
comisd xmm0,xmm1 | ||
{rex} comisd xmm0,xmm1 | ||
vcomisd xmm0,xmm31 | ||
vcomisd xmm0,xmm1 | ||
{vex} vcomisd xmm0,xmm1 | ||
{vex2} vcomisd xmm0,xmm1 | ||
{vex3} vcomisd xmm0,xmm1 | ||
{evex} vcomisd xmm0,xmm1 | ||
{vex2} vcomisd xmm0,xmm1 | ||
{vex3} vcomisd xmm0,xmm1 | ||
{evex} vcomisd xmm0,xmm1 | ||
{vex} vcomisd xmm0,[r8+rax*1] | ||
{vex3} vcomisd xmm0,[r8+rax*1] | ||
{evex} vcomisd xmm0,[r8+rax*1] | ||
{vex} vcomisd xmm0,[rax+r8*2] | ||
{vex3} vcomisd xmm0,[rax+r8*2] | ||
{evex} vcomisd xmm0,[rax+r8*2] | ||
|
||
;; These errors may be caught in different passes, so | ||
;; some shadows the others... | ||
%ifdef ERROR | ||
%if ERROR <= 1 | ||
{vex2} vcomisd xmm0,[rax+r8*2] | ||
{rex} add ah,dl | ||
bits 32 | ||
mov eax,[r8d] | ||
%endif | ||
%if ERROR <= 2 | ||
{rex} vcomisd xmm0,xmm1 | ||
{vex} add eax,edx | ||
{vex3} add eax,edx | ||
%endif | ||
%endif | ||
|
||
bits 64 | ||
|
||
%define YMMWORD yword | ||
|
||
vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
vpmadd52luq ymm16,ymm1,YMMWORD[32+rsi] | ||
vpmadd52luq ymm17,ymm1,YMMWORD[64+rsi] | ||
vpmadd52luq ymm18,ymm1,YMMWORD[96+rsi] | ||
vpmadd52luq ymm19,ymm1,YMMWORD[128+rsi] | ||
|
||
vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
vpmadd52luq ymm16,ymm2,YMMWORD[32+rcx] | ||
vpmadd52luq ymm17,ymm2,YMMWORD[64+rcx] | ||
vpmadd52luq ymm18,ymm2,YMMWORD[96+rcx] | ||
vpmadd52luq ymm19,ymm2,YMMWORD[128+rcx] | ||
|
||
{vex} vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
{vex} vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
|
||
cpu latevex | ||
|
||
vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
vpmadd52luq ymm16,ymm1,YMMWORD[32+rsi] | ||
vpmadd52luq ymm17,ymm1,YMMWORD[64+rsi] | ||
vpmadd52luq ymm18,ymm1,YMMWORD[96+rsi] | ||
vpmadd52luq ymm19,ymm1,YMMWORD[128+rsi] | ||
|
||
vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
vpmadd52luq ymm16,ymm2,YMMWORD[32+rcx] | ||
vpmadd52luq ymm17,ymm2,YMMWORD[64+rcx] | ||
vpmadd52luq ymm18,ymm2,YMMWORD[96+rcx] | ||
vpmadd52luq ymm19,ymm2,YMMWORD[128+rcx] | ||
|
||
cpu default | ||
|
||
vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
|
||
cpu noevex | ||
|
||
vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
|
||
%ifdef ERROR | ||
vpmadd52luq ymm19,ymm2,YMMWORD[128+rcx] | ||
%endif | ||
|
||
cpu evex,novex,latevex | ||
|
||
vpmadd52luq ymm3,ymm1,YMMWORD[rsi] | ||
vpmadd52luq ymm3,ymm2,YMMWORD[rcx] | ||
|
||
cpu default | ||
|
||
vaddps ymm3,ymm1,YMMWORD[rsi] | ||
vaddps ymm3,ymm2,YMMWORD[rcx] | ||
|
||
cpu novex | ||
|
||
vaddps ymm3,ymm1,YMMWORD[rsi] | ||
vaddps ymm3,ymm2,YMMWORD[rcx] | ||
|
||
%ifdef ERROR | ||
cpu noevex | ||
|
||
vaddps ymm3,ymm1,YMMWORD[rsi] | ||
vaddps ymm3,ymm2,YMMWORD[rcx] | ||
%endif | ||
|
||
{vex} vaddps ymm3,ymm1,YMMWORD[rsi] | ||
{vex} vaddps ymm3,ymm2,YMMWORD[rcx] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
section .text | ||
extern _MessageBoxA@16 | ||
%if __?NASM_VERSION_ID?__ >= 0x02030000 | ||
safeseh handler ; register handler as "safe handler" | ||
%endif | ||
handler: | ||
push DWORD 1 ; MB_OKCANCEL | ||
push DWORD caption | ||
push DWORD text | ||
push DWORD 0 | ||
call _MessageBoxA@16 | ||
sub eax,1 ; incidentally suits as return value | ||
; for exception handler | ||
ret | ||
global _main | ||
_main: | ||
push DWORD handler | ||
push DWORD [fs:0] | ||
mov DWORD [fs:0],esp ; engage exception handler | ||
xor eax,eax | ||
mov eax,DWORD[eax] ; cause exception | ||
pop DWORD [fs:0] ; disengage exception handler | ||
add esp,4 | ||
ret | ||
text: db 'OK to rethrow, CANCEL to generate core dump',0 | ||
caption:db 'SEGV',0 | ||
|
||
section .drectve info | ||
db '/defaultlib:user32.lib /defaultlib:msvcrt.lib ' |
Oops, something went wrong.