for me, or for you to explain.
Printable View
for me, or for you to explain.
How much do you really think we know about you and what your abilities are?
If you need to find some code to get an idea of where to start, then you need to scrape the web for it instead of asking us. Try looking at the code for these
http://code.google.com/search/#q=notepad%20replacement
http://sourceforge.net/projects/padpaper/
and you'll get an idea of how what you want to do is actually done. You might convince yourself to use something you found instead, too.
In general the more effort you put in the more help we can be.
I couldn't tell you much about assembly beyond the fact that you will find learning it more awkward than learning C. I could be wrong.
I also don't know anything about the windows console API (or whatever it's called), but it should not be much more (or less) complicated than curses. Like I said earlier, ncurses() is neat once you learn how to use it, and no doubt so are the other options. Pick which ever one you want. But you won't be finishing that up this evening.
Learning a basic Application Programming Interface is probably a good way to get experience and learn C at the same time. How much you'll have to struggle depends on how much you already know, but I really believe that you should be able to start tackling a console API not long after you get a grasp on datatypes and pointers.
And functions. Functions.
No, I know x86 assembly, I am wondering if it would be easier to explain how to edit text with it.
So would you be able to explain how then?
You can use the Windows API to move the console cursor.
Go to MSKnowledge Base and look up: SetConsoleCursorPosition(x,y).
Where x and y represent the the X and Y position, you want the cursor moved to.
Mixing C with assembly?
No, it's straight C, it just uses the Windows API (Application Program Interface).
You don't want assembly - oh! How you do *not* want assembly!! :)
No, but considering that both 68K and PDP-11 has generic "memory to memory" moves [and most other operations], and x86 hasn't, that would further extend the number of lines of code by some amount. For example, where in 68K you could do a memcpy() using this:
Yes, you can do that with rep movs if the registers are in the right place, but it is just ONE possible memory to memory operation - a common one, but there are plenty of places where copying stuff from a data structure to another data structure, for example, would require double the number of x86 instructions compared to the 68K instructions.Code:// assume A0 and A1 points to the memory to be copied, and D0 is the
memcpy:
move.b (a1)+, (a0)+
dbra d0, memcpy
ret
So a rough estimate would be that 7000 lines of 68K assembler turns into some 8500 lines of x86 assembler. Not bad, but a good bit of code to write if you are not used to write LARGE programs in assembler.
It is still MUCH easier to write this sort of thing in a language that has ready-made functions to do many string operations, output numbers in almost any format you like, etc, etc.
--
Mats
So what if you mix C and assembly so you could do it in the least possible time?