No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

107 líneas
2.7 KiB

BITS 16
;mov si, test_string
lfsf_systemcall:
mov ax, 0
mov ah, 0x10
int 0x16
mov ah, 0x0e
mov al, 65 ; backspace
int 0x10 ; print char
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print:
; Prints string in si
; IN si: zero terminated string to print
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
.printchar:
lodsb ; Load byte at address SI into AL, and increment SI
test al, al
jz .done ; If the character is zero (NUL), stop writing the string
int 0x10 ; Otherwise, print the character via 'int 0x10'
jmp .printchar ; Repeat for the next character
.done:
ret
printCRLF:
mov ah, 0xE
mov al, 13
int 0x10
mov al, 10
int 0x10
ret
printSpace:
mov ax, 0xE20
int 0x10
ret
printALChar:
mov ah, 0xE
mov bl, 0x02 ;color
int 0x10
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print_reverse:
; Prints string in si
; IN bx: adress of string
; IN cx: length
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ah, 0xE ; Specify 'int 0x10' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
add bx, cx
.printchar:
mov BYTE al, [bx] ; Load byte at address SI into AL, and increment SI
test al, al
jz .done ; If the character is zero (NUL), stop writing the string
cmp cx, 0
jz .done
int 0x10 ; Otherwise, print the character via 'int 0x10'
dec bx
dec cx
jmp .printchar ; Repeat for the next character
.done:
ret
; Changing the screen the user i looking at.
; value in 'al' is the screen we want to switch to.
; starting from 0x00
os_change_screen:
; Here the addresses for the screens stack
; and base pointer has to be set.
mov ah, 0x05
int 0x10
ret
os_clear_screen:
pusha
; move cursor to the bootom
xor ax, ax
xor bx, bx
mov ah, 0x02
mov bh, 0x00 ; page number 0
mov dh, 0x18 ; row zero
mov dl, 0x00 ; coloumn zero
int 0x10
xor cx, cx
.loop:
call printCRLF
add cx, 1
cmp cx, 0x19 ; until blank screen
jne .loop
; Move curser back to the top of the screen
mov ah, 0x02
mov bh, 0x00 ; page number 0
mov dh, 0x00 ; row zero
mov dl, 0x00 ; coloumn zero
int 0x10
popa
ret
test_string db "Hello", 13, 0
times 2048-($-$$) db 0