stmfd sp!,{r0-r12,lr} adr r0,MagicBal mov r1,#0 mov r2,#0 adr r9,dummy mov r3,#1 mov r4,#1 BigLp bl SPRITE bl WtVsync bl SPROFF add r1,r1,r3 add r2,r2,r4 cmp r1,#0 rsbeq r3,r3,#0 mov r5,#320 sub r5,r5,#16 cmp r1,r5 rsbeq r3,r3,#0 cmp r2,#0 rsbeq r4,r4,#0 cmp r2,#224 rsbeq r4,r4,#0 bl GETKEY cmp r12,#0 beq BigLp Fini ldmfd sp!,{r0-r12,pc} ;_________________________________________________________________________ SPRITE ; CE r0=pointeur vers sprite ; r9=pointeur de sauvegarde ; (r1,r2)=affichage en coord. (x,y) stmfd sp!,{r0-r12,lr} mov r3,#0xc0000010 ldr r3,[r3] mov r4,#640 mla r3,r4,r2,r3 add r3,r3,r1,lsl#1 ; r3=position à l'écran ldrh r1,[r0],#2 ; r1=largeur sub r4,r4,r1,lsl#1 ldrh r2,[r0],#2 ; r2=hauteur str r3,[r9],#4 strh r1,[r9],#2 strh r2,[r9],#2 mov r7,#0 sprht_lp mov r10,r1 sprlg_lp ldrh r8,[r3] strh r8,[r9],#2 ldrh r6,[r0],#2 cmp r6,r7 strneh r6,[r3],#2 addeq r3,r3,#2 subs r10,r10,#1 bne sprlg_lp add r3,r3,r4 subs r2,r2,#1 bne sprht_lp ldmfd sp!,{r0-r12,pc} ;_________________________________________________________________________ SPROFF ; CE r9=pointeur vers fond stmfd sp!,{r0-r12,lr} mov r4,#640 ldr r3,[r9],#4 ldrh r1,[r9],#2 ; r1=largeur sub r4,r4,r1,lsl#1 ldrh r2,[r9],#2 ; r2=hauteur sprhf_lp mov r10,r1 sprlf_lp ldrh r6,[r9],#2 strh r6,[r3],#2 subs r10,r10,#1 bne sprlf_lp add r3,r3,r4 subs r2,r2,#1 bne sprhf_lp ldmfd sp!,{r0-r12,pc} ;_________________________________________________________________________ GETKEY stmfd sp!,{r0-r4,lr} ; scrute le clavier mov r12,#0 mov r0,#0x90000000 ; en sortie r12 contient le code-clavier (=0 si aucune touche pressée) mov r1,#0x000e0000 mov r2,#0x00000010 add r0,r0,r1 add r0,r0,r2 ldmia r0,{r1-r4} ; le tout transféré dans 4 registres respectivement offsets $10-$12, $14-$16, $18-$1a, $1c-$1e orr r1,r1,r2 ; Une touche pressée ?.. orr r2,r3,r4 ; Quelques "ou" logiques de tout ça nous renseigneront... orr r12,r1,r2 ; Ainsi, ldmfd sp!,{r0-r4,pc} ; les registres r0,r2 à r5 retrouvent leurs valeurs préalables ; puis écrit le contenu du ; registre lr dans le registre pc pour retourner (juste après) là où la sous-routine avait été appelée ;_________________________________________________________________________ WtVsync stmfd sp!,{r0-r1,lr} mov r0,#0xC0000008 str r0,[r0,#32] wvs_lp ldr r1,[r0,#24] ands r1,r1,r0 beq wvs_lp ldmfd sp!,{r0-r1,pc} ;_________________________________________________________________________ align MagicBal dcw 16,16 dcw 0x0000,0x0000,0x0000,0x0000,0x0000,0xb014,0xa815,0xa814,0xa814,0xb014,0xb814,0x0000,0x0000,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0xb012,0x9015,0x9015,0x9816,0xa897,0xb0f8,0xb918,0xb8d6,0xb855,0xb012,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x8814,0x8016,0x8817,0x7016,0xa2b9,0xbbfa,0x91b7,0x99d7,0xa9d8,0xc1b9,0xb8d6,0xb013,0x0000,0x0000 dcw 0x0000,0x9813,0x7015,0x7018,0x5816,0x6937,0x8259,0x8a79,0x79b8,0x81b8,0x91b7,0x99d7,0xb1b8,0xb076,0xb013,0x0000 dcw 0x0000,0x6815,0x6018,0x4016,0x4877,0x61d8,0x5998,0x6198,0x69b8,0x71b8,0x79b8,0x8997,0xb359,0xcafa,0xa814,0x0000 dcw 0x6816,0x5016,0x4879,0x38b9,0x4118,0x5239,0x4a19,0x49f9,0x51b9,0x5998,0x69b8,0x7998,0xa319,0xb319,0xa836,0xa813 dcw 0x5016,0x4017,0x40fa,0x41fc,0x3a5a,0x4b7b,0x4b9b,0x4b9b,0x5b5b,0x62ba,0x59d9,0x69b8,0x7998,0x91b7,0xa077,0xa014 dcw 0x4016,0x3818,0x2078,0x19fa,0x2b9b,0x4cdd,0x44dd,0x4cbd,0x9e1e,0xadbd,0x5a7a,0x5998,0x71b8,0x81b8,0x9037,0x9814 dcw 0x3816,0x2818,0x1979,0x131b,0x1c7d,0x45be,0x45fe,0x55fe,0x863e,0x95bd,0x5b5b,0x51b9,0x69d8,0x7137,0x8017,0x9015 dcw 0x3016,0x2058,0x1a1a,0x13dc,0x0d1e,0x4e7e,0x875e,0x66be,0x45de,0x4cdd,0x435b,0x5239,0x5978,0x5836,0x8017,0x8815 dcw 0x3815,0x2097,0x1a5b,0x13fc,0x155e,0x56fe,0x97de,0x7f3e,0x45fe,0x44fd,0x4b9b,0x4199,0x48b7,0x5876,0x7817,0x8815 dcw 0x0000,0x2098,0x1a1c,0x13bc,0x151e,0x569e,0x5efe,0x365e,0x1d3e,0x23fc,0x225a,0x1817,0x5958,0x7959,0x6815,0xf80f dcw 0x0000,0x1815,0x1979,0x1b1d,0x1c5d,0x6e5f,0x2d9e,0x0cfe,0x0c3d,0x12fb,0x1959,0x2017,0x4017,0x6016,0x7016,0x0000 dcw 0x0000,0x0000,0x20d8,0x19da,0x1b1d,0x1bdd,0x13fc,0x13bc,0x131b,0x19d9,0x2078,0x3818,0x5017,0x6015,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0x2015,0x19ba,0x1a1a,0x1a5c,0x1a1c,0x215b,0x2079,0x3017,0x4017,0x5016,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0x0000,0x0000,0x2057,0x20f9,0x2098,0x2017,0x2817,0x4017,0x0000,0x0000,0x0000,0x0000,0x0000 align dummy dcd 0x00000000 dcw 16,16 dcw 0x0000,0x0000,0x0000,0x0000,0x0000,0xb014,0xa815,0xa814,0xa814,0xb014,0xb814,0x0000,0x0000,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0xb012,0x9015,0x9015,0x9816,0xa897,0xb0f8,0xb918,0xb8d6,0xb855,0xb012,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x8814,0x8016,0x8817,0x7016,0xa2b9,0xbbfa,0x91b7,0x99d7,0xa9d8,0xc1b9,0xb8d6,0xb013,0x0000,0x0000 dcw 0x0000,0x9813,0x7015,0x7018,0x5816,0x6937,0x8259,0x8a79,0x79b8,0x81b8,0x91b7,0x99d7,0xb1b8,0xb076,0xb013,0x0000 dcw 0x0000,0x6815,0x6018,0x4016,0x4877,0x61d8,0x5998,0x6198,0x69b8,0x71b8,0x79b8,0x8997,0xb359,0xcafa,0xa814,0x0000 dcw 0x6816,0x5016,0x4879,0x38b9,0x4118,0x5239,0x4a19,0x49f9,0x51b9,0x5998,0x69b8,0x7998,0xa319,0xb319,0xa836,0xa813 dcw 0x5016,0x4017,0x40fa,0x41fc,0x3a5a,0x4b7b,0x4b9b,0x4b9b,0x5b5b,0x62ba,0x59d9,0x69b8,0x7998,0x91b7,0xa077,0xa014 dcw 0x4016,0x3818,0x2078,0x19fa,0x2b9b,0x4cdd,0x44dd,0x4cbd,0x9e1e,0xadbd,0x5a7a,0x5998,0x71b8,0x81b8,0x9037,0x9814 dcw 0x3816,0x2818,0x1979,0x131b,0x1c7d,0x45be,0x45fe,0x55fe,0x863e,0x95bd,0x5b5b,0x51b9,0x69d8,0x7137,0x8017,0x9015 dcw 0x3016,0x2058,0x1a1a,0x13dc,0x0d1e,0x4e7e,0x875e,0x66be,0x45de,0x4cdd,0x435b,0x5239,0x5978,0x5836,0x8017,0x8815 dcw 0x3815,0x2097,0x1a5b,0x13fc,0x155e,0x56fe,0x97de,0x7f3e,0x45fe,0x44fd,0x4b9b,0x4199,0x48b7,0x5876,0x7817,0x8815 dcw 0x0000,0x2098,0x1a1c,0x13bc,0x151e,0x569e,0x5efe,0x365e,0x1d3e,0x23fc,0x225a,0x1817,0x5958,0x7959,0x6815,0xf80f dcw 0x0000,0x1815,0x1979,0x1b1d,0x1c5d,0x6e5f,0x2d9e,0x0cfe,0x0c3d,0x12fb,0x1959,0x2017,0x4017,0x6016,0x7016,0x0000 dcw 0x0000,0x0000,0x20d8,0x19da,0x1b1d,0x1bdd,0x13fc,0x13bc,0x131b,0x19d9,0x2078,0x3818,0x5017,0x6015,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0x2015,0x19ba,0x1a1a,0x1a5c,0x1a1c,0x215b,0x2079,0x3017,0x4017,0x5016,0x0000,0x0000,0x0000 dcw 0x0000,0x0000,0x0000,0x0000,0x0000,0x2057,0x20f9,0x2098,0x2017,0x2817,0x4017,0x0000,0x0000,0x0000,0x0000,0x0000