How do I use my Assembly for operating system development?
Re: How do I use my Assembly for operating system developmen
SamTouraz: nobody questioned your knowledge, and nobody wanted to mislead you (do you realize how many approaches are exist to do a kernel), i dont really understand your reactions.
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html
http://users.atw.hu/gerigeri/DawnOS/download.html
-
- Member
- Posts: 80
- Joined: Wed Aug 09, 2017 7:37 am
Re: How do I use my Assembly for operating system developmen
OK, first of all, what architecture (x86, ARM or PowerPC) are you aiming at? If you want to understand about x86, read more of the Intel software developer manuals (if you have already). What assembler are you using? FASM is good if you want to make an OS fully in Assembly (MenuetOS and KolibriOS have used these).
The GDT can be explained at Global_Descriptor_Table. However, there are lots of resources. You will need the GDT (or Global Descriptor Table) to enter Protected_Mode. There is also https://en.wikipedia.org/wiki/Global_Descriptor_Table which looks good.
If you know Assembly, you'll be able to understand this.
If you want to know about 0xb800, check out Printing_To_Screen. I know it is written in C but this is what it does.
= Makes a variable containing 0xb800
= Does a while loop waiting for the character of the string to be 0x00 (null terminator).
= In the while loop, it copies the character to the variable and the color (the bytes).
I might add some Assembly code to the Wiki as a matter of fact. Here's some code (make sure you understand some of it).
The BIOS Parameter Table is only required if you are using a device that is emulating a floppy (like a USB).
Here's a link for help on it which is https://social.technet.microsoft.com/wi ... ystem.aspx.
This explains things.
You should implement it like this:
By the way, nobody is trolling you. People are just confused at what information you are giving.
The GDT can be explained at Global_Descriptor_Table. However, there are lots of resources. You will need the GDT (or Global Descriptor Table) to enter Protected_Mode. There is also https://en.wikipedia.org/wiki/Global_Descriptor_Table which looks good.
If you know Assembly, you'll be able to understand this.
If you want to know about 0xb800, check out Printing_To_Screen. I know it is written in C but this is what it does.
= Makes a variable containing 0xb800
= Does a while loop waiting for the character of the string to be 0x00 (null terminator).
= In the while loop, it copies the character to the variable and the color (the bytes).
I might add some Assembly code to the Wiki as a matter of fact. Here's some code (make sure you understand some of it).
Code: Select all
BITS 16
org 0x7c00
jmp Main ; jump to main
Main:
mov dx, 0xb800 ; moves 0xb800 to the data register
mov es, dx ; moves the data register to the extra segment (a little address space)
mov si, msg
mov cx, 0
Print:
lodsb ; get byte from string (character) [SI -> AL]
cmp al, 0 ; is character 0x00? (null terminator)
je Done ; if yes, jump to Done!
mov di, cx
mov [es:di], al ; move character to destination index
inc cx
; these three lines will make all your characters have color (remove this if you want).
mov di, cx
mov [es:di], 0x07 ; you may be familiar with BIOS color attributes - change 0x07 to whatever you want
inc cx ; increment of count register
jmp Print
Done:
mov di, cx
ret
msg db 'Hello World!', 0
Here's a link for help on it which is https://social.technet.microsoft.com/wi ... ystem.aspx.
This explains things.
You should implement it like this:
Code: Select all
BITS 16
jmp Start
nop
bpbThis db 0
bpbThis dw 1a49 ; warning - these numbers are examples.
bpbThat db 50
Re: How do I use my Assembly for operating system developmen
I want to point out a couple things for the OP, Steve, and anyone else who comes across this thread: The stack is not set up, ds is not initialized, and the direction flag is not cleared. Things things may sound like nit-picking -- and realistically, this code will probably work as expected 99% of the time -- but the 1% of the time it doesn't it'll be a huge pain in the a** to anyone using it, so I thought it was worthwhile to point them out.stevewoods1986 wrote:Code: Select all
BITS 16 org 0x7c00 jmp Main ; jump to main Main: mov dx, 0xb800 ; moves 0xb800 to the data register mov es, dx ; moves the data register to the extra segment (a little address space) mov si, msg mov cx, 0 Print: lodsb ; get byte from string (character) [SI -> AL] cmp al, 0 ; is character 0x00? (null terminator) je Done ; if yes, jump to Done! mov di, cx mov [es:di], al ; move character to destination index inc cx ; these three lines will make all your characters have color (remove this if you want). mov di, cx mov [es:di], 0x07 ; you may be familiar with BIOS color attributes - change 0x07 to whatever you want inc cx ; increment of count register jmp Print Done: mov di, cx ret msg db 'Hello World!', 0