Zirveos

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.
zirveos

Zirveos

Post by zirveos »

Hello.I write Zirveos.I know c and assembly but I don't know inline assembly.Can you help me?

Zirveos's file system is interesting.I can't load the kernel in bootloader.I don't want bios interrupt.So i want disk read/write in assembly code.
zirveos

Re:Zirveos

Post by zirveos »

Thanks.i use 32bit register.i want floppy read/write in/out for 32bit code
Dex4u

Re:Zirveos

Post by Dex4u »

That code is to be run in 32bit, pmode and uses in/out .
zirveos

Re:Zirveos

Post by zirveos »

How putting text on the screen (i/o assembly or c)?



Pleaseeee....
blip

Re:Zirveos

Post by blip »

Many text modes have their buffer starting at physical address 0B8000h, real mode segment 0B800h, and you should be able to do it with your language of choice. You really should know this kind of thing when OS deving. This site's OSFAQ is pretty good, and the BabySteps mention this, but don't overlook info on other sites like OSRC and osdever.net.
zirveos

Re:Zirveos

Post by zirveos »

thanks
zirveos

Re:Zirveos

Post by zirveos »

putting 'a' character on screen:(don't putting)
   mov ax,0xb8000
   mov es,ax
   mov di,0x0000
   mov bl,'a'
   mov [es:di],bl
   add di,2
   mov [es:di],byte 7
whats error?
Dex4u

Re:Zirveos

Post by Dex4u »

Basic real and pmode put char.

Code: Select all

; realmode
   mov ax,0xb800
   mov es,ax
   mov di,0x0000
   mov bl,'a'
   mov [es:di],bl
   add di,1
   mov byte[es:di], 9

;pmode
   mov ax,8h ;linear Data segment
   mov es,ax
   mov byte [es:0xB8000], "A"
zirveos

Re:Zirveos

Post by zirveos »

dont put char:

start:
mov ax,0xb800
mov es,ax
mov di,0x0000
mov bl,'a'
mov [es:di],bl
add di,1
mov byte[es:di], 9

ret

(and)

start:
mov ax,8h ;linear Data segment
mov es,ax
mov byte [es:0xB8000], "A"
ret
Tolga

Re:Zirveos

Post by Tolga »

In protected mode, to write somethink to screen, try this code;
(Korumali modda ekrana birseyler yazmak icin su kodu dene;)

mov esi, 0xB8000
mov byte[esi], 'T'
mov byte[esi+1], 7
mov byte[esi+2], 'o'
mov byte[esi+3], 7
mov byte[esi+4], 'l'
mov byte[esi+5], 7
mov byte[esi+6], 'g'
mov byte[esi+7], 7
mov byte[esi+8], 'a'
mov byte[esi+9], 7

But ds register must be data selector. Don't forget.
(Ama ds registerinin data selektor olarak secili olmasi gerekiyor. Unutma. ;)
Dex4u

Re:Zirveos

Post by Dex4u »

zirveos wrote: dont put char:

start:
mov ax,0xb800
mov es,ax
mov di,0x0000
mov bl,'a'
mov [es:di],bl
add di,1
mov byte[es:di], 9

ret

(and)

start:
mov ax,8h ;linear Data segment
mov es,ax
mov byte [es:0xB8000], "A"
ret
They work on my pc, as com files, like this.

Code: Select all

; realmode
org???100h
use16
start:
mov ax,0xb800
mov es,ax
mov di,0x0000
mov bl,'a'
mov [es:di],bl
add di,1
mov byte[es:di], 9
xor  ax,ax
int  16h
 
int  20h
;***********************************************************

Code: Select all

;Pmode
org???100h
   use16
start:
;*****************************
; Setting up, to enter pmode.
;*****************************
xor   ebx,ebx
mov   bx,ds
shl   ebx,4
mov   eax,ebx
mov   [sys_code + 2],ax
mov   [sys_data + 2],ax
shr   eax,16
mov   [sys_code + 4],al
mov   [sys_data + 4],al
mov   [sys_code + 7],ah
mov   [sys_data + 7],ah
add   ebx,gdt
mov   [gdtr + 2],ebx
cli
lgdt  [gdtr]

mov   eax, cr0
or    al,0x1
mov   cr0,eax

jmp   0x18: protected

;*****************************
; Pmode. ;-)
;*****************************

use32
protected:
mov   ax,0x10 
mov   ds,ax
mov   ss,ax
mov   ax,0x8
mov   es,ax
;*****************************
; Turn floppy off .
;*****************************
mov   dx,3F2h
mov   al,0
out   dx,al

mov   byte [es:0xB8000], "P"
 jmp $

;*************************************
; GDT. 
;*************************************

gdt:???    dw???  0x0000, 0x0000, 0x0000, 0x0000
sys_Lin:    dw???  0xFFFF, 0x0000, 0x9200, 0x00CF
sys_data:   dw???  0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code:   dw???  0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:

gdtr:???    dw gdt_end - gdt - 1
???    dd gdt
zirveos

Re:Zirveos

Post by zirveos »

thanks
Tolga Bey bu ds olayları nelerdir bahsetermisiniz?
Bide ds ayarları falan yapılmış ve ekrana yazı yazan kodu bnuraya yazarsanız sevinirim.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Zirveos

Post by Solar »

I know it can be much easier to talk in your native language, but imagine someone looking for crucial information, and wondering whether the crucial bit of info might be hidden in the part that is... whatever language that is. ;-)
Every good solution is obvious once you've found it.
Tolga

Re:Zirveos

Post by Tolga »

ZirveOS saying that "Can you talk me about ds register? And with adjusted ds register, can you write protected mode print screen code?".

Answer:
-------------------------------

* DS register must show data selector. If you don't know this, you can search "GDT Selector" at google. I can't tell this at here.
(Translation: Ds registeri data selektorunu gostermelidir. Eger bunu bilmiyorsan, google'da "GDT Selector" diye aratarabilirsin. Bunlari sana burada anlatamam.)

* I wrote this procedure, but i am using it only one times. You can use this:
(Translation: Ben bu proseduru yazdim, ama onu sadece bir kere kullandim. Sen bunu kullanabilirsin:)

[BITS 32]
; Enter :   SI = Message Offset
PMTEXTOUT:
   pusha
   mov edi, 0xB8000
PMTEXTOUT_SUB1:
   lodsb
   or al, al
   jz PMTEXTOUT_SUB2
   mov byte[edi], al
   mov byte[edi+1], 0x07
   add edi, 2
   jmp PMTEXTOUT_SUB1
PMTEXTOUT_SUB2:
   popa
   ret

; Usage(Kullanim):
mov si, startup_msg
call PMTEXTOUT

cli
hlt

startup_msg db "Now in protected mode!", 0
Post Reply