- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 3
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
I spend copious amounts of time programming an operating system in assembly and C. When I'm not geeking out I read, listen to music, work, climb mountains and work towards running my own company.
- Interests
- Photography, mountain climbing, hiking
- PC Specs
- i5 @ 3.5GHz | 4GB RAM @ 2005MHz | 5850 @ 1200/850 1.7TB HDD space | Soundcardless :( Windows 7 | Ubuntu…
30 Posted Topics
Returning back to asm and coding in general, got an issue with what's probably an obvious mistake but I'm stumped non-the-less. [CODE='c']kputs("Testing");[/CODE] [CODE]; ; Print a single character to screen ; kputchar: ; assumes the register ax will contain the character to print mov edx, [SCREEN] ; edx = screen … | |
Re: I think you've misunderstood how modulus works, or maybe I've misunderstood you :P Basically in your x % y example, you are taking y away from x until x is less than y, then returning x. Example in C that I wrote a while ago: [CODE=c]int mod(int a, int b) … | |
Is there any documentation available on creating a dynamic voltage frequency scaling tool in C? I've been unable to find anything on Google and the only applications I seem to be able to find using DVFS are closed source. My preference would be for a Windows based system as that … | |
Just wondering how I can get the time the program was compiled into my code dynamically, I'm guessing it'll be through my makefile somehow but my Google-fu has failed today. Any help would be great! (GCC + make *only*) | |
Re: No. Go read an assembly book, produce some code and ask us where you need help. We don't simply give the code around here. | |
Re: You've used a finite loop which may make it appear that break is being called and that blink is only being called once, I.E. it'll loop 256 times and then come out of the for loop. I suspect you want something like this: [CODE]if (!(strcmp(userinput, led))){ //condition 1 for(;;){ //condition … | |
Re: You're not going to call your new line with that for loop. [CODE]for(i=0;i<10;i++) { for(j=0;j<i;j++) { printf("*"); } printf("\n"); }[/CODE] Will now give the output: [QUOTE]* ** *** **** ...[/QUOTE] So you now need to change the logic to add some spaces to make your * centre. I'll leave that … | |
Re: How are you compiling in GCC? That error usually comes from not supplying the required libraries at compile time. | |
Re: There are many ways to compile code on Windows similar to Linux. If you used an IDE on Linux, then Code::Blocks is a great suggestion, as is Visual C++. If you used the command line then you can install Mingw which is like GCC and works through the command line, … | |
Re: [B]>#define p printf >#define s scanf[/B] No. Just no. This is [I]really[/I] bad practise, not only should you avoid macros where possible, it's also generally a bad idea to rename functions, it reduces code readability and makes it harder for someone else to debug your code, on top of this … | |
Re: As odd as it sounds: [CODE]p = (p + 1) % 10; // works p = (p++) % 10; // doesn't work[/CODE] So if you want to get it all on a single line, do the the top line. | |
Re: Ok, first it'd help if I could understand your question (typing in proper English helps there). Assembly simply gets turned into machine code, which then controls the CPU, which in turn can control other hardware (not quite that simple, but we'll pretend it is). All machine code is is a … | |
Re: Like Adak said, all the compiler really does is convert your code into assembly (which is basically a set of mnemonics for binary). Any compiler worth its salt will optimise it to be the quickest: [CODE=C]p++;[/CODE] becomes: [CODE=ASM]inc eax[/CODE] Where as: [CODE=C]p += 1;[/CODE] would become (if the compiler didn't … | |
Re: I tried running your code, there are multiple issues with it but I'll just list the ones that jumped out to me and leave you to figure out the others. [Line 5] Change your char *ref[52] to be char ref[52], and every other line in your code that uses *ref[i] … | |
Re: You'll need to write your own data type to do this. There is also a library out there which can hold numbers up to a stupid amount, but I can't rememeber what it is called. If you have a search on Google I'm sure you'll find it. EDIT: Found it, … | |
I'm in the process of coding my own OS and right now I'm working on a stdio lib but was just wondering about fputs and how it should write to the screen, which would be a better approach? Making stdout a file descriptor and having puts call fputs with the … | |
Re: From the top... [Line 4] Why are you using a 2d array as well as a 1d array? [Line 12] Getting data 1 longer than the array (2 longer than you should be using seeing as the last value of a char array should be 0x00). [Line 19] Why are … | |
Re: Check your warnings. You'll almost certainly be getting them on every line that you've passed your buffer/token. Remove the & sign and it should work correctly. | |
Re: argv is for giving arguments to your program. You're wanting to return arguments so: [CODE]int main(int argc, char **argp) { // create a new 2D array to return value from int **ret; // dynamically allocate memory here (AKA malloc) // return our ret array }[/CODE] This should start you off … | |
Re: You might have better luck posting on the assembly board as opposed to the C board (unless you're wanting to do inline assembly, if that's the case PM me and I'll give you as much assistance as I can). A good place to start learning assembly is [url]http://forum.codecall.net/assembly-tutorials/[/url] specifically the … | |
Re: Using modulo you can generate a number up to pretty much anything: [CODE]int number = rand();[/CODE] generates a number between 0 and the max your system can handle (likely, 2^32 / 2). [CODE]int number = rand() % 6;[/CODE] generates a number between 0 and 5 (as 6/6 = 1 remainder … | |
Re: [CODE]int main(int argc, char **argp) { bool understood = false; do { read("http://www.daniweb.com/forums/thread78060.html"); // if you get the chance check who you're insulting here, too. } while(!understood); }[/CODE] | |
Re: Narue, out of interest what is the convention for this kind of thing? I just found [URL="http://www.cs.nyu.edu/exact/core/doc/stackOverflow.txt"]this link[/URL] which gives the specific sizes for each platform, I'm just intrigued as to why it has to be 2^16 minimum. | |
Re: As far as I'm aware, the reason people [I]used[/I] for( ; ; ) was due to being faster than while(1), although I believe any compiler worth it's salt these days will optimise while(1) to produce the same output as for( ; ; ). I think the reason people [I]still[/I] use … | |
I've never used inline assembly shockingly, and I'm just wondering how/if I can do something. Bit of background; I'm coding a basic OS kernel, I have various subroutines written in assembly and amongst others I have a puts subroutine that is an attempt at mimicking puts in C. In order … | |
Re: I'm not familiar with dynamic C, but assuming it's the Rabbit IDE, I'd recommend checking out the documentation [URL="http://www.rabbit.com/documentation/docs/manuals/DynCFunctionReference/index.htm"]here[/URL] if you haven't already. Assuming there is no initialisation required for printf then the code appears to be correct except that your main function should return an int: [CODE=C]int main(int argc, … | |
Trying to write a puts like subroutine in assembly but failing miserably. I'm using BIOS calls only (I.E. I'm not running another operating system). The code is using Intel syntax. What I have so far is: [CODE=asm]; [BITS 32] [GLOBAL hello_world_asm] ; ; a very basic puts function without the … | |
Finished writing this a little while ago but unfortunately the generated MD5 doesn't match other application's hashes. I have basically used [URL="http://en.wikipedia.org/wiki/Md5"]Wikipedia[/URL] for reference. I have a feeling my error is introduced in the padding stage but I can't be certain, hoping a fresh set of eyes could point out … | |
Hi there, I'm in the process of moving some code into Visual C++ 2008, the code works fine when compiled with Mingw however crashes when compiled with VC++: [CODE=c++] s_cell **cell; *cell = (s_cell *) malloc(sizeof(s_cell) * MAP_X); for(int loop = 0; loop < MAP_X; loop++) { cell[loop] = (s_cell … |