summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/Makefile.am2
-rw-r--r--samples/p4.s69
2 files changed, 57 insertions, 14 deletions
diff --git a/samples/Makefile.am b/samples/Makefile.am
index cc31c35..1001b2a 100644
--- a/samples/Makefile.am
+++ b/samples/Makefile.am
@@ -4,4 +4,4 @@ all:
make -f Makefile.samples
clean:
- male -f Makefile.samples clean
+ make -f Makefile.samples clean
diff --git a/samples/p4.s b/samples/p4.s
index 28b79fd..ce534e4 100644
--- a/samples/p4.s
+++ b/samples/p4.s
@@ -11,13 +11,15 @@ MsgTour1 DS "C'est au tour du joueur "
MsgTour2 DS " de jouer\n"
MsgGagne1 DS "Le joueur "
MsgGagne2 DS " a gagné\n"
+MsgEgalite DS "Égalité\n"
MsgDraw DS "| "
-MsgDrawJ1 DS "|\e[31m;O\e[0m;"
-MsgDrawJ2 DS "|\e[34m;O\e[0m;"
+MsgDrawJ1 DS "|\e[31mO\e[0m"
+MsgDrawJ2 DS "|\e[34mO\e[0m"
MsgDrawWall DS "|\n"
-MsgsDraw DD MsgDraw, MsgDrawJ1, MsgDrawJ2, MsgDraw
+MsgsDraw DD MsgDraw, MsgDrawJ1, MsgDrawJ2, MsgDrawWall
MsgDrawBegin DS "\e[2J 1 2 3 4 5 6 7\n"
MsgDrawEnd DS "+-+-+-+-+-+-+-+\n"
+MsgEndl DS "\n"
.text
@@ -52,14 +54,14 @@ BoucleInit1: MOV, [R5], R0
MOV R6, 3
BoucleInit2: MOV, [R5], R6
MOV, [R5 + 8], R6
- ADD R5, 1
+ ADD R5, 9
JNE R5, R4, BoucleInit2
; On met à 3 les 'murs' haut et bas.
MOV R4, Table + 9;
MOV R5, R1
BoucleInit3: MOV, [R5], R6
- MOV, [R5 + (8 * 9)], R6
+ MOV, [R5 + 8 * 9], R6
ADD R5, 1
JNE R5, R4, BoucleInit3
@@ -86,7 +88,7 @@ LitMot: PUSH R4
;
-; Sert à afficher la table.
+; Sert à afficher la table
;
AfficheP4: PUSH R4
@@ -97,17 +99,26 @@ AfficheP4: PUSH R4
PUSH R9
MOV, [0xffffff04], MsgDrawBegin
-
- MOV R5, Table + 9;
- ADD R4, R5, 7 * 9;
-BoucleAffiche: MOV R9, [R5]
- MOV R6, Table[R9]
- MOV, [0xffffff04], R6
+ MOV R8, 8
+ MOV R9, 9
+ ADD R4, R1, 10
+ MOV R5, 1
+BoucleAffiche2: MOV R6, 1
+BoucleAffiche1: MOV R7, [R4]
+ MOV R7, MsgsDraw[R7]
+ MOV, [0xffffff04], R7
+ ADD R4, 1
+ ADD R6, 1
+ JNE R6, R9, BoucleAffiche1
ADD R5, 1
- JNE R5, R4, BoucleAffiche
+ ADD R4, 1
+ JNE R5, R8, BoucleAffiche2
MOV, [0xffffff04], MsgDrawEnd
+ MOV, [0xffffff04], MsgTour1
+ MOV, [0xffffff06], R2
+ MOV, [0xffffff04], MsgTour2
POP R9
POP R8
@@ -117,6 +128,38 @@ BoucleAffiche: MOV R9, [R5]
POP R4
RET
+;
+; Sert pour le debuggage lors du developpement de l'application.
+;
+
+AfficheDebug: PUSH R4
+ PUSH R5
+ PUSH R6
+ PUSH R7
+ PUSH R9
+
+ MOV, [0xffffff04], MsgEndl
+
+ MOV R9, 9
+ MOV R4, R1
+ MOV R5, R0
+BoucleDebug2: MOV R6, R0
+BoucleDebug1: MOV R7, [R4]
+ MOV, [0xffffff06], R7
+ ADD R4, 1
+ ADD R6, 1
+ JNE R6, R9, BoucleDebug1
+ MOV, [0xffffff04], MsgEndl
+ ADD R5, 1
+ JNE R5, R9, BoucleDebug2
+
+ POP R9
+ POP R7
+ POP R6
+ POP R5
+ POP R4
+ RET
+
.start
CALL InitP4
CALL AfficheP4