wok diff linld/stuff/src/CRTL.ASM @ rev 24019

syslinux: fix build
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 28 16:32:57 2021 +0000 (2021-02-28)
parents 14ca5e18cfd9
children 42b4b9d947f3
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Thu Feb 25 10:56:54 2021 +0000
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Sun Feb 28 16:32:57 2021 +0000
     1.3 @@ -6,6 +6,9 @@
     1.4                  %crefref
     1.5                  %noincl
     1.6                  %nomacs
     1.7 +
     1.8 +	include	"common.inc"
     1.9 +
    1.10  		ifdef	NO386
    1.11                  p8086
    1.12  		else
    1.13 @@ -19,7 +22,9 @@
    1.14  
    1.15  loaderr		db	"Load failure",0
    1.16  msg_hang	db      "Himem broken",0
    1.17 +		ifdef	VCPI
    1.18  vcpi_alloc_err	db	"VCPI"
    1.19 +		endif
    1.20  		global	overflow:byte
    1.21  overflow	db	"/"
    1.22  msg_malloc      db      "Out of memory"
    1.23 @@ -29,10 +34,12 @@
    1.24  
    1.25          segment _BSS byte public use16 'BSS'
    1.26  
    1.27 +	ifdef ISO9660
    1.28  		include	"isostate.inc"
    1.29  		public	_isostate
    1.30  _isostate	isostate	<?>
    1.31  		org	$-7
    1.32 +	endif
    1.33  	global	buf4k:byte
    1.34  label	buf4k	byte
    1.35  _xfer_buf	db	4096	dup (?)
    1.36 @@ -70,8 +77,24 @@
    1.37          endp	@strcatb$qpxzct1
    1.38  
    1.39  
    1.40 +		ifdef	NO386
    1.41                  p8086
    1.42 +		endif
    1.43  
    1.44 +	ifndef ISO9660
    1.45 +;***************************************************************
    1.46 +;_fastcall int:C open(bx:const char* name, int flags=O_RDONLY);
    1.47 +;_fastcall int:C openargs(bx:const char* name, int flags=O_RDONLY);
    1.48 +;***************************************************************
    1.49 +        global  openargs:near			; openargs(bx)
    1.50 +openargs:
    1.51 +		cmp	[byte bx],'@'
    1.52 +		jne	fail
    1.53 +		inc	bx
    1.54 +
    1.55 +        global  @open$qpxzc:near
    1.56 +@open$qpxzc:
    1.57 +	endif
    1.58  opendos:
    1.59  	ifdef	LONG_FILENAME
    1.60  		;xchg	ax,cx			; attributes
    1.61 @@ -91,6 +114,7 @@
    1.62  	endif
    1.63  		;mov	cl,0			; attribute mask
    1.64  		call	dos
    1.65 +	ifdef ISO9660
    1.66  		jc	catret
    1.67  openok:
    1.68  		xchg	ax,bx
    1.69 @@ -104,12 +128,16 @@
    1.70  		;xor	cx,cx
    1.71  		cwd
    1.72  		call	seeksetpos0		; filepos = 0
    1.73 +	else
    1.74 +openok:
    1.75 +	endif
    1.76  		xchg	ax,bx			; fd
    1.77  		ret
    1.78  
    1.79 +	ifdef ISO9660
    1.80  ;***************************************************************
    1.81 -;_fastcall int open(bx:const char* name, int flags=O_RDONLY);
    1.82 -;_fastcall int openargs(bx:const char* name, int flags=O_RDONLY);
    1.83 +;_fastcall int:C open(bx:const char* name, int flags=O_RDONLY);
    1.84 +;_fastcall int:C openargs(bx:const char* name, int flags=O_RDONLY);
    1.85  ;***************************************************************
    1.86          global  openargs:near			; openargs(bx)
    1.87  openargs:
    1.88 @@ -135,6 +163,7 @@
    1.89  		extrn	@_isoopen$qv:near
    1.90  		mov	[word _isostate.filename2open],bx
    1.91  		jmp	@_isoopen$qv		; filepos = 0
    1.92 +	endif
    1.93  
    1.94  
    1.95  ;***************************************************************
    1.96 @@ -154,8 +183,10 @@
    1.97          global  close:near			; close(ax)
    1.98  close:
    1.99  		mov	bh,3Eh
   1.100 +	ifdef ISO9660
   1.101  		mov	cx,[_isostate.fd]
   1.102  		jcxz	dosbx
   1.103 +	endif
   1.104  		jmp	fail
   1.105  
   1.106          endp    @close$qi
   1.107 @@ -178,6 +209,7 @@
   1.108  		xchg	ax,cx			; sz
   1.109  	global	@read$cxdxbx:near
   1.110  @read$cxdxbx:
   1.111 +	ifdef ISO9660
   1.112  		push	bx
   1.113  		mov	bx,offset _isostate.filepos
   1.114  		push	cx
   1.115 @@ -198,6 +230,7 @@
   1.116  		add	[bx],cx
   1.117  		adc	[(word bx)+2],0
   1.118  		pop	bx
   1.119 +	endif
   1.120  readfd:
   1.121                  mov	ah,3Fh
   1.122                  ;jcxz	fail
   1.123 @@ -221,8 +254,16 @@
   1.124          proc    @rewind$qi near
   1.125  
   1.126  rewind:
   1.127 +	ifdef ISO9660
   1.128  		mov	bx,offset _isostate.fileofs
   1.129  		jmp	lseek
   1.130 +	else
   1.131 +		mov	bl,0
   1.132 +lseek0:
   1.133 +		xor	cx,cx
   1.134 +		xor	dx,dx
   1.135 +		jmp	lseek
   1.136 +	endif
   1.137  
   1.138          endp    @rewind$qi
   1.139  
   1.140 @@ -261,6 +302,7 @@
   1.141          global  @isolseek$qpxul:near
   1.142          proc    @isolseek$qpxul near
   1.143  
   1.144 +	ifdef ISO9660
   1.145  isolseek:
   1.146  		mov	ax,[_isostate.fd]
   1.147  lseek:
   1.148 @@ -270,6 +312,9 @@
   1.149  		xor	bx,bx
   1.150  		mov	[word _isostate.filepos],bx
   1.151  		mov	[(word _isostate.filepos)+2],bx
   1.152 +	else
   1.153 +lseek:
   1.154 +	endif
   1.155  		mov	bh,42h			; bx=fd cx:dx=offset al=whence
   1.156  dosbx:
   1.157  		xchg	ax,bx
   1.158 @@ -277,6 +322,7 @@
   1.159  
   1.160  	endp	@isolseek$qpxul
   1.161  
   1.162 +	ifdef ISO9660
   1.163  ;***************************************************************
   1.164  ;_fastcall int isoreadsector(bx:const unsigned long *offset);
   1.165  ;_fastcall int isoreadrootsector(void);
   1.166 @@ -294,8 +340,10 @@
   1.167  		jmp	@read$dxaxbx		; read(fd,buffer,2560+)
   1.168  
   1.169          endp    @isoreadsector$qpxul
   1.170 +	endif
   1.171  
   1.172  
   1.173 +	ifdef ISO9660
   1.174  		ifdef ISOHOOK
   1.175  ;***************************************************************
   1.176  ;_fastcall int strhead(bx:const char* a, ax:const char* b);
   1.177 @@ -311,6 +359,9 @@
   1.178  		or	dl,dl			; clear C
   1.179  		jz	failifc			; return 0
   1.180                  xor	dl,[bx]			; dl -= *a++
   1.181 +		ifdef BASIC_ISO9660
   1.182 +		and	dl,0dfh			; upcase
   1.183 +		endif
   1.184  		jne	fail			; return -1
   1.185                  inc	bx
   1.186                  jmp	@@loop
   1.187 @@ -354,6 +405,7 @@
   1.188  
   1.189          endp    @strcmp$qpxzct1
   1.190  		endif
   1.191 +	endif
   1.192  
   1.193  ;***************************************************************
   1.194  ;_fastcall const char **argstr(bx:const char *s, ax:const char keywords[], dx:const char **var);
   1.195 @@ -466,8 +518,8 @@
   1.196  		neg	ax
   1.197  		jne	@@end
   1.198  		inc	dx
   1.199 +		endif
   1.200  @@end:
   1.201 -		endif
   1.202  @@setnum:
   1.203  		xchg	ax,si
   1.204  		mov	[di+2],dx
   1.205 @@ -692,6 +744,7 @@
   1.206  		ifndef	NO_CLOSE
   1.207  		mov	[(image_himem si).fd2close],ax
   1.208  		endif
   1.209 +	ifdef ISO9660
   1.210  		ifndef	NO386
   1.211  		mov	eax,[_isostate.filesize]
   1.212  @@end:
   1.213 @@ -703,10 +756,33 @@
   1.214  		mov	[word (image_himem si).chunk_size],ax
   1.215  		mov	[word ((image_himem si).chunk_size)+2],dx
   1.216  		endif
   1.217 +	else
   1.218 +		mov	bl,02h			; SEEK_END
   1.219 +		call	lseek0
   1.220 +		ifndef	NO386
   1.221 +		push	eax
   1.222 +		mov	ax,[(image_himem si).fd]
   1.223 +		call	rewind
   1.224 +		pop	eax
   1.225 +@@end:
   1.226 +		mov	[(image_himem si).chunk_size],eax
   1.227 +		else
   1.228 +		push	ax
   1.229 +		push	dx
   1.230 +		mov	ax,[(image_himem si).fd]
   1.231 +		call	rewind
   1.232 +		pop	dx
   1.233 +		pop	ax
   1.234 +@@end:
   1.235 +		mov	[word (image_himem si).chunk_size],ax
   1.236 +		mov	[word ((image_himem si).chunk_size)+2],dx
   1.237 +		endif
   1.238 +	endif
   1.239  		ret
   1.240  
   1.241          endp    next_chunk
   1.242  
   1.243 +		ifdef	VCPI
   1.244  ;***************************************************************
   1.245  
   1.246  struc   data_himem			;struct data_himem {
   1.247 @@ -801,6 +877,7 @@
   1.248  		endif
   1.249  
   1.250          endp    @malloc_bufv_or_die$qp11image_himem
   1.251 +		endif
   1.252  
   1.253  
   1.254  ;***************************************************************
   1.255 @@ -892,7 +969,7 @@
   1.256  
   1.257          endp    @storepage$qpul
   1.258  
   1.259 -
   1.260 +		ifdef	VCPI
   1.261                  p386
   1.262  ;***************************************************************
   1.263  ;_fastcall void reset_bufv(di:u32 *p);
   1.264 @@ -958,6 +1035,7 @@
   1.265  		ret
   1.266  
   1.267          endp    _prev_bufv
   1.268 +		endif
   1.269  
   1.270  		ifdef	NO386
   1.271                  p8086