org 0x7C00
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 di, pxestat
mov bx, 0x0071
call UsePXEAPI
mov si, pxestat
hlt: hlt
jmp hlt
UsePXEAPI:
push ds
push di
push bx
int 3
call far [pxejmp]
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
mov ah, 0x0e
xor bx, bx
int 0x10
pop bx
pop ax
dump: push cx
mov ax, ds
call print16
mov al, ':'
call putc
mov ax, si
call space
mov cx, 0x08
push si
.hloop: lodsb
call print8
lodsb
loop .hloop
pop si
mov cx, 0x10
.aloop: lodsb
call putbc
loop .aloop
mov al, 0x0A
mov al, 0x0D
pop cx
%include "print.asm"
%include "printf.asm"