#define UCHAR unsigned char
#define VIDEO_INT 0x10
class Screen
{
private:
UCHAR mode, row, col;
UCHAR rownum, colnum;
UCHAR active_page, visual_page;
UCHAR attribute;
public:
Screen(void); // Konstruktor default
Screen(UCHAR mode);
~Screen(void); // Destruktor default
void setMode(UCHAR mode);
UCHAR getMode(void);
void setCursorPos(UCHAR y, UCHAR x);
void getCursorPos(UCHAR *y, UCHAR *x);
void writeChar(UCHAR letter);
void writeString(UCHAR *str);
void setAttribute(UCHAR attr);
UCHAR getCharAttr(UCHAR *attr);
void setActivePage(UCHAR page);
UCHAR getActivePage(void);
void setVisualPage(UCHAR page);
UCHAR getVisualPage(void);
void cls(void);
}; // Akhir prototype class Screen
Screen::Screen(void) // Konstruktor default.
{ // Menset layar pada
UCHAR mode; // mode 25 baris dan
// 80 kolom, warna huruf
this->row = 0; // abu-abu dan latar
this->col = 0; // hitam, 16 warna.
this->mode = mode = 0x03;
this->rownum = 25;
this->colnum = 80;
this->active_page = 0;
this->visual_page = 0;
this->attribute = 7;
asm mov ah, 0x00;
asm mov al, mode;
asm or al, 0x80;
asm int VIDEO_INT;
return;
}
Screen::Screen(UCHAR mode) // Konstruktur
{ // dengan
this->setMode(mode); // parameter mode
// layar.
return;
}
Screen::~Screen(void) // Destruktor default.
{ // Tidak melakukan
return; // apapun.
}
void Screen::setMode(UCHAR mode) // Memilih
{ // mode
this->mode = mode; // layar.
this->active_page = 0;
this->visual_page = 0;
this->rownum = 25;
switch (mode) // Menentukan banyak kolom
{ // berdasarkan nomor mode.
case 0x00 :
case 0x01 : this->colnum = 40;
break;
case 0x02 :
case 0x03 :
case 0x07 : this->colnum = 80;
break;
default : this->colnum = 0;
break;
}
asm mov ah, 0x00;
asm mov al, mode;
asm or al, 0x80;
asm int VIDEO_INT;
return;
}
UCHAR Screen::getMode(void) // Mengetahui
{ // mode layar.
return this->mode;
}
void Screen::setCursorPos(UCHAR y, UCHAR x)
{
UCHAR page = this->active_page;
if ((y > this->rownum) ||
(x > this->colnum))
y = x = 0;
this->row = y; // Menentukan posisi
this->col = x; // kursor.
asm mov ah, 0x02;
asm mov bh, page;
asm mov dh, y;
asm mov dl, x;
asm int VIDEO_INT;
return;
}
void Screen::getCursorPos(UCHAR *y, UCHAR *x)
{
*y = this->row; // Mengetahui posisi
*x = this->col; // kursor.
return;
}
void Screen::writeChar(UCHAR letter)
{
UCHAR page = this->active_page;
UCHAR attr = this->attribute;
asm mov ah, 0x09; // Menuliskan satu
asm mov al, letter; // karakter dan
asm mov bh, page; // atributnya
asm mov bl, attr;
asm mov ch, 0x00;
asm mov cl, 0x01;
asm int VIDEO_INT;
return;
}
void Screen::writeString(UCHAR *str)
{
for (; *str != '\0'; str++)
{
if (this->col > this->colnum)
{
this->row++; // Mencetak rangkaian
this->col = 0; // karakter (string).
}
this->setCursorPos(this->row,
++this->col);
this->writeChar(*str);
}
return;
}
void Screen::setAttribute(UCHAR attr)
{
this->attribute = attr; // Mengubah warna
// huruf dan warna
return; // latar.
}
UCHAR Screen::getCharAttr(UCHAR *attr)
{
UCHAR page = this->active_page;
UCHAR letter, attribute;
asm mov ah, 0x08; // Mengetahui
asm mov bh, page; // karakter dan
asm int VIDEO_INT; // atributnya pada
asm mov attribute, ah; // posisi kursor.
asm mov letter, al;
this->attribute = *attr = attribute;
return letter;
}
void Screen::setActivePage(UCHAR page)
{
this->active_page = page; // Menentukan
// halaman aktif.
return;
}
UCHAR Screen::getActivePage(void)
{ // Mengetahui
return this->active_page; // halaman aktif.
}
void Screen::setVisualPage(UCHAR page)
{
if (page > 7) page = 0;
this->visual_page = page;
asm mov ah, 0x05; // Menentukan halaman
asm mov al, page; // yang ditampilkan.
asm int VIDEO_INT;
return;
}
UCHAR Screen::getVisualPage(void)
{ // Mengetahui
return this->visual_page; // halaman yang
} // ditampilkan.
void Screen::cls(void)
{ // Membersihkan
UCHAR mode = this->mode; // tampilan layar
// serta
this->row = 0; // memposisikan
this->col = 0; // kursor di 0, 0.
asm mov ah, 0x00;
asm mov al, mode;
asm int VIDEO_INT;
return;
}
Kamis, 23 Juni 2016
Langganan:
Posting Komentar (Atom)
About Me
Diberdayakan oleh Blogger.
Popular Posts
-
#include <math.h> #include <stdlib.h> #include "screen.cpp" #include "keyboard.cpp" int main(void) { Screen ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_F1 0x3b /* Kode sc...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char void getCursorP...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 void getMode(union...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char v...
-
#include <stdlib.h> #include "screen.cpp #define KEY_INT 0x16 /* Nomor interupsi keyboard */ UCHAR getKey(void); int main(void) ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_BACKSPACE 0x08 /* ...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsi...
-
#include <math.h> /* Deklarasi prototype atof */ #include <stdlib.h> /* Deklarasi prototype gcvt */ #include "screen.cpp...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 // Nomor interupsi...
Formulir Kontak
Subscribe Here
Ad Home
Random Posts
Recent Posts
Recent
Header Ads
Popular Posts
-
#include <math.h> #include <stdlib.h> #include "screen.cpp" #include "keyboard.cpp" int main(void) { Screen ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_F1 0x3b /* Kode sc...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char void getCursorP...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 void getMode(union...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char v...
-
#include <stdlib.h> #include "screen.cpp #define KEY_INT 0x16 /* Nomor interupsi keyboard */ UCHAR getKey(void); int main(void) ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_BACKSPACE 0x08 /* ...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsi...
-
#include <math.h> /* Deklarasi prototype atof */ #include <stdlib.h> /* Deklarasi prototype gcvt */ #include "screen.cpp...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 // Nomor interupsi...
Flickr
Newsletter
Subscribe Our Newsletter
Enter your email address below to subscribe to our newsletter.
Ad Banner
About Us
Random Posts
Popular Posts
-
#include <math.h> #include <stdlib.h> #include "screen.cpp" #include "keyboard.cpp" int main(void) { Screen ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_F1 0x3b /* Kode sc...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char void getCursorP...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 void getMode(union...
-
#include <conio.h> #include <dos.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsigned char v...
-
#include <stdlib.h> #include "screen.cpp #define KEY_INT 0x16 /* Nomor interupsi keyboard */ UCHAR getKey(void); int main(void) ...
-
#include <stdlib.h> #include "screen.cpp" #define KEY_INT 0x16 /* Nomor interupsi keyboard */ #define KEY_BACKSPACE 0x08 /* ...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 #define UCHAR unsi...
-
#include <math.h> /* Deklarasi prototype atof */ #include <stdlib.h> /* Deklarasi prototype gcvt */ #include "screen.cpp...
-
#include <conio.h> #include <dos.h> #include <stdio.h> #include <stdlib.h> #define VIDEO_INT 0x10 // Nomor interupsi...
Blog Archive
-
▼
2016
(30)
-
▼
Juni
(30)
- Contoh 27 (Coding) dan Gambarnya
- Contoh Mouse.cpp (Coding)
- Contoh 26 (Coding) dan Gambarnya
- Contoh 25 (Coding) dan Gambarnya
- Contoh 24 (Coding) dan Gambarnya
- Contoh 23 (Coding) dan Gambarnya
- Contoh 22 (Coding) dan Gambarnya
- Contoh 21 (Coding) dan Gambarnya
- Contoh 20 (Coding) dan Gambarnya
- Contoh 19 (Coding) dan Gambarnya
- Contoh 18 (Coding) dan Gambarnya
- Contoh 17 (Coding) dan Gambarnya
- Contoh Keyboard.cpp (Coding)
- Contoh 16 (Coding) dan Gambarnya
- Contoh 15 (Coding) dan Gambarnya
- Contoh 14 (Coding) dan Gambarnya
- Contoh 13 (Coding) dan Gambarnya
- Contoh 12 (Coding) dan Gambarnya
- Contoh 11 (Coding) dan Gambarnya
- Contoh 10 (Coding) dan Gambarnya
- Contoh Screen.cpp (Coding)
- Contoh 9 (Coding) dan Gambarnya
- Contoh 8 (Coding) dan Gambarnya
- Contoh 7 (Coding) dan Gambarnya
- Contoh 6 (Coding) dan Gambarnya
- Contoh 5 (Coding) dan Gambarnya
- Contoh 4 (Coding) dan Gambarnya
- Contoh 3 (Coding) dan Gambarnya
- Contoh 2 (Coding) dan Gambarnya
- Contoh 1 (Coding) dan Gambarnya
-
▼
Juni
(30)










0 komentar:
Posting Komentar