News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

console input/output with no macros

Started by koalapauljeff, May 01, 2014, 11:40:38 PM

Previous topic - Next topic

Antariy

Quote from: jj2007 on May 02, 2014, 09:00:40 AM
Quote from: Antariy on May 02, 2014, 08:44:30 AM
A bit modified, 12 bytes but maybe slower

The idea is cute (inc leaves the carry flag intact...), but there are some problems:

Also forget to zero eax in the first post :biggrin:

Yes, I think the slowdown is because partial changement of the flags. With consideration of zeroing eax, the tweak with jnc is not useful, since the code is the same size as you posted first :t Interesting how behaves partial reg changement on the other machines :biggrin:

Antariy


Intel(R) Celeron(R) CPU 2.13GHz (MMX, SSE, SSE2, SSE3)
xx: len=67 bytes, code size=22  bytes for xx
204 ms

xy: len=67 bytes, code size=21  bytes for xy
192 ms

xz: len=67 bytes, code size=14  bytes for xz
128 ms

xf: len=67 bytes, code size=15  bytes for xf
125 ms

Alex 1= 67 bytes, code size=14  bytes for xa1
132 ms

Alex 2= 67 bytes, code size=14  bytes for xa2
116 ms

M32 len=67 bytes, code size=??
99 ms

CRT len=67 bytes, code size=??
61 ms

MB  len=67 bytes, code size=??
30 ms

DaveLen=67 bytes, code size=28  bytes for awGetLen
234 ms

hutch--

 :biggrin:

22 bytes. Still, give the guy a break, I doubt he was looking for a string length benchmark, just some simple code to get the job done.


    mov eax, [esp+4]
    sub eax, 1

  lbl0:
    add eax, 1
    cmp BYTE PTR [eax], 0
    jne lbl0

    sub eax, [esp+4]

    ret 4

koalapauljeff

Just wanted to update that I've finished my project and managed to reduce my includes to:

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib

which I think is the bare minimum for interacting with the console. Thanks so much for all the help; while I was never super concerned with making it run quickly, seeing all the different examples that were posted helped me understand more opcodes and loop structures.

Thanks all!  :greenclp: