Author Topic: Greyscale Pictures  (Read 20579 times)

0 Members and 1 Guest are viewing this topic.

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Greyscale Pictures
« on: February 08, 2011, 11:58:37 pm »
I am a noob at Axe Parser, and would like some advice regarding greyscale pictures. I have done the following code:
Code: [Select]
.EVERYDAY the Same Dream
ClrDraw
DiagnosticOff

GetCalc("appvSC",1*1536)→P
.Scene2
[000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
00001FF00000000000000000
000010100000000000000000 //This is where the problem is
000010100000000000000000
000010100000000000000000
000010100000000000000000
000010100000000000000000
00001FF00000000000000000
0000000003FFF00000000000
0000000003FFF00000000000
0000000002001003F0000000
0000000002001003F0000000
0000000002001003F0000000
0000000002001003F0000000
000000000200100000000000
000000000200100000000000]→Pic1
[FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFF80403FFFF
FFFFFFFFFFFFFFF80403FFFF
FFFFFFFFFFFFFFF80403FFFF
FFFFFFFFFFFFFFF80403FFFF
FFFFFFFFFFFFFFF80402007F
FFFFFFFFFFFFFFF81402007F
FFFFFFFFFFFFFFF80402007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE007F
FFFFFFFFFFFFFFFFFFFE017F
FFFFFFFFFFFFFFFFFFFE017F
FFFFFFFFFFFFFFF80402017F
FF80200FFFFFFFFAAC0A017F
FF80A80FFFFFFFF80402007F
FF80200FFFFFFFFBF402007F
FF80200FFFFFFFFBF402007F
FF80200FFFFFFFFBF402007F
FF80200FFFFFFFFBF402007F
FF80200FFFFFFFF80402007F
FF80200FFFFFFFF80402007F]→Pic2

Copy(Pic1,P,768)
Copy(Pic2,P+768,768)

GetCalc("appvSC")→P
Copy(P,L₆,768)
Copy(P+768,L₃,768)
Repeat getKey(15)
DispGraphr
End

The place where the problem is is marked. Can somebody please examine this code and tell me what is going wrong? The error is "bad number". The hex was created using sourcecoder with a 96*31 picture with 3 greyscale colors.
Anonymous Legend

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Greyscale Pictures
« Reply #1 on: February 09, 2011, 12:00:50 am »
Ah, I am not sure, but does all of the hex need to be on one line? Like, instead of:
Code: [Select]
...
FF80200FFFFFFFFBF402007F
FF80200FFFFFFFFBF402007F
...
put all the hex on one line:
Code: [Select]
...FF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007F...

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #2 on: February 09, 2011, 12:51:16 am »
This is the new code I have. I'm getting an error with the Pic1.
Code: [Select]
.EVERYDAY THE SAME DREAM
ClrDraw
DiagnosticOff

GetCalc("vSC",1*1536)→P
GetCalc("vP1",1536)→Pic1
GetCalc("vP1",1536)→Pic2
[0]→Pic1
[0]→Pic2
Fill(Pic1,1536)
Fill(Pic2,1536)
.Scene2
[00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001FF0000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001FF000000000000000000000000003FFF000000000000000000003FFF000000000000000000002001003F00000000000000002001003F00000000000000002001003F00000000000000002001003F0000000000000000200100000000000000000000200100000000000]→Pic1
[FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFF81402007FFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFF80402017FFF80200FFFFFFFFAAC0A017FFF80A80FFFFFFFF80402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFF80402007FFF80200FFFFFFFF80402007F]→Pic2
conj(Pic1,P,768)
conj(Pic2,P+768,768)

GetCalc("vSC")→P
conj(P,L₆,768)
conj(P+768,L₃,768)
Repeat getKey(15)
DispGraph
End
« Last Edit: February 09, 2011, 12:51:40 am by ikemike »
Anonymous Legend

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #3 on: February 09, 2011, 01:05:23 am »
My new code:
Code: [Select]
.EVERYDAY THE SAME DREAM
ClrDraw
DiagnosticOff

GetCalc("vSC",1*1536)→P
.Scene1
[00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001FF0000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001FF000000000000000000000000003FFF000000000000000000003FFF000000000000000000002001003F00000000000000002001003F00000000000000002001003F00000000000000002001003F0000000000000000200100000000000000000000200100000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFF81402007FFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFF80402017FFF80200FFFFFFFFAAC0A017FFF80A80FFFFFFFF80402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFF80402007FFF80200FFFFFFFF80402007F]→P
conj(P,L₆,720)
conj(P+720,L₃,720)
Repeat getKey(15)
DispGraph
End
Anonymous Legend

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Greyscale Pictures
« Reply #4 on: February 09, 2011, 01:07:05 am »
Why are you copying only 720 bytes?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Ikkerens

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 378
  • Rating: +28/-9
  • JavaScript Magician
    • View Profile
    • Walotech
Re: Greyscale Pictures
« Reply #5 on: February 09, 2011, 02:57:29 am »
Such arrays are stored in a different way in axe, you might want to look at this:

Code: (Axe) [Select]
[FFFF->Pic1
[FFFF
[FFFF
[FFFF
[0000->Pic0
[0000
[0000
[0000
« Last Edit: February 09, 2011, 03:36:18 am by Ikkerens »

Splut for Android [----------]
Paused/halted indefinitely, might be abandoned, our graphic designer quit and the rest of us simply doesn't have the time to work on it...

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Greyscale Pictures
« Reply #6 on: February 09, 2011, 03:51:14 am »
^^ He's right.
I'm not a nerd but I pretend:

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Greyscale Pictures
« Reply #7 on: February 09, 2011, 07:22:43 am »
He's only copying 720 bytes since his picture doesn't take up the whole screen (What are the dimensions of your pic btw? If the length is less than 96 it could get a little messy)
Anyway, if you want to put the pic data into the appvar, you'd have to do something like...
Code: [Select]
GetCalc("appvSC",1536)->P
Copy([Hex],P,720*2)
Copy(P,L6,720)
Copy(P+720,L3,720)
Repeat getKey(15)
Dispgraphr
End
But there's not really a point to putting it into an appvar anyway since it's stored in the program...so
Code: [Select]
[Hex]->Pic1
Copy(Pic1,L6,720)
Copy(Pic1+720,L3,720)
Repeat getKey(15)
Dispgraphr
End
« Last Edit: February 09, 2011, 07:23:52 am by squidgetx »

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #8 on: February 09, 2011, 05:58:08 pm »
These pictures are 96*31. I have figured out, since the actual image is fine, it's just the area it doesn't cover that glitches, that I can just put a black rectangle where the glitches are.

By the way, is there a fast way to display a non 96*64 picture on a different part of the screen?
Anonymous Legend

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Greyscale Pictures
« Reply #9 on: February 09, 2011, 08:32:01 pm »
You could try sprites but I do not know if Axe can make odd sized pictures.

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #10 on: February 09, 2011, 08:39:07 pm »
Is there a way to have sprites simply go on top of the background, and not disturb the background itself? In BASIC, you always had to compensate the sprite's movement by replacing the pixels behind it. Does Axe have a simpler way? Or is it the same as BASIC, and will I have to reload the background back onto the screen every time my sprite moves?

By the way, the sprite is greyscale.
Anonymous Legend

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Greyscale Pictures
« Reply #11 on: February 09, 2011, 08:41:26 pm »
The sprite automatically overwrites the background, I think, unless you choose some other logic method. And you will need to reload the image, I think.

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #12 on: February 10, 2011, 01:22:10 am »
I am having another problem. Why does this not display the two pictures in succesion after pressing 2nd?
Code: [Select]
.EVERYDAY EVERY DAY THE SAME DREAM
ClrDraw
DiagnosticOff

GetCalc("vSC",2*1536)→P
.Scene2
[00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001FF0000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001010000000000000000000001FF000000000000000000000000003FFF000000000000000000003FFF000000000000000000002001003F00000000000000002001003F00000000000000002001003F00000000000000002001003F0000000000000000200100000000000000000000200100000000000]→Pic1
[FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80403FFFFFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFF81402007FFFFFFFFFFFFFFFF80402007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE007FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFFFFFFE017FFFFFFFFFFFFFFFF80402017FFF80200FFFFFFFFAAC0A017FFF80A80FFFFFFFF80402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFFBF402007FFF80200FFFFFFFF80402007FFF80200FFFFFFFF80402007F]→Pic2
conj(Pic1,P,768)
conj(Pic2,P+768,768)
.Scene1
[0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007FFC00000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000400400000000000000000000520400000000000000000000731C00000000000000000000731C00C00000000000000000731C00C00000000000000000731C00C00000000000000000731C00C00000000000000000610400D00000060000000000400400DC0000060000000000400400FC0000060000000000400400FC0000060000000000400400FC000006000000000F540400FC000006000000000F760400FFFFFFFE000000000F7FFC00]→Pic3
[FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFFFFFFFFFFFFFFFFFFF8080FFC007FFFFFFFFFFFFFF8080FFFB5FFFFFFFFFFFFFFF8080FFF207FFFFFFFFFFFFFF8080FFFF1FFFFFFFFFFFFFFF8080FFFF1FFFFFFFFFFFFFFF8080FFFF1FFFFFFFFFFFFFFF8080FFFF1FFFFFFFFFFFFFFF8080FFFF9FFFE0FFFFFFFFFF8080FFFFDFFFD8000007FFFF8080FFFFFFFFDC7FFFFFFFFF8080FFFFFFFFFC7FFFFFFFFFFFFFFFFF07FFFC7FFFFFFFFFFFFFF9FF8FFFFC7FFFFFFFFFFFFFFFFF8FFFFC7FFFFFFFFFFFFFFFFF8FFFFFFFFFFFFFFFFFFFFFFFFFFF]→Pic4
conj(Pic3,P+(768*2),768)
conj(Pic4,P+(768*3),768)

For(Z,0,1)
conj(P+(Z*1536),L₆,768)
conj(P+(Z*1536+768),L₃,768)
ref(0,32,96,33)
Repeat getKey(54)
DispGraph
End
End
Anonymous Legend

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Greyscale Pictures
« Reply #13 on: February 10, 2011, 01:52:39 am »
By any chance, does pressing [2ND] for the first time end the program?
If so, then adding a
Code: [Select]
While getKey(0)
    DispGraphr
End
after your first Repeat loop might help.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline ikemike

  • LV3 Member (Next: 100)
  • ***
  • Posts: 67
  • Rating: +4/-0
  • Hmm.
    • View Profile
Re: Greyscale Pictures
« Reply #14 on: February 10, 2011, 07:33:53 am »
Thanks. I forgot that Axe is 9001% faster than BASIC. =)
Anonymous Legend