Photobucket Photobucket Photobucket

Wednesday, March 21, 2012

C++ Lanjutan ( membuat NURI)


#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);

int main(void)
{
   UCHAR baris, kolom;

   getCursorPos(&baris, &kolom);
   writeChar('N', 0x1f);
   setCursorPos(baris, ++kolom);
   writeChar('U', 0x1f);
   setCursorPos(baris, ++kolom);
   writeChar('R', 0x1f);
   setCursorPos(baris, ++kolom);
   writeChar('I',0x1f);
   setCursorPos(baris, ++kolom);
   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;
}

0 comments:

Post a Comment