9
8

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.

ズンドコキヨシ with x86アセンブラ

Last updated at Posted at 2016-03-18

x86 のアセンブラでズンドコしてみました。

zundoko.asm
        .386
        .model  flat, stdcall
        option  casemap:none

        include windows.inc
        include kernel32.inc

        .code
main:   invoke  GetStdHandle, STD_OUTPUT_HANDLE
        mov     esi, eax
        call    GetTickCount
        mov     ebx, eax
        xor     edi, edi
loop0:  lea     ebx, [ebx+ebx*4]
        add     ebx, 123
        bt      ebx, 7
        mov     ebp, offset zun
        jc      skip
        mov     ebp, offset doko
skip:   rcr     edi, 1
        call    puts
        cmp     edi, 78000000h
        jl      loop0
        mov     ebp, offset kiyoshi
puts:   invoke  lstrlen, ebp
        invoke  WriteConsole, esi, ebp, eax, NULL, NULL
        ret

zun     db      "ずん", 0
doko    db      "どこ", 0
kiyoshi db      "キ・ヨ・シ!", 13, 10, 0

        end     main
makefile
target: zundoko.exe

zundoko.obj: zundoko.asm
	ml /coff /c /I"c:\masm32\include" zundoko.asm

zundoko.exe: zundoko.obj
	link zundoko.obj /subsystem:console /defaultlib:kernel32.lib

zundoko.png

9
8
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
9
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?