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?

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

0
Posted at

概要

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

環境

windows10
wsl1
ubuntu18.04
nasm

手順

アセンブラを書く


global main
extern printf, scanf
section .text

main:
	push 	rbp
	mov 	rbp, rsp
	sub 	rsp, 128
	lea 	rdi, [rel fmti]
	lea 	rsi, [rsp]
	mov 	eax, 0
	call 	scanf
	lea 	rdi, [rel fmto]
	mov 	rsi, [rsp]
	mov 	rax, 0
	call 	printf
	mov 	eax, 0
	mov 	rsp, rbp
	pop 	rbp
	ret

section .data
	fmti db '%d\n', 10, 0;
	fmto db '%x', 10, 0;


コンパイル、実行する

#nasm -f elf64 s1.s
#gcc -o s1 s1.o
#./s1
255
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?