Title: Instruction Set Initial
1Instruction Set - Initial
- Add op1, op2
- Sub op1, op2
- Mov op1, op2
- Inc op
- Dec op
- cmp op1, op2
- Jump instructions
- Jmp label
- Jz label
- Jnz label
- Je label
- Jne label
- Jl label
- Jg label
- Jge label
- Jle label
2Cmp
Cmp op1, op2 comparing two operands, comparing
op1 with op2 Implied subtraction Comparison done
op1 op2
3Using unconditional JMP
.data Val1 byte 12 Val2 byte 25 .code Mov ax,
_at_data set up the data segment Mov ds,
ax again Mov ah, val1 put val1 in the ah
register add ah, val2 ah val1
val2 jmp again rest of template
gets inserted
4Combine cmp and jumps
.data Mystring byte tangerine Encoded byte
? .code Mov ax, _at_data set up the data
segment Mov ds, ax move each byte one by one
into a byte register add one to that byte store
in encoded need to remember the address of
source (mystring) and destination (encoded)
- Questions
- How many times do we
- Need to do this? Ans. 9
- 2. How do we keep track of
- The number of times we are
- Doing this? Ans. Cx
- 3. How do we keep track of where
- We are in the string?
- Use either bx, si, di
- Need one for mystring
- Need one for encoded
5.data string byte "tangerine" codestr
byte .code mov ax,_at_data mov ds,ax initialize m
ov cx,0 setting up counter mov si,offset
string address of string in si mov di,offset
codestr address of string in di need loop
structure again mov ah,si Put a character in
ah inc ah mov di,ah inc si inc di inc cx cmp
cx je again
6Exam Notes - can use Abel's book although mostly
out of orderChapter 1 -Â Â binary-decimal-hexade
cimal conversions  twos-complement
representation for signed integers  PC
components  Segmented memory  Registers Â
InterruptsChapter 2 - read for concepts, some of
this doneChapter 3 - debug, introduction to
simple instructionsINT 21h -   read char  Â
write char   write stringChapter 4 - see
current notes     go through review
exercisesChapter 5 - see current notesChapter 6
- new instructions ADD, SUB, INC, DEC, MOVÂ Â Â
CMP, PTR, JMP, JZ, etc. AND, OR, NOTÂ Â Â Flag
register   See 6-2, 6-3, 6-4, 6-96-116-13 in
masm