wok diff linld/stuff/src/ISOCRTL.ASM @ rev 23863

syslinux/isoboot.s: accept user args
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jun 19 15:46:21 2020 +0000 (2020-06-19)
parents c02f18f9e836
children 06b9d6e33bee
line diff
     1.1 --- a/linld/stuff/src/ISOCRTL.ASM	Sat Jun 13 10:41:01 2020 +0000
     1.2 +++ b/linld/stuff/src/ISOCRTL.ASM	Fri Jun 19 15:46:21 2020 +0000
     1.3 @@ -23,7 +23,7 @@
     1.4  
     1.5  		public	_isostate
     1.6  _isostate	isostate	<?>
     1.7 -		org	$-7
     1.8 +;		org	$-7
     1.9  
    1.10          ends    _BSS
    1.11  
    1.12 @@ -31,9 +31,14 @@
    1.13  
    1.14  		global	fold:near
    1.15  fold:
    1.16 -		org	0F000h
    1.17 +		org	0EF00h
    1.18  		global	unfold:near
    1.19  unfold:
    1.20 +		jmp	iso_open
    1.21 +		extrn	@isoreaddir$qv
    1.22 +		dw	@isoreaddir$qv
    1.23 +		jmp	@readmenu$qv
    1.24 +
    1.25  		push	dx
    1.26  		call	readfd
    1.27  		push	ds
    1.28 @@ -65,11 +70,8 @@
    1.29  iso_open:
    1.30  		mov	[_isostate.filename2open],ax
    1.31  		call	@_isoopen$qv
    1.32 -		inc	ax
    1.33 -		jnz	open_ok
    1.34 -		dec	ax
    1.35 -		stc
    1.36 -open_ok:
    1.37 +		cmp	ax,1
    1.38 +		cmc
    1.39  		push	bx
    1.40  iso_close_hack:
    1.41  		pop	bx
    1.42 @@ -91,74 +93,12 @@
    1.43  		pop	cx
    1.44  	endm
    1.45  
    1.46 -iso_read_hack:
    1.47 -	ifdef	NO386
    1.48 -		push	dx
    1.49 -		curseek
    1.50 -		mov	bx,[word _isostate.filesize]
    1.51 -		sub	bx,ax
    1.52 -		mov	ax,[(word _isostate.filesize)+2]
    1.53 -		sbb	ax,dx
    1.54 -		ja	@@cxok
    1.55 -		je	@@rem
    1.56 -		xor	cx,cx
    1.57 -@@rem:
    1.58 -		cmp	bx,cx
    1.59 -		ja	@@cxok
    1.60 -		mov	cx,bx
    1.61 -@@cxok:
    1.62 -		pop	dx
    1.63 -	else
    1.64 -                p386
    1.65 -		push	edx
    1.66 -		curseek
    1.67 -		mov	edx,[_isostate.filesize]
    1.68 -		sub	edx,eax
    1.69 -		jnb	@@rem
    1.70 -		xor	cx,cx
    1.71 -@@rem:
    1.72 -		movzx	eax,cx
    1.73 -		cmp	edx,eax
    1.74 -		ja	@@cxok
    1.75 -		mov	cx,dx
    1.76 -@@cxok:
    1.77 -		pop	edx
    1.78 -	endif
    1.79 -		or	cx,cx
    1.80 -		pop	bx
    1.81 -		jmp	readfd
    1.82 +;***************************************************************
    1.83 +;_fastcall void readmenu(void);
    1.84 +;***************************************************************
    1.85 +	global	@readmenu$qv:near
    1.86 +	proc	@readmenu$qv near
    1.87  
    1.88 -iso_lseek_hack:
    1.89 -		xchg	ax,bx
    1.90 -		pop	bx
    1.91 -	ifdef	SEEK_CUR
    1.92 -		cmp	al,1	; current
    1.93 -		jne	@@nocurrent
    1.94 -		call	dosfd		; lseek(,0L,SEEK_CUR)
    1.95 -		jmp	@doseek2
    1.96 -@nocurrent:
    1.97 -	endif
    1.98 -		add	dx,[word _isostate.fileofs]
    1.99 -		adc	cx,[(word _isostate.fileofs)+2]
   1.100 -		cmp	al,0	; start
   1.101 -		je	@@doseek
   1.102 -		add	dx,[word _isostate.filesize]
   1.103 -		adc	cx,[(word _isostate.filesize)+2]
   1.104 -@@doseek:
   1.105 -		call	lseekset	; lseek(,0L,SEEK_SET)
   1.106 -@doseek2:
   1.107 -		sub	ax,[word _isostate.fileofs]
   1.108 -		sbb	dx,[(word _isostate.fileofs)+2]
   1.109 -		ret
   1.110 -
   1.111 -iso_cleanup_hack:
   1.112 -		mov	ah,3Eh		; close file
   1.113 -		jmp	dosfd
   1.114 -
   1.115 -
   1.116 -
   1.117 -		global	@readmenu$qv:near
   1.118 -@readmenu$qv:
   1.119  		mov	dx,18
   1.120  		xor	cx,cx
   1.121  		call	lseekset
   1.122 @@ -167,13 +107,16 @@
   1.123  		call	readfd ; // read x->filemod + x->fileofs & x->filesize
   1.124  		mov	bx,offset _isostate.fileofs
   1.125  		; x->fileofs = 0x7FF0 - (x->filesize &= 0xFFFF);
   1.126 -		and	[word bx+6],0
   1.127  		mov	ax,7FF0h
   1.128 +		cwd
   1.129 +		mov	[word bx+6],dx
   1.130  		sub	ax,[bx+4]
   1.131 -		and	[word bx+2],0
   1.132 +		mov	[word bx+2],dx
   1.133  		mov	[bx],ax
   1.134  		; //magic = x->filemod;
   1.135  
   1.136 +	endp	@readmenu$qv
   1.137 +
   1.138  ;***************************************************************
   1.139  ;_fastcall void isolseek(bx:const unsigned long *offset);
   1.140  ;***************************************************************
   1.141 @@ -260,6 +203,69 @@
   1.142  
   1.143          endp    @strcmp$qpxzct1
   1.144  
   1.145 +iso_read_hack:
   1.146 +	ifdef	NO386
   1.147 +		push	dx
   1.148 +		curseek
   1.149 +		mov	bx,[word _isostate.filesize]
   1.150 +		sub	bx,ax
   1.151 +		mov	ax,[(word _isostate.filesize)+2]
   1.152 +		sbb	ax,dx
   1.153 +		ja	@@cxok
   1.154 +		je	@@rem
   1.155 +		xor	cx,cx
   1.156 +@@rem:
   1.157 +		cmp	bx,cx
   1.158 +		ja	@@cxok
   1.159 +		mov	cx,bx
   1.160 +@@cxok:
   1.161 +		pop	dx
   1.162 +	else
   1.163 +                p386
   1.164 +		push	edx
   1.165 +		curseek
   1.166 +		mov	edx,[_isostate.filesize]
   1.167 +		sub	edx,eax
   1.168 +		jnb	@@rem
   1.169 +		xor	cx,cx
   1.170 +@@rem:
   1.171 +		movzx	eax,cx
   1.172 +		cmp	edx,eax
   1.173 +		ja	@@cxok
   1.174 +		mov	cx,dx
   1.175 +@@cxok:
   1.176 +		pop	edx
   1.177 +	endif
   1.178 +		or	cx,cx
   1.179 +		pop	bx
   1.180 +		jmp	readfd
   1.181 +
   1.182 +iso_lseek_hack:
   1.183 +		xchg	ax,bx
   1.184 +		pop	bx
   1.185 +	ifdef	SEEK_CUR
   1.186 +		cmp	al,1	; current
   1.187 +		jne	@@nocurrent
   1.188 +		call	dosfd		; lseek(,0L,SEEK_CUR)
   1.189 +		jmp	@doseek2
   1.190 +@nocurrent:
   1.191 +	endif
   1.192 +		add	dx,[word _isostate.fileofs]
   1.193 +		adc	cx,[(word _isostate.fileofs)+2]
   1.194 +		cmp	al,0	; start
   1.195 +		je	@@doseek
   1.196 +		add	dx,[word _isostate.filesize]
   1.197 +		adc	cx,[(word _isostate.filesize)+2]
   1.198 +@@doseek:
   1.199 +		call	lseekset	; lseek(,0L,SEEK_SET)
   1.200 +@doseek2:
   1.201 +		sub	ax,[word _isostate.fileofs]
   1.202 +		sbb	dx,[(word _isostate.fileofs)+2]
   1.203 +		ret
   1.204 +
   1.205 +iso_cleanup_hack:
   1.206 +		mov	ah,3Eh		; close file
   1.207 +		jmp	dosfd
   1.208  	ifdef	NO386
   1.209          global  N_LXLSH@ES:near
   1.210  N_LXLSH@ES: