rdos/pxe.asm

114 lines
1.3 KiB
NASM
Raw Normal View History

2020-03-01 17:43:23 +01:00
org BASE
main:
mov ax, [es:bx+0x0A]
mov [cs:pxejmp], ax
mov ax, [es:bx+0x0A+2]
mov [cs:pxejmp+2], ax
mov ax, cs
mov ds, ax
mov si, pxejmp
call dump
mov ax, cs
mov ds, ax
mov di, pxestat
mov bx, 0x0071
call UsePXEAPI
mov ax, cs
mov ds, ax
mov si, pxestat
call dump
call dump
hlt: hlt
jmp hlt
UsePXEAPI:
push ds
push di
push bx
int 3
call far [pxejmp]
int 3
add sp, 6
ret
pxejmp: dd 0
pxestat:
.Status dw 0
.PacketType dw 2
.BufferSize dw 0
.BufferOff dw 0
.BufferSeg dw 0
.BufferLimit dw 0
;tftp_open:
; .Status dw 0
; .SIP dd 0
; .GIP dd 0
; .Filename db "pxe.bs"
; times (128-6) db 0
; .Port dw 0
; .PacketSize dw 0
space:
mov al, 0x20
jmp putc
putbc:
cmp al, 0x80
jnc dot
cmp al, 0x20
jnc putc
dot:
mov al, '.'
putc:
push ax
push bx
mov ah, 0x0e
xor bx, bx
int 0x10
pop bx
pop ax
ret
dump: push cx
mov ax, ds
call print16
mov al, ':'
call putc
mov ax, si
call print16
call space
call space
mov cx, 0x08
push si
.hloop: lodsb
call print8
lodsb
call print8
call space
loop .hloop
pop si
call space
mov cx, 0x10
.aloop: lodsb
call putbc
loop .aloop
mov al, 0x0A
call putc
mov al, 0x0D
call putc
pop cx
ret
%include "print.asm"
%include "printf.asm"