0 Members and 4 Guests are viewing this topic.
:.ATILMAP:[11111111111111111111→GDB1:[10001000000000000001:[10000100000000000001:[10000001000000000001:[10000000001000000001:[10001000000000000001:[10000010000000000001:[10000000000000000001:[10010000000000000001:[10100000000000000001:[10000000000000000101:[11111111111111111111:[55AA55AA55AA55AA→Pic1:[FFFFFFFFFFFFFFFF:0→S→D→U:ClrDraw:sub(DS):Repeat getKey(15):If D<40 and getKey(1):20+D→U:End:If D≠0 and getKey(4):D-20→U:End:S+(S<4 and getKey(3))-(S≠0 and getKey(2))→T:If D≠U or (S≠T):U→D:T→S:ClrDraw:End:sub(DS):End:Return:Lbl DS:For(Y,0,7):For(X,0,11):{Y*10+X+GDB1+D+S}→A:Pt-On(X*16,Y*8,A/16*8+Pic1:Pt-On(X*16+8,Y*8,A^16*8+Pic1:End:End:DispGraph
:If D<40 and getKey(1):20+D→U:End:If D≠0 and getKey(4):D-20→U:End
:If D<40 and getKey(1):10+D→U:End:If D≠0 and getKey(4):D-10→U:End
:.ATILMAP:[11111111111111111111→GDB1 .Data Map size is 20 tiles (half-bytes aka nibbles) wide by 12 tiles high.:[10001000000000000001 .The height of the displayed map is 8 tiles. this means the maximum:[10000100000000000001 . vertical offset is 4 tiles. since each row is 20 tiles, the maximum vertical offset is 80.:[10000001000000000001 . the width of the displayed map is 12 tiles. this means the maximum horizontal offset is:[10000000001000000001 . 8 tiles.:[10001000000000000001:[10000010000000000001:[10000000000000000001:[10010000000000000001:[10100000000000000001:[10000000000000000101:[11111111111111111111:[55AA55AA55AA55AA→Pic1:[FFFFFFFFFFFFFFFF:0→S→D .OFFSETS - S = horizontal scroll, D= vertical scroll:ClrDraw:Repeat getKey(15):If D<80 and getKey(1) .80 is the maximum vertical offset:20+D→D:End:If D≠0 and getKey(4) .0 is the minimum vertical offset, naturally.:D-20→D:End:S<8 and getKey(3)-(S≠0 and getKey(2))+S→S .8 is the maximum horizontal offset:For(Y,0,7:For(X,0,11:Pt-Off(X*8,Y*8,sub(GN,Y*20+X+D+S)*8+Pic1 .Y*20+X+D+S is a nibble in the tilemap:End:End:DispGraph:End:Lbl GN:{r1/2+GDB1}→T .Divide the nibble by two to find the correct byte in the tilemapIf r1^2 .If the byte in the tilemap isn't divisible by twoT^16:Else .Return the low nibble of the byte. ElseT/16:End .Return the high nibble of the byte.
:FnOff:Repeat getkey(15)::Pause 7 ;Long pause:For(A,0,15):End ;Fine tuning::DispGraphr:End
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.