#概要
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