Jump to content



Photo
- - - - -

Error in Casio2.h???


  • Please log in to reply
2 replies to this topic

#1 huhn_m

huhn_m

    Casio Maniac

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 29 December 2002 - 09:24 AM

It seems as if the tstpixel routine doesn't work!

I used the folowing code:
#include "stdio.h"
#include "casio2.h"
void main(void)
{
        int result1;
        setpage(0);
        clearpage(0);
        setbpix(1,1,0);
        result1 = tstpixel(1,1,0);
        if (result1 == 1)
        {
                printf("tstpixel OK!");
        }
        else
                printf("ERROR!");
        waitakey(K_F6);
}

and uploaded it. The calc showed ERROR! (as expected!) i need this function
for a program I'm currently working on.

Here is the code of setbpix & tstpix (cut out of casio2.h)

void setbPix(short x,short y,short page){ //Superna
asm{
	mov cx,page  //numero de page   //4
	shl cx,6     //multiplication par 64 //2
	add cx,0x1a20  //ajout de la page 0  //2
	mov es,cx  //on le met dans es    //2
	mov si,64
	mov cx,128
	sub si,y //On copie y   //4
	sub cx,x //On copie x   //4
	mov bx,cx //On en fait une copie  //2
	and cx,7 //Reste de division par 8 dans cl //2
	shr bx,3 //on divise par 8 //3
	shl bx,6 //On multiplie par 64  //2
	add si,bx //On ajoute le tout a si //1
	mov ch,1   //On met le state    //2
	shl ch,cl     //on le deplace selon cl //3
	or es:[si],ch}}; //On l'applique a l'octet //7// Remet le byte

char tstpixel(int X, int Y,int page) { //Teste un pixel et retourne 0 ou 1//Superna&Whyp
asm {	mov cx,page  //numero de page   //4
	shl cx,6     //multiplication par 64 //2
	add cx,0x1a20  //ajout de la page 0  //2
	mov es,cx  //on le met dans es    //2
	mov si,64 //on met 64
	mov cx,128 //on met 128
	mov si,Y //On enleve y   //4
	mov cx,X //On enleve x   //4
	mov bx,cx //On en fait une copie  //2
	and cx,7 //Reste de division par 8 dans cl //2
	shr bx,3 //on divise par 8 //3
	shl bx,6 //On multiplie par 64  //2
	add si,bx //On ajoute le tout a si //1
	mov al,es:[si];
	ror al,cl;
	and al,1; }
return _AL; }

There seems to be no difference between the version 2.0 and the 2.01
in these routines.

Has anyone an idea how to fix this problem???

Thanx

@SuperNA

The CDK is no longer downloadable on you site!

#2 superna

superna

    Casio Addict

  • Members
  • PipPipPip
  • 88 posts

Posted 29 December 2002 - 03:29 PM

ah
i didn't know this function was not working
i'm so sorry
i fixed all the functions but i've not tested this one !
i know for CDK, the server has chage and doesn't accept external downloads
i'll put it onto my website the fastest I can do !
i'll try to discover the erroer
i already correcfted setpix setbpix and setwpix and setdate but it seem there is an error
sorry
i'll post here the corrected version

#3 superna

superna

    Casio Addict

  • Members
  • PipPipPip
  • 88 posts

Posted 29 December 2002 - 03:30 PM

i think it's the same old setpix problem
try this :
char tstpixel(int X, int Y,int page) { //Teste un pixel et retourne 0 ou 1//Superna&Whyp
asm { mov cx,page  //numero de page   //4
shl cx,6     //multiplication par 64 //2
add cx,0x1a20  //ajout de la page 0  //2
mov es,cx  //on le met dans es    //2
mov si,64 //on met 64
mov cx,128 //on met 128
sub si,Y //On enleve y   //4
sub cx,X //On enleve x   //4
mov bx,cx //On en fait une copie  //2
and cx,7 //Reste de division par 8 dans cl //2
shr bx,3 //on divise par 8 //3
shl bx,6 //On multiplie par 64  //2
add si,bx //On ajoute le tout a si //1
mov al,es:[si];
ror al,cl;
and al,1; }
return _AL; }

this must work now
<_<




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users