Showing posts with label GNUアセンブラ. Show all posts
Showing posts with label GNUアセンブラ. Show all posts

Friday, November 4, 2016

Ubuntu: Assembler Example

Command:

$ cat test.S


Result:

.code16
.text
  .globl _start;
_start:
  . = _start + 510
  .byte 0x55
  .byte 0xaa


Command:

$ as -v


Result:

GNU assembler version 2.26.1 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.26.1


Command:

$ ld -v


Result:

GNU ld (GNU Binutils for Ubuntu) 2.26.1


Command:

$ as test.S -o test.o
$ ld -Ttext 0x7c00 --oformat=binary test.o -o test.bin
$ ls


Result:

test.S  test.bin  test.o