Author Topic: Non power of two code alignment  (Read 3834 times)

Offline Olsonist

  • Jr. Member
  • *
  • Posts: 26
Non power of two code alignment
« on: April 14, 2015, 06:24:35 PM »
I have a 2K block of code. I'm adding code at the beginning and aligning addresses to 16 byte boundaries. That much is standard.

However I'd like to have one 16 byte block at the end, the last 16 bytes.
Any clean trick come to mind?

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: Non power of two code alignment
« Reply #1 on: April 14, 2015, 07:00:42 PM »
Labeled block at the end of code or data:

At the end write:

Code: [Select]
myblock: times 512 db 0

Or

Code: [Select]
align 16
myblock: times 512 db 0
Encryptor256's Investigation \ Research Department.

Offline Olsonist

  • Jr. Member
  • *
  • Posts: 26
Re: Non power of two code alignment
« Reply #2 on: April 14, 2015, 08:05:43 PM »
So that requires me to manually figure out how many bytes to skip and that's pretty much what I thought I'd have to do. Is it possible to ASSERT that I've done everything correctly? So if I add some instructions to the head of the 2k that the assembler would barf an error saying I'd forgotten the tail end.

 

SMF spam blocked by CleanTalk