Sei sulla pagina 1di 4

*----------------------------------------------------------* Title

: PROJECT 1
* Written by :
* Date
:
* Description:
*----------------------------------------------------------CR
LF
RESULT

EQU
EQU
EQU

$0D
$0A
$2010

START

ORG

$1000

;address to save result

*--------------get name and display--------------------LEA


NAME,
A1
MOVE.B
#14,
D0
; Display the NULL terminated string at (
A1) without CR, LF (not go to next line). Stored at D1.L
TRAP
#15
; Trap #15 does a simulator input or outp
ut command based on the contents of D0
MOVE.B
#2,
D0
; Stores a user-entered, null-terminated
string at address A1. Length of string is stored in D1.W
TRAP
#15
*--------------get matrix no and display---------------LEA
MATRIC,
MOVE.B
#14,
A1) without CR, LF (not go
TRAP
#15
MOVE
#4,
.L
TRAP
#15

A1
D0
; Display the NULL terminated string at (
to next line)
D0

; Read a number from the keyboard into D1

*--------------no of subject and loop to get cd hour and marks---------------LEA


MOVE.B
TRAP

NEXT_LINE, A1
#14,
D0
#15

; Go to next line :)

LEA
LIST,
A1
MOVE.B
#14,
D0
; Display the NULL terminated string at
(A1) without CR, LF (not go to next line)
TRAP
#15
MOVE
#4,
D0
TRAP
#15
MOVE.W
CLR.L
CLR.L
CLR.L

LOOP

LEA
MOVE.B
TRAP

D1,D3

;Initialize loop counter

D5
D6
D7

NEXT_LINE, A1
#14,
D0
#15

; Go to next line :)

LEA
SUBJECT, A1
MOVE.B
#14,
D0
; Display the NULL terminated string at
(A1) without CR, LF (not go to next line)
TRAP
#15
MOVE.B
#4,
D0
; #4 IS FOR NO #2 IS FOR STRING URGH WHY
LIKE THIS NK MASUKKAN STRINGGGGG
TRAP
#15
LEA
CDHOUR, A1
MOVE.B
#14,
D0
; Display the NULL terminated string at
(A1) without CR, LF (not go to next line)
TRAP
#15
MOVE.B
#4,
D0
TRAP
#15
MOVE.L
ADD

D1,
D4,

D4
D6

;save value of credit hour to D4


;total up credit hour

LEA
GRADE, A1
MOVE.B
#14,
D0
;Display the NULL terminated string at (
A1) without CR, LF (not go to next line)
TRAP
#15
MOVE.B
#5,
D0
;############## Read single character fro
m the keyboard into D1.B
TRAP
#15
*------------calculation based on grade-------------------------------------

_B

_C

_D

_E

_F

CMP.B
BNE
MULU
ADD

#$41,
_B
#4,
D4,

D1

CMP.B
BNE
MULU
ADD

#$42,
_C
#3,
D4,

D1

CMP.B
BNE
MULU
ADD

#$43,
_D
#2,
D4,

D1

CMP.B
BNE
MULU
ADD

#$44,
_E
#1,
D4,

D1

CMP.B
BNE
MULU
ADD

#$45,
_F
#1,
D4,

D1
D4
D7

;plus 1 times cd hour since E

CMP.B
MULU
ADD

#$46,
#0,
D4,

D1
D4
D7

;plus 0 times cd hour since F

D4
D7

D4
D7

D4
D7

D4
D7

;plus 4 times cd hour since A

;plus 3 times cd hour since B

;plus 2 times cd hour since C

;###########################
;plus 1.67 times cd hour since D

LEA
NEXT_LINE, A1
MOVE.B
#14,
D0
; Display the NULL terminated string at
(A1) without CR, LF (not go to next line)
TRAP
#15
SUB.B

#1,

D3

; Minus 1 everytime finish enter a subje

MOVE.W
BEQ

D3,
DONE

D1

BRA

LOOP

DC.B
DC.B

'NAME
: ',0
'MATRIC NO: ',0

ct

NAME
MATRIC

; When D1=zero, it will proceed to DONE

NEXT_LINE DC.B
line.

' ', CR,LF,0

LIST

DC.B

'NO OF SUBJECT TAKEN IN X SEM: ',0

SUBJECT

DC.B

'SUBJECT

CDHOUR
GRADE

;I want no of each subject to have gap 1

: ',0 ; NULL Terminated

DC.B
DC.B

'CREDIT HOUR: ',0


'MARKS
: ',0

RESULTS DC.B

'YOUR GPA IS: ',0

*-------------------display gpa then end program ------------------DONE

LEA
MOVE.B
TRAP

LEA
MOVE.B
1) without CR, LF
TRAP

NEXT_LINE, A1
#14,
D0
#15

; Go to next line :)

RESULTS, A1
#14,
D0
; Display the NULL terminated string at (A
(not go to next line)
#15

DIVU

D6,

D7

; Divide sum of marks*cd hour by total cd

MOVE.L

D7,

D5

D5,
trap
#3,
#15

D1

; Save value of calculated GPA in D1 so th

D0

; Display calculated GPA

hour
MOVE.L
at can be used in
MOVE.B
TRAP

MOVE.B
TRAP

#9,D0
#15

;halt the simulator

END

START

Potrebbero piacerti anche