56 lines
2.1 KiB
NASM
56 lines
2.1 KiB
NASM
;=----------------------------------------------------------------------------=;
|
|
; GNU GPL OS/K ;
|
|
; ;
|
|
; Authors: spectral` ;
|
|
; NeoX ;
|
|
; ;
|
|
; Desc: Basic realmode terminal functions ;
|
|
; (x86_64 architecture only) ;
|
|
;=----------------------------------------------------------------------------=;
|
|
|
|
[BITS 16]
|
|
|
|
disable_cursor:
|
|
pushf
|
|
push eax
|
|
push edx
|
|
mov dx, 0x3D4
|
|
mov al, 0xA ; low cursor shape register
|
|
out dx, al
|
|
inc dx
|
|
mov al, 0x20 ; bits 6-7 unused, bit 5 disables the cursor, bits 0-4 control the cursor shape
|
|
out dx, al
|
|
pop edx
|
|
pop eax
|
|
popf
|
|
ret
|
|
|
|
get_dimensions:
|
|
push eax
|
|
push ebx
|
|
mov ah, 0x0F
|
|
int 0x10
|
|
mov [VGA_HEIGHT], ah
|
|
mov [VIDEO_MODE], al
|
|
pop ebx
|
|
pop eax
|
|
ret
|
|
|
|
PrintB:
|
|
;---------------------------------------------------;
|
|
; Print out a simple string. ;
|
|
; ;
|
|
; DS:SI = String to print ;
|
|
; ;
|
|
; Returns: None ;
|
|
; ;
|
|
;---------------------------------------------------;
|
|
lodsb ; Load byte from ds:si to al
|
|
or al, al ; If al is empty stop looping
|
|
jz .done ; Done looping and return
|
|
mov ah, 0x0e ; Teletype output
|
|
int 0x10 ; Video interupt
|
|
jmp PrintB ; Loop untill string is null
|
|
.done:
|
|
ret
|