324 lines
7.1 KiB
NASM
Executable File
324 lines
7.1 KiB
NASM
Executable File
|
|
mov ax, 0x1000 ; set up segments
|
|
mov ds, ax
|
|
mov es, ax
|
|
|
|
call clrscr ;clear screen
|
|
|
|
;mov si, logo
|
|
;call print_string
|
|
|
|
mov si, logo
|
|
call print_string
|
|
mov si, welcome ;welcome message
|
|
call print_string
|
|
mov si, build; build nummber
|
|
call print_string
|
|
;call setupMouse
|
|
|
|
loop:
|
|
;call drawMousePixel
|
|
;jmp loop
|
|
|
|
mov si, prompt
|
|
call print_string
|
|
|
|
mov di, buffer
|
|
call get_string
|
|
|
|
mov si, buffer
|
|
cmp byte [si], 0 ; blank line?
|
|
je loop ; yes, ignore it
|
|
|
|
mov si, buffer
|
|
mov di, cmd_hi ; "hi" command
|
|
call strcmp
|
|
jz .helloworld
|
|
|
|
mov si, buffer
|
|
mov di, cmd_help ; "help" command
|
|
call strcmp
|
|
jz .help
|
|
|
|
mov si, buffer
|
|
mov di, cmd_credits ; "credits" command
|
|
call strcmp
|
|
jz .credits
|
|
|
|
mov si, buffer
|
|
mov di, cmd_beep ; "beep" command
|
|
call strcmp
|
|
jz .beep
|
|
|
|
mov si, buffer
|
|
mov di, cmd_reboot ; "reboot" command
|
|
call strcmp
|
|
jz .reboot
|
|
|
|
mov si, buffer
|
|
mov di, cmd_halt ;"halt command
|
|
call strcmp
|
|
jz .halt
|
|
|
|
mov si, buffer
|
|
mov di, cmd_banner ;"banner command
|
|
call strcmp
|
|
jz .banner
|
|
|
|
mov si,badcommand ; "failed"
|
|
call print_string
|
|
jmp loop
|
|
|
|
.helloworld:
|
|
mov si, msg_helloworld
|
|
call print_string
|
|
|
|
jmp loop
|
|
|
|
.help:
|
|
mov si, msg_help
|
|
call print_string
|
|
|
|
jmp loop
|
|
|
|
.credits:
|
|
mov si, msg_credits
|
|
call print_string
|
|
|
|
jmp loop
|
|
|
|
.banner:
|
|
mov si, logo
|
|
call print_string
|
|
|
|
jmp loop
|
|
|
|
.beep:
|
|
mov si, beep_code
|
|
call print_string
|
|
|
|
jmp loop
|
|
|
|
.reboot:
|
|
mov si, msg_reboot
|
|
call print_string
|
|
int 19h ;welches man nimmt ist egal
|
|
;jmp 0xffff:0x0000
|
|
|
|
.halt:
|
|
mov si, msg_halt
|
|
call print_string
|
|
|
|
mov ax, 0x1000
|
|
mov ax, ss
|
|
mov sp, 0xf000
|
|
mov ax, 0x5307
|
|
mov bx, 0x0001
|
|
mov cx, 0x0003
|
|
int 0x15
|
|
|
|
|
|
clrscr:
|
|
mov ax, 0x0600
|
|
xor cx, cx
|
|
mov dx, 0x174F
|
|
mov bh, 0x07
|
|
int 0x10;clear screen interupt
|
|
call resetcoursor
|
|
ret
|
|
|
|
resetcoursor:;resets the coursor position
|
|
mov dh, 0 ;row
|
|
mov dl, 0 ;cloum
|
|
mov bh, 0 ;page
|
|
mov ah, 2 ;interupt select
|
|
int 10h ;interupt
|
|
|
|
;set coursor visible
|
|
mov ch, 6;oder 0 je nach form
|
|
mov cl ,7;bottom coursor line
|
|
mov ah, 1;interupt select
|
|
int 10h;interupt
|
|
ret
|
|
;SETUP MOUSE
|
|
setupMouse:
|
|
MOV AX,01
|
|
INT 33h
|
|
|
|
INT 21h
|
|
|
|
|
|
;setupMouse:
|
|
; mov ax, 0
|
|
; int 33h;init mouse
|
|
; mov ax, 1
|
|
; int 33h;show mouse pointer
|
|
; ret
|
|
|
|
;setup graphix
|
|
;mov al, 13h; graphic mode; 00h- text mode. 40x25. 16 colors. 8 pages. 03h- text mode. 80x25. 16 colors. 8 pages. 13h - graphical mode. 40x25. 256 colors. 320x200 pixels. 1 page.
|
|
;mov ah, 0
|
|
;int 10h;INIT GRAPHIX
|
|
;ret
|
|
|
|
;drawMousePixel:
|
|
;mov ax, 0
|
|
;int 33h;init mouse
|
|
;mov al, 1100b;color
|
|
|
|
;grab mouse
|
|
;mov ax, 3
|
|
;int 33h;get mouse cords
|
|
;mov [x], cx
|
|
|
|
;mov ax, dx
|
|
;mov dx, 320
|
|
;mul dx; multiply ax(y) with 320
|
|
|
|
;mov dx, ax
|
|
|
|
; mov cx, [x]
|
|
; mov dx, [y]
|
|
; mov ah, 0ch; interuption select
|
|
; int 10h; interupt
|
|
; ret
|
|
|
|
welcome db 'Welcome to ThiesyyyOS! build ', 0
|
|
build db '######', 0x0D, 0x0A, 0
|
|
beep_code db 0x07, 0
|
|
|
|
badcommand db 'Computer says: no', 0x0D, 0x0A, 0
|
|
prompt db '-> ', 0
|
|
|
|
cmd_reboot db 'reboot', 0
|
|
cmd_credits db 'credits', 0
|
|
cmd_hi db 'hi', 0
|
|
cmd_help db 'help', 0
|
|
cmd_beep db 'beep', 0
|
|
cmd_halt db 'stop', 0
|
|
cmd_banner db 'banner', 0
|
|
|
|
msg_halt db 'Stopping....', 0
|
|
msg_reboot db 'Rebooting....',0
|
|
msg_helloworld db 'Hey, Man!', 0x0D, 0x0A, 0
|
|
msg_help db 'ThiesyyyOS Commands:', 0x0D, 0x0A ,'hi', 0x0D,0x0A,'help', 0x0D, 0x0A,'credits', 0x0D,0x0A,'beep[WIP]',0x0D,0x0A,'reboot',0x0D,0x0A,'stop', 0x0D, 0x0A, 0
|
|
msg_credits db 'Developed and Tested by Thiesyyy and MrBesen!', 0x0D, 0x0A, 0
|
|
|
|
;logo db ' _______ _ _ _ _____ ____ ___ __ ___ __ ___ __ ______ ____ ',0x0D,0x0A, '|__ __| | | | | |_| | ____| / ____| \ \ / / \ \ / / \ \ / / | ___ | / ____| ',0x0D,0x0A, ' | | | |__| | _ | |___ | / \ \/ / \ \/ / \ \/ / | | | | | / ',0x0D,0x0A, ' | | | __ | | | | ___| \ \ \ / \ / \ / | | | | \ \ ',0x0D,0x0A, ' | | | | | | | | | | \ \ \ / \ / \ / | | | | \ \ ',0x0D,0x0A, ' | | | | | | | | | |___ _\ \ | | | | | | | |___| | _\ \ ',0x0D,0x0A, ' |_| |_| |_| |_| |_____| |_____/ |_| |_| |_| |_______| |_____/ ',0x0D,0x0A, 0
|
|
logo db ' ____________________________________________________________________', 0x0d, 0x0A, '| |', 0x0D, 0x0A, '| ThiesyyyOS |',0x0D,0x0A,'| |', 0x0D, 0x0A, '|____________________________________________________________________|',0x0D,0x0A,0
|
|
|
|
buffer times 64 db 0
|
|
; _
|
|
; |_|
|
|
;
|
|
|
|
;_|_|_|_|_| _| _|
|
|
; _| _|_|_| | _|_| _|_|_| _| _| _| _| _|_| _|_|_|
|
|
; _| _| _| _| _|_|_|_| _|_| _| _| _| _| _| _| _|_|
|
|
; _| _| _| _| _| _|_| _| _| _| _| _| _| _|_|
|
|
; _| _| _| _| _|_|_| _|_|_| _|_|_| _|_|_| _|_| _|_|_|
|
|
; _| _|
|
|
; _|_| _|_|
|
|
;
|
|
;
|
|
;
|
|
|
|
; ================
|
|
; calls start here
|
|
; ================
|
|
|
|
print_string:
|
|
lodsb ; grab a byte from SI
|
|
|
|
or al, al ; logical or AL by itself
|
|
jz .done ; if the result is zero, get out
|
|
|
|
mov ah, 0x0E
|
|
int 0x10 ; otherwise, print out the character!
|
|
|
|
jmp print_string
|
|
|
|
.done:
|
|
ret
|
|
|
|
get_string:
|
|
xor cl, cl
|
|
|
|
.loop:
|
|
mov ah, 0
|
|
int 0x16 ; wait for keypress
|
|
|
|
cmp al, 0x08 ; backspace pressed?
|
|
je .backspace ; yes, handle it
|
|
|
|
cmp al, 0x0D ; enter pressed?
|
|
je .done ; yes, we're done
|
|
|
|
cmp cl, 0x3F ; 63 chars inputted?
|
|
je .loop ; yes, only let in backspace and enter
|
|
|
|
mov ah, 0x0E
|
|
int 0x10 ; print out character
|
|
|
|
stosb ; put character in buffer
|
|
inc cl
|
|
jmp .loop
|
|
|
|
.backspace:
|
|
cmp cl, 0 ; beginning of string?
|
|
je .loop ; yes, ignore the key
|
|
|
|
dec di
|
|
mov byte [di], 0 ; delete character
|
|
dec cl ; decrement counter as well
|
|
|
|
mov ah, 0x0E
|
|
mov al, 0x08
|
|
int 10h ; backspace on the screen
|
|
|
|
mov al, ' '
|
|
int 10h ; blank character out
|
|
|
|
mov al, 0x08
|
|
int 10h ; backspace again
|
|
|
|
jmp .loop ; go to the main loop
|
|
|
|
.done:
|
|
mov al, 0 ; null terminator
|
|
stosb
|
|
|
|
mov ah, 0x0E
|
|
mov al, 0x0D
|
|
int 0x10
|
|
mov al, 0x0A
|
|
int 0x10 ; newline
|
|
|
|
ret
|
|
|
|
strcmp:
|
|
.loop:
|
|
mov al, [si] ; grab a byte from SI
|
|
mov bl, [di] ; grab a byte from DI
|
|
cmp al, bl ; are they equal?
|
|
jne .notequal ; nope, we're done.
|
|
|
|
cmp al, 0 ; are both bytes (they were equal before) null?
|
|
je .done ; yes, we're done.
|
|
|
|
inc di ; increment DI
|
|
inc si ; increment SI
|
|
jmp .loop ; loop!
|
|
|
|
.notequal:
|
|
clc ; not equal, clear the carry flag
|
|
ret
|
|
|
|
.done:
|
|
stc ; equal, set the carry flag
|
|
ret
|
|
|
|
;fill file with zeros
|
|
times 2025-($-$$) hlt
|
|
db 'By MrBesen and Thiesyyy';23
|