flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
2 27 Jan 2007, 08:38
Here is my source that uses a messagebox to pause.
I hope there's a better way. Code: format pe console include 'win32ax.inc' start: invoke GetStdHandle,STD_OUTPUT_HANDLE mov [h0],eax mov [b+$20],$D mov [b+$21],$A mov [v],0 p0: mov eax,[v] mov ebx,$20 p1: dec ebx mov [b+ebx],$30 shr eax,1 adc [b+ebx],0 cmp ebx,0 jne p1 invoke WriteConsole,[h0],b,$22,r0,0 invoke MessageBox,HWND_DESKTOP,"press a key to see the next number","pause",MB_OK inc [v] cmp [v],0 jne p0 invoke ExitProcess,0 .end start b rb $22 v rd 1 h0 rd 1 r0 rd 1 |
|||
![]() |
|
vid 27 Jan 2007, 08:40
1. be sure you have nothing in read buffer
2. SetConsoleMode - disable ENABLE_LINE_INPUT and ENABLE_ECHO_INPUT flag. 3. read 1 byte from console |
|||
![]() |
|
madmatt 27 Jan 2007, 22:03
Here's the function I use, you should have crtdll.dll in your dll imports.
Code: proc WaitKey cinvoke printf, <10,13,"[Press ESC or SPACE to continue]",10,13> .repeat invoke Sleep, 10 invoke GetAsyncKeyState, VK_ESCAPE push eax invoke GetAsyncKeyState, VK_SPACE pop ecx or eax, ecx and eax, $8000 .until eax <> NULL return endp [EDIT] You also need to use the include 'WIN32AXP.INC' or 'WIN32WXP.INC' |
|||
![]() |
|
Yardman 28 Jan 2007, 02:11
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:08; edited 1 time in total |
|||
![]() |
|
2 28 Jan 2007, 23:44
Quote:
How do I do read 1 byte? I'll have to look into this stuff. _________________ There are 10 kinds of people in the world. Those who know binary and those who haven't met me. |
|||
![]() |
|
vid 28 Jan 2007, 23:57
Quote: How do I do read 1 byte? I'll have to look into this stuff. |
|||
![]() |
|
2 29 Jan 2007, 00:50
but I had to reserve more data as a buffer to hold the bytes read and
the number of bytes read. So is it true that messagebox is the only way to pause using only 1 line of code? I tried the Sleep call but it always needs a time interval. I don't want to include any more files. Having to include win32ax.inc was bad enough. I already have the program in DOS that does everything and it doesn't need any includes. The reason I made the Windows version is because it's the perfect thing to use cheatengine on and change the value while it's in RAM. Just a fun thing I do. _________________ There are 10 kinds of people in the world. Those who know binary and those who haven't met me. |
|||
![]() |
|
vid 29 Jan 2007, 01:18
Quote: So is it true that messagebox is the only way to pause using only 1 line of code? you can't call mesagebox using one line of assembly code. Maybe one line of macro usage, but such line can do ANYTHING. you need to reserve only one byte buffer to read one byte, and few bytes doesn't matter to anyone anyway |
|||
![]() |
|
ChrisLeslie 29 Jan 2007, 05:23
Quote: I don't want to include any more files. Having to include win32ax.inc |
|||
![]() |
|
2 04 Feb 2007, 05:10
Quote: you need to reserve only one byte buffer to read one byte, and few bytes doesn't matter to anyone anyway It matters to me. That's enough. And I know that 1 line of assembly code wouldn't pause it. Also,I'm not against include files really,but I dislike the Windows API . I have written plenty of DOS programs and I'm just very upset at Windows EXEs as they aren't tiny like DOS COM files. I only do Windows console programs if I have a special need for them. Seriously,all I have ever used my assembly programs is to output integers in binary. I have a routine that I wrote for DOS that outputs EAX! Code: putbineax: pusha mov di,biteax mov cx,$20 converteax: rol eax,1 push eax and eax,1 or eax,$30 stosb pop eax loop converteax mov ah,$9 mov dx,biteax int $21 popa ret biteax db '????????????????????????????????',$0D,$0A,$24 When I "call putbineax" it does my routine to output all bits of EAX. Extremely useful for my numerous binary counting programs! When somebody makes a Windows EXE under 256 bytes(decimal) then I'll be interested! I only do my crazy DOS ASM for the speed. I can actually use PHP if I want something easier. _________________ There are 10 kinds of people in the world. Those who know binary and those who haven't met me. |
|||
![]() |
|
DOS386 04 Feb 2007, 07:39
Quote: I have written plenty of DOS programs and I'm just very upset at Back to DOS ? ![]() Quote: When somebody makes a Windows EXE under 256 bytes(decimal) then Quote: I don't want to include any more files. Having to include win32ax.inc http://board.flatassembler.net/topic.php?t=5616 (<<--1 KB) Hint: reports on Vista size vary from cca 3 GB to 10 GB ... does it matter or not ![]() ![]() _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
![]() |
|
f0dder 04 Feb 2007, 22:34
2 wrote:
Heh, 16bit code running in NTVDM with DOS interrupts emulated on the native windows API? Speed? *grin* |
|||
![]() |
|
vid 04 Feb 2007, 23:18
2: also the size of you executable files doesn't matter at all in DOS, as long as it fits in memory ( <400KB always), and it doesn't execute any other apps. Then, all the remaining memory is used by your application, regardless of how big it is.
Even the size on disk is aligned to cluster size |
|||
![]() |
|
rugxulo 05 Feb 2007, 18:52
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.