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?

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

0
Posted at

概要

中古ノート買ってみた。
windows10でfasmをやってみた。
練習問題、やってみた。

練習問題

乱数を取得せよ。

コンパイル、実行結果

>fasm hello64f.asm
flat assembler  version 1.73.34  (1048576 kilobytes memory)
4 passes, 1536 bytes.

>hello64f
rnd 14
rnd 10
rnd 4

>hello64f
rnd 2
rnd 14
rnd 13

>hello64f
rnd 5
rnd 8
rnd 12

サンプルコード

format PE64 console
entry main
include 'C:\Program Files (x86)\fasmw17334\INCLUDE\win64a.inc'

section '.idata' data readable import
	library kernel32, 'kernel32.dll', msvcrt, 'msvcrt.dll'
	import kernel32, ExitProcess, 'ExitProcess'
	import msvcrt, printf, 'printf', getchar, 'getchar'

section '.text' code executable

main:
	rdtsc
	mov		bl, 10
	mul		bl
	mov		bl, 0x0F
	div		bl 
	and		eax, 0x0f
	cinvoke printf, <'rnd %d', 10, 0>, eax
	rdtsc
	mov		bl, 10
	mul		bl
	mov		bl, 0x0F
	div		bl 
	and		eax, 0x0f
	cinvoke printf, <'rnd %d', 10, 0>, eax
	rdtsc
	mov		bl, 10
	mul		bl
	mov		bl, 0x0F
	div		bl 
	and		eax, 0x0f
	cinvoke printf, <'rnd %d', 10, 0>, eax
	invoke 	ExitProcess, 0





以上。

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?