Document 7819505

Download Report

Transcript Document 7819505

Video systems (continue)
Practice
Modify the program to get a string from a
keyboard to display the input string on the
middle of the screen with reverse video
Hint: Using INT 10H function 13H (last
week’s slide) with 17H as attribute
Review for midterm exam
Review (Week 4 and 3)

Determine the instruction address for the
following given values for CS and IP:
(a) CS = 26AE[0], IP = 0044;
Instruction address= 26B24H;
(b) CS = 25BD[0], IP = 003F;
Instruction address= 25C0FH;
(c) CS = 272D[0], IP = 029C.
Instruction address= 2756C.
Review
2. The BIOS Data Area begins in low memory
at segment address_40[0]H__________
4. A __directive__ enables you to control the
way in which a program assembles and lists.
5. The first byte of an instruction is the
_operation__; the other bytes are
_operand__, which reference an immediate
value, register, or memory location.
Review
3. The value 2505H is stored in locations 130 and
131, and 1C04H is stored in locations 132 and 133.
What is the effect of the following related
instructions?
(a) MOV BX,[0130]
0525H in BX
(b) ADD BX,[0132]
0941H in BX
(c) MOV [0134],BX
4109H in locations 0134 and 0135.

Review
6. The expression in an operand of a data item may
contain a _____?__ to indicate an uninitialized item.
7. The statement DW 10 DUP(25) defines 10 word__
initialized with the value _25__.
8. A comment following an instruction on the same line
is preceded by what character?
(a) *
(b) ;
(c) :
(d) a blank
Review
6. The expression in an operand of a data item may
contain a _____?__ to indicate an uninitialized item.
7. The statement DW 10 DUP(25) defines 10 word__
initialized with the value _25__.
8. A comment following an instruction on the same line
is preceded by what character?
(a) *
(b) ;
(c) :
(d) a blank
Using Graphic Mode




Graphic mode uses pixels to generate color patterns.
It represents a pixel from one to eights bits
There are 10 common graphic modes. They are
different in terms of # pages, #colors, resolution.
EMU8086 supports 1 graphic mode (INT 10H,
function 13H):
–
Page 1, Resolution: 320 x 200, 256 colors
Setting graphic mode
INT 10H, function 00H
Step 1: Set AL = 13H
Step 2: Set AH =0
Step 3: Call INT 10H

Direct Video Display



Fastest way to display text or graphic characters is to
transfer them directly to video display area
The address of page 0 for mode 3 is B800[0]H. Each
character require two bytes (one for representing the
character itself and one for its attribute)
Moving a pair of character:attribute into video area of
the active page will cause the character appear
immediately on screen
Example of direct video display
MOV
MOV
AX, 0B800h
ES, AX
; print message using ES
; as segment:
MOV ES:[00h], 48h
MOV ES:[02H], 45h
MOV ES:[04H], 4ch
MOV ES:[06H], 4ch
MOV ES:[08H], 4fh
;H
;E
;L
;L
;O
Example of direct video display
Example of direct video display
MOV AX, 0B800H
MOV ES, AX
MOV AX, 0003H ; Set the current video mode to text mode
INT 10H
; INT 10H, function 00H (mode=03H is standard text)
MOV AX, 0500H ; Set the active page = 00
INT 10H
CALL DISPLAY
Example of direct video display
DISPLAY PROC NEAR
mov cx,25
mov di,0
again1:
mov es:[di],48h
mov es:[di+1],4eh
add di,80
loop again1
DISPLAY ENDP
;vertical line
Direct Video Display
Direct video display Practice

Modify the previous program to draw
horizontal line on the screen using direct
video display
Review exercise (Week 1 and 2)
1. The smallest unit of data in a computer is a _bit___.
It may be off so that its value is __0___, or on so that
its value is __1__.
2. In a byte, the parity bit always requires that the
number of bits on is a(n) ___odd___ number.
3. The number 210 equals _1024_____, which is
represented by the letter _K_, for kilobyte.
4. A negative binary number contains a __1___ in its
leftmost position. A negative value is expressed in
what is called __two’s complement__________
notation.
Review exercise (Week 1 and 2)
5. The _hexadecimal_____ (base 16) numbering system involves
the digits 0 through F.
To indicate a base 16 number in a program, you code the letter
_H_ immediately after the number.
6. A segment is an area that begins on a _paragraph__________
boundary, that is, at any location evenly divisible by decimal
16__, or hex 10__. A segment may be located almost
anywhere in memory and in real mode may be up to _64K___
bytes in size.
7. Within a program, memory locations are relative to the start of a
__segment________; the distance in bytes is expressed as
a(n) __offset______ from its start.
Review exercise (Week 1 and 2)
8. To convert a binary number into its two's complement form
(a) add 1,
(b) reverse the bit values,
(c) reverse the bit values and add 1,
(d) reverse the bit values and subtract 1.
9. Reverse-byte sequence means that the processor stores
(a) byte values upside down,
(b) byte addresses backwards,
(c) numeric values with bytes in reverse sequence,
(d) all values with bytes in reverse sequence.
Review exercise (Week 1 and 2)
10. The general purpose registers are
(a) AX, BX, CX, DX
(b) SP, BP, IP
(c) DI, SI
(d) CS, DS, ES, SS
11. The index registers are the
(a) AX, BX, CX, DX
(b) SP, BP, IP
(c) DI, SI
(d) CS, DS, ES, SS
12.
What is the maximum size of a segment?
(a) 4K
(b) 64K
(c) 256K
(d) no limit
Review exercise (Week 1 and 2)
13. Provide the two instructions to initialize the
address of the data segment in the DS
register, given the name DATSG.
MOV AX,DATSG
MOV DS,AX
Review exercise (Week 1 and 2)
14.
Practice
2B360H
PSP
DS=2B36[0]H
Stack Segment
SS=2B360H+100H
=2B46[0]H
CS=2B360H+100H
+ 30H
+ 70H
=2B50[0]H
Data Segment
ES=2B36[0]H
SP=0030H
Code Segment
Memory