summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/Makefile61
-rw-r--r--modules/int18.asm16
-rw-r--r--modules/poweroff.asm102
-rw-r--r--modules/pxechain.asm558
-rw-r--r--modules/ver.asm606
-rw-r--r--modules/writestr.inc47
6 files changed, 0 insertions, 1390 deletions
diff --git a/modules/Makefile b/modules/Makefile
deleted file mode 100644
index e985af4a..00000000
--- a/modules/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-## -----------------------------------------------------------------------
-##
-## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-## Boston MA 02111-1307, USA; either version 2 of the License, or
-## (at your option) any later version; incorporated herein by reference.
-##
-## -----------------------------------------------------------------------
-
-##
-## Non-COM32 simple Syslinux modules
-##
-
-VPATH = $(SRC)
-include $(MAKEDIR)/embedded.mk
-
-INCLUDES = -I$(com32)/include
-NASMOPT = -I$(SRC)/ -I$(SRC)/../core/
-
-BINS = pxechain.com poweroff.com int18.com ver.com
-
-all: $(BINS)
-
-.PRECIOUS: %.o
-
-.PRECIOUS: %.elf
-%.elf: c32entry.o %.o $(LIB)
- $(LD) -Ttext 0x101000 -e _start -o $@ $^
-
-%.c32: %.elf
- $(OBJCOPY) -O binary $< $@
-
-%.com: %.asm
- ( $(NASM) -M -DDEPEND -o $@ $< ; echo '' ) > .$@.d ; true
- $(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
-
-$(LIB): $(LIBOBJS)
- rm -f $@
- $(AR) cq $@ $^
- $(RANLIB) $@
-
-%.lss: %.ppm.gz $(PPMTOLSS16)
- $(GZIPPROG) -cd $< | \
- $(PPMTOLSS16) \#000000=0 \#d0d0d0=7 \#f6f6f6=15 \
- > $@
-
-%.ppm.gz: %.png
- $(PNGTOPNM) $< | gzip -9 > $@
-
-tidy dist:
- rm -f *.o *.a *.lst *.elf *.map .*.d
-
-clean: tidy
-
-spotless: clean
- rm -f $(BINS)
-
--include .*.d
diff --git a/modules/int18.asm b/modules/int18.asm
deleted file mode 100644
index a13ada75..00000000
--- a/modules/int18.asm
+++ /dev/null
@@ -1,16 +0,0 @@
- bits 16
- org 100h
-_start:
- mov ax,5
- int 22h
- mov ah,09h
- mov dx,msg
- int 21h
- mov ax,000Ch
- xor dx,dx
- int 22h
- int 18h
- jmp 0F000h:0FFF0h ; INT 18h should not return...
-
- section .data
-msg: db 'Local boot via INT 18...', 13, 10, '$'
diff --git a/modules/poweroff.asm b/modules/poweroff.asm
deleted file mode 100644
index f4f19a2f..00000000
--- a/modules/poweroff.asm
+++ /dev/null
@@ -1,102 +0,0 @@
-; ****************************************************************************
-;
-; poweroff.asm
-;
-; Copyright 2009 Sebastian Herbszt
-;
-; APM poweroff module.
-;
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-; Boston MA 02111-1307, USA; either version 2 of the License, or
-; (at your option) any later version; incorporated herein by reference.
-;
-; ****************************************************************************
-
- absolute 0
-pspInt20: resw 1
-pspNextP: resw 1
- resb 124
-pspCmdLen: resb 1
-pspCmdArg: resb 127
-
- section .text
- org 0x100
-
-_start:
- mov ax,5300h ; APM Installation Check (00h)
- xor bx,bx ; APM BIOS (0000h)
- int 15h
- jnc check_sig
-
- mov bx, msg_notpresent
- jmp error
-
-check_sig:
- cmp bx,504Dh ; signature 'PM'
- je check_ver
-
- mov bx, msg_notpresent
- jmp error
-
-check_ver:
- cmp ax,0101h ; Need version 1.1+
- jae check_state
-
- mov bx, msg_notsup
- jmp error
-
-check_state:
- test cx,8 ; bit 3 APM BIOS Power Management disabled
- jz connect
-
- mov bx, msg_pmdisabled
- jmp error
-
-connect:
- mov ax,5301h ; APM Real Mode Interface Connect (01h)
- xor bx,bx ; APM BIOS (0000h)
- int 15h
- jnc connect_ok
-
- mov bx, msg_connect
- jmp error
-
-connect_ok:
- mov ax,530Eh ; APM Driver Version (0Eh)
- xor bx,bx ; APM BIOS (0000h)
- mov cx,0101h ; APM Driver version 1.1
- int 15h
- jnc apm0101_check
-
- mov bx, msg_notsup
- jmp error
-
-apm0101_check:
- cmp cx,0101h ; APM Connection version
- jae apm0101_ok
-
- mov bx, msg_notsup
- jmp error
-
-apm0101_ok:
- mov ax,5307h ; Set Power State (07h)
- mov bx,0001h ; All devices power managed by the APM BIOS
- mov cx,0003h ; Power state off
- int 15h
- jnc off
-
- mov bx, msg_failed
-
-error:
- mov ax,2
- int 22h
-off:
- ret
-
-msg_notpresent: db 'APM not present.',0dh,0ah,0
-msg_notsup: db 'APM 1.1+ not supported.',0dh,0ah,0
-msg_pmdisabled: db 'Power management disabled.',0dh,0ah,0
-msg_connect: db 'APM RM interface connect failed.',0dh,0ah,0
-msg_failed: db 'Power off failed.',0dh,0ah,0
diff --git a/modules/pxechain.asm b/modules/pxechain.asm
deleted file mode 100644
index 35c19691..00000000
--- a/modules/pxechain.asm
+++ /dev/null
@@ -1,558 +0,0 @@
-; "$Id: pxechain.asm,v 1.2 2007/12/16 08:15:39 jhutz Exp $"
-; -*- fundamental -*- (asm-mode sucks) vim:noet:com=\:;
-; ****************************************************************************
-;
-; pxechain.asm
-;
-; A comboot program to chain from PXELINUX to another PXE network
-; bootstrap program (NBP). This improves on PXELINUX's built-in PXE
-; chaining support by arranging for the server address and boot filename
-; reported by the PXE stack to be those from which the new NBP was
-; loaded, allowing PXELINUX to be used to select from multiple NBP's,
-; such as gPXE, another PXELINUX(*), Windows RIS, and so on.
-;
-; (*) This seems unnecessary at first, but it is very helpful when
-; selecting from among self-contained network boot images.
-;
-; Copyright (c) 2007 Carnegie Mellon University
-; Copyright (C) 1994-2007 H. Peter Anvin
-;
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-; Boston MA 02111-1307, USA; either version 2 of the License, or
-; (at your option) any later version; incorporated herein by reference.
-;
-; ****************************************************************************
-
-;%define DEBUG
-;%define NO_RUN
-
- absolute 0
-pspInt20: resw 1
-pspNextP: resw 1
- resb 124
-pspCmdLen: resb 1
-pspCmdArg: resb 127
-
- section .text
- org 0x100
-
-%ifdef DEBUG
-%macro MARK 1.nolist
- mov ah,0x02
- mov dl,%1&0xff
- int 0x21
-%if (%1 >> 8) & 0xff
- mov dl,(%1 >> 8) & 0xff
- int 0x21
-%if (%1 >> 16) & 0xff
- mov dl,(%1 >> 16) & 0xff
- int 0x21
-%if (%1 >> 24) & 0xff
- mov dl,(%1 >> 24) & 0xff
- int 0x21
-%endif
-%endif
-%endif
- mov dl,' '
- int 0x21
-%endmacro
-%macro SHOWD 1.nolist
- mov al,%1
- call print_dec
- mov ah,0x02
- mov dl,' '
- int 0x21
-%endmacro
-%macro SHOWX 1.nolist
- mov bx,%1
- call print_hex
- mov ah,0x02
- mov dl,' '
- int 0x21
-%endmacro
-%else
-%macro MARK 1.nolist
-%endmacro
-%macro SHOWD 1.nolist
-%endmacro
-%macro SHOWX 1.nolist
-%endmacro
-%endif
-
-_start:
- MARK 'INIT'
-
-; There should be exactly one command-line argument, which is of the form
-; [[ipaddress]::]tftp_filename, just like filenames given to PXELINUX.
-; Too few or too many arguments is an error.
-;
-; This code is based on mangle_name in pxelinux.asm
-parse_args:
- cld
- xor cx,cx
- mov cl,[pspCmdLen]
- dec cx
- mov si,pspCmdArg+1
- and cx,cx
- je near usage ; no args is bad
- add si,cx
- dec si
- std
-.chomp: lodsb
- cmp al,' '
- loopz .chomp
- inc cx
- cld
- mov [pspCmdLen],cl
- mov si,pspCmdArg+1
- cmp word [si],'::' ; Leading ::?
- je near gotprefix
- dec cx
- jz noip
- MARK 'SCAN'
-
-.more:
- inc si
- cmp byte [si],' '
- je near usage
- cmp word [si],'::'
- je near parse_ip
- loop .more
-
-noip:
- MARK 'NOIP'
- mov ax,0x0e ; get config file name
- int 0x22
- mov si,bx
-%ifdef DEBUG
- mov ah,0x02
- mov dl,'['
- int 0x21
- mov ax,0x02
- int 0x22
- mov ah,0x02
- mov dl,']'
- int 0x21
- mov dl,' '
- int 0x21
-%endif
- push ds
- push es
- pop ds
- pop es
- push es
-.find_prefix:
- lodsb
- and al,al
- jnz .find_prefix
- dec si
-
- mov cx,si
- sub cx,bx
- MARK 'LEN'
- SHOWD cl ; assume it's <256 for debugging
- dec si
- std
-.find_slash:
- lodsb
- cmp al,'/'
- je .slash
- loop .find_slash
-.slash:
- cmp cx,127
- cld
- jna .copy_prefix
- pop ds
- jmp too_long
-
-.copy_prefix:
- SHOWD cl
- MARK 'PFX'
- mov si,bx
- mov di,tftp_filename
- mov bx,128
- sub bx,cx
- rep movsb
- pop ds
-
- mov cl,[pspCmdLen]
- mov si,pspCmdArg+1
- jmp prefix_done
-
-usage:
- xor cx,cx
- mov si,msg_usage
- jmp fail
-
-too_long:
- xor cx,cx
- mov si,msg_too_long
- jmp fail
-
-parse_ip:
- MARK 'PIP'
- mov di,si
- mov si,pspCmdArg+1
- call parse_dotquad
- jc .notdq
- cmp si,di ; is it the same place?
- jne .notdq
- mov [tftp_siaddr],eax
- jmp gotprefix
-.notdq:
- MARK 'NDQ'
- mov si,di
- mov bx,pspCmdArg+1
- mov ax,0x0010 ; DNS resolve
- int 0x22
- and eax,eax
- jz noip
- mov [tftp_siaddr],eax
-gotprefix:
- MARK 'GOTP'
- dec cx ; skip the ::
- dec cx
- inc si
- inc si
- mov di,tftp_filename
- mov bx,128
-
-prefix_done:
- SHOWD bl
- MARK 'LEFT'
-
-; SI points at the filename, plus remaining arguments,
-; CX contains their combined length.
-; DI points to where the filename should be stored
-; BX says how much space is left for the filename and NUL
-
- and cx,cx
- jz usage ; no args is bad
-.copy_filename:
- lodsb
-%ifdef DEBUG
- mov dl,al
- mov ah,0x2
- int 0x21
-%endif
- cmp al,' '
- je usage
- dec bx
- jz too_long
- stosb
- loop .copy_filename
- xor eax,eax
- stosb
-
-; get PXE cached data
- MARK 'GCI'
- mov ax,0x0009 ; call PXE stack
- mov bx,0x0071 ; PXENV_GET_CACHED_INFO
- mov di,PXECacheParms
- int 0x22
- and eax,eax
- jz .fix_siaddr
- mov cx,[gci_status]
- mov si,msg_get_cache
- jmp fail
-
-.fix_siaddr:
- mov bx,[gci_bufferseg]
- mov es,bx
- mov bx,[gci_buffer]
- mov eax,[es:bx+12] ; save our address (ciaddr)
- mov [open_ciaddr],eax ; ... in case we have to do UDP open
- mov eax,[tftp_siaddr]
- and eax,eax
- jnz .replace_addr
- MARK 'ADDR'
- mov eax,[es:bx+20] ; siaddr
- mov [tftp_siaddr],eax
- jmp .addr_done
-.replace_addr:
- mov [es:bx+20],eax
-.addr_done:
- mov si,tftp_filename ; copy the new filename...
- lea di,[es:bx+108] ; to the "cached DHCP response"
- mov cx,128
- rep movsb
- mov bx,ds ; restore es before proceeding
- mov es,bx
-
-; print out what we are doing
-%ifdef DEBUG
- mov ah,0x02 ; write character
- mov dl,0x0d ; print a CRLF first
- int 0x21
- mov dl,0x0a
- int 0x21
-%endif
- mov ax,0x0002 ; write string
- mov bx,msg_booting
- int 0x22
- mov ebx,[tftp_siaddr]
- call print_dotquad
- mov ah,0x02 ; write character
- mov dl,' '
- int 0x21
- mov ax,0x0002 ; write string
- mov bx,tftp_filename
- int 0x22
- mov ah,0x02 ; write character
- mov dl,0x0d
- int 0x21
- mov dl,0x0a
- int 0x21
-
-%ifndef NO_RUN
- mov ax,0x0009 ; call PXE stack
- mov bx,0x0031 ; PXENV_UDP_CLOSE
- mov di,PXECloseParms
- int 0x22
- mov cx,[close_status]
- mov si,msg_udp_close
- and ax,ax
- jnz fail
-
- mov ax,0x0009 ; call PXE stack
- mov bx,0x0073 ; PXENV_RESTART_TFTP
- mov di,PXERestartTFTPParms
- int 0x22
- mov cx,[tftp_status]
- mov si,msg_rst_tftp
- call fail
-
- mov ax,0x0009 ; call PXE stack
- mov bx,0x0030 ; PXENV_UDP_OPEN
- mov di,PXEOpenParms
- int 0x22
- mov cx,[open_status]
- mov si,msg_udp_open
- and ax,ax
- jnz fail
- ret
-%endif
-
-fail:
- MARK 'FAIL'
- SHOWX cs
- SHOWX ds
- SHOWX es
- SHOWX si
-%ifdef DEBUG
- mov ah,0x02 ; write character
- mov dl,0x0d ; print a CRLF first
- int 0x21
- mov dl,0x0a
- int 0x21
-%endif
- mov ax,0x0002 ; write string
- mov bx,msg_progname ; print our name
- int 0x22
- mov bx,si ; ... the error message
- int 0x22
- mov ah,0x02 ; write character
- jcxz .done
- mov dl,' ' ; ... and the error code, in []
- int 0x21
- mov dl,'['
- int 0x21
- mov bx,cx
- call print_hex
- mov ah,0x02 ; write character
- mov dl,']'
- int 0x21
-.done:
- mov dl,0x0d ; and finally a CRLF
- int 0x21
- mov dl,0x0a
- int 0x21
- ret
-
-
-; print_hex
-;
-; Take a 16-bit integer in BX and print it as 2 hex digits.
-; Destroys AX and DL.
-;
-print_hex:
- mov al,bh
- aam 16
- cmp ah,10
- jb .lt_a000
- add ah,'A'-'0'-10
-.lt_a000: add ah,'0'
- mov dl,ah
- mov ah,0x02 ; write character
- int 0x21
-
- cmp al,10
- jb .lt_a00
- add al,'A'-'0'-10
-.lt_a00: add al,'0'
- mov dl,al
- mov ah,0x02 ; write character
- int 0x21
-
- mov al,bl
- aam 16
- cmp ah,10
- jb .lt_a0
- add ah,'A'-'0'-10
-.lt_a0: add ah,'0'
- mov dl,ah
- mov ah,0x02 ; write character
- int 0x21
-
- cmp al,10
- jb .lt_a
- add al,'A'-'0'-10
-.lt_a: add al,'0'
- mov dl,al
- mov ah,0x02 ; write character
- int 0x21
- ret
-
-
-; print_dec
-;
-; Take an 8-bit integer in AL and print it in decimal.
-; Destroys AX and DL.
-;
-print_dec:
- cmp al,10 ; < 10?
- jb .lt10 ; If so, skip first 2 digits
-
- cmp al,100 ; < 100
- jb .lt100 ; If so, skip first digit
-
- aam 100
- ; Now AH = 100-digit; AL = remainder
- add ah,'0'
- mov dl,ah
- mov ah,0x02
- int 0x21
-
-.lt100:
- aam 10
- ; Now AH = 10-digit; AL = remainder
- add ah,'0'
- mov dl,ah
- mov ah,0x02
- int 0x21
-
-.lt10:
- add al,'0'
- mov dl,al
- mov ah,0x02
- int 0x21
- ret
-
-
-; print_dotquad
-;
-; Take an IP address (in network byte order) in EBX and print it
-; as a dotted quad.
-; Destroys EAX, EBX, ECX, EDX
-;
-print_dotquad:
- mov cx,3
-.octet:
- mov al,bl
- call print_dec
- jcxz .done
- mov ah,0x02
- mov dl,'.'
- int 0x21
- ror ebx,8 ; Move next char into LSB
- dec cx
- jmp .octet
-.done:
- ret
-
-
-; parse_dotquad:
-; Read a dot-quad pathname in DS:SI and output an IP
-; address in EAX, with SI pointing to the first
-; nonmatching character.
-;
-; Return CF=1 on error.
-;
-; No segment assumptions permitted.
-;
-parse_dotquad:
- push cx
- mov cx,4
- xor eax,eax
-.parseloop:
- mov ch,ah
- mov ah,al
- lodsb
- sub al,'0'
- jb .notnumeric
- cmp al,9
- ja .notnumeric
- aad ; AL += 10 * AH; AH = 0;
- xchg ah,ch
- jmp .parseloop
-.notnumeric:
- cmp al,'.'-'0'
- pushf
- mov al,ah
- mov ah,ch
- xor ch,ch
- ror eax,8
- popf
- jne .error
- loop .parseloop
- jmp .done
-.error:
- loop .realerror ; If CX := 1 then we're done
- clc
- jmp .done
-.realerror:
- stc
-.done:
- dec si ; CF unchanged!
- pop cx
- ret
-
- section .data
-msg_booting: db 'TFTP boot: ',0
-msg_progname: db 'pxechain: ',0
-msg_usage: db 'usage: pxechain.cbt [[ipaddress]::]filename',0dh,0ah,0
-msg_too_long: db 'pxechain: filename is too long (max 127)',0dh,0ah,0
-msg_get_cache: db 'PXENV_GET_CACHED_INFO',0
-msg_rst_tftp: db 'PXENV_RESTART_TFTP',0
-msg_udp_close: db 'PXENV_UDP_CLOSE',0
-msg_udp_open: db 'PXENV_UDP_OPEN',0
-
-PXECacheParms:
-gci_status: dw 0
-gci_packettype: dw 3 ; PXENV_PACKET_TYPE_CACHED_REPLY
-gci_buffersize: dw 0
-gci_buffer: dw 0
-gci_bufferseg: dw 0
-gci_bufferlim: dw 0
-
-PXERestartTFTPParms:
-tftp_status: dw 0
-tftp_filename: times 128 db 0
-tftp_bufsize: dd 0x00090000 ; available memory for NBP
-tftp_bufaddr: dd 0x00007c00 ; PXE NBP load address
-tftp_siaddr: dd 0
-tftp_giaddr: dd 0
-tftp_mcaddr: dd 0
-tftp_mcport: dw 0
-tftp_msport: dw 0
-tftp_timeout: dw 0
-tftp_reopendly: dw 0
-
-PXECloseParms:
-close_status: dw 0
-
-PXEOpenParms:
-open_status: dw 0
-open_ciaddr: dd 0
diff --git a/modules/ver.asm b/modules/ver.asm
deleted file mode 100644
index 600def02..00000000
--- a/modules/ver.asm
+++ /dev/null
@@ -1,606 +0,0 @@
-; ****************************************************************************
-;
-; ver.asm
-;
-; A COMBOOT/DOS COM program to display the version of the system
-; (Syslinux, DOS, or DRMK)
-;
-; Copyright (C) 2009-2010 Gene Cumm
-;
-; This program is free software; you can redistribute it and/or modify
-; it under the terms of the GNU General Public License as published by
-; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-; Boston MA 02111-1307, USA; either version 2 of the License, or
-; (at your option) any later version; incorporated herein by reference.
-;
-; ****************************************************************************
-
-; %define DEBUG
-
- section .text
- org 0x100
-
-_start:
- call crlf
- mov si,info_str
- call writestr
- call getdosver
- call chkprn_dosver
- jnz .end
- call chkprn_syslinux
- call crlf
-.end:
-; pop ds
- ret
-
-
-; chkprn_syslinux
-chkprn_syslinux:
-%ifdef DEBUG
- mov si,may_sysl_str
- call writestr
-%endif
- cmp eax,59530000h
- jne .end
- cmp ebx,4C530000h
- jne .end
- cmp ecx,4E490000h
- jne .end
- cmp edx,58550000h
- jne .end
-.is_syslinux:
- pushad
-%ifdef DEBUG
- mov si,is_sysl_str
- call writestr
-%endif
-.get_sysl_ver:
- mov ax,0001h
- int 22h
-; AX=0001h [2.00] Get Version
-;
-; Input: AX 0001h
-; Output: AX number of INT 22h API functions available
-; CH Syslinux major version number
-; CL Syslinux minor version number
-; DL Syslinux derivative ID (e.g. 32h = PXELINUX)
-; ES:SI Syslinux version string
-; ES:DI Syslinux copyright string
-%ifdef DEBUG
- push si
- push cs
- pop ds
- mov si,gotver_str
- call writestr
- pop si
-%endif
-
-.prn_ver_str:
- mov si,syslban_str
- call writestr
- push ds
- push es
- pop ds
- call writestr
- call crlf
- pop ds
-.prn_var:
- cmp dl,31h
- je .var_sysl
- cmp dl,32h
- je .var_pxel
- cmp dl,33h
- je .var_isol
- cmp dl,34h
- je .var_extl
- jmp .var_unk
-.var_sysl:
- mov si,sysl_str
- call writestr
- jmp .prn_lnxsp
-.var_pxel:
- mov si,pxel_str
- call writestr
- jmp .prn_lnxsp
-.var_isol:
- mov si,isol_str
- call writestr
- jmp .prn_lnxsp
-.var_extl:
- mov si,extl_str
- call writestr
-; jmp .prn_lnxsp
-.prn_lnxsp:
- mov si,linsp_str
- call writestr
- jmp .prn_ver
-.var_unk:
- mov si,unkvar_str
- call writestr
-.prn_ver:
-%ifdef DEBUG
- push si
- push cs
- pop ds
- mov si,prn_ver_str
- call writestr
- pop si
-%endif
-.prn_ver_maj:
- mov al,ch
- call writedecb
- mov dl,'.'
- call writechr_dl
-.prn_ver_min:
- mov al,cl
-; cmp al,10
-; jae .min_wri
-; mov al,'0'
-; call writechr
-; mov al,cl
-; .min_wri:
-; call writedecb
- call writedecb2
-
-.end_prn:
- popad
-.end:
- ret
-
-; chkprn_dosver Check and print DOS version;
-; Input Data from INT21 AH=30h
-; AH Major version of DOS or 0
-; AL Minor Version
-; BH DOS type
-; BL:CX 24-bit OEM serial number
-; Return
-; ZF Unset if DOS, Set if not DOS (AX=0)
-chkprn_dosver:
- and ax,ax ; cmp ax,0
- jz .end
-.is_dos:
- push eax
- push edx
- push si
-%ifdef DEBUG
- mov si,is_dos_str
- call writestr
- call crlf
- call prnreg_gp_l
- call crlf
-%endif
-.var_prn:
- cmp bh,0
- je .var_pcdos
- cmp bh,0FFh
- je .var_msdos
- cmp bh,0FDh
- je .var_freedos
- cmp bh,0DEh
- je .var_drmk
- jmp .var_unk
-.var_pcdos:
- mov si,pcdos_str
- call writestr
- jmp .var_end
-.var_msdos:
- mov si,msdos_str
- call writestr
- jmp .var_end
-.var_freedos:
- mov si,freedos_str
- call writestr
- jmp .var_end
-.var_drmk:
- mov si,drmk_str
- call writestr
- jmp .var_end
-.var_unk:
- mov si,unkdos_str
- call writestr
- mov si,spparen_str
- call writestr
- push eax
- mov al,bh
- call writehex2
- pop eax
- mov si,parensp_str
- call writestr
-; jmp .var_end
-.var_end:
- call prn_dosver_num
- call crlf
-.subver:
- pop si
- pop edx
- pop eax
- cmp bh,0FFh
- je .msdos_ver
- cmp bh,0DEh
- jne .end_ver
-.drmk_ver:
- call getprn_drmkver
-; jmp .end_ver ; DRMK returns Extended/True DOS
-.msdos_ver:
- cmp al,5
- jb .end_ver
- call getprn_msdosver
-.end_ver:
- and ax,ax ; Unset ZF
-.end:
- ret
-
-; prn_dosver_num Print the numerical DOS version
-; Input Data from INT21 AH=30h
-; AH Major version of DOS or 0
-; AL Minor Version
-; BH DOS type
-; BL:CX 24-bit OEM serial number
-prn_dosver_num:
- push eax
- push edx
- push si
- pushfd
-.vmaj_prn:
- call writedecb
-; call writehex2
- mov dl,'.'
- call writechr_dl
-.vmin_prn:
- mov al,ah
- call writedecb
-; call writehex2
-.serial: ; Skip if 0
- cmp bl,0
- jne .ser_start
- cmp cx,0
- je .end
-.ser_start:
- mov si,spparen_str
- call writestr
- mov si,zerox_str
- call writestr
-.ser_bl:
- mov al,bl
- call writehex2
-.ser_cx:
- mov ax,cx
- call writehex4
-.serial_end:
- mov si,parensp_str
- call writestr
-.end:
- popfd
- pop si
- pop edx
- pop eax
- ret
-
-; getdosver Get the DOS version
-; Return Version or 0 + SYSLINUX message
-; EAX Part 1
-; EBX Part 2
-; ECX Part 3
-; EDX Part 4
-getdosver:
- mov ecx,0
- mov edx,0
- mov ebx,0
- mov eax,3000h
- int 21h
- ret
-
-; getmsdosver Get the Extended MS-DOS version
-; Returns Version
-; EAX Part 1
-; EBX Part 2
-; ECX Part 3
-; EDX Part 4
-getmsdosver:
- mov ecx,0
- mov edx,0
- mov ebx,0
- mov eax,3306h
- int 21h
- ret
-
-; getprn_msdosver
-getprn_msdosver:
- pushad
- pushfd
- call getmsdosver
-%ifdef DEBUG
- call prnreg_gp_l
- call crlf
-%endif
- mov si,dosext_str
- call writestr
- mov eax,ebx
- mov ebx,0
- mov ecx,edx
- call prn_dosver_num
-.end:
- popfd
- popad
- ret
-
-; getdrmkver: Get the DRMK-specifc OS version
-; Returns Version
-; AX OS Version
-; DX Patch Version
-getdrmkver:
- mov ax,4452h
- int 21h
- ret
-
-; getdrmkver: Get the DRMK-specifc Kernel build info
-; Returns Kernel build info
-; AX Kernel build date in DOS 16-bit format
-; [ES:BX] Kernel private data
-getdrmkbld:
- mov ax,4458h
- int 21h
- ret
-
-; getprn_drmkver: Get/Print DRMK-specific Version info
-getprn_drmkver:
- pushad
- pushfd
-.getver:
- call getdrmkver
-.prnosver: ; "OS Version"
- mov si,osver_str
- call writestr
- mov si,zerox_str
- call writestr
-; mov ax,0
- call writehex4
- call crlf
-.prnpatchver: ; "Patch Version"
- mov si,patchver_str
- call writestr
- mov si,zerox_str
- call writestr
- mov ax,dx
- call writehex4
- call crlf
-.getbld:
- call getdrmkbld
-.prnkernbld: ; "Kernel Build Date"
- mov si,kernbld_str
- call writestr
- call writedate_ax
- call crlf
-.prnkernprvaddr:
- mov si,prvdat_str
- call writestr
- mov ax,es
- call writehex4
- mov dl,':'
- call writechr_dl
- mov ax,bx
- call writehex4
- call crlf
-%ifdef DEBUG
-.prnkernprv:
- mov di,[es:bx]
- mov ax,di
- call writehex4
- call crlf
- mov si,2
- mov cx,8
-.prnkernprv2:
- push cx
- mov cx,8
-.prnkernprv1:
- mov eax,[es:bx+si]
- call writehex8
- cmp cx,1
- jbe .prnkern0dash
- mov ax,'-'
- call writechr
-.prnkern0dash:
- add si,4
- sub di,4
- cmp di,0
- jbe .prnkernprvend
- loop .prnkernprv1
- call crlf
- pop cx
- loop .prnkernprv2
- jmp .end
-.prnkernprvend:
- pop cx
-%endif
-.end:
- popfd
- popad
- ret
-
-;writedate_ax Write a date in AX in ISO8601 big endian format
-; Input
-; AX Date in 16-bit DOS format
-; 2006-01-11
-; 0011010 0001 01011
-writedate_ax:
- pushad
- pushfd
- mov dx,ax
-%ifdef DEBUG
- call writehex4
- call crlf
-%endif
-.year:
- shr ax,9
- add ax,1980
- call writedecw
- mov al,'-'
- call writechr
- mov ax,dx
-.month:
- shr ax,5
- and ax,0Fh
-; cmp ax,10
-; jae .month_wri
-; mov cx,ax
-; mov ax,'0'
-; call writechr
-; mov ax,cx
-; .month_wri:
-; call writedecb
- call writedecb2
- mov al,'-'
- call writechr
- mov ax,dx
-.day:
- and ax,1Fh
-; cmp ax,10
-; jae .day_wri
-; mov cx,ax
-; mov ax,'0'
-; call writechr
-; mov ax,cx
-; .day_wri:
-; call writedecb
- call writedecb2
-.end:
- popfd
- popad
- ret
-
-; writechr_dl Write a character to the console saving AX
-; Input
-; DL character to write
-writechr_dl:
- push ax
- mov ah,02h
- int 21h
-.end:
- pop ax
- ret
-
-; writechr_al Write a character to the console saving AX
-; Input
-; AL character to write
-writechr:
-writechr_al:
- push dx
- mov dl,al
- call writechr_dl
-.end: pop dx
- ret
-
-; writedecb[23] Print byte as fixed width
-; Input
-; AL number to write
-writedecb3:
- pushfd
- cmp al,100
- jae .skip
- push ax
- mov ax,'0'
- call writechr
- pop ax
-.skip: popfd
-writedecb2:
- pushfd
- cmp al,10
- jae .skip
- push ax
- mov ax,'0'
- call writechr
- pop ax
-.skip: popfd
- call writedecb
- ret
-
-
-; prnreg_gp_l Dump GP registers (Long)
-prnreg_gp_l:
- push eax
- push si
- call crlf
- mov si,sp2_str
- call writestr
- mov si,eax_str
- call writestr
- call writehex8
- mov si,sp2_str
- call writestr
- mov si,ecx_str
- call writestr
- mov eax,ecx
- call writehex8
- mov si,sp2_str
- call writestr
- mov si,edx_str
- call writestr
- mov eax,edx
- call writehex8
- mov si,sp2_str
- call writestr
- mov si,ebx_str
- call writestr
- mov eax,ebx
- call writehex8
- call crlf
- pop si
- pop eax
-.end:
- ret
-
-; is_zf
-is_zf:
- push si
- jz .true
-.false:
- mov si,zero_not_str
- call writestr
- jmp .end
-.true:
- mov si,zero_is_str
- call writestr
-.end:
- pop si
- ret
-
-%include "../core/macros.inc" ; CR/LF
-%include "writestr.inc" ; String output
-%include "../core/writehex.inc" ; Hexadecimal output
-%include "../core/writedec.inc" ; Decimal output
-
- section .data
-info_str db 'Ver.com b026', CR, LF, 0
-is_dos_str db 'Found DOS', CR, LF, 0
-is_sysl_str db 'Found a Syslinux variant', CR, LF, 0
-is_drmk_str db 'Found DRMK', CR, LF, 0
-may_sysl_str db 'Maybe Syslinux variant', CR, LF, 0
-gotver_str db 'Got the version back', CR, LF, 0
-prn_ver_str db 'Printing version number', CR, LF, 0
-syslban_str db 'Syslinux banner: ',0
-sysl_str db 'SYS', 0
-pxel_str db 'PXE', 0
-isol_str db 'ISO', 0
-extl_str db 'EXT', 0
-linsp_str db 'LINUX ', 0
-unkvar_str db 'Unkown-Variant ', 0
-pcdos_str db 'PC-DOS ', 0
-msdos_str db 'MS-DOS ', 0
-freedos_str db 'FreeDOS ', 0
-unkdos_str db 'Unknown-DOS ', 0
-drmk_str db 'DRMK ', 0
-dosext_str db ' Extended DOS version: ', 0
-osver_str db ' OS Version: ', 0
-patchver_str db ' Patch Version: ', 0
-kernbld_str db ' Kernel Build Date: ', 0
-prvdat_str db ' Private Data Ptr: ', 0
-spparen_str db ' (', 0
-zerox_str db '0x', 0
-parensp_str db ') ', 0
-eax_str db 'EAX=', 0
-ebx_str db 'EBX=', 0
-ecx_str db 'ECX=', 0
-edx_str db 'EDX=', 0
-sp2_str db ' ', 0
-zero_not_str db ' NOT_Zero ',0
-zero_is_str db ' IS_Zero ',0
diff --git a/modules/writestr.inc b/modules/writestr.inc
deleted file mode 100644
index 9c11b320..00000000
--- a/modules/writestr.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-;; -----------------------------------------------------------------------
-;;
-;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
-;;
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
-;; Boston MA 02111-1307, USA; either version 2 of the License, or
-;; (at your option) any later version; incorporated herein by reference.
-;;
-;; -----------------------------------------------------------------------
-
-;;
-;; writestr.inc
-;;
-;; Code to write a simple string.
-;;
-
-;
-; crlf: Print a newline
-;
-crlf: push ax
- mov al,CR
- call writechr
- mov al,LF
- call writechr
- pop ax
- ret
-
-;
-; writestr: write a null-terminated string to the console, saving
-; registers on entry.
-;
-; Note: writestr_early and writestr are distinct in
-; SYSLINUX and EXTLINUX, but not PXELINUX and ISOLINUX
-;
-writestr:
- pushfd
- pushad
-.top: lodsb
- and al,al
- jz .end
- call writechr
- jmp short .top
-.end: popad
- popfd
- ret