OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 10:50 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Please help!
PostPosted: Tue Jan 10, 2017 12:51 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 2:05 pm 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
By the way, how would I display the date and time from the BIOS?


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 2:09 pm 
Offline
Member
Member

Joined: Wed Oct 12, 2016 11:32 am
Posts: 34
Location: At my PC
Here are some code samples for RTC.
You will need to have a hex-printing function, as these return Hex.
Code:
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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 2:41 pm 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 723
Location: Tallinn, Estonia
Please stop!

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:00 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:01 pm 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
dozniak wrote:
Please stop the music!


Someone was complaining about my quote thing. Stop what? Asking for help?! You must be specific.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:05 pm 
Offline
Member
Member

Joined: Wed Oct 12, 2016 11:32 am
Posts: 34
Location: At my PC
andrewthompson555 wrote:
Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.

use the VGA bios interrupts.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:08 pm 
Offline
Member
Member
User avatar

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:09 pm 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
Maybe you should look at the first post.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:11 pm 
Offline
Member
Member

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

1) Stop using real mode.
2) Use C. ASM is ridiculous for your knowledge.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:14 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:15 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:17 pm 
Offline
Member
Member
User avatar

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


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:19 pm 
Offline
Member
Member

Joined: Thu Oct 13, 2016 2:07 pm
Posts: 27
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[i] = 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.


Top
 Profile  
 
 Post subject: Re: Please help!
PostPosted: Tue Jan 10, 2017 3:21 pm 
Offline
Member
Member

Joined: Wed Oct 12, 2016 11:32 am
Posts: 34
Location: At my PC
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[i] = 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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Garnek0 and 56 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group