{ Game   : eldenring.exe
  Version:
  Date   : 2022-02-25
  Author : cfe

  This script does blah blah blah
}

[ENABLE]
bNoClip:
db 1

globalalloc(cNoClipTread,$1000)
createthread(cNoClipTread)

label(cbStop)
registersymbol(cbStop)
label(cStart)
label(cEnding)
cNoClipTread:
 sub rsp,28
cStart:
 mov rcx,10
 call Sleep
 cmp byte ptr[cbStop],1
 je cEnding
 mov rax,[camadr]
 test rax,rax
 je cStart
 mov rsi,rax
 mov rdi,rax
       mov r15,fSpeed
       mov rcx,57 // VK_W
       call GetAsyncKeyState
       test eax,eax
       je @f
        call SinCos
        movss xmm1,[r15]
        divss xmm1,[cfTen]
        movups xmm0,[rsi] // Vector Pos

        // X += Sin Hor
        movss xmm2,[cCalculated]
        mulss xmm2,xmm1
        addss xmm0,xmm2

        // Y -= Sin Ver
        shufps xmm0,xmm0,E1
        movss xmm2,[cCalculated+8]
        mulss xmm2,xmm1
        subss xmm0,xmm2

        // Z += Cos Hor
        shufps xmm0,xmm0,C6
        movss xmm2,[cCalculated+4]
        mulss xmm2,xmm1
        addss xmm0,xmm2

        // XYZ store
        shufps xmm0,xmm0,C9
        movups [rsi],xmm0

@@:
       mov rcx,53 // VK_S
       call GetAsyncKeyState
       test eax,eax
       je @f
        call SinCos
        movss xmm1,[r15]
        divss xmm1,[cfTen]
        movups xmm0,[rsi] // Vector Pos

        // X -= Sin Hor
        movss xmm2,[cCalculated]
        mulss xmm2,xmm1
        subss xmm0,xmm2

        // Y += Sin Ver
        shufps xmm0,xmm0,E1
        movss xmm2,[cCalculated+8]
        mulss xmm2,xmm1
        addss xmm0,xmm2

        // Z -= Cos Hor
        shufps xmm0,xmm0,C6
        movss xmm2,[cCalculated+4]
        mulss xmm2,xmm1
        subss xmm0,xmm2

        // XYZ store
        shufps xmm0,xmm0,C9
        movups [rsi],xmm0

@@:
        mov rcx,41 // VK_A
        call GetAsyncKeyState
        test eax,eax
        je @f
          call SinCosAngle
          movss xmm1,[r15]
          divss xmm1,[cfTen]
          movups xmm0,[rsi] // Vector Pos

          // X += Sin Hor - 90°
          movss xmm2,[cCalculated]
          mulss xmm2,xmm1
          addss xmm0,xmm2

          shufps xmm0,xmm0,E1

          // Z += Cos Hor - 90°
          shufps xmm0,xmm0,C6
          movss xmm2,[cCalculated+4]
          mulss xmm2,xmm1
          addss xmm0,xmm2

          // XYZ store
          shufps xmm0,xmm0,C9
          movups [rsi],xmm0
@@:
       mov rcx,44 // VK_D
       call GetAsyncKeyState
       test eax,eax
       je @f
        call SinCosAngle
        movss xmm1,[r15]
        divss xmm1,[cfTen]
        movups xmm0,[rsi] // Vector Pos

        // X -= Sin Hor - 90°
        movss xmm2,[cCalculated]
        mulss xmm2,xmm1
        subss xmm0,xmm2

        shufps xmm0,xmm0,E1

        // Z -= Cos Hor - 90°
        shufps xmm0,xmm0,C6
        movss xmm2,[cCalculated+4]
        mulss xmm2,xmm1
        subss xmm0,xmm2

        // XYZ store
        shufps xmm0,xmm0,C9
        movups [rsi],xmm0
@@:
       mov rcx,20// VK_SPACE
       call GetAsyncKeyState
       test eax,eax
       je @f
        // Y += speed
        movss xmm0,[rsi+4]
        movss xmm1,[r15]
        divss xmm1,[cfTen]
        addss xmm0,xmm1
        movss [rsi+4],xmm0
       @@:
       mov rcx,11// VK_CTRL
       call GetAsyncKeyState
       test eax,eax
       je @f
        // Y -= speed
        movss xmm0,[rsi+4]
        movss xmm1,[r15]
        divss xmm1,[cfTen]
        subss xmm0,xmm1
        movss [rsi+4],xmm0
 @@:
 jmp cStart
cEnding:
 add rsp,28
 ret
SinCos:
  fld [rdi+B4] // Hor
  fsin
  fstp [cCalculated]
  fld [rdi+B4] // Hor
  fcos
  fstp [cCalculated+4]
  fld [rdi+B8] // Ver
  fsin
  fstp [cCalculated+8]
  ret
DegreeToRad:
  movss xmm0,[PI]
  movss xmm1,[HALF]
  divss xmm0,xmm1
  mulss xmm0,[RIGHTANGLE]
  ret
SinCosAngle:
  call DegreeToRad
  movss xmm1,[rdi+B4] // Hor
  subss xmm1,xmm0
  movss [cCalculated],xmm1
  fld [cCalculated]
  fsin
  fstp [cCalculated]
  movss xmm1,[rdi+B4] // Hor
  subss xmm1,xmm0
  movss [cCalculated+4],xmm1
  fld [cCalculated+4]
  fcos
  fstp [cCalculated+4]
  ret

cbStop:
db 0
cCalculated:
dd 0 // Hor Sin
dd 0 // Hor Cos
dd 0 // Ver Sin
cfTen:
dd (float)10
PI:
dd (float)3.14159265359
HALF:
dd (float)180.0
RIGHTANGLE:
dd (float)90.0
startfreecam:
db 0

[DISABLE]
bNoClip:
db 0

cbStop:
db 1

startfreecam:
db 1
unregistersymbol( * ) 

Assembly Online Compiler

Write, Run & Share Assembly code online using OneCompiler's Assembly online compiler for free. It's one of the robust, feature-rich online compilers for Assembly language. Getting started with the OneCompiler's Assembly compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Assembly and start coding.

About Assembly

Assembly language(asm) is a low-level programming language, where the language instructions will be more similar to machine code instructions.

Every assembler may have it's own assembly language designed for a specific computers or an operating system.

Assembly language requires less execution time and memory. It is more helful for direct hardware manipulation, real-time critical applications. It is used in device drivers, low-level embedded systems etc.

Syntax help

Assembly language usually consists of three sections,

  1. Data section

    To initialize variables and constants, buffer size these values doesn't change at runtime.

  2. bss section

    To declare variables

  3. text section

    _start specifies the starting of this section where the actually code is written.

Variables

There are various define directives to allocate space for variables for both initialized and uninitialized data.

1. To allocate storage space to Initialized data

Syntax

variable-name    define-directive    initial-value 
Define DirectiveDescriptionAllocated Space
DBDefine Byte1 byte
DWDefine Word2 bytes
DDDefine Doubleword4 bytes
DQDefine Quadword8 bytes
DTDefine Ten Bytes10 bytes

2. To allocate storage space to un-initialized data

Define DirectiveDescription
RESBReserve a Byte
RESWReserve a Word
RESDReserve a Doubleword
RESQReserve a Quadword
RESTReserve a Ten Bytes

Constants

Constants can be defined using

1. equ

  • To define numeric constants
CONSTANT_NAME EQU regular-exp or value

2. %assign

  • To define numeric constants.
%assign constant_name value

3. %define

  • To define numeric or string constants.
%define constant_name value

Loops

Loops are used to iterate a set of statements for a specific number of times.

mov ECX,n
L1:
;<loop body>
loop L1

where n specifies the no of times loops should iterate.

Procedures

Procedure is a sub-routine which contains set of statements. Usually procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.

procedure_name:
   ;procedure body
   ret