Autor Thema: standardfarbe 0x07 ändern bei int 0x10  (Gelesen 9169 mal)

Feuermonster

  • Beiträge: 24
    • Profil anzeigen
Gespeichert
« Antwort #20 am: 13. September 2008, 11:04 »
ich würd sgen, dass 'inc dl,' nur 'inc dl heißen muss
und ein {enter} muss mit einer 'normalen' 'bios_string_output' geschrieben werden ich hab das bei mir so gelöst:

ich hoffe du kannst damit was anfangen


Erstmal danke.

Ich hab es mal so probiert (die ints hab ich nicht registriert im interrupt table registriert, ich verwende call)



 
    mov ax, 0x1000
    mov ds, ax
    mov es, ax
 
    start:

mov ah,0x0
mov al,0x3
int 0x10 ; Textmodus, 80 x 25, 16 Farben

    mov si, _s_noos_logo
    mov ah, 0x03
    call _v_noos_stdstrout
mov si, _s_noos_jmp_good
    mov ah, 0x0A
    call _v_noos_stdstrout

call _v_noos_printlogo
mov si, _s_noos_detdrvs
mov ah, 0x07
call _v_noos_stdstrout

mov si, _s_noos_drv00
mov ah, 0x07
call _v_noos_stdstrout

mov dl,0x00
call _v_noos_get_drv_state
cmp ah,00h
jne _l_noos_gdrvchk_error

mov si, _s_noos_drv01
mov ah, 0x07
call _v_noos_stdstrout

;mov dl,0x01
;call _v_noos_get_drv_state
;cmp ah,00h
;jne _l_noos_gdrvchk_error

jmp _l_noos_chk_end

_l_noos_gdrvchk_error:
call _v_noos_drvchk_error
retn

_l_noos_chk_end:


 
    mov si,msg_boot
mov ah, 0x07
    call _v_noos_stdstrout ;_v_noos_tprintf
 
    call _v_noos_getkey   
    jmp _v_noos_reboot   
 
   
 
    _s_noos_logo db "[ NoOS ]",0
    _s_noos_jmp_good db " Jump into kernel successful",0
_s_noos_detdrvs db " Detecting drives...",0
_s_noos_drv00 db "         drive 00...",0
_s_noos_drv01 db "         drive 01...",0
_s_noos_drv80 db "         drive 80....",0
_s_noos_drv81 db "         drive 81....",0
_s_noos_drvchk_error db "          DRIVE ERROR!",0
    msg_boot db "Press any key...",0
ent db "",13,10,0
 
    ; Funktionen

;%%%%%%%%%%%
_v_noos_drvchk_error:
mov si,_s_noos_drvchk_error
mov ah,0x04
call _v_noos_stdstrout
retn

;%%%%%%%%%
;ret: AH = Fehlercode
;DL = Laufwerknummer
;==============

_v_noos_get_drv_state:
mov ah,0x00
int 0x13
retn

;%%%%%%%%%
_v_noos_printlogo:
mov si, _s_noos_logo
call _v_noos_stdstrout

;%%%%%%%
;AL = Farbe
;SI = String
;==========
    _v_noos_clrstrout:
lodsb         
or al,al
jz short _v_noos_clrstroutd
mov cx, 1   
xor bh, bh   
mov ah,0x09   
    int 0x10
jmp _v_noos_clrstrout
_v_noos_clrstroutd
retn
 
;%%%%%%%%
;SI = String
;============
_v_noos_stdstrout:
push bx
mov bl,ah
mov al,0x01
mov ah,01h
call _int0x21
mov si, ent
mov al, 0x01
call _int0x21
pop bx
retn

    _v_noos_getkey:
    mov ah, 0
    int 0x16 
    ret
 

    _v_noos_reboot:
    jmp 0xffff:0x0000

;%%%%%%%%%%
;AH = Farbe
;SI = String
;===============
_v_noos_tprintf:
lodsb
or al,al
jz short _v_noos_tprintfd

mov cx, 1   
xor bh, bh   
mov bl, ah   
mov ah, 0x09
int 0x10

call _v_noos_inccrs

jmp _v_noos_tprintf

_v_noos_tprintfd:
call _v_noos_inccrs
retn

;%%%%%%%%%%%%
;AL = Zeichen
;==================
_v_noos_inccrs:
cmp al,10
jz _v_noos_incrsa

call _v_noos_get_cursor_pos
cmp dl,79
jz _v_noos_incrsa

inc dl
call _v_noos_set_cursor_pos
retn

_v_noos_incrsa:
call _v_noos_pnewline
retn

;%%%%%%%%%%%%%
_v_noos_pnewline:
call _v_noos_get_cursor_pos
inc dh
xor dl,dl
call _v_noos_set_cursor_pos
retn

;%%%%%%%%%%
;DL = Spalte
;DH = Reihe
;===============
_v_noos_set_cursor_pos:
push ax
push bx
xor bh,bh
mov ah,0x02
int 0x10
pop bx
pop ax
retn
;%%%%%%%%%%%%%
;ret: DL = Spalte
;ret DH = Reihe
;===================
_v_noos_get_cursor_pos:
push ax
push bx
xor bh,bh
mov ah,0x03
int 0x10
push bx
push ax
retn

_int0x21:
_int0x21_ser0x01:       
cmp al, 0x01         
jne _int0x21_end       
cmp ah, 0x01
jne _int0x21_ser0x01_start

_int0x21_ser0x01_ser0x01_start:
lodsb
or al,al
jz _int0x21_ser0x01__ser0x01_end

mov ah,09h
; <--- Farbattribut  0 = Schwarz  1 = Blau  2 = Grün 3 = Türkis 4 = Rot 5 = Magenta 6 = braun 7 = Hellgrau 8 = Dunkelgrau 9 = Hellblau a = Hellgrün b = Helltürkis c = Hellrot d = Hellmagenta e = gelb f = weiß
mov cx,0001h
int 10h

;Cursorposition auslesen
mov ah,03h
int 10h
inc dl

;und Cursorposition schreiben
mov ah,02h
int 10h
jmp _int0x21_ser0x01_ser0x01_start
_int0x21_ser0x01__ser0x01_end:
jmp _int0x21_end



_int0x21_ser0x01_start:
lodsb                   
or  al, al             
     jz  _int0x21_ser0x01_end
mov ah, 0x0E           
mov bh, 0x00           
mov bl, 0x07           
int 0x10               
jmp _int0x21_ser0x01_start
_int0x21_ser0x01_end:
jmp _int0x21_end

_int0x21_end:
retn
;funktionen

Die Ausgabe sieht so aus:

]


 Detecting drives
             drive 00...
             drive 01...
Press any key...




Das ']' hat die Farbe gelb. Irgendwie heisst das ja, dass alles ausgegeben wird, was bl,0x07 hat, nicht aber das, was eine andere Farbe hat?

Feuermonster

  • Beiträge: 24
    • Profil anzeigen
Gespeichert
« Antwort #21 am: 15. September 2008, 17:08 »
So. Ich habs nun hingekriegt.

main:
mov ax, 0x1000 ;update segment register...
mov ds, ax
mov es, ax

init0:
mov si,s_noos_init0
call noos_putstr

mov bl, 0x05
mov si, s_noos_logo
call noos_printf
mov bl, 0x02
mov si, s_noos_jmp_good
call noos_printf
call noos_inc_line

call noos_getkey

;Variablen
;========

s_noos_init0 db "Init 0",13,10,0
s_noos_logo db "[ NoOS ]",0
s_noos_jmp_good db  " Jump into kernel successful",0

;Funktionen
;========

;ret: DL = Spalte; ret: DH = Zeile
noos_get_cursor_pos:
mov ah, 0x03
int 0x10
retn


;DL = Spalte; DH = Zeile
noos_set_cursor_pos:
mov ah, 0x02
push bx
xor bh, bh
int 0x10
pop bx
retn

noos_inc_line:
call noos_get_cursor_pos
inc dh
call noos_set_cursor_pos
retn

noos_inc_row:
call noos_get_cursor_pos
inc dl
call noos_set_cursor_pos
retn

;SI = string
noos_printf:
lodsb
or al,al
jz noos_printf_end
call noos_putchar
call noos_inc_row
jmp noos_printf
noos_printf_end:
retn

;AL = char; BL = Farbe
noos_putchar:
push cx
mov cx, 1
mov ah, 0x09
int 0x10
pop cx
retn

;SI = string
noos_putstr:
lodsb
or al, al
jz noos_putstr_end
mov ah, 0x0E
mov bx, 0x07
int 0x10
jmp noos_putstr
noos_putstr_end:
retn

noos_reboot:
jmp 0xffff:0x0000

noos_getkey:
mov ah,0
int 0x16
retn

Ich hoffe das hilft vlt auch anderen weiter.



Eine kleine Frage verbleibt jedoch:

Bei getkey wird irgendwie die Cursorposition veraendert, seh ich das richtig?
Und wie kann ich dafuer sorgen, dass sie das nicht wird?

chris12

  • Beiträge: 134
    • Profil anzeigen
Gespeichert
« Antwort #22 am: 15. September 2008, 18:37 »
so wie ich das sehe wird sie erst bei set_key geändert
vermeiden kanst du es in dem du  set_key weg lässt ... xD
OS? Pah! Zuerst die CPU, dann die Plattform und _dann_ das OS!

Feuermonster

  • Beiträge: 24
    • Profil anzeigen
Gespeichert
« Antwort #23 am: 15. September 2008, 18:52 »
so wie ich das sehe wird sie erst bei set_key geändert
vermeiden kanst du es in dem du  set_key weg lässt ... xD

set_key?

chris12

  • Beiträge: 134
    • Profil anzeigen
Gespeichert
« Antwort #24 am: 15. September 2008, 19:28 »
noos_set_cursor_pos:
bei mir ist es schon bei getkey einen weiter gerückt, wenn du das meintest
OS? Pah! Zuerst die CPU, dann die Plattform und _dann_ das OS!

Feuermonster

  • Beiträge: 24
    • Profil anzeigen
Gespeichert
« Antwort #25 am: 15. September 2008, 20:27 »
noos_set_cursor_pos:
bei mir ist es schon bei getkey einen weiter gerückt, wenn du das meintest

Stimmt, vor getkey sollte ich die Cursorpos wieder auf 0 setzen.

 

Einloggen