Please help!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Please help!

Post 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.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post by andrewthompson555 »

By the way, how would I display the date and time from the BIOS?
hannah
Member
Member
Posts: 34
Joined: Wed Oct 12, 2016 11:32 am
Location: At my PC

Re: Please help!

Post 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
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Please help!

Post by dozniak »

Please stop!
Learn to read.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post by andrewthompson555 »

Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post by andrewthompson555 »

dozniak wrote:Please stop the music!
Someone was complaining about my quote thing. Stop what? Asking for help?! You must be specific.
hannah
Member
Member
Posts: 34
Joined: Wed Oct 12, 2016 11:32 am
Location: At my PC

Re: Please help!

Post 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.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Please help!

Post 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.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post by andrewthompson555 »

Maybe you should look at the first post.
hannah
Member
Member
Posts: 34
Joined: Wed Oct 12, 2016 11:32 am
Location: At my PC

Re: Please help!

Post 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.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post 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.
hannah
Member
Member
Posts: 34
Joined: Wed Oct 12, 2016 11:32 am
Location: At my PC

Re: Please help!

Post 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
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Please help!

Post 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:
You know your OS is advanced when you stop using the Intel programming guide as a reference.
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

Re: Please help!

Post 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.
hannah
Member
Member
Posts: 34
Joined: Wed Oct 12, 2016 11:32 am
Location: At my PC

Re: Please help!

Post 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.
Post Reply