Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I have been trying to write a routine to display sprites on the ti-84+.

I am trying to do it by accessing the LCD screen hardware port itself.

Here is the most recent attempt. It does create some cool affects though, even if it doesn't work:


Code:

Draw:
   ld (Temp),hl
   ld d,h
   ld e,l
   push hl
   ld de,0
   ld a,$80
   out ($10),a
Draw_Main:
   pop hl
   inc hl
   ld a,l
   out ($10),a
   push hl
   ld hl,(Temp)
   inc de
   add hl,de
   ld a,(hl)
   out ($11),a
   ld a,0
   ld e,a
   cp 8
   jr z,Draw_Quit
   jr nz, Draw_Main
Draw_Quit:
   ret



This is sadly, the worst try out of the bunch.

But my idea is as follows:

1. load x,y coords
2. load sprite
3. load 0 into reg de
3.5 Main
4. add de to hl (containing sprite) to grab next line
5. display line of hl
6. increment de
7. test if we have hit 8 lines, if so exit
8. if not, increment y coords
9. go back to Main
9.5 Exit
10. return

Granted knowing me, I have learned z80 asm 100% wrong and should give up.

Another attempt:

Code:

Draw:
   ld a,$20
   inc a
   out ($10),a
   ld a,$80
   inc a
   out ($10),a
Draw_Main:
   ld a,(hl)
   out ($11),a
   inc bc
   add hl,bc
   inc e
   ld e,a
   cp 8
   jr z,Draw
   jr nz,Draw_Quit
Draw_Quit:
   ret


I am trying to get this code, but universal and using a loop:

Code:

Draw_Drone:
   ld a,$20
   inc a
   out ($10),a
   ld a, %00000000
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %00011000
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %01111110
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %11111111
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %11011011
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %11000011
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %01100110
   out ($11),a
   ld a,$20
   inc a
   out ($10),a
   ld a, %00000000
   out ($11),a
   ret


Another attempt, getting partial success.


Code:

Draw:
   ld bc,0
Draw_Main:
   in a,($11)
   add hl,bc
   ld a,(hl)
   out ($11),a
   in a,($10)
   ld a,$20
   inc a
   out ($10),a
   inc e
   ld a,e
   cp 8
   jr z,Draw_Quit
   inc bc
   jr nz,Draw_Main   
Draw_Quit:
   ret


Again:


Code:

Draw:
   ld bc,0
Draw_Main:
   call _LCD_Ready_
   ld hl,Zerg_Drone
   add hl,bc
   ld (Temp),hl
   ld a,(Temp)
   out ($11),a
   call _LCD_Ready_
   ld a,$20
   inc a
   out ($10),a
   inc e
   ld a,e
   cp 8
   jr z,Draw_Quit
   inc bc
   jr nz,Draw_Main   
Draw_Quit:
   ret
Since the LCD is arranged where each bit represents a pixel, there's some not-to-bad bit shifting you have to do in order to position your sprite in the correct location. In addition, it is usually much easier to write to a buffer which will store all the pixel data, and then "blit" all the data to the screen at once. When I was first working on sprite routines, these ones here on TICalc were a huge help: Sprite Routines. In addition, looks like you have the setup done, which in my opinion was the hardest part of learning assembly. Other than that, just keep practicing and you will be fine Smile Good luck!

Also, if you wish to write directly to the LCD, keep in mind that hardware is really slow. You will probably need some wait states in there so the data doesn't get corrupted.
+1 with Mateo : you'd better use a buffer on which you will write your sprite, then you will use a routine called fastcopy to load the whole buffer onto screen
(see here : http://wikiti.brandonw.net/index.php?title=Z80_Routines:Graphic:Fastcopy )
You can take a look at my complementary routine : fastercopy
(https://www.cemetech.net/forum/viewtopic.php?p=243864#243864)
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement