IBC chat

ShoutMix chat widget
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Ada errorr.....help

View previous topic View next topic Go down

Ada errorr.....help

Post  g34rboxxx on Tue Oct 20, 2009 12:23 pm

Code:
/* Feeling Blue */

#include <stdio.h>
#include <dos.h>

#define VIDEO 0x10
#define BLUE 0x1F

void dcolor(char ch,unsigned char color);
void main()
{
  char *text="Am I Blue?";
  unsigned char x;

  while(*text)
  {
    dcolor(*text,BLUE);
    text++;
  }

putchar('\n');
} <---- error

void dcolor(char ch,unsigned char color)

{

 union REGS regs;
 int x,y;

 /* First,read the cursor */

 regs.h.ah=0x03;  //Read cursor
 regs.h.ah=0x00;  //"page"
 int86(VIDEO,&regs,&regs);
 y=regs.h.dl;    //save Y pos.
 x=regs.h.dh;    //save X pos.

 /* Now,write the color char */

 regs.h.ah=0x09;  //Write color
 regs.h.al=ch;    //character
 regs.h.bh=0x00;  //"page"
 regs.h.bl=color; //count
 int86(VIDEO,&regs,&regs);

 /* Move the cursor forward one notch */

 y++;

 /* Reset the cursor's position(locate()) */

 regs.h.ah=0x02;  //Move cursor
 regs.h.bh=0x00;  //"page"
 regs.h.dh=x;       //row
 reg.h.dl=y;      //coloumn
 int86(VIDEO,&regs,&regs);

}


Tolong kalo ada yang bisa....maklum lagie belajar neh, tutornya gak ada.


gearboxxx Laughing

g34rboxxx
Admin

Posts : 250
Join date : 2009-10-19
Age : 40
Location : Tebak hayooo

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  vailo on Thu Oct 22, 2009 2:09 am

itu udah kombinasi antara C++ ma assembly yah... keren...

1. void main() <= diganti sama int main(), or pake main() doank, tapi gak yakin juga seh...
2. } <---- error <= coba tambah double slash jadi } // <---- error, or buang ajah tanda panah sama tulisan errornya
3. tambahin int int86(int ivec, union REGS *in, union REGS *out); setelah baris #define BLUE 0x1F
4. tambah s di baris ke3 dari terakhir, reg.h.dl=y; menjadi regs.h.dl=y;

jadi kalo boleh di ubah jadinya:
Code:
#include <stdio.h>
#include <dos.h>
#define VIDEO 0x10
#define BLUE 0x1F

int int86(int ivec, union REGS *in, union REGS *out);
void dcolor(char ch,unsigned char color);
int main(){
  char *text="Am I Blue?";
  unsigned char x;

  while(*text){
    dcolor(*text,BLUE);
    text++;
  }

  putchar('\n');
}

void dcolor(char ch,unsigned char color){
 union REGS regs;
 int x,y;

 regs.h.ah=0x03;
 regs.h.ah=0x00;
 int86(VIDEO,&regs,&regs);
 y=regs.h.dl;
 x=regs.h.dh;

 regs.h.ah=0x09;
 regs.h.al=ch;
 regs.h.bh=0x00;
 regs.h.bl=color;
 int86(VIDEO,&regs,&regs);

 y++;

 regs.h.ah=0x02;
 regs.h.bh=0x00;
 regs.h.dh=x;
 regs.h.dl=y;
 int86(VIDEO,&regs,&regs);
}

coba deh di compile, error atau enggak??? kalo di tempat gw seh, masih tetep error.
errornya ada di baris 21. si compiller bilang kalo "aggregate 'REGS regs' has incomplete type and cannot defined". bingung juga gak tau kenapa errornya. iseng buka" file dos.h ternyata gak ada deklarasi buat 'REGS' nya. padahal kalo diliat dari reverensi yang ada harusnya didalem file dos.h ada deklarasi:
Code:
Struct WORDREGS
{
unsigned int ax, bx, cx, dx, si, di, cflag;
}
Struct BYTEREGS
{
unsigned char al, ah, bl, bh, cl, ch, dl, dh;
}
union REGS
{
struct WORDREGS x;
struct BYTEREGS h;
}


tapi dos.h yg punya gw gak ada, aneh...
yang pokoknya intinya masih ada 1 error lage

Sad tapi cobain ajah, kali ajah di komputer laen bisa jalan Laughing


Last edited by mons on Thu Oct 22, 2009 2:12 am; edited 1 time in total (Reason for editing : biar lebih keren...)

vailo

Posts : 137
Join date : 2009-10-18

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  sinax89 on Thu Oct 22, 2009 7:13 am

klw nu pke compiler di Geany... errornya Buanyak bener...!!!

yang punya nick nm MOnst U ikut BUgs Finder gx??? Lumayan tuh hadiahnya .... Twisted Evil Laughing

sinax89
Admin

Posts : 72
Join date : 2009-10-13
Age : 27
Location : Bekasi

View user profile http://ibc-forum.forumc.biz

Back to top Go down

Re: Ada errorr.....help

Post  vailo on Thu Oct 22, 2009 1:04 pm

sinax89 wrote:klw nu pke compiler di Geany... errornya Buanyak bener...!!!

yang punya nick nm MOnst U ikut BUgs Finder gx??? Lumayan tuh hadiahnya .... Twisted Evil Laughing

gak suka ikut lomba afro
mase harus banyak belajar saiiah study


Last edited by monstm on Sun Nov 01, 2009 5:52 am; edited 1 time in total

vailo

Posts : 137
Join date : 2009-10-18

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  g34rboxxx on Thu Oct 22, 2009 3:10 pm

[code]
#include <stdio.h>
#include <dos.h>
#define VIDEO 0x10
#define BLUE 0x1F <== apa harus dibuat dulu??

int int86(int ivec, union REGS *in, union REGS *out);
void dcolor(char ch,unsigned char color);
int main(){
char *text="Am I Blue?";
unsigned char x;

while(*text){
dcolor(*text,BLUE);
text++;
}

putchar('\n');
} <== selalu error

void dcolor(char ch,unsigned char color){
union REGS regs;
int x,y;

regs.h.ah=0x03;
regs.h.ah=0x00;
int86(VIDEO,&regs,&regs);
y=regs.h.dl;
x=regs.h.dh;

regs.h.ah=0x09;
regs.h.al=ch;
regs.h.bh=0x00;
regs.h.bl=color;
int86(VIDEO,&regs,&regs);

y++;

regs.h.ah=0x02;
regs.h.bh=0x00;
regs.h.dh=x;
regs.h.dl=y;
int86(VIDEO,&regs,&regs);
}
[code]

Dah om compile hasilnya 17 errornya....kalo yang om punya cuman 1 errornya. Oh ya mungkin karena on compile di c++ ver 5.02 kali yeee. Tapi harusnya gak bgitu ngaruh. Atau kita musti buat file "#define" dulu.....

Ayo yang lain bantuuuuuuuuuuuuin.......biar sama-sama bljar....



gearboxxx

g34rboxxx
Admin

Posts : 250
Join date : 2009-10-19
Age : 40
Location : Tebak hayooo

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  vailo on Thu Oct 22, 2009 3:37 pm

ZZZZZZZZzzzzzzzzz.......

kok bisa beda smua yah???
saiiah pake "devcpp-4.9.9.2-beta"

vailo

Posts : 137
Join date : 2009-10-18

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  g34rboxxx on Thu Oct 22, 2009 3:59 pm

Ayo oprek lagie dunks ......keep on rockinn...... lol! lol!


gearboxxx

g34rboxxx
Admin

Posts : 250
Join date : 2009-10-19
Age : 40
Location : Tebak hayooo

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  vailo on Thu Oct 22, 2009 11:30 pm

Well.. udah nemu neh, jawabannya kenapa revisi punya gw ma punya yang laen beda...

penjelasan pertama ada di link ini, dan penjelasan kedua ada di link ini

itu ngejelasin kenapa hasil revisi gw yang pake devcpp-4.9.9.2-beta punya hasil yang berbeda sama yang laen...
maaf yak.... afro afro study

vailo

Posts : 137
Join date : 2009-10-18

View user profile

Back to top Go down

Re: Ada errorr.....help

Post  Sponsored content Today at 10:23 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum