Philip Rushik on 13 Sep 2017 16:34:48 -0700
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Why Can't Programmers.. Program?
|
- From: Philip Rushik <prushik@gmail.com>
- To: "Philadelphia Linux User's Group Discussion List" <plug@lists.phillylinux.org>
- Subject: Re: [PLUG] Why Can't Programmers.. Program?
- Date: Wed, 13 Sep 2017 23:34:21 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=uyqN9fs1NNBEJnoCJgalSZqk/BwhYLlVYp4JCCZMMVA=; b=BOsbGuM7Izwf8gTUL+9qUXqR7K0AbghmYcnsLU9v6avC9N2DSVZdPoP33656f1IC+A YUk7CeDvQu7QxyMJ8l/5dq6eeKnkJJvNJTr8+JsiyvOZy7brvH/UPTEOihsfY3QsmR3O IFY1IR2zqTLa8XcIwbCjCbkabeHSRWc6lx0tjdQYclMHPogMLD+79lZcuhXxcBnB2EjI eXGg5kY6QkGyRGG+5Izf3VEBMPZX/kC36MvRKn7y1awg34pc2JNz4Iosgapqj7Cubr7z I9gEcxm2REjfDR7TkDTdjVv0iwYIqWEHZA4vC0IIUKZqc9ul2G/ujeDGfqx7rtf2Atgm Exlg==
- Reply-to: Philadelphia Linux User's Group Discussion List <plug@lists.phillylinux.org>
- Sender: "plug" <plug-bounces@lists.phillylinux.org>
I find it hard to believe that there are actually programmers out there that can't solve that problem. I know non-programmers that could easily solve that problem (I asked a few). Anyways, for the sake of being annoying, I implemented this in just about the worst way possible, here yall go, enjoy:
section .data
fizz: db "fizz",10
buzz: db "buzz",10
num: db " "
num1: db "0"
num2: db "0"
num3: db "0"
db 10
section .text
global _start
write_buzz:
push rsi
lea rsi, [buzz]
call write
pop rsi
ret
write_num:
mov rax, rcx
mov r10, 10
xor rdx, rdx
div r10
cmp rdx, 5
je write_buzz
cmp rdx, 0
je write_buzz
add rdx, '0'
mov [num3], dl
xor rdx, rdx
div r10
add rdx, '0'
add rax, '0'
mov [num2], dl
mov [num1], al
lea rsi, [num]
write:
push rcx
mov rax, 1
mov rdi, 1
mov rdx, 5
syscall
pop rcx
ret
_start:
xor rcx, rcx
_loop:
inc rcx
call write_num
cmp rcx, 100
jge _exit
inc rcx
call write_num
inc rcx
lea rsi, [fizz]
call write
mov rax, rcx
xor rdx, rdx
mov r10, 5
div r10
cmp rdx, 0
jne _loop
call write_buzz
jmp _loop
_exit:
mov rax, 60
syscall
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug