Skip to content

Commit

Permalink
Add Nasm-win64 Fasm-win32 (#1416)
Browse files Browse the repository at this point in the history
* Add Nasm win64 assembly

* Add Fasm win32 assembly

* Update readme.md

* Update readme.md

* Update a/Assembler NASM Win64.asm

Co-authored-by: gnuhead-chieb <[email protected]>

---------

Co-authored-by: Gabe <[email protected]>
Co-authored-by: gnuhead-chieb <[email protected]>
  • Loading branch information
3 people authored Jan 5, 2024
1 parent d32f013 commit dfb06d1
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
26 changes: 26 additions & 0 deletions a/Assembler FASM Win32.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
format PE CONSOLE
entry start
include 'win32a.inc'
section '.data' data readable writable
helo db "Hello World", 0

section '.text' code readable executable
start: xor ecx, ecx
push helo
call [printf]
add esp, 4
push ecx
call [ExitProcess]



section '.idata' import data readable
library kernel , 'kernel32.dll',\
msvcrt , 'msvcrt.dll '

import kernel,\
ExitProcess, 'ExitProcess'
import msvcrt,\
printf, 'printf'
120 changes: 120 additions & 0 deletions a/Assembler NASM Win64.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
BITS 64
SECTION .text
global main
main:
xor rcx, rcx
mov rax, [gs:rcx + 0x60]
mov rax, [rax + 0x18]
mov rsi, [rax + 0x20]
lodsq
xchg rax, rsi
lodsq
mov rbx, [rax + 0x20]
xor r8, r8
mov r8d, [rbx + 0x3c]
mov rdx, r8
add rdx, rbx
mov r8d, [rdx + 0x88]
add r8, rbx
xor rsi, rsi
mov esi, [r8 + 0x20]
add rsi, rbx
xor rcx, rcx
mov r9, 0x41636f7250746547


Get_Function:

inc rcx
xor rax, rax
mov eax, [rsi + rcx * 4]
add rax, rbx
cmp QWORD [rax], r9
jnz Get_Function
xor rsi, rsi
mov esi, [r8 + 0x24]
add rsi, rbx
mov cx, [rsi + rcx * 2]
xor rsi, rsi
mov esi, [r8 + 0x1c]
add rsi, rbx
xor rdx, rdx
mov edx, [rsi + rcx * 4]
add rdx, rbx
mov rdi, rdx


mov rcx, 0x41797261
push rcx
mov rcx, 0x7262694c64616f4c
push rcx
mov rdx, rsp
mov rcx, rbx
sub rsp, 0x30
call rdi
add rsp, 0x30
add rsp, 0x10
mov rsi, rax

mov rcx, 0x41656C6F73
push rcx
mov rcx, 0x6E6F436574697257
push rcx
mov rdx, rsp
mov rcx, rbx
sub rsp, 0x30
call rdi
mov rsi, rax


mov rcx, 0x656C646E
push rcx
mov rcx, 0x6148647453746547
push rcx
mov rdx, rsp
mov rcx, rbx
sub rsp, 0x30
call rdi
add rsp, 0x28
add rsp, 0x18
mov r15, rax

mov rcx, offset
sub rsp, 0x30
call r15
mov r15, rax
add RSP, 32

sub RSP, 32 + 8 + 8
mov rcx, r15
mov rdx, message
mov r8, len
mov r9, written
mov qword[rsp+2*8], 0
sub rsp, 0x30
call rsi

xor rcx, rcx
mov rcx, 0x737365
push rcx
mov rcx, 0x636f725074697845
push rcx
mov rdx, rsp
mov rcx, rbx
sub rsp, 0x30
call rdi
add rsp, 0x30
add rsp, 0x10
mov r15, rax


mov rcx, 0
call r15
section .data

offset equ -11
message db "Hello World",0
len equ $-message

section .bss
written resq 1
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Make sure to see [contributing.md](/contributing.md) for instructions on contrib
* [Assembler Bootsect](a/Assembler%20Bootsect.asm)
* [Assembler DCPU16](a/Assembler%20DCPU16.asm)
* [Assembler FASM DOS](a/Assembler%20FASM%20DOS.asm)
* [Assembler FASM Win32](a/Assembler%20FASM%20Win32.asm)
* [Assembler hla](a/Assembler%20hla.hla)
* [Assembler HP85](a/Assembler%20HP85.asm)
* [Assembler IBM360](a/Assembler%20IBM360.asm)
Expand All @@ -139,6 +140,7 @@ Make sure to see [contributing.md](/contributing.md) for instructions on contrib
* [Assembler NASM Linux64](a/Assembler%20NASM%20Linux64.asm)
* [Assembler NASM Macho64](a/Assembler%20NASM%20Macho64.asm)
* [Assembler NASM Win32](a/Assembler%20NASM%20Win32.asm)
* [Assembler NASM Win64](a/Assembler%20NASM%20Win64.asm)
* [Assembler pdp10 midas](a/Assembler%20pdp10%20midas.mid)
* [Assembler pdp11 palx](a/Assembler%20pdp11%20palx.palx)
* [Assembler RISC-V](a/Assembler%20RISC-V.s)
Expand Down

0 comments on commit dfb06d1

Please sign in to comment.