Added the bounce

This commit is contained in:
Arne van Iterson 2020-10-11 23:43:16 +02:00
parent 232a2858b0
commit ab66b50637
8 changed files with 552 additions and 329 deletions

Binary file not shown.

Binary file not shown.

View File

@ -2,45 +2,78 @@ Segment Base Top High Length
-------- ------ ------ ------ -------
icon D1A882 D1A882 0h
launcher D1A882 D1A8DA 58h
libs D1A8DA D1A913 39h
startup D1A913 D1A952 3Fh
cleanup D1A952 D1A966 14h
exit D1A966 D1A96C 6h
code D1A96C D1AB82 216h
data D1AB82 D1B264 6E2h
strsect D1B264 D1B264 0h
text D1B264 D1B266 2h
bss D031F6 D031F6 D13FD6 0h
libs D1A8DA D1A917 3Dh
startup D1A917 D1A956 3Fh
cleanup D1A956 D1A96A 14h
exit D1A96A D1A970 6h
code D1A970 D1AD8D 41Dh
data D1AD8D D1C863 1AD6h
strsect D1C863 D1C863 0h
text D1C863 D1C863 0h
bss D031F6 D03228 D13FD6 32h
header D1A87F D1A882 3h
Label Value
------------------------- ------
_os_DisableHomeTextBuffer = D1A96C
_os_EnableHomeTextBuffer = D1A97E
_random = D1A990
__state = D1AB82
__frameset0 = D1A9E7
__frameset = D1A9F2
__irems = 00016C
__icmpzero = 000138
__setflag = 000218
_rand = D1AA00
_os_DisableHomeTextBuffer = D1A970
_os_EnableHomeTextBuffer = D1A982
_srandom = D1A994
__setstate = D1A99B
_random = D1A9AB
__state = D1AD8D
__frameset0 = D1AA02
__seqcase = 000210
__ltof = 000284
__frameset = D1AA0D
__fmul = 000288
__fsub = 000290
__fneg = D1AA1B
__itol = 000194
__fcmp = 000274
__idvrmu = 000140
__idvrmu = 000144
__iremu = 000170
_srand = D1AA28
_abs = D1AA30
__fadd = 000270
__fdiv = 000278
_rand = D1AA3C
__ftol = 00027C
__ultof = 000280
__findlibload = D1A882
__ccleanup = D1A952
__ccleanup = D1A956
_errno = D008DC
_init = D1A882
_exit = D1A968
__exit = D1A941
__exitsp = D1A941
__errsp = D1A941
_hearts_data = D1ABB4
_logo_gfx_pal = D1B25A
_main = D1AA34
_draw_sprite = D1AA0D
_exit = D1A96C
__exit = D1A945
__exitsp = D1A945
__errsp = D1A945
_clubs_data = D1ADBF
_diamonds_data = D1B465
_hearts_data = D1BB0B
_logo_gfx_pal = D1C1B1
_spades_data = D1C1BD
_main = D1ABDE
_new_card = D1AACE
_draw_sprite = D1AA49
_w = D03225
_card = D03222
_fr = D0321E
_fd = D0321A
_fv = D03216
_a = D03212
_u = D0320E
_v = D0320A
_m = D03206
_delta = D03202
_c = D031FE
_dt = D031FA
_t = D031F6
_gfx_Begin = D1A8ED
_gfx_End = D1A8F1
_gfx_SetPalette = D1A8F5
_gfx_SetDraw = D1A8F9
_gfx_Blit = D1A8FD
_gfx_Sprite = D1A901
_kb_Scan = D1A90F
_gfx_FillScreen = D1A8F9
_gfx_SetDraw = D1A8FD
_gfx_Blit = D1A901
_gfx_Sprite = D1A905
_kb_Scan = D1A913

View File

@ -10,10 +10,11 @@ _logo_gfx_pal:
DW 31744
DW 60879
DW 0
DW 33291
XDEF _logo_gfx_pal
; 1 // convpng v7.2
; 2 #include <stdint.h>
; 3 #include "logo_gfx.h"
; 4
; 5 uint16_t logo_gfx_pal[5] = {
; 5 uint16_t logo_gfx_pal[6] = {
END

View File

@ -3,7 +3,33 @@
; -localcse -const=ROM
FILE "SRC\MAIN.C"
.assume ADL=1
SEGMENT CODE
SEGMENT BSS
_t:
DS 4*1
_dt:
DS 4*1
_c:
DS 4*1
_delta:
DS 4*1
_m:
DS 4*1
_v:
DS 4*1
_u:
DS 4*1
_a:
DS 4*1
_fv:
DS 4*1
_fd:
DS 4*1
_fr:
DS 4*1
_card:
DS 3
_w:
DS 3
; 1 #include <stdbool.h>
; 2 #include <stddef.h>
; 3 #include <stdint.h>
@ -20,19 +46,50 @@
; 14 /* Include the sprite data */
; 15 #include "gfx/logo_gfx.h"
; 16
; 17 /* Function for drawing the main sprite */
; 18 void draw_sprite(int x, int y)
; 19 {
; 17 float t, dt, c, delta, m, v, u, a, fv, fd, fr;
; 18 int card, w;
SEGMENT CODE
; 19
; 20 void draw_sprite(int x, int y)
; 21 {
_draw_sprite:
CALL __frameset0
; 20 /* Fill the screen with color index 0
; 21 /* Note that this is a super inefficient way to
; 22 /* redraw, but it demonstrates a simple way of clearing past data */
; 23 // gfx_FillScreen(0xFF);
; 24
; 25 /* Draw a bunch of different styled sprites on the screen */
; 26
; 27 gfx_Sprite(hearts, x, y);
; 22 switch (card)
LD HL,(_card)
CALL __seqcase
L__0:
DW 4
DW 0
DB 0
DW24 L_0
DW24 L_1
DW24 L_2
DW24 L_3
DW24 L_4
; 23 {
; 24 case 0:
L_0:
; 25 gfx_Sprite(diamonds, x, y);
LD BC,(IX+9)
PUSH BC
LD BC,(IX+6)
PUSH BC
LD BC,_diamonds_data
PUSH BC
CALL _gfx_Sprite
POP BC
POP BC
POP BC
; 26 break;
JR L_4
; 27 case 1:
L_1:
; 28 gfx_Sprite(hearts, x, y);
LD BC,(IX+9)
PUSH BC
LD BC,(IX+6)
@ -43,14 +100,46 @@ _draw_sprite:
POP BC
POP BC
POP BC
; 28
; 29 /* Copy the buffer to the screen */
; 30 gfx_BlitBuffer(); // This is the same as gfx_Blit(gfx_buffer)
; 29 break;
JR L_4
; 30 case 2:
L_2:
; 31 gfx_Sprite(spades, x, y);
LD BC,(IX+9)
PUSH BC
LD BC,(IX+6)
PUSH BC
LD BC,_spades_data
PUSH BC
CALL _gfx_Sprite
POP BC
POP BC
POP BC
; 32 break;
JR L_4
; 33 case 3:
L_3:
; 34 gfx_Sprite(clubs, x, y);
LD BC,(IX+9)
PUSH BC
LD BC,(IX+6)
PUSH BC
LD BC,_clubs_data
PUSH BC
CALL _gfx_Sprite
POP BC
POP BC
POP BC
; 35 break;
; 36 }
L_4:
; 37
; 38 gfx_BlitBuffer();
LD BC,1
PUSH BC
CALL _gfx_Blit
POP BC
; 31 }
; 39 }
LD SP,IX
POP IX
RET
@ -59,8 +148,12 @@ _draw_sprite:
;**************************** _draw_sprite ***************************
;Name Addr/Register Size Type
;_gfx_Blit IMPORT ----- function
;_clubs_data IMPORT 1702 variable
;_spades_data IMPORT 1702 variable
;_hearts_data IMPORT 1702 variable
;_diamonds_data IMPORT 1702 variable
;_gfx_Sprite IMPORT ----- function
;_card STATIC 3 variable
;y IX+9 3 parameter
;x IX+6 3 parameter
@ -69,32 +162,147 @@ _draw_sprite:
; Spill Code: 0 (instruction)
; 32
; 33 void main(void)
; 34 {
; 40
; 41 void new_card()
; 42 {
_new_card:
; 43 card = randInt(0, 3);
CALL _random
LD A,L
AND A,3
UEXT HL
LD L,A
LD (_card),HL
; 44 t = randInt(5, LCD_WIDTH / 6) / w;
CALL _random
LD BC,49
CALL __iremu
LD IY,HL
LEA HL,IY+5
LD BC,(_w)
CALL __idivu
LD BC,HL
XOR A,A
CALL __ultof
LD (_t),BC
LD (_t+3),A
; 45 w = randInt(10, 30);
CALL _random
LD BC,21
CALL __iremu
LD IY,HL
LEA BC,IY+10
LD (_w),BC
; 46 dt = 0.075;
LD BC,10066330
LD (_dt),BC
LD A,61
LD (_dt+3),A
; 47 c = randInt(2, 8);
CALL _random
LD BC,7
CALL __iremu
INC HL
INC HL
LD BC,HL
XOR A,A
CALL __ultof
LD (_c),BC
LD (_c+3),A
; 48 delta = (float)rand() / (float)RAND_MAX * 5;
CALL _rand
LD BC,HL
CALL __itol
CALL __ltof
LD HL,16777214
LD E,74
CALL __fdiv
LD HL,10485760
LD E,64
CALL __fmul
LD (_delta),BC
LD (_delta+3),A
; 49 m = 20;
LD BC,10485760
LD (_m),BC
LD A,65
LD (_m+3),A
; 50 v = randInt(0, 100);
CALL _random
LD BC,101
CALL __iremu
LD BC,HL
XOR A,A
CALL __ultof
LD (_v),BC
LD (_v+3),A
; 51 u = (LCD_HEIGHT - hearts_height) - 5;
LD BC,3735552
LD (_u),BC
LD A,67
LD (_u+3),A
; 52 a = 0;
LD BC,0
LD (_a),BC
XOR A,A
LD (_a+3),A
; 53 fv = 0;
LD (_fv),BC
XOR A,A
LD (_fv+3),A
; 54 fd = 0;
LD (_fd),BC
XOR A,A
LD (_fd+3),A
; 55 fr = 0;
LD (_fr),BC
XOR A,A
LD (_fr+3),A
; 56 }
RET
;**************************** _new_card ***************************
;Name Addr/Register Size Type
;_fr STATIC 4 variable
;_fd STATIC 4 variable
;_fv STATIC 4 variable
;_a STATIC 4 variable
;_u STATIC 4 variable
;_v STATIC 4 variable
;_m STATIC 4 variable
;_delta STATIC 4 variable
;_rand IMPORT ----- function
;_c STATIC 4 variable
;_dt STATIC 4 variable
;_t STATIC 4 variable
;_w STATIC 3 variable
;_card STATIC 3 variable
;_random IMPORT ----- function
; Stack Frame Size: 6 (bytes)
; Spill Code: 0 (instruction)
; 57
; 58 void main(void)
; 59 {
_main:
LD HL,-11
LD HL,-4
CALL __frameset
; 35 /* Coordinates used for the sprite */
; 36 int x, y;
; 37 bool gravity[2] = {
; 38 true,
; 39 true};
LEA DE,IX+-8
LD HL,_0temp1
LD BC,2
LDIR
; 40 float angle;
; 41
; 42 /* Initialize the 8bpp graphics */
; 43 gfx_Begin();
; 60 srand(rtc_Time());
LD BC,(15925316)
PUSH BC
CALL _srand
POP BC
; 61
; 62 gfx_Begin();
CALL _gfx_Begin
; 44
; 45 /* Set up the palette for our sprites */
; 46 gfx_SetPalette(logo_gfx_pal, sizeof_logo_gfx_pal, 0);
; 63 gfx_SetPalette(logo_gfx_pal, sizeof_logo_gfx_pal, 0);
LD BC,0
PUSH BC
LD BC,10
LD BC,12
PUSH BC
LD BC,_logo_gfx_pal
PUSH BC
@ -102,191 +310,157 @@ _main:
POP BC
POP BC
POP BC
; 47
; 48 /* Start at 0, 0 */
; 49 x = 0;
LD BC,0
LD (IX+-6),BC
; 50 y = (rand() % (LCD_HEIGHT - 0 + 1));
CALL _rand
LD BC,241
CALL __irems
LD (IX+-3),HL
; 51
; 52 gfx_SetDrawBuffer();
; 64 gfx_SetDrawBuffer();
LD BC,1
PUSH BC
CALL _gfx_SetDraw
POP BC
; 53
; 54 //gfx_FillScreen(1);
; 55
; 56 draw_sprite(x, y);
LD BC,(IX+-3)
; 65 gfx_FillScreen(0x05);
LD BC,5
PUSH BC
LD BC,0
PUSH BC
CALL _draw_sprite
CALL _gfx_FillScreen
POP BC
POP BC
; 57
; 58 do
L_18:
; 59 {
; 60 /* Scan the keypad to update kb_Data */
; 61 kb_Scan();
CALL _kb_Scan
; 62
; 63 if ((x + hearts_width) <= LCD_WIDTH && x >= 0)
LD IY,(IX+-6)
LEA BC,IY+34
LD HL,320
OR A,A
SBC HL,BC
CALL __setflag
JP M,L_8
LD HL,(IX+-6)
CALL __icmpzero
CALL __setflag
JP M,L_8
; 64 {
; 65 if (gravity[0])
LD A,(IX+-8)
OR A,A
JR Z,L_4
; 66 {
; 67 x = x + 2;
LD IY,(IX+-6)
LEA IY,IY+2
LD (IX+-6),IY
; 68 }
; 69 else
JR L_16
L_4:
; 66
; 67 new_card();
CALL _new_card
; 68
; 69 do
L_9:
; 70 {
; 71 x = x - 2;
LD IY,(IX+-6)
LEA IY,IY+-2
LD (IX+-6),IY
; 72 }
; 73 }
; 74 else
JR L_16
L_8:
; 75 {
; 76 if (gravity[0])
LD A,(IX+-8)
OR A,A
JR Z,L_6
; 77 {
; 78 gravity[0] = false;
LD (IX+-8),0
; 79 x = x - 2;
LD IY,(IX+-6)
LEA IY,IY+-2
LD (IX+-6),IY
; 80 }
; 81 else
JR L_16
L_6:
; 82 {
; 83 gravity[0] = true;
LD (IX+-8),1
; 84 x = x + 2;
LD IY,(IX+-6)
LEA IY,IY+2
LD (IX+-6),IY
; 71 /* Scan the keypad to update kb_Data */
; 72 kb_Scan();
CALL _kb_Scan
; 73
; 74 fv = c * u;
LD A,(_u+3)
LD E,A
LD A,(_c+3)
LD HL,(_u)
LD BC,(_c)
CALL __fmul
LD (_fv),BC
LD (_fv+3),A
; 75 fd = delta * v;
LD A,(_v+3)
LD E,A
LD A,(_delta+3)
LD HL,(_v)
LD BC,(_delta)
CALL __fmul
LD (_fd),BC
LD (_fd+3),A
; 76 fr = -fv - fd;
LD BC,(_fv)
LD A,(_fv+3)
CALL __fneg
LD H,A
LD A,(_fd+3)
LD E,A
LD A,H
LD HL,(_fd)
CALL __fsub
LD (_fr),BC
LD (_fr+3),A
; 77 a = fr / m;
LD A,(_m+3)
LD E,A
LD A,(_fr+3)
LD HL,(_m)
CALL __fdiv
LD (_a),BC
LD (_a+3),A
; 78 v = v + a * dt;
LD A,(_dt+3)
LD E,A
LD A,(_a+3)
LD HL,(_dt)
CALL __fmul
LD H,A
LD A,(_v+3)
LD E,A
LD A,H
LD HL,(_v)
CALL __fadd
LD (_v),BC
LD (_v+3),A
; 79 u = u + v * dt;
LD A,(_dt+3)
LD E,A
LD A,(_v+3)
LD HL,(_dt)
CALL __fmul
LD H,A
LD A,(_u+3)
LD E,A
LD A,H
LD HL,(_u)
CALL __fadd
LD (_u),BC
LD (_u+3),A
; 80 t = t + dt;
LD A,(_dt+3)
LD E,A
LD A,(_t+3)
LD HL,(_dt)
LD BC,(_t)
CALL __fadd
LD (_t),BC
LD (_t+3),A
; 81
; 82 if (t * w > LCD_WIDTH)
LD BC,(_w)
CALL __itol
CALL __ltof
LD E,A
LD HL,BC
LD BC,(_t)
LD A,(_t+3)
CALL __fmul
LD (IX+-4),BC
LD (IX+-1),A
LD HL,10485760
LD E,67
CALL __fcmp
JP P,L_8
; 83 {
; 84 new_card();
CALL _new_card
; 85 }
; 86 }
L_16:
; 87
; 88 if ((y + hearts_height) <= LCD_HEIGHT && y >= 0)
LD IY,(IX+-3)
LEA BC,IY+50
LD HL,240
; 86 else
JR L_10
L_8:
; 87 {
; 88 draw_sprite(t * w, (LCD_HEIGHT - hearts_height) - abs(u));
LD BC,(_u)
LD A,(_u+3)
CALL __ftol
PUSH BC
CALL _abs
POP BC
LD BC,HL
LD HL,190
OR A,A
SBC HL,BC
JP M,L_15
LD HL,(IX+-3)
CALL __icmpzero
CALL __setflag
JP M,L_15
; 89 {
; 90 if (gravity[1])
LEA HL,IX+-8
INC HL
LD A,(HL)
OR A,A
JR Z,L_11
; 91 {
; 92 y = y + 2;
LD IY,(IX+-3)
LEA IY,IY+2
LD (IX+-3),IY
; 93 }
; 94 else
JR L_17
L_11:
; 95 {
; 96 y = y - 2;
LD IY,(IX+-3)
LEA IY,IY+-2
LD (IX+-3),IY
; 97 }
; 98 }
; 99 else
JR L_17
L_15:
; 100 {
; 101 if (gravity[1])
LEA BC,IX+-8
INC BC
LD (IX+-11),BC
LD HL,BC
LD A,(HL)
OR A,A
JR Z,L_13
; 102 {
; 103 gravity[1] = false;
LD HL,(IX+-11)
LD (HL),0
; 104 y = y - 2;
LD IY,(IX+-3)
LEA IY,IY+-2
LD (IX+-3),IY
; 105 }
; 106 else
JR L_17
L_13:
; 107 {
; 108 gravity[1] = true;
LD HL,(IX+-11)
LD (HL),1
; 109 y = y + 2;
LD IY,(IX+-3)
LEA IY,IY+2
LD (IX+-3),IY
; 110 }
; 111 }
L_17:
; 112
; 113 draw_sprite(x, y);
LD BC,(IX+-3)
PUSH BC
LD BC,(IX+-6)
PUSH HL
LD BC,(IX+-4)
LD A,(IX+-1)
CALL __ftol
PUSH BC
CALL _draw_sprite
POP BC
POP BC
; 114 } while (kb_Data[6] != kb_Clear);
; 89 }
; 90
; 91 } while (kb_Data[6] != kb_Clear);
L_10:
LD A,(16056348)
CP A,64
JR NZ,L_18
; 115
; 116 /* Close the graphics */
; 117 gfx_End();
JR NZ,L_9
; 92
; 93 /* Close the graphics */
; 94 gfx_End();
CALL _gfx_End
; 118 }
; 95 }
LD SP,IX
POP IX
RET
@ -295,42 +469,79 @@ L_17:
;**************************** _main ***************************
;Name Addr/Register Size Type
;_gfx_End IMPORT ----- function
;_abs IMPORT ----- function
;_w STATIC 3 variable
;_t STATIC 4 variable
;_dt STATIC 4 variable
;_a STATIC 4 variable
;_m STATIC 4 variable
;_fr STATIC 4 variable
;_fd STATIC 4 variable
;_v STATIC 4 variable
;_delta STATIC 4 variable
;_fv STATIC 4 variable
;_u STATIC 4 variable
;_c STATIC 4 variable
;_kb_Scan IMPORT ----- function
;_gfx_FillScreen IMPORT ----- function
;_gfx_SetDraw IMPORT ----- function
;_rand IMPORT ----- function
;_logo_gfx_pal IMPORT 10 variable
;_logo_gfx_pal IMPORT 12 variable
;_gfx_SetPalette IMPORT ----- function
;_gfx_Begin IMPORT ----- function
;_0temp1 STATIC 2 variable
;G_0 IX-11 3 variable
;gravity IX-8 2 variable
;x IX-6 3 variable
;y IX-3 3 variable
;_srand IMPORT ----- function
;G_0 IX-4 4 variable
; Stack Frame Size: 17 (bytes)
; Stack Frame Size: 10 (bytes)
; Spill Code: 0 (instruction)
SEGMENT TEXT
_0temp1:
DB 1
DB 1
XREF _logo_gfx_pal:ROM
XREF _clubs_data:ROM
XREF _spades_data:ROM
XREF _hearts_data:ROM
XREF _diamonds_data:ROM
XREF _kb_Scan:ROM
XREF _gfx_Sprite:ROM
XREF _gfx_Blit:ROM
XREF _gfx_SetDraw:ROM
XREF _gfx_FillScreen:ROM
XREF _gfx_SetPalette:ROM
XREF _gfx_End:ROM
XREF _gfx_Begin:ROM
XREF _abs:ROM
XREF _rand:ROM
XREF __irems:ROM
XREF _srand:ROM
XREF _random:ROM
XREF __idivu:ROM
XREF __iremu:ROM
XREF __fadd:ROM
XREF __fsub:ROM
XREF __fmul:ROM
XREF __fdiv:ROM
XREF __fneg:ROM
XREF __fcmp:ROM
XREF __ftol:ROM
XREF __ltof:ROM
XREF __ultof:ROM
XREF __itol:ROM
XREF __frameset0:ROM
XREF __frameset:ROM
XREF __setflag:ROM
XREF __icmpzero:ROM
XREF __seqcase:ROM
XDEF _main
XDEF _new_card
XDEF _draw_sprite
XDEF _w
XDEF _card
XDEF _fr
XDEF _fd
XDEF _fv
XDEF _a
XDEF _u
XDEF _v
XDEF _m
XDEF _delta
XDEF _c
XDEF _dt
XDEF _t
END

View File

@ -2,10 +2,11 @@
#include <stdint.h>
#include "logo_gfx.h"
uint16_t logo_gfx_pal[5] = {
uint16_t logo_gfx_pal[6] = {
0xFFFF, // 00 :: rgb(255,255,255)
0x0000, // 01 :: rgb(0,0,0)
0x7C00, // 02 :: rgb(255,0,0)
0xEDCF, // 03 :: rgb(221,116,125)
0x0000, // 04 :: rgb(0,0,0)
0x820B,
};

View File

@ -26,7 +26,7 @@ extern uint8_t spades_data[1702];
#define clubs_size 1702
extern uint8_t clubs_data[1702];
#define clubs ((gfx_sprite_t*)clubs_data)
#define sizeof_logo_gfx_pal 10
extern uint16_t logo_gfx_pal[5];
#define sizeof_logo_gfx_pal 12
extern uint16_t logo_gfx_pal[6];
#endif

View File

@ -14,103 +14,80 @@
/* Include the sprite data */
#include "gfx/logo_gfx.h"
/* Function for drawing the main sprite */
float t, dt, c, delta, m, v, u, a, fv, fd, fr;
int card, w;
void draw_sprite(int x, int y)
{
/* Fill the screen with color index 0
/* Note that this is a super inefficient way to
/* redraw, but it demonstrates a simple way of clearing past data */
// gfx_FillScreen(0xFF);
/* Draw a bunch of different styled sprites on the screen */
switch (card)
{
case 0:
gfx_Sprite(diamonds, x, y);
break;
case 1:
gfx_Sprite(hearts, x, y);
break;
case 2:
gfx_Sprite(spades, x, y);
break;
case 3:
gfx_Sprite(clubs, x, y);
break;
}
/* Copy the buffer to the screen */
gfx_BlitBuffer(); // This is the same as gfx_Blit(gfx_buffer)
gfx_BlitBuffer();
}
void new_card()
{
card = randInt(0, 3);
t = randInt(5, LCD_WIDTH / 6) / w;
w = randInt(10, 30);
dt = 0.075;
c = randInt(2, 8);
delta = (float)rand() / (float)RAND_MAX * 5;
m = 20;
v = randInt(0, 100);
u = (LCD_HEIGHT - hearts_height) - 5;
a = 0;
fv = 0;
fd = 0;
fr = 0;
}
void main(void)
{
/* Coordinates used for the sprite */
int x, y;
bool gravity[2] = {
true,
true};
float angle;
srand(rtc_Time());
/* Initialize the 8bpp graphics */
gfx_Begin();
/* Set up the palette for our sprites */
gfx_SetPalette(logo_gfx_pal, sizeof_logo_gfx_pal, 0);
/* Start at 0, 0 */
x = 0;
y = (rand() % (LCD_HEIGHT - 0 + 1));
gfx_SetDrawBuffer();
gfx_FillScreen(0x05);
//gfx_FillScreen(1);
draw_sprite(x, y);
new_card();
do
{
/* Scan the keypad to update kb_Data */
kb_Scan();
if ((x + hearts_width) <= LCD_WIDTH && x >= 0)
fv = c * u;
fd = delta * v;
fr = -fv - fd;
a = fr / m;
v = v + a * dt;
u = u + v * dt;
t = t + dt;
if (t * w > LCD_WIDTH)
{
if (gravity[0])
{
x = x + 2;
new_card();
}
else
{
x = x - 2;
}
}
else
{
if (gravity[0])
{
gravity[0] = false;
x = x - 2;
}
else
{
gravity[0] = true;
x = x + 2;
}
draw_sprite(t * w, (LCD_HEIGHT - hearts_height) - abs(u));
}
if ((y + hearts_height) <= LCD_HEIGHT && y >= 0)
{
if (gravity[1])
{
y = y + 2;
}
else
{
y = y - 2;
}
}
else
{
if (gravity[1])
{
gravity[1] = false;
y = y - 2;
}
else
{
gravity[1] = true;
y = y + 2;
}
}
draw_sprite(x, y);
} while (kb_Data[6] != kb_Clear);
/* Close the graphics */