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

linld: basic iso9660 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Mar 14 19:55:20 2021 +0000 (2021-03-14)
parents 42b4b9d947f3
children 6b6d14c9f7e9
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Sat Mar 06 18:15:05 2021 +0000
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Sun Mar 14 19:55:20 2021 +0000
     1.3 @@ -34,17 +34,14 @@
     1.4  
     1.5          segment _BSS byte public use16 'BSS'
     1.6  
     1.7 -	ifdef ISO9660
     1.8 -		include	"isostate.inc"
     1.9 -		public	_isostate
    1.10 -_isostate	isostate	<?>
    1.11 -		org	$-7
    1.12 -	endif
    1.13 -	global	buf4k:byte
    1.14 -label	buf4k	byte
    1.15 -_xfer_buf	db	4096	dup (?)
    1.16 -filecnt		db	?		; in fact 0 minus file count...
    1.17 -nextfilename	dw	?
    1.18 +		ifdef	ISO9660
    1.19 +		global	_buf2k:byte
    1.20 +label	_buf2k	byte
    1.21 +		db	2048	dup (?)
    1.22 +		endif
    1.23 +		global	_buf4k:byte
    1.24 +label	_buf4k	byte
    1.25 +		db	4096	dup (?)
    1.26  
    1.27          ends    _BSS
    1.28  
    1.29 @@ -110,7 +107,7 @@
    1.30                  mov	ax,3d00h		; read-only+compatibility
    1.31  	else
    1.32                  mov	ah,3dh			; read-only+compatibility
    1.33 -                mov	dx,bx
    1.34 +                mov	dx,bx			; open(DS:DX=filename,al=access,cl=attributes)
    1.35  	endif
    1.36  		;mov	cl,0			; attribute mask
    1.37  		call	dos
    1.38 @@ -135,6 +132,10 @@
    1.39  		ret
    1.40  
    1.41  	ifdef ISO9660
    1.42 +
    1.43 +		include	"isostate.inc"
    1.44 +		extrn	_isostate:isostate
    1.45 +
    1.46  ;***************************************************************
    1.47  ;_fastcall int:C open(bx:const char* name, int flags=O_RDONLY);
    1.48  ;_fastcall int:C openargs(bx:const char* name, int flags=O_RDONLY);
    1.49 @@ -182,7 +183,7 @@
    1.50  
    1.51          global  close:near			; close(ax)
    1.52  close:
    1.53 -		mov	bh,3Eh
    1.54 +		mov	bh,3Eh			; close(BX:handle)
    1.55  	ifdef ISO9660
    1.56  		mov	cx,[_isostate.fd]
    1.57  		jcxz	dosbx
    1.58 @@ -232,7 +233,7 @@
    1.59  		pop	bx
    1.60  	endif
    1.61  readfd:
    1.62 -                mov	ah,3Fh
    1.63 +                mov	ah,3Fh			; read(BX=handle,DS:DX=to,CX=count)
    1.64                  ;jcxz	fail
    1.65  dos:
    1.66                  int	21h
    1.67 @@ -274,14 +275,14 @@
    1.68  ;***************************************************************
    1.69  	proc	@readmenu$qv near
    1.70  
    1.71 -		mov	dx,18
    1.72 +		mov	dx,20
    1.73  		xor	cx,cx
    1.74  		call	seeksetpos0		; filepos = 0
    1.75 -		mov	dx,offset _isostate.filemod
    1.76 -		; //magic = x->filemod;
    1.77 -		mov	cl,10
    1.78 -		call	readfd ; // read x->filemod + x->fileofs & x->filesize
    1.79 -		mov	bx,offset _isostate.fileofs
    1.80 +		mov	dx,offset _isostate.fileofs
    1.81 +		mov	cl,8
    1.82 +		push	dx
    1.83 +		call	readfd ; // read x->fileofs & x->filesize
    1.84 +		pop	bx
    1.85  		; x->fileofs = 0x7FF0 - (x->filesize &= 0xFFFF);
    1.86  		mov	ax,7FF0h
    1.87  		cwd
    1.88 @@ -335,9 +336,9 @@
    1.89  
    1.90  		call	isolseek		; filepos = 0
    1.91  		jc	fail
    1.92 -		mov	dh,10
    1.93 -		mov	ax,offset _isostate.buffer
    1.94 -		jmp	@read$dxaxbx		; read(fd,buffer,2560+)
    1.95 +		mov	cx,2048
    1.96 +		mov	dx,offset _buf2k
    1.97 +		jmp	readfd			; read(fd,buf2k,2048)
    1.98  
    1.99          endp    @isoreadsector$qpxul
   1.100  	endif
   1.101 @@ -394,9 +395,11 @@
   1.102                  inc	bx
   1.103  		xchg	ax,bx
   1.104                  xor	dl,[bx]			; dl ^= *a++
   1.105 +	    ifndef RAW_ISO9660
   1.106  		ifndef  ROCKRIDGE
   1.107  		and	dl,0dfh			; case insensitive
   1.108  		endif
   1.109 +	    endif
   1.110  		jne	fail			; return -1
   1.111                  inc	bx
   1.112  		or	dl,dl			; clear C
   1.113 @@ -947,7 +950,7 @@
   1.114  		else
   1.115  		les	ax,[dword di]
   1.116  		endif
   1.117 -		mov	cx,offset _xfer_buf
   1.118 +		mov	cx,offset _buf4k
   1.119  storepage:					; storepage(edx,cx)
   1.120  		ifndef	NO386
   1.121  		push	0
   1.122 @@ -1066,7 +1069,7 @@
   1.123  		xchg	ax,cx
   1.124  @@szok:
   1.125  		jcxz	image_done
   1.126 -		lea	dx,[di+_xfer_buf]
   1.127 +		lea	dx,[di+_buf4k]
   1.128  		mov	bx,[(image_himem si).fd]
   1.129  		call	@read$cxdxbx
   1.130  		jb	image_done
   1.131 @@ -1083,7 +1086,7 @@
   1.132  @@fill:
   1.133  		test	al,3
   1.134  		je	@@filled
   1.135 -		mov	[di+_xfer_buf],dl
   1.136 +		mov	[di+_buf4k],dl
   1.137  		inc	di
   1.138  		inc	ax
   1.139  		jmp	@@fill