rdos/rom/debug.asm

114 lines
1.8 KiB
NASM

cpu 8086
org 0x0000
; interrupt vector we store addr of data segment in
bssvec: equ 0xB6
db 0x55, 0xAA
db 0x00
jmp near init
times (0x18 - ($-$$)) db 0
dw 0
dw pnp
pnp: db "$PnP"
db 1 ; version 1
db 2 ; 2 * 16 length
dw 0 ; offset of next header
db 0
db 0 ; checksum (filled by fix-rom)
dd 0 ; device identifier
dw 0 ; manufacturer string
dw name ; product name string
db 0,0,0 ; device type string
db 0x20 ; device indicator, bit for "read cacheable" set
dw 0 ; boot connection vector
dw 0 ; boot disconnect vector
dw 0 ; bootstrap entry point
dw 0 ; reserved
zero: dw 0
name: db "rdos debug", 0
init: push ds
push ax
push cx
; DS := 0
xor ax, ax
mov ds, ax
; allocate a single kilobyte from end of lowmem
dec word [0x413]
; calculate segment from kilobytes
mov ax, [0x413]
mov cl, 6
shl ax, cl
; store ptr to our data segment in B6h vector
mov word [bssvec*4], ax
; set entry points vectors
mov word [1*4], int3entry
mov word [1*4+2], cs
mov word [3*4], int3entry
mov word [3*4+2], cs
pop cx
pop ax
pop ds
retf
; Expects DI to mark end of command
runcmd: mov si, inbuf
lodsb
cmp al, 'G'
je cmd_g
cmp al, 'H'
je cmd_h
cmp al, 'R'
je cmd_r
cmp al, 'T'
je cmd_t
cmp al, '?'
je cmd_?
cerr: mov al, '?'
call putc
jmp crlf
%include "debug/chario.asm"
%include "debug/parse.asm"
%include "debug/names.asm"
%include "debug/edit.asm"
%include "debug/run.asm"
%include "debug/util.asm"
align 512
absolute 0
reg_ax: resw 1
reg_cx: resw 1
reg_dx: resw 1
reg_bx: resw 1
reg_sp: resw 1
reg_bp: resw 1
reg_si: resw 1
reg_di: resw 1
reg_es: resw 1
reg_cs: resw 1
reg_ss: resw 1
reg_ds: resw 1
reg_ip: resw 1
reg_fl: resw 1
ingetc: resw 1
inmin: resb 1
inmax: resb 1
inbuf: resb 0x20
; reserve at least 80h words for stack
resw 0x80
alignb 1024
stack: