You are on page 1of 4

Nom & Prénom : Wisal El Alouan

Filière : GL

Exercice 1:
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

* Put program code here


lea $2000,A1
MOVE #2,d0
trap #15
move #0,d0
clr d2 ;Somme
Return cmp d0,d1
bgt Programme
lea txt1,A1
move #1,d0
trap #15
move d2,d1
move #3,d0
trap #15
Simhalt
Programme move.b (A1,d0),d4
sub.b #48,d4
add.b d4,d2
ADDQ #1,d0
jmp Return

SIMHALT ; halt simulator


TXT1 DC.L 'Somme',0
* Put variables and constants here

END START ; last line of source

Exercice 2:
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

* Put program code here


move #4,d0
TRAP #15
move.w d1,D2 ;tmp
subq #1,d2
return cmp #1,d2
bgt Programme
lea text2,A1
move #0,d0
trap #15
SIMHALT

Programme Move d1,d3 ;N


divu d2,d3 ;N/i
mulu d2,d3 ; N/i *i
cmp d3,d1
beQ NonPremier
subq #1,d2
jmp return

NonPremier lea text1,A1


move #0,d0
trap #15

text1 Dc.l 'Non ',0

text2 Dc.l 'Oui',0

SIMHALT ; halt simulator

* Put variables and constants here

END START ; last line of source

Exercice 3:
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

* Put program code here


LEA $2000,A1
move #2,d0
trap #15
clr d0
bsr Check
Palindorme lea text2,A1
move #0,d0
trap #15

Check cmp d0,d1


ble Palindorme
move d1,d2
subq #1,d2
sub d0,d2
move.b (A1,d0),d3
move.b (A1,d2),d4
cmp.b d3,d4
bne nonPalindrome
addq #1,d0
jmp Check

nonPalindrome lea text1,A1


move #0,d0
trap #15

text1 Dc.l 'Non ',0


text2 Dc.l 'Oui',0

SIMHALT ; halt simulator

* Put variables and constants here

END START ; last line of source

Exercice 4:

*-----------------------------------------------------------
* Title :
* Written by :El Alouan Wisal
* Date :
* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

; Demander à l'utilisateur de saisir la chaîne


LEA $5000,A1
MOVE #2,D0
TRAP #15
MOVE A1,A3
MOVE D1,D2

; Inverser la chaîne
MOVE D2, D3
LEA (A3, D2),A3 ; Ajuster A3 à la fin de la chaîne

Inverse CMP #0,D3


BEQ Fin
move.b -(A3),d1

MOVE #6,D0
TRAP #15
MOVE.B D1,(A2)+ ; Stocker le caractère inversé
SUB #1,D3

JMP Inverse

Fin RTS
Fin2 SIMHALT
TXT1 DC 'Entrer la taille de la chaine',0
TXT2 DC 'Entrer la chaine',0
END START ; last line of source

Exercice 5:
*-----------------------------------------------------------
* Title :
* Written by :El Alouan Wisal
* Date :
*-----------------------------------------------------------
* Title :
* Written by :
* Date :
* Description:
*-----------------------------------------------------------
ORG $1000
START: ; first instruction of program

* Put program code here


MOVE #1,d1
move d1,$2000
move d1,$2002
move #3,d0
trap #15
lea tab,A1
move #0,d0
trap #15
move #3,d0
trap #15
lea tab,A1
move #0,d0
trap #15
move #3,d0
move #3,d2
boucle cmp #20,d2
ble Fibb
simhalt

FIBB move $2000,d3


move $2002,d4
move d4,d1
add d3,d1
move d4,$2000
move d1,$2002
addq #1,d2
trap #15
lea tab,A1
move #0,d0
trap #15
move #3,d0
jmp boucle
SIMHALT ; halt simulator
tab DC.L ' ',0
* Put variables and constants here

END START ; last line of source

You might also like