
Learning ASM/C
#1
Posted 09 September 2003 - 06:00 PM
as my AFX2.0 will be here in under a week and i want to program it in C or ASM, C is preferable
#2
Posted 09 September 2003 - 06:36 PM
#3
Posted 09 September 2003 - 08:30 PM
#4
Posted 10 September 2003 - 05:21 AM
What's the name of the topic ?Well i think that for learn assembler programmation, first you need to know the hardware of the calculator, maybe you can download the Mohamed's english traduction of an AFX document (made by Olivier COUPELON), see the topic in the main forum, also there is an introduction of how to use the C compiler in that document.

#5
Posted 10 September 2003 - 05:26 AM
So my advice is - look at all casio sites in search for games and programs that come with the source code (even I released some of it) and learn from it (eventhough some of them may be in terrible style).
As I remember: Mysterious island, older Touche, Highway, Cube3D, Scorch (not sure) and probably some more from the french.
If you don't know anything about C or ASM then first of all start programming in it on PC, when you will know how pointers, etc. work then switch to the calc.
BTW don't bother with C++ for the calc.
As usual I am a busy man so do not PM me, ask here at the forum.
Roeoender.
#6
Posted 10 September 2003 - 05:40 AM
What's the program ?If you don't know anything about C or ASM then first of all start programming in it on PC, when you will know how pointers, etc. work then switch to the calc.

#7
Posted 10 September 2003 - 07:18 AM
#9
Posted 10 September 2003 - 10:53 AM

#11
Posted 11 September 2003 - 06:42 AM

#12
Posted 11 September 2003 - 01:59 PM
Yes, My ISP had a problem that it solve quite !hmmm, i managed to download it perfectly, and straight awy
Thanks.

But at first where I input ASM/C Code ?thanks c@siomax, now i have two guides, which i can cross refernece between

#13
Posted 11 September 2003 - 08:30 PM
You know programming is a creative art, you cannot only ask how to do this and that, you have to think, and try to solve problems by yourself.
You can treat this message as a warning.
Roeoender.
#14
Posted 16 September 2003 - 03:14 PM
What about Visual C++ ?for C on the PC u will need visual C or Borland C, for a C compiler i have chosen Pacific C and Turbo C

#15
Posted 16 September 2003 - 04:41 PM
R.
#16
Posted 17 September 2003 - 09:44 AM
Only C !BTW don't bother with C++ for the calc.
Roeoender.

#17
Posted 17 September 2003 - 01:31 PM
In http://www.microsoft...?displaylang=en I only find "Visual C# .net"for C on the PC u will need visual C or Borland C, for a C compiler i have chosen Pacific C and Turbo C


#18
Posted 17 September 2003 - 05:10 PM
#19
Posted 20 September 2003 - 06:27 AM
Note that you can compile using another gui !! like context or vc++ 6, but you need turbo c to compile, and configure correctly your gui to launch tcc.exe using the correct arguments to build an exe file compatible with the calc

#20
Posted 20 September 2003 - 11:52 AM
could you please send me the source code?
#21
Posted 20 September 2003 - 12:36 PM
BTW C@asiomax probably didn't read all those threads about C++ here, I said that you can use C++ but it is simply unpractical.
Roe.
#22
Posted 20 September 2003 - 01:02 PM
void clrScreen(unsigned int seg)
{asm push es;
asm push ds;
asm push si;
asm push di;
asm mov ax,seg; //error: Expression sentax
asm mov es,ax;
asm mov di,0;
asm mov al,0;
asm cld;
asm mov cx,1024;
asm rep stosb;
asm pop di;
asm pop si;
asm pop ds;
asm pop es;}
I'm just trying to compile it and see if it works.

-----EDIT-----
ok, i figgured out its giving me an error every time ax is used, why?
#23
Posted 20 September 2003 - 01:07 PM
#24
Posted 20 September 2003 - 02:21 PM
BTW don't bother with C++ for the calc.
Roeoender.



C@siomax, Thank You !I'm sorry for replying so late, but C++ code works perfectly on afx2 .... look at mx3d or shadow world ... fully made in c++ !!
Note that you can compile using another gui !! like context or vc++ 6, but you need turbo c to compile, and configure correctly your gui to launch tcc.exe using the correct arguments to build an exe file compatible with the calc

#25
Posted 20 September 2003 - 02:29 PM
but isn't it speed we want? And isn't it compatibility you want? If you only use vc++ as compiler where is the sense? You
can even use an editor in this case. And @crimsons ... If you write your code this way why don'T you write directly
in assembler? Don't you know that c code is about 10 times as large as asm code (sometimes) and (nearly every time)
also 10 times slower? I don't understand how someone can write c code and says asm would be difficult. who does so
doesn'T program himself but only uses other libs since they MUST be written in asm in order to make them work with
the calc. And if you write those libs yourself you also can write your whole prog in asm and use asms advantages ...
(just my opinion)
#26
Posted 20 September 2003 - 02:53 PM
#27
Posted 20 September 2003 - 02:56 PM
You must define what segment (of what variable)
e.g.
MOV AX,seg dudum ;Moves segment of var dumdum to AX ...
#28
Posted 20 September 2003 - 02:57 PM
#29
Posted 20 September 2003 - 03:01 PM
refers to the segment the variable is stored in.
#30
Posted 20 September 2003 - 03:05 PM

#31
Posted 20 September 2003 - 03:33 PM
#32
Posted 20 September 2003 - 05:33 PM
As for huhn_m:
I don't believe you don't understand why people use ASM as a part of their programs.
Ok here is the story:
when you use a profiler on any program you will see that some parts of programs (like plotting a sprite, putting a pixel, clearing the screen) are, especially in games, called *very* often and thus the whole program's performance depends in about 70% on those tasks, so people try to code those strategic parts in the fastest language - machine language. Putting some parts of code as those "asm xxx" statements gives you *none* peantly comparing to externally compiled .asm file (acutally you can compile .c files via assembler).
Ofcourse it would be the best if everything was written in ASM (fastest and smallest code), but some other non performance-dependent tasks (like getting keyboard input from the user) can be written in easier to use and easier to read/maintain language (like C). I don't know how many programs you wrote, but please write 10 programs in ASM, don't look at them for a year and then return to them to modify some even simple part (I had to add changes to linl and txtview in this maner) - I am sure it will take you ages to understand what you have written year ago (unless for every line of code you write 2 of comments, but then why not write in C - less work).
My opinion and about 90% of the population of practical programmers (10% is even more lazy).
Roeoender.
#33
Posted 20 September 2003 - 05:41 PM
this isn't my code, its the code in scorch, I'm wondering how he got this to work in the first place...SEG is an assembler keyword (a directive to be exact) it simply gets the segment value of a variable that SHOULD be after it - so now you see why it caused the error - you treated seg as a variable when compiler interpreted is as a keyword and expected something more.
#34
Posted 20 September 2003 - 05:46 PM
but even in this version compiling ASM parts can produce some strange errors, so in his compiler it could be this way that the seg-variable hid (overlapped) the seg-asm-directive so everything was clear. It is common that some less important/external things are don in compilers in a crappy way (they quickly addapt huge parts of external source code etc.).
Congratulations in deciding to learn C/ASM programming - it is really worth the effort.
Roeoender.
#35
Posted 20 September 2003 - 05:50 PM

#36
Posted 21 September 2003 - 03:07 AM
As for huhn_m:
I don't believe you don't understand why people use ASM as a part of their programs.
I didn't say this ... read my post!
I said: *You must write main parts in asm*
and I said that if they can do this it should be no problem for them to write the whole prog in asm ...
As for huhn_m:
I don't believe you don't understand why people use ASM as a part of their programs.
Well sure i'm not as experienced as you are but i wrote at least 8 progs (including 3 completely rewritteln <{GNULINUX}> version wherer only 2 were released) and I looked at some code of my first <{GNULINUX}> release (03/2003) to look how I did sth there. And I must say I
could read it very well ... I only commented about every 20th line and there params used for macros and procs but I used
variables names that make sense and since I know how most commands work it is no problem for me to see what I've done.
Sure it will be a problem for someone who doesn't know my style ... But I think someone who can'T reread his own code
without commenting every line ... well ....
#37
Posted 21 September 2003 - 07:43 AM
Personnally I can avoid comments because of the structurated code I write now(not like bomberman), using structures and explicit names !! Non-programmers can understand my code very well !! But don't follow my example ... I add comments at the end coz I find it boring to explain ....

About asm stuf ... I fully agree with Roe !! Asm is indispensible to make a program running at a correct speed !! For example, I write many of my routines in C, but I take some time to translate them into asm


#38
Posted 21 September 2003 - 07:51 AM

#39
Posted 21 September 2003 - 08:05 AM
Mine "I don't believe..." sentence was not precise (my fault) it should be:If you write your code this way why don'T you write directly
in assembler? Don't you know that c code is about 10 times as large as asm code (sometimes) and (nearly every time)
also 10 times slower
>>I don't believe you don't understand why people use ASM as a part of their [C] programs,[and not write everything in ASM]. <<
You are still working on <{GNULINUX}> so you remember all the stuff, but ater <{GNULINUX}> write 6 more programs for the calc (and 5 more for PC) in a year and then return to your <{GNULINUX}>.
Ofcourse everyone has his times of fascination about ASM language, but someday he finds out that it is not needed (or even harmful) for some tasks.
Another quote from your post:
So 90% of all programmers programming for *NIX are not "real" programmers because they use system calls, libraries like curses, glibc, or maybe C++ are not "real" programmers because they use STL library, adn even C programmers use standard library so they are not real programmers. lol.I don't understand how someone can write c code and says asm would be difficult. who does so
doesn'T program himself but only uses other libs since they MUST be written in asm in order to make them work with
the calc.
I think that modern programming (sadly or not) is all about using libraries.
Ofcourse CASIO AFX is so simple you can do everyting on your own, but I wouldn't force everyone to do so (but ok, I do this way) and reinvent a wheel. And using someone elses code (if legal) doesn't mean that you're not a programmer, only if you steal someone elses code you're a lamer.
Agreed with C@siomax - I also use C for "prototyping"

Roeoender.
#40
Posted 21 September 2003 - 08:53 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users