Pertemuan 3 Pemanfaatan berbagai fungsi grafik yang telah ada baik melalui ROM-BIOS

Download Report

Transcript Pertemuan 3 Pemanfaatan berbagai fungsi grafik yang telah ada baik melalui ROM-BIOS

Matakuliah : T0074 / Grafika Komputer
Tahun
: 2005
Versi
: Versi 1 / Revisi 0
Pertemuan 3
Pemanfaatan berbagai fungsi grafik
yang telah ada baik melalui ROM-BIOS
atau Compiler C/C++
1
Pokok Bahasan (3) :
Pemanfaatan berbagai
fungsi/Instruksi
grafik yang telah ada (OpenGL)
dengan C/C++ Compiler
Oleh :
Djunaidy Santoso M.Kom.
2
Pokok Bahasan (3) : Pemanfaatan
berbagai fungsi/Instruksi grafik yang
telah ada (contoh OpenGL) dengan
C/C++ Compiler
3
Learning Outcomes
Pada akhir pertemuan , diharapkan mahasiswa
akan mampu :
• Menghasilkan program Grafik dengan
IBM PC dalam grafika komputer.
4
Outline Materi
•
•
•
•
•
Materi 1 : Inisialisasi fungsi grafik
Materi 2 : Set modus video
Materi 3 : Fungsi-fungsi grafik
Materi 4 : Blok Diagram CGA/VGA/SVGA
Materi 5 : Menggambar titik pada layar
5
PEMROGRAMAN GRAFIK
(pada keluarga IBM PC)
Memory Pemetaan Display
Keluarga IBM PC menggunakan memory pemetaan display. Tergantung modus dan jenis
video, memory ini lokasinya pada A0000H hingga BFFFFH.
Modus : Text dan Graphics
Jenis video : CGA, VGA (hanya ini yang kita bahas)
SVGA ??
Lihat tabel Memory Assignment seperti berikut :
Mode card Type
0H,1H
0H,1H
2H,3H
2H,3H
4H,5H
4H,5H
6H
6H
10H
12H
CGA
VGA
CGA
VGA
CGA
VGA
CGA
VGA
VGA
VGA
pa charac
ge ters
pixels
Text
8
Text
8
Text
4
Text
4
Graphics 1
Graphics 1
Graphics 1
Graphics 1
Graphics 2
Graphics 1
40x25
40x25
80x25
80x25
40x25
40x25
80x25
80x25
80x25
40x25
320x200
360x400
640x200
720x400
320x200
320x200
640x200
640x200
640x350
320x200
Colors
Start
[/pallets] Address
16
16/256K
16
16/256K
4
4/256K
2
2/256K
16/256K
256/256K
B8000H
B8000H
B8000H
B8000H
B8000H
B8000H
B8000H
B8000H
A8000H
A8000H
6
Modus Teks
Tiap Karakter menempati 2 byte memori :
byte 1 : Kode ASCII yang ditampilkan
byte 2 : atribut karakter
bit 7 : blink-enable
bit 6-4 : 3 bit warna latar belakang (000-111)
bit 3-0 : 4 bit warna huruf (0000-1111)
Konstanta simbolik pada Turbo C dan Turbo Pascal
Nilai
Nilai
Huruf atau
Numerik
Biner
latar belakang ?
Konstanta
simbolik
BLACK
0
0000
keduanya
BLUE
1
0001
keduanya
GREEN
2
0010
keduanya
CYAN
3
0011
keduanya
RED
4
0100
keduanya
MAGENTA
5
0101
keduanya
BROWN
6
0110
keduanya
LIGHTGRAY
7
0111
keduanya
DARKGRAY
8
1000
hanya huruf
LIGHTBLUE
9
1001
hanya huruf
LIGHTGREEN
10
1010
hanya huruf
LIGHTCYAN
11
1011
hanya huruf
7
Turbo C :
library<conio.h>
void textattr (int attr)
void textbackground (into color)
void textcolor (int color)
Turbo Pascal : Unit Crt var textattr:byte;
procedure
textbackground(c:byte);
procedure textcolor( c:byte);
8
CGA (Color Graphics Adapter)
pada modus grafik
Mode 4H,5H
: 2 bit per pixel (=1byte per 4 pixel)
Mode 6H : 1 bit per pixel (=1byte per 8 pixel)
CGA I/O Ports
Mode Select Port(port 3D8H)
bit
7 6 5
4
3
2
1
0
Arti dari bit 0 s/d 7 bisa dilihat dari buku wajib dan
Lewat internet ( dengan google : CGA/VGA/SVGA I/O
Port.)
9
VGA ( Video Graphics Array)
Mode 4H,5H
: 2bit per pixel (=1 byte per 4 pixel)
Mode 6H
: 1bit per pixel (=1 byte per 8 pixel)
Mode DH,EH,FH 10H,11H, 12 H, 13H, dst
Bentuk Umum Register
Full Register
AX
BX
CX
DX
2 byte
2 byte
2 byte
2 byte
10
Half Register
high byte
low byte
AH
BH
CH
DH
AL
BL
CL
DL
Struct fullregs
{
unsigned int ax ;
unsigned int bx ;
unsigned int cx ;
unsigned int dx ;
};
Struct halfregs
{
unsigned int ax ;
unsigned int bx ;
unsigned int cx ;
unsigned int dx ;
};
Unions REGS
{
struct fulltegs x ;
struct halfregs h ;
}
General Registers
Miscellaneous Output Register
Miscellaneous Control Register
Input Status Register Zero
Input Status Register
(Port 3c2), Write Only
(Port 3d2), Write Only
(Port 3c2), Read Only
(Port 3d2), Read Only
11
Sequencer Register
Port : 3c4, 3c5
Reset Clocking Mode Map Mask Character Map SelectMemory Mode -
Sequencer Register 0
Sequencer Register 1
Sequencer Register 2
Sequencer Register 3
Sequencer Register 4
Attribute Registers
Port : 3c0h
Pallete Register Mode Control Oversan Color Color Plane Enable Horizontal Pixel Panning Color Select Register -
Attribute
Attribute
Attribute
Attribute
Attribute
Attribute
Register 00h to 0fh
Register 10h
Register 11h
Register 12h
Register 13h
Register 14h
Note : Pelajari penggunaan register tersebut.
12
<< CLOSING>>
Mahasiswa mampu menghasilkan program
grafik dengan IBM PC dalam grafika
Komputer.
13