Advertisement
Guest User

Untitled

a guest
May 20th, 2011
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .nolist
  2. #include "ti83plus.inc"
  3. #include "dcs7.inc"
  4. .list
  5.    .org userMem-2
  6.    .db $BB,$6D
  7. Init:
  8.   B_CALL (_ClrLCDFull)
  9.   ld hl,0
  10.  
  11. Loop:
  12.  
  13.   ld b,8
  14.   ld ix,MyImage
  15.   ld a,h
  16.   push hl
  17.  
  18.   call iPutSprite        ;Display Image
  19.   call iFastCopy         ;Put it in the buffer
  20.  
  21.   B_CALL(_GrBufClr)      ;Clears the graph screen
  22.  
  23.   ;Draw line code
  24.   ld h,0
  25.   ld l,63
  26.   ld d,95
  27.   ld e,63
  28.   ld a,1
  29.  
  30.   call fastline
  31.   ;End of draw line code
  32.  
  33.   ;Start of gravity code
  34.   ld a,8
  35.   add a,l
  36.   ld e,a                 ;Sets e to y+8
  37.  
  38.   ld a,h                 ;Sets a to x
  39.  
  40.   call iGetPixel
  41.  
  42.   ld e,0
  43.   and (hl)
  44.   pop hl
  45.   call z,SetGravity      ;If pixel below image is white, y=y+1
  46.  
  47.   ;End of gravity code
  48.  
  49.   pop hl
  50.  
  51.   ld a,l
  52.   add a,e
  53.  
  54.   ld l,a
  55.  
  56.   ;Getkeys code
  57.   ld a,$FE
  58.   out (1),a
  59.   nop
  60.   nop
  61.   nop
  62.   in a,(1)
  63.  
  64.   bit 1,a
  65.   call z,CheckMoveLeft
  66.  
  67.   bit 2,a
  68.   call z,CheckMoveRight
  69.  
  70.   bit 3,a
  71.   call z,CheckMoveUp
  72.   ;End of getkeys code
  73.  
  74.   jp Loop
  75.  
  76. SetGravity:
  77.   ld e,0
  78.   inc e
  79.   ret
  80.  
  81. CheckMoveUp:
  82.   push af
  83.   ld a,l
  84.   cp 0
  85.  
  86.   call nz,MoveUp
  87.   pop af
  88.   ret
  89.  
  90. MoveUp:
  91.   dec l
  92.   dec l
  93.   ret
  94.  
  95. CheckMoveLeft:
  96.   push af
  97.   ld a,h
  98.   cp 0
  99.  
  100.   call nz,MoveLeft
  101.   pop af
  102.   ret
  103.  
  104. MoveLeft:
  105.   dec h
  106.   dec h
  107.   ret
  108.  
  109. CheckMoveRight:
  110.   push af
  111.   ld a,h
  112.   cp 87
  113.  
  114.   call c,MoveRight
  115.   pop af
  116.   ret
  117.  
  118. MoveRight:
  119.   inc h
  120.   inc h
  121.   ret
  122.  
  123. MyImage:
  124.   .db $FF,$81,$81,$81,$81,$81,$81,$FF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement