Please help!
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Please help!
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.
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.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
By the way, how would I display the date and time from the BIOS?
Re: Please help!
Here are some code samples for RTC.
You will need to have a hex-printing function, as these return Hex.
For more info, 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);
}
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
Someone was complaining about my quote thing. Stop what? Asking for help?! You must be specific.dozniak wrote:Please stop the music!
Re: Please help!
use the VGA bios interrupts.andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Please help!
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.andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
Maybe you should look at the first post.
Re: Please help!
1) Stop using real mode.andrewthompson555 wrote:Maybe you should look at the first post.
2) Use C. ASM is ridiculous for your knowledge.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.omarrx024 wrote: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.andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
Re: Please help!
OSDev is not to learn languagesandrewthompson555 wrote:So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.omarrx024 wrote: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.andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Please help!
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.andrewthompson555 wrote:So funny. By the way, I'm learning Assembly. I'm not ready for C yet. C is not required. However, it is recommended.omarrx024 wrote: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.andrewthompson555 wrote:Thank you. However, I'm using Assembly. By the way, I also needed help with drawing graphics.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Please help!
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.hannah wrote:1) Stop using real mode.andrewthompson555 wrote:Maybe you should look at the first post.
2) Use C. ASM is ridiculous for your knowledge.
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!
andrewthompson555 wrote: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.hannah wrote:1) Stop using real mode.andrewthompson555 wrote:Maybe you should look at the first post.
2) Use C. ASM is ridiculous for your knowledge.
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.