Search Results

Showing results 1 to 34 of 34
Search took 0.02 seconds.
Search: Posts Made By: dan63043
Forum: C 23 Days Ago
Replies: 1
Views: 219
Posted By dan63043
You thought that memset would put an integer 5 into each element of your array, but that isn't how it works. It is putting a 5 into each byte.

5*256*256*256 + 5*256*256 + 5*256 + 5*1 = 84215045
Forum: C 29 Days Ago
Replies: 6
Views: 291
Posted By dan63043
Someone who ignores sociopaths, once he knows who they are.
Forum: C 29 Days Ago
Replies: 6
Views: 291
Posted By dan63043
Because the OP created the arrays without a size.

You're the first one in this thread to be rude. Why drive off responders?
Forum: C 29 Days Ago
Replies: 6
Views: 291
Posted By dan63043
Well, just my two cents, I only lurk in these forums because I otherwise don't get enough practice at C, which will soon be a significant part of my job for the first time in many years.

First,...
Forum: Assembly 34 Days Ago
Replies: 3
Views: 704
Posted By dan63043
I missed the part about 80186, so it is probably DOS. If they type the number, getting it from standard input might be easiest, and ASCII/ANSI characters will be the input.

Here's some help on...
Forum: Assembly Nov 17th, 2009
Replies: 3
Views: 704
Posted By dan63043
How will the user enter the number?
Will you get it in ASCII?
What operating system?
Forum: C Nov 16th, 2009
Replies: 4
Views: 331
Posted By dan63043
Try: struct poly {
int len;
char *name;
int arr[];
};

BTW, your structure won't alway take up the same number of bytes. That might be fine for a particular situation.
Forum: Assembly Nov 12th, 2009
Replies: 2
Views: 491
Posted By dan63043
See if this helps:
http://www.arl.wustl.edu/~lockwood/class/ece291/books/CH20/CH20-3.html
Forum: C Nov 11th, 2009
Replies: 3
Views: 310
Posted By dan63043
You just use the command string as the argument, so (in unix) to delete "/mypath/myfile", you do:
system("/usr/bin/rm /mypath/myfile");
I tend to use the path when I know it, but:
system("rm...
Forum: C Nov 10th, 2009
Replies: 8
Views: 316
Posted By dan63043
Aha! We (other posters) made assumptions about the code, because we had only a snippet. Looking back at the error received by the original poster, I'd say Aia has hit the nail on the head.
Forum: C Nov 10th, 2009
Replies: 8
Views: 316
Posted By dan63043
There are a million ways to do anything in C, and I'm glad someone got it to compile. Personally, rather than:
struct RECORD *head=(struct RECORD*)malloc(sizeof(struct RECORD));
I would have done...
Forum: Assembly Nov 8th, 2009
Replies: 2
Views: 488
Posted By dan63043
The C compiler will cause the executable to save and restore certain registers before and after a call, but not others, so the point of this exercise must be to get you thinking along those lines. ...
Forum: Assembly Nov 7th, 2009
Replies: 6
Views: 712
Posted By dan63043
Ha! Isn't funny how we overlook the obvious? When you pointed DX at 0002, you forgot that your program actually loads at 0100. Just change
MOV DX,0002
to
MOV DX,0102

BTW, here's how...
Forum: Assembly Nov 7th, 2009
Replies: 6
Views: 712
Posted By dan63043
Hmmm... not a fasm user, so just some other observations. No org statement, or use 16 statement. Thought fasm syntax was a dollar symbol before hex numbers, but that may be optional. Some assemblers...
Forum: Assembly Nov 6th, 2009
Replies: 6
Views: 712
Posted By dan63043
Strange.

Presumably DOS, or you'd get nothing.

I notice the lack of a return statement. The control chars may appear at the beginning of the line, but that doesn't mean they were printed...
Forum: Assembly Nov 6th, 2009
Replies: 7
Views: 484
Posted By dan63043
I don't have an assembler on this box, so I wrote this in the old MS-DOS debug command. That's why it looks a little funny, isn't optimal, whatever, but hey, we're just making the best of a bad...
Forum: Assembly Nov 4th, 2009
Replies: 7
Views: 484
Posted By dan63043
A few items:

You XOR a DWORD with 0ffh, but you need to XOR each byte in the buffer, not some randomly chosen DWORD in memory.

So, point something at your buffer and XOR byte-wise for the...
Forum: Assembly Nov 4th, 2009
Replies: 7
Views: 484
Posted By dan63043
Goto http://cis.ysu.edu/~rick/class3714/ch5.html and search for OpenInputFile and you will find the three functions documented near one another.

I see that you need to use EAX after that first...
Forum: Assembly Nov 3rd, 2009
Replies: 1
Views: 622
Posted By dan63043
Ummm.... actually do your assignment for you? How about a little effort... or at least some idea why you are so completely stumped that you haven't generated any code.
Forum: Assembly Nov 3rd, 2009
Replies: 7
Views: 484
Posted By dan63043
Those functions could be in some library that I don't have, but perhaps writing those functions is the REAL assignment.

Could you give us some idea what assembler you use, on what operating...
Forum: C Oct 27th, 2009
Replies: 15
Views: 566
Posted By dan63043
I just can't bear the thought of deciphering what your variables represent. You need meaningful variable names.

Also, indent your control structures so that you know what is nested. (You may...
Forum: Assembly Oct 23rd, 2009
Replies: 2
Views: 323
Posted By dan63043
If memory serves, it could be any even address on the 16 bit processors. Of course, if you're running 16 bit code on a 32 bit processor, go with divisible by four.
Forum: C Oct 23rd, 2009
Replies: 2
Views: 424
Posted By dan63043
You need a terminating null character, \0. You could add it any number of ways. If you just change "for(i=0; i<n2; i++)" so that "i" goes from 0 to "n2" then it will copy the null at the end of the...
Forum: C Oct 22nd, 2009
Replies: 4
Views: 268
Posted By dan63043
You never initialize time1, time2, or time3. Perhaps they have random garbage that isn't less than 1. But then why print zero? I don't know, but I like to test values AFTER giving them a value. ...
Forum: C Oct 21st, 2009
Replies: 6
Views: 316
Posted By dan63043
I should also point out that having the function call itself repeatedly until you get proper user input is dangerous. If you really had wanted to force good input, then a while loop would be...
Forum: C Oct 21st, 2009
Replies: 6
Views: 316
Posted By dan63043
You are correctly putting a value in seed, but your function refuses to end until you get a good value. The caller, getInput(), never checks the result (which will always be true, as presently...
Forum: C Oct 21st, 2009
Replies: 6
Views: 316
Posted By dan63043
You can be sure that you are expected to do the if/else inside the function that gets the data. That is fairly standard practice, as it allows you to reuse the function to do validation in other...
Forum: Assembly Jul 16th, 2009
Replies: 8
Views: 1,368
Posted By dan63043
Thanks, NotNull, I overlooked the single-quotes.

So that let's us say exactly how the processor perceives this code, and having "defined" the variable within the code actually looks like:
mov...
Forum: Assembly Jun 15th, 2009
Replies: 2
Views: 684
Posted By dan63043
There must be no stack segment, that is the biggest problem I remember having with exe2bin.
Forum: Assembly Jun 15th, 2009
Replies: 3
Views: 557
Posted By dan63043
You will still use the x86 instructions on the other processors that you mentioned. So, those books may be useful. The real question for an x86 book is what operating system the examples were...
Forum: Assembly Jun 15th, 2009
Replies: 8
Views: 1,368
Posted By dan63043
deostroll,

I can see that you're doing this in DOS.

If your execution actually begins at "mov ax,3", then the "var db '$'" is executed next. $ is just a counter of the current program...
Forum: Assembly Dec 4th, 2007
Replies: 6
Views: 2,319
Posted By dan63043
My first thought was "Well, you're probably rebooting because of a triple-fault. Have you defined your interrupt descriptor table (IDT)?"

But now I really see the 7c00, and suppose you're writing...
Forum: Assembly Dec 3rd, 2007
Replies: 6
Views: 2,319
Posted By dan63043
Looked at Fine's stuff, good in itself, doesn't help you, though.

Here's from http://en.wikipedia.org/wiki/Protected_mode


; set PE bit
mov eax, cr0
or eax, 1
mov cr0, eax
Forum: Assembly Dec 3rd, 2007
Replies: 6
Views: 2,319
Posted By dan63043
As I recall, we sometimes needed to specify the jump to protected mode in a DB statement. Google for John Fine, he has something to get you over that problem, I think.
Showing results 1 to 34 of 34

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC