e3165 digital electronic system
DESCRIPTION
E3165 DIGITAL ELECTRONIC SYSTEM. 3.0 INTRODUCTION. Message sent by programmers (program instructions) understood by the computer and vice versa. Language that friendly to human also understandable to computer systems. Three level of language: Low level – machine language - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/1.jpg)
![Page 2: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/2.jpg)
3.0 INTRODUCTION
Message sent by programmers (program instructions) understood by the computer and vice versa.
Language that friendly to human also understandable to computer systems.
Three level of language: Low level – machine language Middle level – assembly language High level – high-level language
![Page 3: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/3.jpg)
3.0 INTRODUCTION
![Page 4: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/4.jpg)
3.1 HLL,AL,ML Machine language:
Natural language of a particular computer system. Strings of numbers or binary codes (0 or 1). Machine-dependant (differ from one µP to other µP. Programmers need to know specifically the
architecture of CPU. Assembly language:
Using english-like abbreviations (MUL). Overcome problems – writing machine language is
too slow and tedious. Assembler as translator. Programmer need to know the basic architecture.
![Page 5: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/5.jpg)
3.1 HLL,AL,ML
High-level language: Using everyday English and common
mathematical notation. (x = I + j) Overcome problems : assembly language
require many instruction to accomplish a simple task.
Single instruction in HLL = several AL instructions.
Compiler as translator. Programmers do not need to know the
architecture of CPU.
![Page 6: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/6.jpg)
3.1 HLL,AL,ML
![Page 7: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/7.jpg)
3.1 HLL,AL,ML
![Page 8: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/8.jpg)
3.2 ASSEMBLY LANGUAGE PROGRAMING
ASM68K
![Page 9: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/9.jpg)
3.2 ASSEMBLY LANGUAGE PROGRAMING
![Page 10: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/10.jpg)
3.2.1 MACHINE INSTRUCTION / CODE FORMAT
![Page 11: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/11.jpg)
3.3 INSTRUCTION FORMAT There are many MC68000 instructions.
However, theses instructions comply to a standard instruction format:
Label – a user-defined symbol representing the address associated with the instruction. Up to 8 alphanumeric, begin with letter, terminated by a space.
SLIDE 48
![Page 12: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/12.jpg)
3.3 INSTRUCTION FORMAT Operator .
a mnemonic code for MC68000 instructions . An assembler directive / pseudo-instruction /
pseudo-operation. Macro call (repetitive instructions in a program
which arecodified only once and can be used as many times as necessary)
Operand – depends on the operator, may has more than one operand.
Comment – explanation about the execution of instruction.
Data format: Byte | Word | Longword | Sign-extended
![Page 13: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/13.jpg)
3.4.1 DATA TRANSFER / MOVE GROUP Transfer / move data between registers and
memory. Instructions of data transfer group.
MOVE.B D1,D2MOVE.B D6,CCRMOVE.W SR,D6MOVE.L USP,A1MOVE.L A2,USPMOVEA.W #$4321,A0MOVEQ.B #01,D4MOVEM.W D2/D4-D6, $4000MOVEM.L $4000,D0-D5LEA START,A0
EXG D1,D2SWAP D3CLR.B $3000
![Page 14: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/14.jpg)
3.4.1 MOVE Byte(B), Word(W) and Long word(L). R R , R M , M M , EA SR , USP An Example 1:
MOVE.W #$72,D1 Before : D1 = $00200500 After : D1 = $00200072
Example 2: MOVE.B D0,D1 Before : D1 = $00200500 , D0 = $00002222 After : D1 = $00200522 , D0 = $00002222
Example 3: MOVE.B $3000,D1 Before : D1 = $00200500 , After : D1 = $00200532 ,
# menunjukkan data sebenar.
$ menunjukkan nombor heksa
$3000 32
$3001 43
$3002 98
![Page 15: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/15.jpg)
3.4.1 MOVE(CONT.) Example 4:
MOVE.W D6,$4000 Before: D6 = $AB206541 , After : D6 = $AB206541 ,
Example 5: MOVEA.W D6,A2 Before : D6 = $AB206541 , A2 = $ABCD1234 After : D6 = $AB206541 , A2 = $00006541
Example 6: MOVEA.W D6,A2 Before : D6 = $AB20A541 , A2 = $ABCD1234 After : D6 = $AB206541 , A2 = $FFFFA541
$4000 3254
$4002 4377
$4004 9868
$4000 32
$4001 54
$4002 43
@
$4000 6541
$4002 4377
$4004 9868
@$4000 65
$4001 41
$4002 43
![Page 16: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/16.jpg)
3.4.1 MOVE(CONT.) Example 7:
MOVEA.L D6,A2 Before : D6 = $AB206541 , A2 = $ABCD1234 After : D6 = $AB206541 , A2 = $AB206541
Example 8: MOVEQ #$04,D3 (MOVEQ #XXX,Dn) Before : D3 = $AB206541 After : D3 = $00000004
Example 9: MOVEQ #$80,D3 Before : D3 = $AB206541 After : D3 = $FFFFFF80
-128 (80) hingga 127 (7F)
![Page 17: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/17.jpg)
3.4.1 MOVE(CONT.) Example 10:
MOVEM.W D2/D5/D0,$200 Before : D0 = $11112222 ,
D2 = $33334444 ,
D5 = $55556666 , After : D0 = $11112222 ,
D2 = $33334444 ,
D5 = $55556666 ,
Example 11: MOVEM.L D2/D5/D0,-(A4) Before : D0 = $11112222 , D2 = $33334444 ,
D5 = $55556666 , A4 = $0000050C After : D0 = $11112222 ,
D2 = $33334444 ,
D5 = $55556666 ,
A4 = $00000500
$200 6541
$202 4377
$204 9868
$200 4444
$202 6666
$204 2222
$500 451287A4
$504 54A2F221
$508 846AC1DD
$50C 45123211$500 33334444
$504 55556666
$508 11112222
Predecrement (tolak dulu)B : – 1 , W : – 2 , L : – 4Dlm contoh ada 3 daftar maka 3x4=12 , 50C – C = 500
![Page 18: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/18.jpg)
3.4.1 MOVE(CONT.) Example 12:
MOVEM.W $200,D2/D5/D0 Before : D0 = $11112222 ,
D2 = $33334444 ,
D5 = $55556666 , After : D0 = $FFFF9868 ,
D2 = $00006541 ,
D5 = $00004377 ,
Example 13: MOVEM.L (A4)+,D2/D5/D0 Before : D0 = $1111222 , D2 = $33334444 ,
D5 = $55556666 , A4 = $00000500 After : D0 = $846AC1DD ,
D2 = $451287A4 ,
D5 = $54A2F221 ,
A4 = $0000050C
$200 6541
$202 4377
$204 9868
$200 6541
$202 4377
$204 9868
$500 451287A4
$504 54A2F221
$508 846AC1DD
$50C 45123211$500 451287A4
$504 54A2F221
$508 846AC1DD
Posincrement (tmbh kmdn)B : + 1 , W : + 2 , L : + 4Dlm contoh ada 3 daftar maka 3x4=12 , 500 + C = 50C
![Page 19: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/19.jpg)
3.4.1 MOVE(CONT.) Example 14:
MOVEP.W D2,1(A1) Before : D2 = $AB206541 ,
A1 = $00000501 After : D2 = $AB206541 ,
A1 = $00000501
Example 15: EXG D1,D5 Before : D1 = $11223344 , D5 = $66778899 After : D1 = $66778899 , D5 = $11223344
Example 16: SWAP D1 Before : D1 = $11223344 After : D1 = $33441122
$501 FF
$502 65
$503 41
$501 FF
$502 FF
$503 FF $502 dan $501
adalah alamat I/O
![Page 20: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/20.jpg)
3.4.1 MOVE(CONT.) Example 17:
After : A1 = $00002001 MOVEA.L $2001,A1 ≠ LEA $2001,A1
Example 18: CLR.B D1 Before : D1 = $11223344 After : D1 = $ 11223300
OPER EQU $2001MOVEA.L #OPER,A1
MOVEA.L #$2001,A1
OPER EQU $2001LEA OPER,A1
LEA $2001,A1
![Page 21: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/21.jpg)
3.4.2 ARITHMETIC
ADD.W $300,D1ADD.L D2,$218ADDI.B #$44,D3ADDQ.W #$32,D2ADDX D1,D2ADDX -(A1),-(A3)ADDA $100,A6SUB.W $300,D1SUB.L D2,$218SUBI.B #$44,D3SUBQ.W #$32,D2SUBX D1,D2SUBX -(A1),-(A3)SUBA $100,A6NEG D1NEGX A4MULS $32,D5MULU #$04,D5DIVS $32,D5DIVU #$04,D5EXT.W D3EXT.L D2
![Page 22: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/22.jpg)
3.4.2 ARITHMETIC(CONT.) Byte(B), Word(W) and Long word(L). Data via register, memory, absolute data and I/O
port. Example 1:
ADDI.W #$72,D1 Before : D1 = $00200500 After : D1 = $00200572
Example 2: ADD.L D0,D1 Before : D1 = $00200500 , D0 = $00002222 After : D1 = $00202722 , D0 = $00002222
Example 3: ADD.W $3000,D1 Before : D1 = $00200500 , After : D1 = $00203743 ,
$3000 32
$3001 43
$3002 98
![Page 23: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/23.jpg)
3.4.2 ARITHMETIC(CONT.) Example 4:
ADD.W D6,$4000 Before: D6 = $AB206541 , After : D6 = $AB206541 ,
Example 5: ADDA.W D6,A2 Before : D6 = $AB206541 , A2 = $ABCD1234 After : D6 = $AB206541 , A2 = $ABCD7775
Example 6: ADDA.L D6,A2 Before : D6 = $AB20A541 , A2 = $ABCD1234 After : D6 = $AB206541 , A2 = $56EDB775 , C = 1
$4000 3254
$4002 4377
$4004 9868
$4000 32
$4001 54
$4002 43
@
$4000 9795
$4002 4377
$4004 9868
@$4000 97
$4001 95
$4002 43
![Page 24: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/24.jpg)
3.4.2 ARITHMETIC(CONT.) Example 7:
ADDX.B D2,D3 Before : D2 = $AB206541 , D3 = $ABCD1234 , X = 1 After : D2 = $AB206541 , D3 = $AB206576 , X = 1
Example 8: ADDQ.B #$04,D3 (ADDQ #XXX,Dn) Before : D3 = $AB206541 After : D3 = $AB206545
Example 9: SUB.W #$80,D3 Before : D3 = $AB206541 After : D3 = $AB2064C1
-128 (80) hingga 127 (7F)
![Page 25: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/25.jpg)
3.4.2 ARITHMETIC(CONT.) Example 10:
SUBI.L #10,D2 Before : D2 = $AB206541 After : D2 = $AB206537
Example 11: SUBQ.W #@11,D3 (SUBQ #XXX,Dn) Before : D3 = $AB206541 After : D3 = $AB200038
Example 12: NEG.W D3 Before : D3 = $AB206541 After : D3 = $AB209ABF
@ menunjukkan nombor octal
% menunjukkan nombor binari
-128 (80) hingga 127 (7F)
NEG = Pelengkap 2
$41 = 01000001Songsangkan 10111110
+ 1$BF = 10111111
![Page 26: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/26.jpg)
3.4.2 ARITHMETIC(CONT.) Example 13:
MULU #2,D2 ;16 bit x 16 bit = 32 bit Before : D2 = $AB206541 After : D2 = $0000CA82
Example 11: MULU #2,D2 Before : D2 = $AB20FFFF After : D2 = $0001FFFE
Example 12: DIVU #2,D3 ;32 bit / 16 bit = 16 bit lower (result)
16 bit upper ( remainder)
Before : D3 = $00006541 After : D3 = $000132A0
@ menunjukkan nombor octal
% menunjukkan nombor binari
6541F = 2592132A016
= 1296010
![Page 27: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/27.jpg)
3.4.3 LOGICAL OPERATION
AND.W $300,D1AND.L D2,$218ANDI.B #$44,D3ANDI #%11011,CCRADDI #$25,SR
OR.W $300,D1OR.L D2,$218ORI.B #$44,D3ORI #%11011,CCRORI #$25,SR
EOR.W $300,D1EORI.B #$44,D3EORI #%11011,CCREORI #$25,SR
NOT.W D2
![Page 28: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/28.jpg)
3.4.3 LOGICAL OPERATION(CONT.) Example 1:
AND.B #$3E,D1 Before : D1 = $12345674 After : D1 = $12345634
Example 2: OR.B D0,D1 Before : D1 = $1234563E , D0 = $98765474 After : D1 = $1234567E , D0 = $98765474
Example 3: NOT.B D1 Before : D1 = $12345655 , After : D1 = $123456AA ,
![Page 29: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/29.jpg)
3.4.4 SHIFT AND ROTATE Example 4: B : 0 to 255 | $00 - $FF
![Page 30: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/30.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 5:
B : 0 to 255 | $00 - $FF
![Page 31: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/31.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 6: B : 0 to 255 | $00 to $FF
![Page 32: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/32.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 7: B : 0 to 255 | $00 to $FF
![Page 33: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/33.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 8: B : 0 to 127 | $00 - $7F
-1 to -128 | $FF to $8F
![Page 34: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/34.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 9: B : 0 to 127 | $00 - $7F
-1 to -128 | $FF to $8F
![Page 35: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/35.jpg)
3.4.4 SHIFT AND ROTATE (CONT.) Example 10:
![Page 36: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/36.jpg)
3.4.5 CONTROL TRANSFER Normally : PC point to the next instruction.
PC has the address of next instruction.
Jump / branch : PC will be load with target address.
Jump : unconditional Branch : conditional Example:
JMP $8450BCS $8A50
PC is a 32 bit register.
![Page 37: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/37.jpg)
3.4.5 CONTROL TRANSFER Conditional transfer instruction
i. Bcc instruction (Branch conditionally) Format: Bcc DST Example: START MOVE.W D3,D4
….. BNE NEXT ;(Branch if
Z=0) NEG D3
….NEXT SUB.W #32, D1
![Page 38: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/38.jpg)
3.4.5 CONTROL TRANSFERii. DBcc instruction (test condition, decrement & branch) Format: DBcc Dn,DST Operation: Test condition; i. condition met; no branch, execute next instruction. ii. condition not met; (Dn - 1)
if Dn ≠ -1; branch to DST
if Dn = -1; no branch, execute next instruction.
Example: START CLR.L D4 ; D4 = $00000000
….. DBNE D4,NEXT ; condition (Z=0) NEG D3….NEXT SUB.W #32, D1
![Page 39: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/39.jpg)
3.4.5 CONTROL TRANSFERiii. Scc instruction (set conditionally) Format: Scc DST Operation: Test condition:
i. condition met; DST will get 1s ii. condition not met; DST will get 0s
No branch involved. Example: START CLR.L D4 ; Z = 1
SNE D5 ; D5 = $00000000
![Page 40: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/40.jpg)
3.4.5 CONTROL TRANSFER JMP
– always jump to any address. JMP DST
BRA always branch but up to 65536 (216) address. BRA DST .S for branch to 256 (28) address BRA.S DST
NOP no operation delay in execution time.
STOP operand loads into status register and stop. STOP #$78
![Page 41: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/41.jpg)
3.4.6 STACK CONTROL Stack is a data structure that can be used to
save data. Stack works in LIFO concept.
![Page 42: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/42.jpg)
3.4.6 STACK CONTROL There are two (2) stack:
User Stack – point by USP & Supervisor Stack – point by SSP
![Page 43: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/43.jpg)
3.4.6 STACK CONTROL
PUSH data into stack. 1. decrement SP
2. move data into stack MOVE.B D1,-(A0)
POP data from stack. 1. move data from stack
2. increment SP MOVE.B (A0)+,D1
![Page 44: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/44.jpg)
3.4.7 SUBROUTINE CONTROL An approach to simplify a long and complex
program. Grouping repeated instructions into
subroutine. This subroutine will be called when needed. Operation:
Before executing subroutine, current data (registers, SR, PC)need to be save in stack first.
Subroutine is carried out After the subroutine finish,
data in stack will be restored back.
Instruction : JSR, BSR, RTS, RTR
![Page 45: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/45.jpg)
3.4.7 SUBROUTINE CONTROL JSR
JSR EA – the subroutine maybe anywhere in the memory.
Operation: PC -(SP) EA PC
BSR BSR EA – the subroutine must be
within 65536 address Operation:
PC -(SP) PC + d PC
![Page 46: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/46.jpg)
3.4.7 SUBROUTINE CONTROL RTS
RTS – return from subroutine Operation:
(SP)+ PC
RTR RTR – return and restore CCR Operation:
(SP)+ CCR (SP)+ PC
![Page 47: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/47.jpg)
REVISION68000 INSTRUCTIONS: DATA TRANSFER/ MOVE GROUP
move,movem,lea,exg,swap,clr ARITHMETIC OPERATION
add,sub,neg,mul,div,ext LOGICAL OPERATION
and,or,not,eor SHIFT AND ROTATE (x)
lsl,lsr,asl,asr,rol,ror,roxl,roxr (x) CONTROL TRANSFER GROUP
Jmp,bcc,dbcc,scc,nop,stop STACK CONTROL INSTRUCTION SUBROUTINE CONTROL INSTRUCTION
jsr,bsr,rts,rtr
![Page 48: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/48.jpg)
3.4.8 ASSEMBLER DIRECTIVES Assembler directives are not executed during program execution. ORG :
– instruct the assembler to assemble the program. – initiate the address of the first instruction.
– ORG $1000 END
– terminate the assembly process. EQU
– assign value – COUNTER EQU $30
DC – reserve memory with initial values. – DATA DC.B$32,$65,$21,$33
DS – reserve memory with no initial values– SUM DS.B 6 TOTAL DS.W 1
SLIDE 11
![Page 49: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/49.jpg)
3.4.8 ASSEMBLER DIRECTIVES
![Page 50: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/50.jpg)
3.4.8 ASSEMBLER DIRECTIVES
![Page 51: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/51.jpg)
3.5 FLAG/STATUS REGISTER
![Page 52: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/52.jpg)
3.5 FLAG/STATUS REGISTER (CONT.) Carry, C
![Page 53: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/53.jpg)
3.5 FLAG/STATUS REGISTER (CONT.) oVerflow, V
For operation with 2’s complement. (+ve) + (+ve) = (-ve) V = 1 (salah) (+ve) + (+ve) = (+ve) V = 0 (betul)
![Page 54: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/54.jpg)
3.5 FLAG/STATUS REGISTER (CONT.) oVerflow, V
For operation with 2’s complement. (-ve) - (+ve) = (+ve) V = 1
![Page 55: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/55.jpg)
3.5 FLAG/STATUS REGISTER (CONT.) oVerflow, V
For operation with 2’s complement. (-ve) - (+ve) = (-ve) V = 0 (-ve) - (-ve) = (+ve) V = 0
![Page 56: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/56.jpg)
3.5 FLAG / STATUS REGISTER Zero, Z
Result zero; Z = 1 Result not zero; Z = 0
![Page 57: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/57.jpg)
3.5 FLAG / STATUS REGISTER Negative, N
Result negative; N = 1 Result positive; N = 0
Extend (X) Usually copy C flag. Use in multiple precision arithmetic (aritmetik titik
apungan).
![Page 58: E3165 DIGITAL ELECTRONIC SYSTEM](https://reader035.vdocument.in/reader035/viewer/2022062500/56815a62550346895dc79fe8/html5/thumbnails/58.jpg)
3.5 FLAG / STATUS REGISTER Interrupt mask bits (I2,I1,I0)
Trace, T T = 1, Instructions will be execute step by step. T = 0, Instructions will be execute till the end.
Supervisor, S S = 1, processor in supervisor state, all instruction can
be executed. S = 0, processor in user state, executing privileged
instruction will cause trap.