2019-04-20 23:02:35 +02:00
|
|
|
cpu 8086
|
2019-09-24 00:06:25 +02:00
|
|
|
org 0x0
|
2019-09-10 23:38:52 +02:00
|
|
|
jmp init
|
2019-04-20 23:02:35 +02:00
|
|
|
|
2019-09-06 00:24:39 +02:00
|
|
|
isr_dos_main:
|
2019-09-10 23:38:52 +02:00
|
|
|
cmp ah, 0x01
|
|
|
|
je isr_getc_echo
|
|
|
|
cmp ah, 0x02
|
|
|
|
je isr_putc
|
2019-09-10 23:50:58 +02:00
|
|
|
cmp ah, 0x25
|
|
|
|
je isr_intr_register
|
2019-09-10 23:38:52 +02:00
|
|
|
jmp isr_invalid
|
2019-09-08 17:18:37 +02:00
|
|
|
|
2019-09-10 23:38:52 +02:00
|
|
|
%include "intr.asm"
|
2019-09-10 23:50:58 +02:00
|
|
|
%include "chario.asm"
|
2019-09-08 17:18:37 +02:00
|
|
|
|
|
|
|
; ISR for invalid subfunctions or unimplemented
|
|
|
|
isr_invalid:
|
|
|
|
mov bp, 0xFEFE
|
|
|
|
int3
|
|
|
|
.hlt:
|
|
|
|
hlt
|
|
|
|
jmp .hlt
|
|
|
|
; ISR tail to set carry flag to signal error
|
2019-09-06 00:24:39 +02:00
|
|
|
isr_error:
|
|
|
|
push bp
|
|
|
|
mov bp, sp
|
|
|
|
; set carry flag
|
|
|
|
or WORD [SS:BP+6], 1
|
|
|
|
pop bp
|
|
|
|
isr_return:
|
|
|
|
iret
|
|
|
|
|
2019-09-19 22:02:16 +02:00
|
|
|
%include "drive.asm"
|
|
|
|
|
2019-09-10 23:38:52 +02:00
|
|
|
init:
|
2019-09-10 23:50:58 +02:00
|
|
|
mov ax, cs
|
|
|
|
mov ds, ax
|
|
|
|
mov es, ax
|
2019-09-08 17:18:37 +02:00
|
|
|
|
2019-09-19 22:02:16 +02:00
|
|
|
mov di, kernel_end
|
|
|
|
call drive_setup
|
|
|
|
|
2019-09-10 23:50:58 +02:00
|
|
|
mov dx, isr_dos_main
|
|
|
|
mov ax, 0x2521
|
|
|
|
pushf
|
|
|
|
push cs
|
|
|
|
call isr_dos_main
|
2019-09-03 12:58:06 +02:00
|
|
|
|
2019-09-19 22:02:16 +02:00
|
|
|
mov dl, 0x37
|
|
|
|
mov ah, 0x02
|
|
|
|
int 0x21
|
2019-09-10 23:38:52 +02:00
|
|
|
|
|
|
|
cli
|
|
|
|
.halt:
|
|
|
|
hlt
|
|
|
|
jmp .halt
|
2019-09-06 00:24:39 +02:00
|
|
|
|
2019-09-19 22:02:16 +02:00
|
|
|
|
2019-09-08 17:18:37 +02:00
|
|
|
kernel_end:
|