I get an application error when I do it that way...
"memory at blah referenced at blah could not be written"
"memory at blah referenced at blah could not be written"
I think you're on your own locke, I can't see the problem from my pov, I don't have your library files so I can't test it here except to test the createfile writefile stuff and that works fine. I'm afraid I've given you all the ideas that I have. Maybe sleep on the problem and you'll come up with something in the morning. (or start your homework on Saturday instead :) )
hell I'll send u the files... lol :)
I've been working on this the past 2,3 days... I seriously need to find out whats going wrong
I've been working on this the past 2,3 days... I seriously need to find out whats going wrong
Try jumping past the seive part and just writing the file full of zeroes with bufSize set to 32768, that'll let you see which routine is causing the error. I'm off to bed, g'nite.
when vc++ dubugger runs... the problem is w/ this line of code: mov byte ptr ,1
says "The instruction at 0x00401044 referenced memory at "0x004339bb". The memory could not be "written" ".
says "The instruction at 0x00401044 referenced memory at "0x004339bb". The memory could not be "written" ".
when I do a jmp past all the sieve algoritm... the file size changed to like 63 bytes! but its still empty
Cause position > 0ffffh
try
try
.data?
buffer db 0ffffh dup (?)
.code
lea esi,buffer
mov ecx,2
mov eax,2
@@:
push eax
mul ecx
mov byte ptr [esi+eax],1
pop eax
inc eax
cmp eax, 0ffffh
jb @B
inc ecx
cmp ecx,10
jnz @B
Your stack is not balanced :
.REPEAT
mov bl, 2
mul bl
.WHILE (ax < lengthof buffer)
[COLOR=red]push eax[/COLOR]
mov ebx,esi
add eax,ebx
mov esi,eax
add [esi], dx
[COLOR=red]pop eax[/COLOR]
[COLOR=red]pop ebx[/COLOR]
inc bl
mul bl
.ENDW
inc al
roticv:
I still get "The instruction at "0x00401044" referenced memory at "0x0041a000". The memory could not be "written" "
donkey:
when I balance it out (either push ebx also, or get rid of the pop ebx) it gives me an error saying: "The instruction at "0x0040105c" referenced memory at "0x0042d77c". The memory could not be "written". "
I should also add... when I added a "jmp write" to skip all the Sieve algorithm, I does indeed write to the file (its 64kb), though its filled w/ weird squarish looking characters.
I still get "The instruction at "0x00401044" referenced memory at "0x0041a000". The memory could not be "written" "
donkey:
when I balance it out (either push ebx also, or get rid of the pop ebx) it gives me an error saying: "The instruction at "0x0040105c" referenced memory at "0x0042d77c". The memory could not be "written". "
I should also add... when I added a "jmp write" to skip all the Sieve algorithm, I does indeed write to the file (its 64kb), though its filled w/ weird squarish looking characters.
As I said it would write DWORDs and not text, those squares are DWORD 0's.
so how do I write text???
You have to do a conversion to ascii,
.data
fmtstring db "%ld",0
.data?
textbuffer db 16 dup (?)
.code
; This line will convert a DWORD value to text and place it in textbuffer
invoke wsprintf,ADDR textbuffer, ADDR fmtstring ,number
.data
fmtstring db "%ld",0
.data?
textbuffer db 16 dup (?)
.code
; This line will convert a DWORD value to text and place it in textbuffer
invoke wsprintf,ADDR textbuffer, ADDR fmtstring ,number
whats number ???
my assembler (masm6.15) doesn't know what wsprintf is
Any DWORD Value, I haven't thought about how to integrate this into your program, just posted the command that you need to use to convert a numeric DWORD value into an ascii string so you can display it or write it to a file in a readable by humans format. The rest you really have to figure out yourself.
wsprintf is a Windows api command, it would be in your windows.inc or library files. If it doesn't recognize it amybe your lib has another function for it
wsprintf is a Windows api command, it would be in your windows.inc or library files. If it doesn't recognize it amybe your lib has another function for it
well Donkey,
I know I bothered you a lot... thanx for ALL the help :)
I hope I can get this done
I know I bothered you a lot... thanx for ALL the help :)
I hope I can get this done
one last question:
whats this: fmtstring db "%ld", 0
whats this: fmtstring db "%ld", 0
It just tells the wsprintf api call what the input format is for the conversion i.e
%ld = A long signed decimal integer
%ld = A long signed decimal integer
General advise:
I assume you should move "bufSize = ($ - buffer)" to right after the buffer, so you won't accidentally trash anything.
use 32-bit registers and data, 16bit stuff is slow in 32bit mode. Very important, make SURE your stack is 4byte aligned. This also means no pushing/popping of 16bit values. Many win32 functions will fail if stack is not 4byte aligned, especially NT doesn't like this.
(already mentioned), your push/pop are unbalanced.
Read up on 32bit assembly at www.madwizard.org, read up on win32 API.
Run app through debugger and make sure API return values etc are valid.
What's in irvine32.inc? And are you using the standard windows.inc (etc) files that are supplied with hutches masm32 package?
I assume you should move "bufSize = ($ - buffer)" to right after the buffer, so you won't accidentally trash anything.
use 32-bit registers and data, 16bit stuff is slow in 32bit mode. Very important, make SURE your stack is 4byte aligned. This also means no pushing/popping of 16bit values. Many win32 functions will fail if stack is not 4byte aligned, especially NT doesn't like this.
(already mentioned), your push/pop are unbalanced.
Read up on 32bit assembly at www.madwizard.org, read up on win32 API.
Run app through debugger and make sure API return values etc are valid.
What's in irvine32.inc? And are you using the standard windows.inc (etc) files that are supplied with hutches masm32 package?
already put the bufSize = ($-buffer) under... that not the prob :)
prob is, i'm a novice at asm... hahah :(
now, the Irvince32.inc is just a small including for that includes some constants so you don't have to type in for example:
.386
.model flat, stdcall
and makes some function calls easier
it includes other include files: smallwin.inc
this is masm6.15 which comes w/ the book: "Assembly using Intel" by Kip Irvine
prob is, i'm a novice at asm... hahah :(
now, the Irvince32.inc is just a small including for that includes some constants so you don't have to type in for example:
.386
.model flat, stdcall
and makes some function calls easier
it includes other include files: smallwin.inc
this is masm6.15 which comes w/ the book: "Assembly using Intel" by Kip Irvine