0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

中古ノート、買ってみた。 その48

Posted at

概要

中古ノート買ってみた。
wsl1のubuntu18.04にnasm入れてみた。
書式付きprintf、やってみた。

環境

windows10
wsl1
ubuntu18.04
nasm

手順

アセンブラを書く


extern printf
global main
section .text

main:
	push 	rbp
	mov	 	rbp, rsp
	lea 	rdi, [rel fmt]
	mov 	rsi, 255
	mov 	rax, 0
	call 	printf
	xor 	eax, eax
	mov 	rsp, rbp
	pop 	rbp
	ret

section .data
	fmt: db '%x', 10, 0



コンパイル、実行する

#nasm -f elf64 p1.s
#gcc -o p1 p1.o
#./p1
ff
#

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?