Hey I need some help with this assembly language assignment

Started by jwill22, January 27, 2011, 09:35:29 PM

Previous topic - Next topic

qWord

isn't there the need to preserver ECX when calling  the functions Random32 and WriteInt?
FPU in a trice: SmplMath
It's that simple!

brethren

Quote from: qWord on January 28, 2011, 06:17:31 PM
isn't there the need to preserver ECX when calling  the functions Random32 and WriteInt?

no, internally all procs in irvine32.lib push/pop any registers they use (except for a return value in eax, of course :P)

heres one example
QuoteWriteInt PROC
;
; Writes a 32-bit signed binary integer to the console window
; in ASCII decimal.
; Receives: EAX = the integer
; Returns:  nothing
; Comments: Displays a leading sign, no leading zeros.
; Last update: 7/11/01
;-----------------------------------------------------
WI_Bufsize = 12
true  =   1
false =   0
.data
buffer_B  BYTE  WI_Bufsize DUP(0),0  ; buffer to hold digits
neg_flag  BYTE  ?

.code
   pushad
   CheckInit

   mov   neg_flag,false    ; assume neg_flag is false
   or    eax,eax             ; is AX positive?
   jns   WIS1              ; yes: jump to B1
   neg   eax                ; no: make it positive
   mov   neg_flag,true     ; set neg_flag to true
        .....

jwill22

 :bg :bg :bg I'm sorry I didn't get back to u guys sooner. I had to do a little surgery on my laptop, but I'm alright now. Thanks to everyone, I think I understand now. I really appreciate it. :U