59 lines
725 B
NASM
59 lines
725 B
NASM
cpu 8086
|
|
org 0x0100
|
|
jmp init
|
|
|
|
isr_dos_main:
|
|
cmp ah, 0x01
|
|
je isr_getc_echo
|
|
cmp ah, 0x02
|
|
je isr_putc
|
|
cmp ah, 0x25
|
|
je isr_intr_register
|
|
jmp isr_invalid
|
|
|
|
%include "intr.asm"
|
|
%include "chario.asm"
|
|
|
|
; 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
|
|
isr_error:
|
|
push bp
|
|
mov bp, sp
|
|
; set carry flag
|
|
or WORD [SS:BP+6], 1
|
|
pop bp
|
|
isr_return:
|
|
iret
|
|
|
|
init:
|
|
mov ax, cs
|
|
mov ds, ax
|
|
mov es, ax
|
|
|
|
mov dx, isr_dos_main
|
|
mov ax, 0x2521
|
|
pushf
|
|
push cs
|
|
call isr_dos_main
|
|
|
|
mov cx, WORD [0x80]
|
|
xor ch, ch
|
|
mov si, 0x81
|
|
.loop:
|
|
lodsb
|
|
call putc
|
|
loop .loop
|
|
|
|
cli
|
|
.halt:
|
|
hlt
|
|
jmp .halt
|
|
|
|
kernel_end:
|