kvisc/ka/sys/main.k

49 lines
752 B
Plaintext
Raw Normal View History

2019-05-30 12:44:56 +02:00
; The OS/K Team licenses this file to you under the MIT license.
2019-05-30 12:27:13 +02:00
; See the LICENSE file in the project root for more information.
2019-06-21 22:19:55 +02:00
PrintBootMsg:
2019-07-24 16:52:26 +02:00
call print, .bootmsg
2019-06-21 22:19:55 +02:00
ret
.bootmsg = "Starting DOS...\n\n"
2019-07-09 19:51:03 +02:00
;
; Initialize TRAP handlers
;
InitSyscalls:
2019-08-14 09:52:39 +02:00
call RFS.ActivateFrame, 1
2019-07-09 19:51:03 +02:00
2019-09-07 16:45:03 +02:00
mov ax1, $eip
2019-08-06 23:21:37 +02:00
mov ax2, DefaultTrapHandler
2019-07-09 19:51:03 +02:00
call RFS.StoreReg
2019-08-06 23:21:37 +02:00
mov ax0, 256
mov ax1, 1
2019-07-09 19:51:03 +02:00
call IDT.AddHandler
ret
2019-08-06 23:21:37 +02:00
InitExcepts:
2019-08-14 09:52:39 +02:00
call RFS.ActivateFrame, 2
2019-08-06 23:21:37 +02:00
2019-09-07 16:45:03 +02:00
mov ax1, $eip
2019-08-06 23:21:37 +02:00
mov ax2, DefaultExceptionHandler
call RFS.StoreReg
2019-08-14 09:52:39 +02:00
call IDT.AddHandler, zero, 2
2019-08-06 23:21:37 +02:00
2019-07-15 20:58:17 +02:00
SwitchToCMD:
2019-09-07 16:45:03 +02:00
mov eax, Sys.Exit
2019-07-15 20:58:17 +02:00
trap 0
2019-05-30 12:27:13 +02:00
;
; Main function
;
main:
2019-06-21 22:19:55 +02:00
call PrintBootMsg
2019-07-09 19:51:03 +02:00
call InitSyscalls
2019-08-06 23:21:37 +02:00
call InitExcepts
2019-07-15 20:58:17 +02:00
call SwitchToCMD
2019-06-18 12:58:26 +02:00
ret