2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

raspberry pi 1 model bで、アセンブラ その2

Last updated at Posted at 2016-10-29

#概要
raspberry pi 1 model bで、アセンブラでzundokoやってみた。
#開発環境
raspberry pi 1 model b
raspbian 2016_09_23 jessie lite
#実行
nano zundoko.s
gcc zundoko.s -nostdlib
./a.out
#サンプルコード
https://lowreal.net/2016/03/16/2

.text
.global _start
_start:
	ldr r8, =0x02020000
	mov r6, #0
loop:
	eor r8, r8, r8, lsl #13
	eor r8, r8, r8, lsr #17
	eor r8, r8, r8, lsl #15
	tst r8, $0x80
	adreq r1, zun
	moveq r2, #zun_len
	addeq r6, #1
	adrne r1, doko
	movne r2, #doko_len
	mov r0, #1
	mov r7, #4
	svc #0
	bne check_kiyoshi
	b loop
check_kiyoshi:
	cmp r6, #4
	bge call_kiyoshi
	mov r6, #0
	b loop
call_kiyoshi:
	adr r1, kiyoshi
	mov r2, #kiyoshi_len
	mov r0, #1
	mov r7, #4
	svc #0
	mov r0, #0
	mov r7, #1
	svc #0
zun:
	.string "ズン\n"
zun_len = . - zun
	.align 2
doko:
	.string "ドコ\n"
doko_len = . - doko
	.align 2
kiyoshi:
	.string "キヨシ\n"
kiyoshi_len = . - kiyoshi
	.align 2

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?