tenderlove / asmrepl

A REPL for x86-64 assembly language
Apache License 2.0
866 stars 33 forks source link

How to define data or buffers? #11

Open Ismael-VC opened 4 months ago

Ismael-VC commented 4 months ago

I am trying to do a simple hello world, I am learning using nasm, perhaps the syntax style is not the same?

section .data
  syscall:  equ 0x80
  syswrite: equ 4
  stdout:   equ 1

  sysexit:  equ 1
  success:  equ 0

  str:      db  `Hello World!!!\n`
  len:      equ $-str

section .text
  global _start

_start:
  ; hello
  mov rax, syswrite
  mov rbx, stdout
  mov rcx, str
  mov rdx, len
  int syscall

  ; exit
  mov eax, sysexit
  mov ebx, success
  int syscall

I haven't found examples or tests that do this, is it possible with the replL

(rip 0x00007ff23f7d4001)> msg: db "hello"
Invalid intruction
(rip 0x00007ff23f7d4001)> .section data
Invalid intruction

Best regards.

foxypiratecove37350 commented 5 days ago

This REPL only allow us to put code in the .text section, and it uses a in-REPL parser, so not every things of a full assembler are accessible, like data writing directives or certain instructions. Also, your NASM code is for 32-bits x86 while this REPL is for 64-bits x86 (x86_64).

Sincerely,