Fine, a new Pascal coder for AFX
![:)](/dot/public/style_emoticons/default/smile.png)
2. what libraries i must use if programming in turbo pascal 60? AFXTP 1.0 is not really documented, and its functions is not enough:(
Yeah, it's not really documented (I considered the the variable's and function's names as self explaining and also was too lazy to write a doc, sorry). But functions should be enough. There are different units implementing most stuff needed (e.g. AFXCRT implementing CRT functions, AFXSTDIO implementing standard I/O = readln/writeln, AFXGFX graphic routines, AFXTIME implementing timer support and so on).
First, for your bulls and cows - program, just unsert "uses afxcrt,afxstdio" as the first line. AFXCRT gives you the standard CRT functions "gotoxy", "clrscr" and so on as you know them from unit CRT (PC, DOS). And AFXSTDIO (implementing a wrapper) will establish standard in - and output variables automatically so you can use READLN and WRITELN commands in your program.
Then, after BEGIN of the main program (before the clrscr - command), call SETCRTMODE function. This will setup text mode, clear the screen and initialise various variables of AFXCRT - unit (it's needed to call SETCRTMODE once before using an AFXCRT - function).
That's it, your program should work fine then.
3. how change program if i want to define "Sgn" in a worked program dynamically, not as a constant?
As for SGN: just make it a variable if you want it's contents changing during runtime (Be aware that you need to change the line Numb = array[1..Sgn] of S; to Numb = array[1..MaxSgn] of S; then, and of course var i1,i2 : 1..Sgn; to var i1,i2 : 1..MaxSgn;, too). Then you can assign any values from 1 to MaxSgn to Sgn.
4. how to draw a buttons like in original casio addons? and how to use them, for example, to start a program from beginning or stop program execution?
If you want to draw buttons, you can use AFXGFX unit. On startup, just call SETGFXMODE(MODE_BW) for initializing BW, and SETGFXMODE(MODE_GREY) for grey scale mode. Then you can use all the functions like SETPIXEL, VLINE, HLINE, RECTANGLE, LINE, MOVETO, LINETO, FILLCIRCLE et.c. (I think this functions really are self explaining), there are also some more complex functions like drawing bitmaps na dpage flipping.
5. is there any guides about programminf for afx in turbo pascal?
Well, none that is especially for pascal, but it works in pascal the same way as for any other language. I'd advise you to read Oliver Coupelons's Programming Guide (see algebrafx2.earthforge.com).
so can anyone help me with writing some short procedures in assembler to use they in my program? I wrote they in pascal but this is not optimal for speed. and I don't know how to use the inline assembler:(
As Orwell said, you really don't need it, not for that kind of game at least. Pascal is fast enough, cause the AFX' CPU executes the compiled program directly (not like the the Casio Basic Programs). Even if you'd rewrite the program completely in ASM, you'll not notice _any_ difference in speed. In general, only very computing intensive routines (e.g. graphic routines, see AFXGFX source) or hardware stuff should be written in ASM, the whole rest in a High Level Language (--> even very complex games are written in C or Pascal, not Assembler).
But if you want to use inline assembler in spite of, you can do it with that like statements in Turbo Pascal:
asm
mov ax,123
...
end;
also I need to know how to process interrupts if I intercept them
If you use unit AFXSYS in your program, you can access the interrupt vectors directly by INTVECTS arrays. If you want to install an own interrupt handler (e.g. timer interrupt $1C), store the old value of INTVECTS[$1C] to restore it later, then write the adress of your handler (wich must be an interrupt procedure) to INTVECTS[$1C].
procedure myhandler; interrupt;
begin
...
end;
var oldhandler: pointer;
begin
oldhandler := intvects[$1C];
intvects[$1C] := myhandler;
...
intvects[$1C] := oldhandler;
end.
That's it. What the MYHANDLER procedure does is upon yours then.