First ASM (FASM) test- output all chars loop
MaKiPL Nov 21st, 2015 (edited) 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- ; By MaKiPL
- ; My first ASM algorithm (finally!)
- ; It writes down all ASCII 8 bit characters and ends program
- ; As soon as index hits ~252 (due to some logic and datatypes problems I have)
- ; FASM for Windows!
- include '%fasminc%/win32ax.inc'
- inchar DB ? ; null
- numwritten DD ?
- numread DD ?
- outhandle DD ?
- inhandle DD ?
- string1 DB 00h
- stop DB 00h
- invoke AllocConsole
- invoke GetStdHandle,STD_OUTPUT_HANDLE
- mov [outhandle],eax
- invoke GetStdHandle,STD_INPUT_HANDLE
- mov [inhandle],eax
- jmp begin
- mov bl, [string1]
- add bl, 1
- mov [string1], bl
- invoke WriteConsole,[outhandle],string1,1,numwritten,0
- invoke ReadConsole,[inhandle],inchar,1,numread,0
- mov dl, [stop]
- add dl, 1
- mov [stop], dl
- cmp [stop], 252
- jb begin ;CF ! ZF is for signed
- jna ending
- invoke ExitProcess,0
- .end start
RAW Paste Data