0 Members and 1 Guest are viewing this topic.
the subroutine GN definitely returns a 0 or a 1, based on the tile in the tilemap. could you post some code? and yes, the way grayscale is made is turning pixels on and off very quickly. so when you do DispGraphr, you actually turn on a checkerboard pattern on the backbuffer, and then the next time you call it the checkerboard pattern is shifted, making the appearance of gray. you probably see the checkerboard because the screen is not updating quickly enough. you could put an If getKey(0) around the part where you draw the tilemap to remedy this.
GN does not explicitly return 1 or 0, it returns the half byte tile 0-F (0-15 in decimal). Although personally, I don't like that routine since there is no X and Y its usage is confusing.If you want a solid gameboy gray, you have to turn interrupts off for the entire code and you also need to make sure to adjust the pause time in between each DispGraph to the perfect amount. It will take some tuning since every display is different unfortunately. For me, I have a TI-84 Plus K-0108H and my perfect gray setting is this:Code: [Select]:FnOff:Repeat getkey(15)::Pause 7 ;Long pause:For(A,0,15):End ;Fine tuning::DispGraphr:EndBy perfect, I mean like a gameboy, not even one of those slowly scanning lines that moves diagonally from one side to the other, I mean literal gray. The pause times will of course have to be different depending on how much other code you have in your loop.
:FnOff:Repeat getkey(15)::Pause 7 ;Long pause:For(A,0,15):End ;Fine tuning::DispGraphr:End
:.ATILMAP:[11111111111111111111→GDB1:[10001000000000000001:[10000100000000000001:[10000001000000000001:[10000000001000000001:[10001000000000000001:[10000010000000000001:[10000000000000000001:[10010000000000000001:[10100000000000000001:[10000000000000000101:[11111111111111111111:[55AA55AA55AA55AA→Pic1:[FFFFFFFFFFFFFFFF:0→S→D:ClrDraw:ClrDrawr:Shade(48):FnOff:Repeat getKey(15):If D<80 and getKey(1):20+D→D:End:If D≠0 and getKey(4):D-20→D:End:S<8 and getKey(3)-(S≠0 and getKey(2))+S→S:Pause 7:sub(DS):DispGraphr:End:Return:.Drawing sub:Lbl DS:ClrDraw:ClrDrawr:For(Y,0,7):For(X,0,11):sub(GN,Y*20+X+D+S)→W:!If W:Pt-Off(X*8,Y*8,sub(GN,Y*20+X+D+S)*8+Pic1):End:Pt-Off(X*8,Y*8,sub(GN,Y*20+X+D+S)*8+Pic1)r:End:End:.Extraction:Lbl GN:{r1/2+GDB1}→A:If r1^2:A^16:Else:A/16:End