[Day 2] Get to Know Assembly

[Day 2] Get to Know Assembly

I was curious to know the relationship between Assembly (by NASM) and the generated binary.

Findings are summarized as follows, note: guidelines only, it seems not correct for one parameter takes 2 bytes at least.

  • ORG generates no binary code. Actually like labels, it is only considered at compile time.
  • One label in the operand takes 2 bytes.
  • JMP takes 1 byte, 0xeb
  • BD, DW, DD takes no bytes, but they generate space for holding 1, 2 and 4 bytes respectively
  • MOV takes no bytes, but registers AX, pointers SP etc takes 1 byte each
  • MOV AX,0; where parameter 0 take 2 bytes
  • One register (e.g AX) can hold 32 bit (for 32-bit CPU) = 4 bytes. There are 8 registers (AX, BX, CX, DX, BP, SP, SI, DI), 4 bytes x 8 = 32 bytes in total, too little storage
  • [SI] from memory takes 1 byte
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: