Jump to content



Photo
- - - - -

Grayscale


  • Please log in to reply
16 replies to this topic

#1 Endi

Endi

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Wroclaw, Poland

  • Calculators:
    AFX 2.0 PLUS

Posted 10 June 2003 - 01:34 PM

I've seen a lot of asm games on AFX with grayscale (Fall down, S-Bomber).
Does anyone can tell me how to do it (special calc abilities or simple screen page-flipping)?

#2 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • 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 10 June 2003 - 04:31 PM

It is screen page flipping. You can set the screen to redraw 3 pages.
To see how to do this I recommed you the "La Graph100 second edition" (in french) simply
search for it with google.

If i remember right killer wanted to translate it. Didn't he :-).

#3 Roeoender

Roeoender

    UCF ASM/C Programming Only Winner

  • [Legends]
  • PipPipPipPip
  • 273 posts
  • Gender:Male
  • Location:Gdynia, Poland
  • Interests:Technical University student (informatics)
    Interests:
    Sport climbing
    Orieenting (100km walk in 23h31min)
    C/Asm on calculators

    Dislike cars

  • Calculators:
    CASIO AFX 2.0 ROM 1.01, 10 countable fingers

Posted 10 June 2003 - 04:44 PM

Something more:
Yes it is done by page flipping, but flipping is done by the hardware - you simply write a special value to port 02h to set LCD to this mode (there are several modes - they differ with pixel layout order in the memory) - there are problems because AFX with ROM ver 1.01 has smoother greyscale mode that doesn't work as nice on other ROMs.

And yes - KILLER83Z promised that with his beautiful and fluent knowledge of french he WILL certenly translate it. :greengrin:

Roeoender.

#4 Endi

Endi

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Wroclaw, Poland

  • Calculators:
    AFX 2.0 PLUS

Posted 10 June 2003 - 05:33 PM

Thx.
I agree, that french language is beautiful and very attractive to everybody. (It's amazing, that they seem not to take care about common users) :P

What is the special value a have to set? I don't want to wait for KILLER83Z :huh:

#5 Killer83Z

Killer83Z

    Casio CEO

  • [Legends]
  • PipPipPipPipPipPip
  • 427 posts
  • Location:I'm near to the place where I study
  • Interests:Guitar, Piano, Music, UCN<br />

  • Calculators:
    Algebra FX2.0, CFX-9850G, fx-7000G, fx-7500G, TI-83, HP100lx

Posted 10 June 2003 - 06:57 PM

You know the problem isn't waiting for me. But for the translation...eventually I will someday get up to learn ASM on the calculator. But that is a story long, long ago, in a galaxy, far, far away.

Greetings to ROEOENDER!!! (Yay, an opportunity to spell the name I learned)

#6 Swifter

Swifter

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 11 June 2003 - 06:36 AM

you can download my librairie Db-Lib.h ( http://team.graph100.com )...
there are many fonctions and exemples to do grayscale
( but comment are in french... )

#7 Endi

Endi

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Wroclaw, Poland

  • Calculators:
    AFX 2.0 PLUS

Posted 14 June 2003 - 09:53 AM

Thanks, it's great. I think I understood these comments.
Now I can make my big project :)

Is it normal, that when I want to shut the calc (shutcalc()) in 0xdb mode and then turn it on, evrything goes crazy and I have to reset it?

#8 Swifter

Swifter

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 14 June 2003 - 10:26 AM

yes it's normal...
when you turn on your calc, the mode is always in c3 mode.
so, after shutcalc() you must use "mode(0xdb);"...
for exemple, if you want shut the calc with F6, it's ->

if (testkey(6,10))
{
  shutcalc();
  mode(0xdb);
}


#9 Exca

Exca

    Casio Addict

  • Members
  • PipPipPip
  • 77 posts

Posted 14 June 2003 - 02:08 PM

I'm trying to get the calc to display all 4 possible "colors" with this code:
#include <DB-lib.h>

main(){
 int x=0;
 mode(0xdb);
 clear3(SEG1);
 contrast(15);pxl(1,x,1,SEG1);
 pxl(1,x+1,1,SEG1);
 pxl(1,x+2,2,SEG1);
 pxl(1,x+3,3,SEG1);
return 0;
}
The 4 pixels are displayed correctly but it has some odd graphic errors, it looks like the seg1 wouldn't be empty and if I press exe the graphical errors change a bit until I press the exe third time and after that there's a image of penguin :) (propably on seg5 or 6)

How to make it display only the 4 pixels I want to see?

#10 Swifter

Swifter

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 14 June 2003 - 04:03 PM

"colors" possibles are :
white : 0
black : 1
grey : 2
invert pixel : 3
I think you use wrong value... and the x coord is in first
#include <DB-lib.h>

main(){
int x=0;
clear3(SEG1);
db_on();
pxl(x,1,0,SEG1);
pxl(x+1,1,0,SEG1);
pxl(x+2,1,1,SEG1);
pxl(x+3,1,2,SEG1);
waitkey(0x7F,0x7FF);
db_off();
return 0;
}

try that

#11 X-thunder28

X-thunder28

    Casio Freak

  • Members
  • PipPipPipPip
  • 192 posts

  • Calculators:
    2 Graph100 (rom 1.02 and rom 1.03 (+) )

Posted 15 June 2003 - 07:06 AM

with interrupts I have displayed 4 grey colors(white, light grey,dark grey, black) with only 2 video buffer!
But this technique don't work on all rom and that have a stroboscop effect :lol:

#12 Exca

Exca

    Casio Addict

  • Members
  • PipPipPip
  • 77 posts

Posted 15 June 2003 - 03:30 PM

One other thingie.

I draw all the graphics to SEG2 and then move that to SEG1 (to display a frame immediatly) and then I clear SEG2 and start drawing second frame, for some reason this makes the black pixels look just like the grey pixels. Should I draw to 2 segs and then change the current segment instead of copying em?

#13 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1564 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Alternative states of consciousness, programming, making things work the best they possibly can.

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 16 June 2003 - 12:10 AM

Yes you should just change the current buffer address instead of copying a whole buffer, this would be much faster (this technique is called 'page flipping' instead of 'double buffering' when you copy).

#14 Swifter

Swifter

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 16 June 2003 - 06:29 AM

use SEG1 and SEG3 for draw yours graphics in grayscale...
SEG2 is "useless" but it must stay cleared...
if you want draw a picture with grey ->
unsigned char pic1[1024]={ ..,..,..,.., };
unsigned char pic2[1024]={ ..,..,..,.., };

main()
{
  clear3(SEG1);
  db_on();
  desactint9();
  drawpict(pic1, SEG1);
  drawpict(pic2,SEG3);
  emptykey(); 
  waitkey(0x7F,0x7FF);
  emptykey();
  clear3(SEG1);
  db_off();
  actint9();
}

On pic1, grey is black and on pic2 grey is white...

#15 Endi

Endi

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Wroclaw, Poland

  • Calculators:
    AFX 2.0 PLUS

Posted 16 June 2003 - 11:23 AM

One thing more: I tried to use d16clip_* functions with C++. When I installed it to my calc it had a problem with putting a cut part of a sprite at the top border of the screen. It accesses to SEG4 and tries to draw sth there (but incorrectly). All the other borders worked correctly.
I tried to use SEG6 instead of SEG4. It works and doesn't make direct complications, but it still throws whole sprite out of the screen instead of e.g. one line. It shouldn't be like that.
It's strange, because the example of d16clip I have works perfectly.
(I have AFX PLUS, ROM 1.03)

#16 Swifter

Swifter

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 17 June 2003 - 11:44 AM

hum...
send me your code and your program...
-> swifter68 AT hotmail.com

#17 Endi

Endi

    Casio Addict

  • Members
  • PipPipPip
  • 74 posts
  • Location:Wroclaw, Poland

  • Calculators:
    AFX 2.0 PLUS

Posted 17 June 2003 - 01:11 PM

ok.

BTW: I made two similar programs for making 8x8 and 16x16 sprites for your db-lib.

Download here

Maybe you find them useful.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users