C Print function doesn't work...
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
C Print function doesn't work...
char *VIDEO = (char *) 0xb800;
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
character('A');
character('B');
asm mov ah, 0
asm int 22
}
This doesn´t work... do you know why?
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
character('A');
character('B');
asm mov ah, 0
asm int 22
}
This doesn´t work... do you know why?
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
thanx
char *VIDEO
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
VIDEO = (char *) 0xb8000; //CORRECTION
character('A');
character('B');
asm mov ah, 0
asm int 22
}
ok, this is the final code
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
VIDEO = (char *) 0xb8000; //CORRECTION
character('A');
character('B');
asm mov ah, 0
asm int 22
}
ok, this is the final code
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
BUT IT DOESN'T WORK...
char *VIDEO;
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
VIDEO = (char *) 0xb8000;
character('A');
character('B');
asm mov ah, 0
asm int 22
}
What's the problem?
void character(char A)
{
*VIDEO = A;
VIDEO++;
*VIDEO = 7;
VIDEO++;
}
void main()
{
VIDEO = (char *) 0xb8000;
character('A');
character('B');
asm mov ah, 0
asm int 22
}
What's the problem?
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
info
I'm using Turbo C++ 3.0... with BootProg to load EXE files...
The compilation proccess finishes succesfully... but when I run it under DosBox, Bochs, or Virtual PC, I doesn't prints anithyng...
--------
I made a new post because I don't think anyone will answer a post with 3 replies...
I'm sorry, I didn't wanted to make spam...
Thanks
The compilation proccess finishes succesfully... but when I run it under DosBox, Bochs, or Virtual PC, I doesn't prints anithyng...
--------
I made a new post because I don't think anyone will answer a post with 3 replies...
I'm sorry, I didn't wanted to make spam...
Thanks
well, from what I can tell, your C code is fine (although I am uncertain of the asm).
Is it possible that your bootloader/exe handler could have offset your base memory addressing or something of that nature?
not to disuade you from your current bootloader, but try that code with another bootloader like grub or any other a20-enabled bootstrap to see if it is the C or the loader.
Is it possible that your bootloader/exe handler could have offset your base memory addressing or something of that nature?
not to disuade you from your current bootloader, but try that code with another bootloader like grub or any other a20-enabled bootstrap to see if it is the C or the loader.
Website: https://joscor.com
- matias_beretta
- Member
- Posts: 101
- Joined: Mon Feb 26, 2007 3:39 pm
more info
1) I'm working in real mode, so grub will not work.
2) I had already done this before and it worked with the same bootloader and the same compiler...
2) I had already done this before and it worked with the same bootloader and the same compiler...
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Use a short for video memory instead, then do:
You should know how to calculate the offset.
Code: Select all
VIDEO[offset] = ( 0x07 << 8 ) | A;