Recent

Author Topic: How to declare couple of bytes in inline assembly?  (Read 812 times)

LemonParty

  • Sr. Member
  • ****
  • Posts: 438
How to declare couple of bytes in inline assembly?
« on: March 18, 2025, 02:45:04 pm »
Hello.
I need to declare a couple of bytes in assembly block to replace unrecognized instruction.
Architecture AARCH64.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Thaddy

  • Hero Member
  • *****
  • Posts: 18956
  • Glad to be alive.
Re: How to declare couple of bytes in inline assembly?
« Reply #1 on: March 18, 2025, 02:46:41 pm »
db ?
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

LemonParty

  • Sr. Member
  • ****
  • Posts: 438
Re: How to declare couple of bytes in inline assembly?
« Reply #2 on: March 18, 2025, 02:53:51 pm »
"db"
Not work.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Zvoni

  • Hero Member
  • *****
  • Posts: 3359
Re: How to declare couple of bytes in inline assembly?
« Reply #3 on: March 18, 2025, 03:35:28 pm »
Reminds of a WhatsApp-Chat i saw...

User 1: What's this? (Shows a Picture of a USB-C connector)
User 2: Type C
User 1: C
User 1: Doesn't work
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Thaddy

  • Hero Member
  • *****
  • Posts: 18956
  • Glad to be alive.
Re: How to declare couple of bytes in inline assembly?
« Reply #4 on: March 18, 2025, 04:03:24 pm »
Usually this is assembler agnostic:
Code: [Select]
DB 0x90, 0x90, 0x90  // Three Intel NOP instructions in a rowYou should be able to use the same for AARCH64. As long as you know the instruction byte order, that is.

You obviously did not know about the db instruction/directive..
It works, the code example is for intel though.
Fully supported for AARCH64 instructions in byte notation.
« Last Edit: March 18, 2025, 04:17:22 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

LemonParty

  • Sr. Member
  • ****
  • Posts: 438
Re: How to declare couple of bytes in inline assembly?
« Reply #5 on: March 18, 2025, 04:21:03 pm »
I found the solution.
Code: ASM  [Select][+][-]
  1. .byte 1,2,3,4
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Thaddy

  • Hero Member
  • *****
  • Posts: 18956
  • Glad to be alive.
Re: How to declare couple of bytes in inline assembly?
« Reply #6 on: March 18, 2025, 04:32:12 pm »
That is the same indeed.
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

 

TinyPortal © 2005-2018