Assalamu'alaikum guys, sekarang AnakKuliah akan memulai posting kembali. Setelah sekian lama vakum dari dunia blogging karena tugas mata kuliah yang menumpuk, hehe.. tapi buat kita yang sama-sama berjuang jadi anak kuliahan ya satu kalimat yang pas untuk mewakili keluh kesah kita ya "NIKMATIN AJA".
btw, sekarang AnakKuliah mau bagiin script Borland C++ yang saat ini sudah memasuki semester 2, untuk semester 2 ini kita akan lebih mendalami lagi masalah DOS atau lebih spesifik lagi kita akan mencoba membuat tampilah DOS secara sederhana. walaupun kalau dipikir lagi kita sudah sering make WINDOWS ngapain masih belajar DOS :D
(Good Luck Have Fun)
Here we go ..!
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#define VIDEO_INT 0x10
#define UCHAR unsigned char
void getCursorPos(UCHAR *y, UCHAR *x);
void setCursorPos(UCHAR y, UCHAR x);
void writeChar(UCHAR letter, UCHAR attr);
void writeString(UCHAR *str, UCHAR attr);
int main(void)
{
UCHAR baris, kolom; \\anakkuliahbsi.blogspot.com
getCursorPos(&baris, &kolom);
writeString("12345 54321", 0x4f);
setCursorPos(1, 0);
writeString("1234 4321", 0x4f);
setCursorPos(2, 0);
writeString("123 321", 0x4f);
setCursorPos(3, 0);
writeString("12 21", 0x4f);
setCursorPos(4, 0);
writeString("1 1", 0x4f);
setCursorPos(5, 0);
writeString("12 21", 0x4f);
setCursorPos(6, 0);
writeString("123 321", 0x4f);
setCursorPos(7, 0);
writeString("1234 4321", 0x4f);
setCursorPos(8, 0);
writeString("12345 54321", 0x4f);
setCursorPos(9, 0);
getch();
return EXIT_SUCCESS;
}
void getCursorPos(UCHAR *y, UCHAR *x)
{
UCHAR row, col;
asm mov ah, 0x03;
asm mov bh, 0x00;
asm int VIDEO_INT;
asm mov row, dh;
asm mov col, dl;
*y=row; *x=col;
return;
}
void setCursorPos(UCHAR y, UCHAR x)
{
asm mov ah, 0x02;
asm mov bh, 0x00;
asm mov dh, y;
asm mov dl, x;
asm int VIDEO_INT;
return;
}
void writeChar(UCHAR letter, UCHAR attr)
{
asm mov ah, 0x09;
asm mov al, letter;
asm mov bh, 0x00;
asm mov bl, attr;
asm mov ch, 0x00;
asm mov cl, 0x01;
asm int VIDEO_INT;
return;
}
void writeString(UCHAR *str, UCHAR attr)
{
UCHAR x,y;
getCursorPos(&y, &x);
for (; *str!='\0';str++)
{
if (x>79)
{
y++; x=0;
}
setCursorPos(y, x++);
writeChar(*str, attr);
}
return;
}
btw, sekarang AnakKuliah mau bagiin script Borland C++ yang saat ini sudah memasuki semester 2, untuk semester 2 ini kita akan lebih mendalami lagi masalah DOS atau lebih spesifik lagi kita akan mencoba membuat tampilah DOS secara sederhana. walaupun kalau dipikir lagi kita sudah sering make WINDOWS ngapain masih belajar DOS :D
(Good Luck Have Fun)
Here we go ..!
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#define VIDEO_INT 0x10
#define UCHAR unsigned char
void getCursorPos(UCHAR *y, UCHAR *x);
void setCursorPos(UCHAR y, UCHAR x);
void writeChar(UCHAR letter, UCHAR attr);
void writeString(UCHAR *str, UCHAR attr);
int main(void)
{
UCHAR baris, kolom; \\anakkuliahbsi.blogspot.com
getCursorPos(&baris, &kolom);
writeString("12345 54321", 0x4f);
setCursorPos(1, 0);
writeString("1234 4321", 0x4f);
setCursorPos(2, 0);
writeString("123 321", 0x4f);
setCursorPos(3, 0);
writeString("12 21", 0x4f);
setCursorPos(4, 0);
writeString("1 1", 0x4f);
setCursorPos(5, 0);
writeString("12 21", 0x4f);
setCursorPos(6, 0);
writeString("123 321", 0x4f);
setCursorPos(7, 0);
writeString("1234 4321", 0x4f);
setCursorPos(8, 0);
writeString("12345 54321", 0x4f);
setCursorPos(9, 0);
getch();
return EXIT_SUCCESS;
}
void getCursorPos(UCHAR *y, UCHAR *x)
{
UCHAR row, col;
asm mov ah, 0x03;
asm mov bh, 0x00;
asm int VIDEO_INT;
asm mov row, dh;
asm mov col, dl;
*y=row; *x=col;
return;
}
void setCursorPos(UCHAR y, UCHAR x)
{
asm mov ah, 0x02;
asm mov bh, 0x00;
asm mov dh, y;
asm mov dl, x;
asm int VIDEO_INT;
return;
}
void writeChar(UCHAR letter, UCHAR attr)
{
asm mov ah, 0x09;
asm mov al, letter;
asm mov bh, 0x00;
asm mov bl, attr;
asm mov ch, 0x00;
asm mov cl, 0x01;
asm int VIDEO_INT;
return;
}
void writeString(UCHAR *str, UCHAR attr)
{
UCHAR x,y;
getCursorPos(&y, &x);
for (; *str!='\0';str++)
{
if (x>79)
{
y++; x=0;
}
setCursorPos(y, x++);
writeChar(*str, attr);
}
return;
}
Bingkai angka 1-5 Borland C++
Reviewed by MCH
on
April 19, 2017
Rating:
No comments: