News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Fibonacci sequence

Started by zekyr, July 30, 2011, 11:07:15 PM

Previous topic - Next topic

zekyr

I got it! :) I'm just a little behind on figuring out and finding all the macro's I need to use. I figured -1323752223 was a two's compliment interpretation or whatever just didnt know how to correct it. good to know that i can use ustr$ for unsigned stuff.

there is a lot these macro's do that I get confused what they assemble into or how they handle some of their parameters; for example
    invoke CreateWindowEx, 0, wcex.lpszClassName, "title", 010c80000h, 0,0,256,256,0,0,wcex.hInstance,0
will error; it doesnt like "title" as a parameter and i got to make it its own var and pass it the offset

but
    mov eax, rv(CreateWindowEx, 0, wcex.lpszClassName, "title", 010c80000h, 0,0,256,256,0,0,wcex.hInstance,0)
doesn't.

i dont know what rv is doing with my string or where its sticking it or anything. im guessing it somehow fits "title" into .data and does like push OFFSET title or something

dedndave


zekyr

that worked :) thanks a lot dave!

dedndave

the chr$ macro assigns memory space for the string in the initialized data section
if you use the string 'title' several times throughout the program, it may be better to declare it the regular way
AppName db 'title',0
then refer to the ADDR or OFFSET of AppName
of course, it depends on the length of the string and how many times it's used   :P

cobold

Hello,

take 8192 DWORDS as a "bignumber" and keep adding you will arrive at Fibonaccinumber 377599 which has 78914 decimal digits:

149446500387691722........754064175901

:bdg

of course you could even take 32768 DWORDS and calculate F1510391 with 315653 decimal digits.  :eek

or - if you like it extreme: allocate all of your available memory for bignumber. What would be the biggest fib you are able to calculate?  :dazzled:


zekyr

i was actually thinking about doing something like this! but i never got to writing anything because i saw the gui example and i wanted to figure out how to do guis in ASM :) but i do need to figure out how to allocate memory without using the .data? stuff and i have to figure out how to use the FPU still

cobold

Hello zekyr,

Quotehow to allocate memory without using the .data?

- use the alloc-macro or
- invoke GlobalAlloc,GPTR,number_of_bytes    ; GPTR = GMEM_FIXED AND GMEM_ZEROINIT

Quotefigure out how to use the FPU still

Raymond is the man to help you. You may want to read his excellent fputute at
http://www.website.masmforum.com/tutorials/fptute/


dedndave

i would think the FPU has limitations, here
the round-off errors happen fast in fibonacci world   :P
i can help you convert large integers to ASCII, though....

LLKF9_1.zip
http://www.masm32.com/board/index.php?topic=12363.msg94779#msg94779