problem with printing on screen
Posted: Fri Mar 21, 2008 2:07 pm
i could not print on the screen using interrupt 10 when i am in real,mode..
help me..!!!
help me..!!!
The Place to Start for Operating System Developers
http://f.osdev.org/
Code: Select all
texmem: dd 0xB8000;text memory
cline: dd 0xB8000;current line
color: db 0x0A;green
kputc:;put a char on the screen
cmp al,"$"
je bnline
mov ebx,[texmem]
mov ah,[color]
mov [ebx],al
inc ebx
mov [ebx],ah
inc ebx
mov [texmem],ebx
jmp kpute
bnline:
mov eax,[cline]
add eax,0xA0
mov [cline],eax
mov [texmem],eax
kpute:
ret
kputs:;put a string on the screen
lodsb
or al,al
jz kpdone
call kputc
jmp kputs
kpdone:
ret
Code: Select all
org 0x7c00
bits 16
Start:
mov al,'A'
mov bx,0x0003
mov ah,0x0e
int 0x10
jmp $
times 510 - ($-$$) db 0
dw 0xAA55
Code: Select all
@@: mov bx, 0007h
mov ah, 0Eh
push si
int 10h
pop si
inc si
output_string: mov al, [si]
and al, al
jg @b
ret
Code: Select all
;----------------------------------------------------------------------
; Simple boot program that prints the letter 'H'
; and then hangs
;----------------------------------------------------------------------
org 0x7c00 ; This is where BIOS loads the bootloader
; Execution begins here
entry:
jmp short begin ; jump over the DOS boot record data
; --------------------------------------------
; Boot program code begins here
; --------------------------------------------
; boot code begins at 0x003E
begin:
mov ah, 0x0 ; Function to print a character to the screen
mov al, 'H' ; Which character to print
mov bl, 7 ; color/style to use for the character
int 0x10 ; print the character
hang:
jmp hang ; just loop forever.
;---------------------------------------------
size equ $ - entry
%if size+2 > 512
%error "code is too large for boot sector"
%endif
times (512 - size - 2) db 0
db 0x55, 0xAA ;2 byte boot signature
Code: Select all
nasmw h.asm –o h.bin
Code: Select all
bootable h.bin a:
Code: Select all
debug
-n h.bin
-l 0
-w 0 0 0 1