Where do i start??

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

Re:Where do i start??

Post by Curufir »

All that means is shorthand for saying interrupt 0x10 function 0x00. Which is a fancy way of saying dump 0x00 in AH, lookup which res you want and stick the value in AL, call INT 10h, stand back and admire your wonderfully empty screen.

No, you don't have to use DLLs (Eg Linux can be run entirely from statically compiled binaries if you have a desperate urge to burn memory), shared libraries are just nice on resources. No, you can't use them in your OS until you write a loader/linker that will dynamically link your code to the dll code at load time. If you can't figure out int 10 then I seriously doubt this is something you need to worry about for a month or two.

Curufir
Pietro

Re:Where do i start??

Post by Pietro »

Hi Berserk. Since I also am a beginner, but in this week I successfully managed to write my own bootsector by shamelessly stealing code from the examples online I can share some info with you.

It seems that you are a little unaware of some fundamental operating system concept. There are good books to fill the gap: The two books of Andrew Tanenbaum (Operating System Concepts, and Operating Systems: Design and Implementation). The first is more theoretical, the second also has an os inside which is discussed and studied (Minix).

I found useful NASM: is a good assembler, easy to learn - has less intricated directives than NASM and TASM - portable (Win and Linux and whatever) and free as speech. Also there are many examples out there written in NASM. Go on gaztek.sourceforge.net under the osdev section.

Also, use a PC emulator. DEFINITELY! VMWare costs money, so download and use the free (as speech) Bochs from bochs.sourceforge.net. It is better restarting an emulator than having to restart your pc - not everyone has two pc, one to write programs and one to test the stuff. Also, I learn that soon Bochs will allow you to *debug* the code - this would be great to understand what happens.

More tips to come, and maybe some code.

A presto
Pietro
Berserk

Re:Where do i start??

Post by Berserk »

A message for Curufir:

I put this code in the bootsector:

int 10, 0
mov ah, 00
mov al, 10
int 10h

and i get an error: invalid combination of opcode and operands??

what is this??

so this code changes the res, cool, just what i'm looking for - but could you show me an example, and is this the right manner to put the code??

int 10, 0
mov ah, 00
mov al, 10
int 10h

ciao, Please help 8)
Curufir

Re:Where do i start??

Post by Curufir »

Ok this is wrong

Code: Select all

int 10, 0      <- And this is what's wrong about it.
mov ah, 00
mov al, 10
int 10h
Sorry if I sounded snappy, gotta remember not to post before drinking my morning coffee (And that wasn't in the link Schol-R-Lea posted ;D).

As I said before the shorthand I used was:

Code: Select all

int    10,    0
|      |      |-> The function of the interrupt you are calling
|      |
|      |-> The interrupt you are calling in hex
|
|-> The assembly language command to call an interrupt
This is only a convenient shorthand way of writing which interrupt and function to use.

BIOS (In general) takes the value in AH as the function you want to use.

So to change modes you use.

Code: Select all

;Load AH with the function you want to use.
;Here it is 0 which is Set Video Mode
MOV AH, 0x00

;Load AL with the mode you wish to use.
;Here it is 0x13 which is 320*200 256 colour mode
MOV AL, 0x13

;Finally call the interrupt.
;Here interrupt 0x10 which is video BIOS services
INT 0x10
It should be clear where the int 10h, 0 shorthand comes in now.

Other BIOS functions take different arguments passed to them in the registers. For example int 13h, 2 a disk read operation.

Code: Select all

This takes these registers.
AH = 0x02 Ie the read sectors function of interrupt 0x13
AL = Number of sectors to read
CH = Cylinder
CL = Sector
DH = Head
DL = Drive
This is the way BIOS interrupts work. You fill the correct registers with the appropriate information and call the interrupt, no mystery to it at all. Of course the trick is knowing what to put in which registers ;).

Search around the internet for a utility called HelpPC, it's an invaluable reference for things like interrupts, ports etc. Very handy to have around.

Hope that clears it up.

Curufir

Just a minor note. The values in that int 10, 0 table are given in hexadecimal, as are all the ones I gave. Nasm supports 3 different ways of declaring hex numbers. $012, 0x12 and 12h all mean the same thing ie 18 in decimal. Just wanted to point it out since you were heading for a 640*200 4 colour by using the decimal value 10 in AL and it seemed weird.
Berserk

Re:Where do i start??

Post by Berserk »

So,

would this load 640x480 res?? (without VESA)

mov ah, 0x00
mov al, 0x10
int 0x10

??

And if it does, how can i get 256 colours??

Also, how would i make a splash screen for my OS??

How can i put a pixel onto the screen in nasm, i will put it in my bootsector?

ciao, please help ;)
Tom

Re:Where do i start??

Post by Tom »

Berserk, you are getting way ahead of your self.

Don't worry about all this graphics stuff untill your OS can do things like have a FS, and have a printf and IDT and Keyboard IRQ...


like just worry about printf now
Curufir

Re:Where do i start??

Post by Curufir »

Berserk wrote: So,

would this load 640x480 res?? (without VESA)

mov ah, 0x00
mov al, 0x10
int 0x10
Ok, this is becoming more than a little frustrating. The table of which VGA modes are possible through BIOS is in this thread. I think I also did an "ok" job of explaining just how to read that table and use the information. 0x10 is 640*350 16 colour mode, which is just bizarre. The one you actually want is 0x12 which is 640*480 16 colour mode.

No you can't have 256 colours, only mode 0x13 in VGA has 256 colours and that's precisely the reason it's limited to 320*200 pixels.

No, I'm not gonna tell you how to put pixels onscreen, or how to draw a splashscreen or anything else like that. Schol-R-Lea posted a whole bunch of links to graphical tutorials and they're likely to explain it a lot better when you go look at them.

Curufir
nimis

Re:Where do i start??

Post by nimis »

k, im a beginner at C and ASM. But ive programmed in VB for 5 years and PHP for nearly 3 months. So I know a bit about C :)

I have made my own OS (well one along a tutorial which im adding to) at the moment it prints different coloured text to the screen. What im doin is workin on makeing my own kernel which runs a little like DOS. where you have a command prompt. the only difference is that you can only tell it to "run thefile.exe" and it shall run that file. (I shant go into details on how) then that exe can be the propper os, like early windows where they booted from DOS mine will boot from a simple home made dos :)

If you want help try this tutorial. Im totaly new to this and its worked for me. It contains the windows files to copy the ready made bootloader to the first sector of a floppy in drive A:\. I found it a very helpfull tutorial and it teaches you how to make an os that prints text to the screen and an os that uses the VGA memory to fill the screen with different coloured dots. Its very good for beginners and contains links to c compilers and other resource's

Well thats my 2cents. Ive now goto go get my old laptop (with no C drive) so that I can propperly test my os on it :) Good luck everyone
DynatOS

Re:Where do i start??

Post by DynatOS »

At the beginning...
Tom

Re:Where do i start??

Post by Tom »

Berserk, learning video graphics now will only be a problem...

You should learn how to get the OS internles working first, then worry about how it and the graphics work.

Graphics is hard...almost harder than making the OS internels.
Berserk

Re:Where do i start??

Post by Berserk »

I understand what your saying, but PLEASE, i really want to get the graphics sorted. I will not start at the graphics, but i want to know what i'm in for;D

Scrap all my other questions, all i want to know now, is: HOW do i Print Pixels on the Screen via my bootsector, i want to make a splash screen.

After somebody answers this question, i swear i will not ask about graphics until i make a reliable boot sector & kernel!

I will only ask questions on my BootSector and Kernel.

Please, Please just tell me how to make a splash screen, 256 colours, anything! PLEASSEEEEEE!!!!!!!

ciao ;)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Where do i start??

Post by Pype.Clicker »

just do

Code: Select all

mov ax,0013h  ; service 0 set mode, mode = 13 (320x200x256)
int 10h ; call video bios

mov ax,A000h
mov es,A000    ; set one of the segment register to VRAM
and you can access pixel (x,y) with (x+320*y) ...

thus if you have a splash screen in some sectors, just load them to the A000 segment and they'll show on screen ;)

... and, btw, it will only work if int 10h is issued in real mode ;)
Tom

Re:Where do i start??

Post by Tom »

a bootsector is way to small for a splash screen ;)
Tim

Re:Where do i start??

Post by Tim »

A kernel is too small for a splash screen. :)

Having said that, the Windows 2000 splash screen lives in the kernel. However, the Windows 2000 kernel is over 1.6MB in size. :)
Tom

Re:Where do i start??

Post by Tom »

In your bootsector you could print

"<Cool Splash Screen>" if you are that desperate, seriously
;)
Post Reply