Page 1 of 2

Please help!

Posted: Tue Jan 10, 2017 12:51 pm
by andrewthompson555
Hello.

I've problems with drawing in Assembly.

Here's my code:
mov ah, 09h
mov cx, 1840
mov al, 20h
mov bl, 3Fh
int 10h

mov ah, 09h
mov cx, 1000
mov al, 20h
mov bl, 77h
int 10h

With the order:
First part [3Fh]
Second part [77h]

It will show gray (grey) and black.

With this order:
First part [77h]
Second part [3Fh]

It will just show light blue and black.

Please help.

Thank you
Andrew.

Re: Please help!

Posted: Tue Jan 10, 2017 2:05 pm
by andrewthompson555
By the way, how would I display the date and time from the BIOS?

Re: Please help!

Posted: Tue Jan 10, 2017 2:09 pm
by hannah
Here are some code samples for RTC.
You will need to have a hex-printing function, as these return Hex.

Code: Select all

uint8_t rtc_get_year(void)
{
	outb(0x70, 0x09);
	return inb(0x71);
}

uint8_t rtc_get_month(void)
{
	outb(0x70, 0x08);
	return inb(0x71);
}

uint8_t rtc_get_day(void)
{
	outb(0x70, 0x07);
	return inb(0x71);
}

uint8_t rtc_get_weekday(void)
{
	outb(0x70, 0x06);
	return inb(0x71);
}

uint8_t rtc_get_hour(void)
{
	outb(0x70, 0x04);
	return inb(0x71);
}

uint8_t rtc_get_minute(void)
{
	outb(0x70, 0x02);
	return inb(0x71);
}

uint8_t rtc_get_second(void)
{
	outb(0x70, 0x00);
	return inb(0x71);
}
For more info, RTC

Re: Please help!

Posted: Tue Jan 10, 2017 2:41 pm
by dozniak
Please stop!

Re: Please help!

Posted: Tue Jan 10, 2017 3:00 pm
by andrewthompson555
Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.

Re: Please help!

Posted: Tue Jan 10, 2017 3:01 pm
by andrewthompson555
dozniak wrote:Please stop the music!
Someone was complaining about my quote thing. Stop what? Asking for help?! You must be specific.

Re: Please help!

Posted: Tue Jan 10, 2017 3:05 pm
by hannah
andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
use the VGA bios interrupts.

Re: Please help!

Posted: Tue Jan 10, 2017 3:08 pm
by BrightLight
andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
Long story short: if you cannot translate that snippet of code from C to assembly, then OS development is not for you. Thank you for your time.

Re: Please help!

Posted: Tue Jan 10, 2017 3:09 pm
by andrewthompson555
Maybe you should look at the first post.

Re: Please help!

Posted: Tue Jan 10, 2017 3:11 pm
by hannah
andrewthompson555 wrote:Maybe you should look at the first post.
1) Stop using real mode.
2) Use C. ASM is ridiculous for your knowledge.

Re: Please help!

Posted: Tue Jan 10, 2017 3:14 pm
by andrewthompson555
omarrx024 wrote:
andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
Long story short: if you cannot translate that snip snip snip of code, that doesn't matter. You can't translate instructions from C to Assembly? Then, OS development is for you! Buy it now for $100 - £82.16 - €94.68 Thank you for your time.
So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.

Re: Please help!

Posted: Tue Jan 10, 2017 3:15 pm
by hannah
andrewthompson555 wrote:
omarrx024 wrote:
andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
Long story short: if you cannot translate that snip snip snip of code, that doesn't matter. You can't translate instructions from C to Assembly? Then, OS development is for you! Buy it now for $100 - £82.16 - €94.68 Thank you for your time.
So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.
OSDev is not to learn languages

Re: Please help!

Posted: Tue Jan 10, 2017 3:17 pm
by BrightLight
andrewthompson555 wrote:
omarrx024 wrote:
andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
Long story short: if you cannot translate that snip snip snip of code, that doesn't matter. You can't translate instructions from C to Assembly? Then, OS development is for you! Buy it now for $100 - £82.16 - €94.68 Thank you for your time.
So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.
Ladies and gentlemen, this is the easiest way to tell someone "don't try to help me again." I would have added you to my foes list, but I'm enjoying the laughs. :lol:

Re: Please help!

Posted: Tue Jan 10, 2017 3:19 pm
by andrewthompson555
hannah wrote:
andrewthompson555 wrote:Maybe you should look at the first post.
1) Stop using real mode.
2) Use C. ASM is ridiculous for your knowledge.
Answer my question. Assembly is what I've learned before C and Java. I've learned many interrupts. I know some C. As a matter of fact, C is much more harder. It is more portable.

Here's a kernel from the internet:
/*
* kernel.c
*/
void kmain(void)
{
const char *str = "my first kernel";
char *vidptr = (char*)0xb8000; //video mem begins here.
unsigned int i = 0;
unsigned int j = 0;

/* this loops clears the screen
* there are 25 lines each of 80 columns; each element takes 2 bytes */
while(j < 80 * 25 * 2) {
/* blank character */
vidptr[j] = ' ';
/* attribute-byte - light grey on black screen */
vidptr[j+1] = 0x07;
j = j + 2;
}

j = 0;

/* this loop writes the string to video memory */
while(str[j] != '\0') {
/* the character's ascii */
vidptr = str[j];
/* attribute-byte: give character black bg and light grey fg */
vidptr[i+1] = 0x07;
++j;
i = i + 2;
}
return;
}

Here's a bootloader for Assembly I've wrote myself:

BITS 16
org 0x7C00

jmp Start

Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print

Done:
ret

Start:
mov si, msg
call Print

msg db 'Hello World!", 0

times 510-($-$$) db 0
dw 0xAA55

Do you see any difference? }; and { and (i =0 3910 =29i49t9u8ehbay8gfuo is an example of C. I don't need C! KolibriOS and Baremetal OS were done 100% fully in Assembly.

Re: Please help!

Posted: Tue Jan 10, 2017 3:21 pm
by hannah
andrewthompson555 wrote:
hannah wrote:
andrewthompson555 wrote:Maybe you should look at the first post.
1) Stop using real mode.
2) Use C. ASM is ridiculous for your knowledge.
Answer my question. Assembly is what I've learned before C and Java. I've learned many interrupts. I know some C. As a matter of fact, C is much more harder. It is more portable.

Here's a kernel from the internet:
/*
* kernel.c
*/
void kmain(void)
{
const char *str = "my first kernel";
char *vidptr = (char*)0xb8000; //video mem begins here.
unsigned int i = 0;
unsigned int j = 0;

/* this loops clears the screen
* there are 25 lines each of 80 columns; each element takes 2 bytes */
while(j < 80 * 25 * 2) {
/* blank character */
vidptr[j] = ' ';
/* attribute-byte - light grey on black screen */
vidptr[j+1] = 0x07;
j = j + 2;
}

j = 0;

/* this loop writes the string to video memory */
while(str[j] != '\0') {
/* the character's ascii */
vidptr = str[j];
/* attribute-byte: give character black bg and light grey fg */
vidptr[i+1] = 0x07;
++j;
i = i + 2;
}
return;
}

Here's a bootloader for Assembly I've wrote myself:

BITS 16
org 0x7C00

jmp Start

Print:
lodsb
cmp al, 0
je Done
mov ah, 0eh
int 10h
jmp Print

Done:
ret

Start:
mov si, msg
call Print

msg db 'Hello World!", 0

times 510-($-$$) db 0
dw 0xAA55

Do you see any difference? }; and { and (i =0 3910 =29i49t9u8ehbay8gfuo is an example of C. I don't need C! KolibriOS and Baremetal OS were done 100% fully in Assembly.

I'm so close to beating the s-
Ok, but the difference is. Baremetal and KolibiriOS are in Protected Mode. That means they cant use int 10h to print anything. Try printing anything in ASM without bios interrupts. That isn't even a bootloader. That just prints a message using bios interrupts. Hell, you could go as far to say it's a DOS app. Just please, stop before you get banned.