71 lines
3.3 KiB
NASM
71 lines
3.3 KiB
NASM
|
;=----------------------------------------------------------------------------=;
|
||
|
; GNU GPL OS/K ;
|
||
|
; ;
|
||
|
; Desc: Basic realmode terminal functions ;
|
||
|
; (x86_64 architecture only) ;
|
||
|
; ;
|
||
|
; ;
|
||
|
; Copyright © 2018-2019 The OS/K Team ;
|
||
|
; ;
|
||
|
; This file is part of OS/K. ;
|
||
|
; ;
|
||
|
; OS/K is free software: you can redistribute it and/or modify ;
|
||
|
; it under the terms of the GNU General Public License as published by ;
|
||
|
; the Free Software Foundation, either version 3 of the License, or ;
|
||
|
; (at your option) any later version. ;
|
||
|
; ;
|
||
|
; OS/K is distributed in the hope that it will be useful, ;
|
||
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of ;
|
||
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;
|
||
|
; GNU General Public License for more details. ;
|
||
|
; ;
|
||
|
; You should have received a copy of the GNU General Public License ;
|
||
|
; along with OS/K. If not, see <https://www.gnu.org/licenses/>. ;
|
||
|
;=----------------------------------------------------------------------------=;
|
||
|
|
||
|
[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
|