SlideShare a Scribd company logo
1 of 6
#include <conio.h>
#include <stdlib.h>
#include "screen.cpp"
#define KEY_INT0x16 /* Nomorinterupsi keyboard*/
#define KEY_BACKSPACE0x08/* Tombol Backspace */
#define KEY_RETURN 0x0d /* Tombol Enter*/
#define KEY_TAB0x09 /* Tombol Tab */
#define KEY_SPACE0x20 /* Tombol spasi */
#define NULL0x00 /* ASCII0 */
#define TRUE 1
UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max);
UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max);
int main(void)
{
Screen*layar = newScreen();
UCHAR *nama, nama2[16];
UCHAR *sandi,sandi2[21];
UCHAR *jenis,jenis2[2];
UCHAR kar = '*';
layar->setMode(0x03);
layar->setCursorPos(2,15);
layar->writeString("InputBiodataUser");
layar->setCursorPos(3,9);
layar->writeString("==============================");
layar->setCursorPos(5,9);
layar->writeString("Nama :");
layar->setCursorPos(5,27);
/* Memasukanusername */
nama = getString(layar,nama2,15);
layar->setCursorPos(6,9);
layar->writeString("Password :");
layar->setCursorPos(6,27);
/* Memasukanpassword*/
sandi = getPwdString(layar,sandi2,20);
layar->setCursorPos(7,9);
layar->writeString("JenisKelamin:");
layar->setCursorPos(7,27);
/* Memasukanjeniskelamin*/
nama = getString(layar,jenis2,1);
clrscr();
layar->setCursorPos(2,15);
layar->writeString("OutputBiodataUser");
layar->setCursorPos(3,9);
layar->writeString("==============================");
layar->setCursorPos(5,9);
layar->writeString("Nama : ");
layar->setCursorPos(5,26);
layar->writeString(nama2);
layar->setCursorPos(6,9);
layar->writeString("Password :");
layar->setCursorPos(6,26);
layar->writeString(sandi);
layar->setCursorPos(7,9);
layar->writeString("JenisKelamin:");
layar->setCursorPos(7,26);
layar->writeString(jenis2);
layar->setCursorPos(7,40);
/* getKey*/
asm mov ah,0x00;
asm intKEY_INT;
delete layar;returnEXIT_SUCCESS;
}
UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max)
{
UCHAR key,i,x, y;
key= i = 0;
while (TRUE)
{
asm mov ah,0x00;
asm intKEY_INT;
asm mov key,al;
if ((key== KEY_BACKSPACE) &&(i > 0))
{
scr->getCursorPos(&y,&x);
scr->setCursorPos(y, --x);
scr->writeChar(KEY_SPACE);
*(str + i) = NULL; i--;
}
if ((key>= 32) && (key<= 126) && (i < max))
{
scr->getCursorPos(&y,&x);
scr->writeChar(key);
scr->setCursorPos(y,++x);
*(str + i) = key;i++;
}
if ((key== KEY_TAB) && (i < max))
{
scr->getCursorPos(&y,&x);
scr->writeChar(KEY_SPACE);
scr->setCursorPos(y,++x);
*(str + i) = KEY_SPACE;i++;
}
if (key== KEY_RETURN)
{
*(str + i) = NULL;
break;
}
if (i == max) *(str+ i) = NULL;
}
return str;
}
UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max)
{
UCHAR key,i,x, y;
key= i = 0;
while (TRUE)
{
asm mov ah,0x00;
asm intKEY_INT;
asm mov key,al;
if ((key== KEY_BACKSPACE) &&(i > 0))
{
scr->getCursorPos(&y,&x);
scr->setCursorPos(y, --x);
scr->writeChar(KEY_SPACE);
*(pwd+ i) = NULL; i--;
}
if ((key>= 32) && (key<= 126) && (i < max))
{
scr->getCursorPos(&y,&x);
scr->writeChar('*');
scr->setCursorPos(y,++x);
*(pwd+ i) = key;i++;
}
if ((key== KEY_TAB) && (i < max))
{
scr->getCursorPos(&y,&x);
scr->writeChar('*');
scr->setCursorPos(y,++x);
*(pwd+ i) = KEY_TAB; i++;
}
if (key== KEY_RETURN)
{
*(pwd+ i) = NULL;
break;
}
if (i == max) *(pwd+ i) = NULL;
}
return pwd;
}

More Related Content

What's hot (20)

Sumahexavector
SumahexavectorSumahexavector
Sumahexavector
 
Node.JS
Node.JSNode.JS
Node.JS
 
Infitopost notepad
Infitopost   notepadInfitopost   notepad
Infitopost notepad
 
Introduction to Service Worker
Introduction to Service WorkerIntroduction to Service Worker
Introduction to Service Worker
 
Comparison Principle
Comparison PrincipleComparison Principle
Comparison Principle
 
es6.concurrency()
es6.concurrency()es6.concurrency()
es6.concurrency()
 
Dsa 1
Dsa 1Dsa 1
Dsa 1
 
Img 0002
Img 0002Img 0002
Img 0002
 
Cuestionario ii
Cuestionario iiCuestionario ii
Cuestionario ii
 
Macro
MacroMacro
Macro
 
Sumahex
SumahexSumahex
Sumahex
 
Fibonacci
FibonacciFibonacci
Fibonacci
 
Semana 12 interfaces gráficas de usuario
Semana 12   interfaces gráficas de usuarioSemana 12   interfaces gráficas de usuario
Semana 12 interfaces gráficas de usuario
 
PHP Profiling
PHP ProfilingPHP Profiling
PHP Profiling
 
The Flavor of TypeScript
The Flavor of TypeScriptThe Flavor of TypeScript
The Flavor of TypeScript
 
Caculadora pacho (1)
Caculadora pacho (1)Caculadora pacho (1)
Caculadora pacho (1)
 
Underscore.js
Underscore.jsUnderscore.js
Underscore.js
 
Sbaw091027
Sbaw091027Sbaw091027
Sbaw091027
 
Form Pemesanan Tiket dengan Java NetBeans
Form Pemesanan Tiket dengan Java NetBeansForm Pemesanan Tiket dengan Java NetBeans
Form Pemesanan Tiket dengan Java NetBeans
 
Gestire l'asincronia in javascript uno sguardo al futuro!
Gestire l'asincronia in javascript  uno sguardo al futuro!Gestire l'asincronia in javascript  uno sguardo al futuro!
Gestire l'asincronia in javascript uno sguardo al futuro!
 

Viewers also liked

Tugas matematika 1 (semester 2)
Tugas matematika 1 (semester 2)Tugas matematika 1 (semester 2)
Tugas matematika 1 (semester 2)riaayu12345
 
Tugas matematika 3 bab 4
Tugas matematika 3 bab 4Tugas matematika 3 bab 4
Tugas matematika 3 bab 4riaayu12345
 
Tugas 1 matematika 3
Tugas 1 matematika 3Tugas 1 matematika 3
Tugas 1 matematika 3riaayu12345
 
Convention fiscale-france-panama
Convention fiscale-france-panamaConvention fiscale-france-panama
Convention fiscale-france-panamaVivre-au-Panama
 
Tugas matematika 2 (semester 2)
Tugas matematika 2 (semester 2)Tugas matematika 2 (semester 2)
Tugas matematika 2 (semester 2)riaayu12345
 
Tugas matematika 3 bab3
Tugas matematika 3 bab3Tugas matematika 3 bab3
Tugas matematika 3 bab3riaayu12345
 
14. marcel breuer abrham zebene
14. marcel breuer  abrham zebene14. marcel breuer  abrham zebene
14. marcel breuer abrham zebeneAbrham Zebene
 

Viewers also liked (10)

Panama real estate
Panama real estatePanama real estate
Panama real estate
 
Tugas matematika 1 (semester 2)
Tugas matematika 1 (semester 2)Tugas matematika 1 (semester 2)
Tugas matematika 1 (semester 2)
 
Tugas matematika 3 bab 4
Tugas matematika 3 bab 4Tugas matematika 3 bab 4
Tugas matematika 3 bab 4
 
Deck switch
Deck   switchDeck   switch
Deck switch
 
Tugas 1 matematika 3
Tugas 1 matematika 3Tugas 1 matematika 3
Tugas 1 matematika 3
 
dhanna (1)
dhanna (1)dhanna (1)
dhanna (1)
 
Convention fiscale-france-panama
Convention fiscale-france-panamaConvention fiscale-france-panama
Convention fiscale-france-panama
 
Tugas matematika 2 (semester 2)
Tugas matematika 2 (semester 2)Tugas matematika 2 (semester 2)
Tugas matematika 2 (semester 2)
 
Tugas matematika 3 bab3
Tugas matematika 3 bab3Tugas matematika 3 bab3
Tugas matematika 3 bab3
 
14. marcel breuer abrham zebene
14. marcel breuer  abrham zebene14. marcel breuer  abrham zebene
14. marcel breuer abrham zebene
 

includ

  • 1. #include <conio.h> #include <stdlib.h> #include "screen.cpp" #define KEY_INT0x16 /* Nomorinterupsi keyboard*/ #define KEY_BACKSPACE0x08/* Tombol Backspace */ #define KEY_RETURN 0x0d /* Tombol Enter*/ #define KEY_TAB0x09 /* Tombol Tab */ #define KEY_SPACE0x20 /* Tombol spasi */ #define NULL0x00 /* ASCII0 */ #define TRUE 1 UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max); UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max); int main(void) { Screen*layar = newScreen(); UCHAR *nama, nama2[16]; UCHAR *sandi,sandi2[21]; UCHAR *jenis,jenis2[2]; UCHAR kar = '*'; layar->setMode(0x03); layar->setCursorPos(2,15); layar->writeString("InputBiodataUser");
  • 2. layar->setCursorPos(3,9); layar->writeString("=============================="); layar->setCursorPos(5,9); layar->writeString("Nama :"); layar->setCursorPos(5,27); /* Memasukanusername */ nama = getString(layar,nama2,15); layar->setCursorPos(6,9); layar->writeString("Password :"); layar->setCursorPos(6,27); /* Memasukanpassword*/ sandi = getPwdString(layar,sandi2,20); layar->setCursorPos(7,9); layar->writeString("JenisKelamin:"); layar->setCursorPos(7,27); /* Memasukanjeniskelamin*/ nama = getString(layar,jenis2,1); clrscr(); layar->setCursorPos(2,15); layar->writeString("OutputBiodataUser"); layar->setCursorPos(3,9); layar->writeString("=============================="); layar->setCursorPos(5,9);
  • 3. layar->writeString("Nama : "); layar->setCursorPos(5,26); layar->writeString(nama2); layar->setCursorPos(6,9); layar->writeString("Password :"); layar->setCursorPos(6,26); layar->writeString(sandi); layar->setCursorPos(7,9); layar->writeString("JenisKelamin:"); layar->setCursorPos(7,26); layar->writeString(jenis2); layar->setCursorPos(7,40); /* getKey*/ asm mov ah,0x00; asm intKEY_INT; delete layar;returnEXIT_SUCCESS; } UCHAR *getString(Screen*scr,UCHAR*str, UCHAR max) { UCHAR key,i,x, y; key= i = 0; while (TRUE) { asm mov ah,0x00; asm intKEY_INT; asm mov key,al;
  • 4. if ((key== KEY_BACKSPACE) &&(i > 0)) { scr->getCursorPos(&y,&x); scr->setCursorPos(y, --x); scr->writeChar(KEY_SPACE); *(str + i) = NULL; i--; } if ((key>= 32) && (key<= 126) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar(key); scr->setCursorPos(y,++x); *(str + i) = key;i++; } if ((key== KEY_TAB) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar(KEY_SPACE); scr->setCursorPos(y,++x); *(str + i) = KEY_SPACE;i++; } if (key== KEY_RETURN) { *(str + i) = NULL;
  • 5. break; } if (i == max) *(str+ i) = NULL; } return str; } UCHAR *getPwdString(Screen*scr,UCHAR*pwd,UCHAR max) { UCHAR key,i,x, y; key= i = 0; while (TRUE) { asm mov ah,0x00; asm intKEY_INT; asm mov key,al; if ((key== KEY_BACKSPACE) &&(i > 0)) { scr->getCursorPos(&y,&x); scr->setCursorPos(y, --x); scr->writeChar(KEY_SPACE); *(pwd+ i) = NULL; i--; }
  • 6. if ((key>= 32) && (key<= 126) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar('*'); scr->setCursorPos(y,++x); *(pwd+ i) = key;i++; } if ((key== KEY_TAB) && (i < max)) { scr->getCursorPos(&y,&x); scr->writeChar('*'); scr->setCursorPos(y,++x); *(pwd+ i) = KEY_TAB; i++; } if (key== KEY_RETURN) { *(pwd+ i) = NULL; break; } if (i == max) *(pwd+ i) = NULL; } return pwd; }