Author Topic: Test Junk  (Read 6711 times)

MichaelW

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Test Junk
« on: May 19, 2012, 02:59:13 AM »
Code: [Select]
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
.code
;==============================================================================
testproc proc C args:VARARG
    xor eax, eax                ; assume zero args
    mov edx, [ebp+4]            ; get return address
    cmp WORD PTR[edx], 0C483h   ; opcode for add esp,n
    je  @F
    ret
  @@:
    movzx eax, BYTE PTR[edx+2]  ; get value added to esp
    shr eax, 2                  ; divide by 4 for arg count
    ret
testproc endp
;==============================================================================
start:
;==============================================================================
    invoke testproc
    printf("%d\n",eax)
    invoke testproc,1
    printf("%d\n",eax)
    invoke testproc,1,2
    printf("%d\n",eax)
    invoke testproc,1,2,3
    printf("%d\n",eax)
    invoke testproc,1,2,3,4
    printf("%d\n",eax)
    invoke testproc,1,2,3,4,5
    printf("%d\n",eax)
    invoke testproc,1,2,3,4,5,6
    printf("%d\n\n",eax)
    inkey
    exit
;==============================================================================
end start
Well Microsoft, here’s another nice mess you’ve gotten us into.

jj2007

  • Member
  • *****
  • Posts: 7552
  • Assembler is fun ;-)
    • MasmBasic
Re: Test Junk
« Reply #1 on: May 21, 2012, 01:48:49 AM »
Not bad for a noob with only one post, MichaelW ;)

Code: [Select]
0
1
2
3
4
5
6

Press any key to continue ...

Daydreamer

  • Guest
Re: Test Junk
« Reply #2 on: May 21, 2012, 04:30:00 AM »
time to show my first upload

Tedd

  • Member
  • ***
  • Posts: 353
  • Procrastinor Extraordinaire
Re: Test Junk
« Reply #3 on: May 21, 2012, 04:31:01 AM »
Needs more garlic..
Potato2

x64Core

  • Member
  • **
  • Posts: 80
Re: Test Junk
« Reply #4 on: May 21, 2012, 05:52:19 AM »
the attached files just can be download if one is user :P
Nice forum, goo MASM!  :biggrin:
« Last Edit: May 21, 2012, 05:57:29 AM by RHL »

Adamanteus

  • Member
  • **
  • Posts: 180
Re: Test Junk
« Reply #5 on: May 21, 2012, 06:16:43 AM »
That to upload nice examples and I'll join, so hows singing grands on russian TV now - comon and dance  :t
For example allowed only C calling convensions and stayed to call func(va_list, int) - maybe samewere will be need - unknown  :eusa_boohoo:
My first upload (last from now) to here is on my site - it's driven for any errors Test_GM.exe (G-Lib program example). If somebody will hang it even by WinAPI-hook, I'll appriciate - so could post to me  :dazzled:

Vortex

  • Member
  • *****
  • Posts: 1704
Re: Test Junk
« Reply #6 on: May 21, 2012, 06:39:25 AM »
Return of The Jedi 8)

Antariy

  • Member
  • ****
  • Posts: 541
Re: Test Junk
« Reply #7 on: May 21, 2012, 10:24:15 AM »
"Was Marilyn Monroes a redhead, brunette or blonde assembly programmer ?:"

:lol

Greenhorn

  • Member
  • **
  • Posts: 93
Re: Test Junk
« Reply #8 on: May 21, 2012, 05:40:04 PM »
Hi Sirs,

nice new forum.  :t

At first I thought "How many legs does the average horse have ?" was a catch-22 until I checked that the input wants a number and not a word.
btw, doesn't an average horse have just two legs ???
(german pun: average = durchschnitt = cut through/intersect)


Regards
Greenhorn

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4813
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Test Junk
« Reply #9 on: May 21, 2012, 05:54:10 PM »
 :biggrin:

> (german pun: average = durchschnitt = cut through/intersect)  :greenclp:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

brixton

  • Guest
Re: Test Junk
« Reply #10 on: May 22, 2012, 06:24:17 AM »

Don57

  • Guest
Re: Test Junk
« Reply #11 on: May 23, 2012, 05:58:36 AM »
Well I guess were all new members now


dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: Test Junk
« Reply #13 on: May 23, 2012, 10:48:42 PM »
:eusa_dance:

i had to see what it would look like   :biggrin:

it's like the mirrors in the movie "Inception"   :P
(except without the little cutie pie Ellen Page)

Antariy

  • Member
  • ****
  • Posts: 541
Re: Test Junk
« Reply #14 on: May 24, 2012, 12:16:42 PM »
:eusa_dance:

i had to see what it would look like   :biggrin:

it's like the mirrors in the movie "Inception"   :P
(except wi... nBbΓΘ"≤▬☺îy►τ■Z▲2⌂ä∟⌡╞.3╜


SMF_EXCEPTION_CRASH_DUMP:
00000000  49 54 20 49  53 20 54 4F  4F 4F 4F 20  44 45 45 50  IT IS TOOOO DEEP
00000010  20 52 45 43  55 52 53 49  4F 4E 2C 20  44 41 56 45   RECURSION, DAVE