mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2010-09-27, 17:35   #1
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default asm trouble

I've tried iczelion tutorial for message box it works. I try adding mov(ax,1) it tells me I missed the right parenthesis and if i just try his basic outline it assembles fine but I goto check it out and it tells me it's not win32. any help i have books but I don't understand why i can't get mov(ax,1) to work. if i could maybe it's a start lol. I'm on a intel pentium d processor.
science_man_88 is offline   Reply With Quote
Old 2010-09-27, 21:05   #2
Robert Holmes
 
Robert Holmes's Avatar
 
Oct 2007

2·53 Posts
Default

You're using MASM? There's no need for parenthesis. It's just MOV (E)AX, 1.
Robert Holmes is offline   Reply With Quote
Old 2010-09-27, 21:10   #3
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by Robert Holmes View Post
You're using MASM? There's no need for parenthesis. It's just MOV (E)AX, 1.
sorry long time no use lol.

though your very helpful so stick around lol.
science_man_88 is offline   Reply With Quote
Old 2010-09-28, 16:09   #4
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

once I got one thing working I remember that I made this code before lol.


Code:
include \masm32\include\masm32rt.inc

.code
AppName	db "Masm32:", 0

start:	
mov eax,9h
MsgBox 0, str$(eax), addr AppName, MB_OK
	exit

end start
quite nice too bad I suck at thinking of ways to implement LL test though I think I could still do it, then I could just use this to print the ones that are prime lol maybe this is a job for f2xml(ST0) if we can make it calculate it with ST0 out of range maybe this would be of use lol.
science_man_88 is offline   Reply With Quote
Old 2010-09-28, 17:21   #5
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

32×5×7×19 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
quite nice too bad I suck at thinking of ways to implement LL test though I think I could still do it
One step at a time!

You want to take numbers below, say, a billion and check if they're exponents of Mersenne numbers. The first natural step would be to test if the number is prime. For numbers this size, trial division is reasonable. Can you program that in assembly?
CRGreathouse is offline   Reply With Quote
Old 2010-09-28, 17:36   #6
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

100000110000002 Posts
Default

I know the book I has breaks thing down to the parts that make up loops etc. and then talks of knowing your data as it's rarely random.

if possible conditional jumps should be used minimally.

to be prime it can't be a power and has to be of form 6n+1/-1 if above 3

so inc(eax) is useful in groups of 2 or 4

counting down is more efficient if I read the book correct.

checking for 6n+1 doesn't seem hard unless you put the limit on jumps to me. be nice if we could make a table of equivalent codes between languages so I could possibly turn Pari Codes into asm etc.
science_man_88 is offline   Reply With Quote
Old 2010-09-28, 17:37   #7
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

yeah that would be a 2 variable operation one the exponent you want to test and 2 the number to divide it by also as we go could we not push it on the stack to make an array of primes found along the way.
science_man_88 is offline   Reply With Quote
Old 2010-09-28, 17:44   #8
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

343310 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
One step at a time!
Indeed, but the first step, IMO, should not be assembly at all! I realize that assembly language has the great lure of speed, but speed gains can typically only be realized with *extensive* knowledge of the underlying hardware... something yet to be demonstrated.

Why anyone would want to burden themselves with assembly language syntax/tools for anything but the most critical loops of code is beyond me. A msgbox... in ASM... really??
bsquared is online now   Reply With Quote
Old 2010-09-28, 17:47   #9
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

win32 asm

anyway maybe something I can learn from asm I can carry into something else.

Code:
include \masm32\include\masm32rt.inc

.code
AppName	db "Masm32:", 0

start:	
mov eax,7
imod 6,edx:eax
cmp edx,1
jne bust
MsgBox 0, str$(eax), addr AppName, MB_OK
	exit
bust:
end bust
end start
I get this error when i try to assemble.

Quote:
C:\masm32\try5.asm(8) : error A2008: syntax error : integer

Last fiddled with by science_man_88 on 2010-09-28 at 17:49
science_man_88 is offline   Reply With Quote
Old 2010-09-28, 20:12   #10
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111011000012 Posts
Default

Quote:
Originally Posted by bsquared View Post
Indeed, but the first step, IMO, should not be assembly at all!
Yes, I of course agree... but if the goal is to learn asm, then let him learn asm!
CRGreathouse is offline   Reply With Quote
Old 2010-09-28, 20:56   #11
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

7×193 Posts
Default

You should replace the instruction you marked in red by:

xor edx,edx
mov ebx,6
div ebx

Then you have the quotient in EAX and the remainder in EDX.
alpertron is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
installation of OS trouble wildrabbitt Linux 5 2015-12-22 16:51
Is Entropia in trouble? ekugimps PrimeNet 1 2005-09-09 16:18
More trouble in randomness Orgasmic Troll Math 11 2005-04-15 15:26
Trouble with display ThomRuley Hardware 3 2005-01-17 23:11
Trouble at t' mill Wacky NFSNET Discussion 6 2004-01-27 17:56

All times are UTC. The time now is 21:27.

Wed May 5 21:27:26 UTC 2021 up 27 days, 16:08, 0 users, load averages: 3.28, 3.32, 3.06

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.