wok diff linld/stuff/src/_ISOBEG.ASM @ rev 23864

syslinux/isoboot.s: accept user args (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jun 19 17:01:11 2020 +0000 (2020-06-19)
parents 31a47c12da10
children
line diff
     1.1 --- a/linld/stuff/src/_ISOBEG.ASM	Sun May 31 10:17:28 2020 +0000
     1.2 +++ b/linld/stuff/src/_ISOBEG.ASM	Fri Jun 19 17:01:11 2020 +0000
     1.3 @@ -20,15 +20,8 @@
     1.4          ends    _DATA
     1.5  
     1.6          segment _BSS byte public use16 'BSS'
     1.7 -
     1.8          global  _bss_start:byte
     1.9          label   _bss_start byte
    1.10 -utoabuf		db	6 dup(?)
    1.11 -
    1.12 -		include	"isostate.inc"
    1.13 -
    1.14 -		extrn	_isostate:isostate
    1.15 -
    1.16          ends    _BSS
    1.17  
    1.18          segment _TEXT byte public use16 'CODE'
    1.19 @@ -37,205 +30,8 @@
    1.20          global  _text_start:byte
    1.21          label   _text_start byte
    1.22  
    1.23 -		extrn	fold
    1.24 -		extrn	unfold
    1.25 -		mov	si,offset fold
    1.26 -		mov	di,offset unfold
    1.27 -		mov	ch,4
    1.28 -		cld
    1.29 -		rep
    1.30 -		  movsw
    1.31 -
    1.32 -;***************************************************************
    1.33 -; clear bss
    1.34 -;***************************************************************
    1.35 -
    1.36 -		mov	si,offset _bss_start
    1.37 -clearbss:
    1.38 -		mov	[byte si],cl	; clear bss + heap
    1.39 -		inc	si
    1.40 -		jne	clearbss
    1.41 -
    1.42 -;***************************************************************
    1.43 -; build arg
    1.44 -;***************************************************************
    1.45 -
    1.46 -		mov	si,80h
    1.47 -		lodsb
    1.48 -		cbw
    1.49 -		xchg	ax,bx
    1.50 -		mov	[bx+si],bh		; set EOS
    1.51 -searchStart:
    1.52 -		lodsb
    1.53 -		cmp	al,0
    1.54 -		je	_abort
    1.55 -		cmp	al,' '
    1.56 -		je	searchStart
    1.57 -		dec	si
    1.58 -		mov	di,offset filename
    1.59 -		push	di
    1.60 -		mov	ah,60h			; canonicalize filename
    1.61 -                int	21h
    1.62 -		jc	_abort
    1.63 -	ifdef	WITH_LONG_FILENAME
    1.64 -		pop	si
    1.65 -		mov	ax,716Ch
    1.66 -		xor	bx,bx			; R/O
    1.67 -		;xor	cx,cx			; attributes
    1.68 -		cwd				; action = open
    1.69 -		stc
    1.70 -                int	21h
    1.71 -                jnc	opened
    1.72 -                mov	dx,si
    1.73 -	else
    1.74 -		pop	dx
    1.75 -	endif
    1.76 -                mov	ax,3d00h		; read-only+compatibility
    1.77 -		;mov	cl,0			; attribute mask
    1.78 -                int	21h
    1.79 -                jnc	opened
    1.80 -
    1.81 -_abort:
    1.82 -		mov	dx,offset stopmsg
    1.83 -		mov	ah,9
    1.84 -		int	21h
    1.85 -		int	20h
    1.86 -opened:
    1.87 -		mov	[_isostate.fd],ax
    1.88 -		mov	ax,offset bootdir
    1.89 -		extrn	iso_open:near
    1.90 -		call	iso_open
    1.91 -jc_abort:
    1.92 -		jc	_abort
    1.93 -
    1.94 -; patch magic
    1.95 -;***************************************************************
    1.96 -
    1.97 -		extrn	@readmenu$qv:near
    1.98 -		call	@readmenu$qv
    1.99 -		mov	ax,[_isostate.filemod]
   1.100 -		mov	bx,10
   1.101 -		xor	cx,cx
   1.102 -@@loop1:
   1.103 -		xor	dx,dx
   1.104 -		div	bx		; DX:AX = n%10:n/10
   1.105 -		push	dx		; DL = n%10
   1.106 -		inc	cx
   1.107 -		or	ax,ax
   1.108 -		jnz	@@loop1
   1.109 -		push	ds
   1.110 -		pop	es
   1.111 -		mov	di,offset magic
   1.112 -@@loop2:
   1.113 -		pop	ax
   1.114 -		add	al,'0'
   1.115 -		stosb
   1.116 -		loop	@@loop2
   1.117 -
   1.118 -; patch initrd
   1.119 -;***************************************************************
   1.120 -		cwd
   1.121 -		or	[_isostate.curdirsize],-1
   1.122 -		jmp	patchtest
   1.123 -found:
   1.124 -		inc	dh
   1.125 -patchtest:
   1.126 -		push	dx
   1.127 -		extrn	@isoreaddir$qv:near
   1.128 -		call	@isoreaddir$qv
   1.129 -		pop	dx
   1.130 -		push	ds
   1.131 -		pop	es
   1.132 -		inc	ax
   1.133 -		jne	patchlp
   1.134 -		cmp	dx,100h
   1.135 -		je	initrddone
   1.136 -		mov	di,offset dotgz
   1.137 -		or	dh,dh
   1.138 -		je	modify
   1.139 -		add	di,4
   1.140 -		mov	si,offset rootfs
   1.141 -		mov	cx,3
   1.142 -		rep
   1.143 -		  movsw
   1.144 -modify:
   1.145 -		xchg	ax,dx
   1.146 -		mov	ah,'.'
   1.147 -		stosw
   1.148 -		mov	ax,'zg'
   1.149 -		stosw
   1.150 -		mov	ax,'!,'
   1.151 -		stosw
   1.152 -initrddone:
   1.153 -
   1.154 -;***************************************************************
   1.155 -
   1.156 -		mov	si, offset cmdline
   1.157 -		mov	di, 82h
   1.158 -copy:
   1.159 -		mov	ah,al
   1.160 -		lodsb
   1.161 -		cmp	al,' '
   1.162 -		jne	docopy
   1.163 -		cmp	al,ah
   1.164 -		je	copy
   1.165 -docopy:
   1.166 -		stosb
   1.167 -		cmp	al,0
   1.168 -		jnz	copy
   1.169 -		xchg	di,ax
   1.170 -		sub	al, 82h
   1.171 -		mov	[80h],al
   1.172 -
   1.173 -		mov	ax,offset linld
   1.174 -		call	iso_open
   1.175 -		jc	jc_abort
   1.176 -		mov	cx,[word _isostate.filesize]
   1.177 -		mov	dx,100h
   1.178 -		jmp	near unfold
   1.179 -
   1.180 -patchlp:
   1.181 -		mov	si,[_isostate.filename]
   1.182 -		mov	di,offset rootfs
   1.183 -		mov	cx,9
   1.184 -		rep
   1.185 -		  cmpsb
   1.186 -		jcxz	found
   1.187 -		cmp	cl,3
   1.188 -		ja	patchtest
   1.189 -		dec	si
   1.190 -		cmp	dl,[si]
   1.191 -		ja	patchtest
   1.192 -		mov	dl,[si]
   1.193 -		jmp	patchtest
   1.194 -
   1.195 -stopmsg:
   1.196 -		db	 "This program cannot be run in DOS mode$"
   1.197 -bootdir:
   1.198 -		db	"/boot",0
   1.199 -linld:
   1.200 -		db	"linld.com",0
   1.201 -cmdline:
   1.202 -		db	"-f "
   1.203 -		;db	"image=\boot\"
   1.204 -		;db	"bzImage "
   1.205 -		db	"initrd="
   1.206 -rootfs:
   1.207 -		db	"rootfs"
   1.208 -dotgz:
   1.209 -		db	".gz,!            "
   1.210 -		; 	".gz,rootfs4.gz,! "
   1.211 -		;db	"rw "
   1.212 -		db	"autologin rdinit=/init.exe "
   1.213 -		;db	"mode=menu "
   1.214 -		db	"magic="
   1.215 -magic:
   1.216 -		db	"0     bootfrom="
   1.217 -		;	"65535 bootfrom="
   1.218 -filename:
   1.219 -
   1.220 -
   1.221 -;***************************************************************
   1.222 +		extrn	_isostate
   1.223 +		dw	_isostate
   1.224  
   1.225          ends    _TEXT
   1.226