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?

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

0
Last updated at Posted at 2025-12-06

概要

中古ノート買ってみた。
wsl1のubuntu18.04にnasm入れてみた。
練習問題、やってみた。

練習問題

乱数の様なもの。

実行結果

gas
# gcc -o rnd rnd.s -no-pie

# ./rnd
1  1  2  1  1  1  0  1  2  0  

# ./rnd
0  2  2  2  1  0  0  1  0  0  

# ./rnd
0  1  0  0  1  1  2  0  1  1  

# ./rnd
0  0  2  2  1  2  1  0  0  1  

# ./rnd
0  0  0  2  2  0  0  0  1  1  

サンプルコード


.intel_syntax noprefix
.global main
.text

main:
	push	rbp
	mov		rbp, rsp
_start:
	mov 	r15, 0
_loop:
	inc 	r15
	rdtsc
	mov 	rdx, 0
	mov 	rcx, 3
	div 	rcx
	mov		rsi, rdx
	mov		rdi, OFFSET FLAT:fmt
	mov		rax, 0
	call	printf
	cmp		r15, 10
	jne		_loop
_end:
	mov		eax, 0
	leave
	ret

.data
	fmt:	.string "%d  "



以上。

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?