mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-02-13 11:13:38 +00:00
Implements SCAS unit tests
This commit is contained in:
parent
c8b2aefb9a
commit
4db38f389a
43
unittests/ASM/Primary/Primary_AE.asm
Normal file
43
unittests/ASM/Primary/Primary_AE.asm
Normal file
@ -0,0 +1,43 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RAX": "0x1200",
|
||||
"RDI": "0xE0000001"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434445464748
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x61
|
||||
scasb
|
||||
; cmp = 0x61 - 0x48 = 0x19
|
||||
; 0: CF - 00000000
|
||||
; 1: - 00000010
|
||||
; 2: PF - 00000000
|
||||
; 3: 0 - 00000000
|
||||
; 4: AF - 00010000
|
||||
; 5: 0 - 00000000
|
||||
; 6: ZF - 00000000
|
||||
; 7: SF - 00000000
|
||||
; ================
|
||||
; 00010010
|
||||
; OF: LAHF doesn't load - 0
|
||||
|
||||
mov rax, 0
|
||||
lahf
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AE_REP.asm
Normal file
31
unittests/ASM/Primary/Primary_AE_REP.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "5",
|
||||
"RDI": "0xE0000003"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434445466161
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x61
|
||||
mov rcx, 8
|
||||
cmp rax, 0x61
|
||||
|
||||
rep scasb
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AE_REPNE.asm
Normal file
31
unittests/ASM/Primary/Primary_AE_REPNE.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "1",
|
||||
"RDI": "0xE0000007"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4161434445464748
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x61
|
||||
mov rcx, 8
|
||||
cmp rax, 0
|
||||
|
||||
repne scasb
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AE_REPNE_down.asm
Normal file
31
unittests/ASM/Primary/Primary_AE_REPNE_down.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "5",
|
||||
"RDI": "0xE000000D"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434445464748
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5161535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 2]
|
||||
|
||||
std
|
||||
mov rax, 0x61
|
||||
mov rcx, 8
|
||||
cmp rax, 0
|
||||
|
||||
repne scasb
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AE_REP_down.asm
Normal file
31
unittests/ASM/Primary/Primary_AE_REP_down.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "7",
|
||||
"RDI": "0xE000000F"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434445466161
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 2]
|
||||
|
||||
std
|
||||
mov rax, 0x61
|
||||
mov rcx, 8
|
||||
cmp rax, 0x61
|
||||
|
||||
rep scasb
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AF_REP_dword.asm
Normal file
31
unittests/ASM/Primary/Primary_AF_REP_dword.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "6",
|
||||
"RDI": "0xE0000008"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434461626364
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x61626364
|
||||
mov rcx, 8
|
||||
cmp rax, 0x61626364
|
||||
|
||||
rep scasd
|
||||
|
||||
hlt
|
32
unittests/ASM/Primary/Primary_AF_REP_qword.asm
Normal file
32
unittests/ASM/Primary/Primary_AF_REP_qword.asm
Normal file
@ -0,0 +1,32 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "6",
|
||||
"RDI": "0xE0000010"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x6162636465666768
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x6162636465666768
|
||||
mov rbx, 0x6162636465666768
|
||||
mov rcx, 8
|
||||
cmp rax, rbx
|
||||
|
||||
rep scasq
|
||||
|
||||
hlt
|
31
unittests/ASM/Primary/Primary_AF_REP_word.asm
Normal file
31
unittests/ASM/Primary/Primary_AF_REP_word.asm
Normal file
@ -0,0 +1,31 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RCX": "6",
|
||||
"RDI": "0xE0000004"
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
mov rdx, 0xe0000000
|
||||
|
||||
mov rax, 0x4142434445466162
|
||||
mov [rdx + 8 * 0], rax
|
||||
mov rax, 0x5152535455565758
|
||||
mov [rdx + 8 * 1], rax
|
||||
mov rax, 0x0
|
||||
mov [rdx + 8 * 2], rax
|
||||
|
||||
lea rdi, [rdx + 8 * 0]
|
||||
|
||||
cld
|
||||
mov rax, 0x6162
|
||||
mov rcx, 8
|
||||
cmp rax, 0x6162
|
||||
|
||||
rep scasw
|
||||
|
||||
hlt
|
Loading…
x
Reference in New Issue
Block a user