     1                                  ; ****************************************************************************
     2                                  ; dplaywav2.s - TRDOS 386 (TRDOS v2.0.9) WAV PLAYER - VESA VBE Video Mode 101h
     3                                  ; ----------------------------------------------------------------------------
     4                                  ; DPLAYWAV2.PRG ! AC'97 (ICH) .WAV PLAYER program by Erdogan TAN
     5                                  ;
     6                                  ; 28/12/2024
     7                                  ;
     8                                  ; [ Last Modification: 05/02/2025 ]
     9                                  ;
    10                                  ; Modified from DPLAYWAV.PRG .wav player program by Erdogan Tan, 26/12/2024
    11                                  ;
    12                                  ; ****************************************************************************
    13                                  ; nasm dplayw2.s -l dplayw2.txt -o DPLAYW2.PRG -Z error.txt
    14                                  
    15                                  ; 28/12/2024
    16                                  ; dplayw2.s : DMA buffer tracking (instead of user's audio buffer)
    17                                  
    18                                  ; Draw graphics by using 'sysvideo' bx=0305h
    19                                  ; and display text by using bx=010Fh
    20                                  
    21                                  ; 07/12/2024 - playwav9.s - interrupt (srb) + tuneloop version
    22                                  ; ------------------------------------------------------------
    23                                  ; INTERRUPT (SRB) + TUNELOOP version ; 24/11/2024 (PLAYWAV9.ASM)
    24                                  ;	(running in DOSBOX, VIRTUALBOX, QEMU is ok)
    25                                  ; Signal Response Byte = message/signal to user about an event/interrupt
    26                                  ;	    as requested (TuneLoop procedure continuously checks this SRB)
    27                                  ; (TRDOS 386 v2 feature is used here as very simple interrupt handler output)
    28                                  
    29                                  ; ------------------------------------------------------------
    30                                  
    31                                  ; 30/11/2024
    32                                  ; 20/08/2024 ; TRDOS 386 v2.0.9
    33                                  ; 29/04/2016
    34                                  _ver 	equ 0
    35                                  _exit 	equ 1
    36                                  _fork 	equ 2
    37                                  _read 	equ 3
    38                                  _write	equ 4
    39                                  _open	equ 5
    40                                  _close 	equ 6
    41                                  _wait 	equ 7
    42                                  _creat 	equ 8
    43                                  _link 	equ 9
    44                                  _unlink	equ 10
    45                                  _exec	equ 11
    46                                  _chdir	equ 12
    47                                  _time 	equ 13
    48                                  _mkdir 	equ 14
    49                                  _chmod	equ 15
    50                                  _chown	equ 16
    51                                  _break	equ 17
    52                                  _stat	equ 18
    53                                  _seek	equ 19
    54                                  _tell 	equ 20
    55                                  _mount	equ 21
    56                                  _umount	equ 22
    57                                  _setuid	equ 23
    58                                  _getuid	equ 24
    59                                  _stime	equ 25
    60                                  _quit	equ 26
    61                                  _intr	equ 27
    62                                  _fstat	equ 28
    63                                  _emt 	equ 29
    64                                  _mdate 	equ 30
    65                                  _video 	equ 31
    66                                  _audio	equ 32
    67                                  _timer	equ 33
    68                                  _sleep	equ 34
    69                                  _msg    equ 35
    70                                  _geterr	equ 36
    71                                  _fpsave	equ 37
    72                                  _pri	equ 38
    73                                  _rele	equ 39
    74                                  _fff	equ 40
    75                                  _fnf	equ 41
    76                                  _alloc	equ 42
    77                                  _dalloc equ 43
    78                                  _calbac equ 44
    79                                  _dma	equ 45
    80                                  _stdio  equ 46
    81                                  
    82                                  ; ------------------------------------------------------------
    83                                  
    84                                  %macro sys 1-4
    85                                      ; 29/04/2016 - TRDOS 386 (TRDOS v2.0)
    86                                      ; 03/09/2015
    87                                      ; 13/04/2015
    88                                      ; Retro UNIX 386 v1 system call.
    89                                      %if %0 >= 2
    90                                          mov ebx, %2
    91                                          %if %0 >= 3
    92                                              mov ecx, %3
    93                                              %if %0 = 4
    94                                                 mov edx, %4
    95                                              %endif
    96                                          %endif
    97                                      %endif
    98                                      mov eax, %1
    99                                      ;int 30h
   100                                      int 40h ; TRDOS 386 (TRDOS v2.0)
   101                                  %endmacro
   102                                  
   103                                  ; Retro UNIX 386 v1 system call format:
   104                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
   105                                  
   106                                  ; ------------------------------------------------------------
   107                                  
   108                                  ; player internal variables and other equates.
   109                                  BUFFERSIZE	equ 65536
   110                                  ENDOFFILE	equ 1		; flag for knowing end of file
   111                                  
   112                                  ; ------------------------------------------------------------
   113                                  
   114                                  [BITS 32] ; 32-bit intructions
   115                                  
   116                                  [ORG 0]
   117                                  
   118                                  START_CODE:
   119                                  	; Prints the Credits Text.
   120                                  	sys	_msg, Credits, 255, 0Bh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000000 BB[E8290000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000005 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000000A BA0B000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000000F B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000014 CD40                <1>  int 40h
   121                                  
   122                                  	; clear bss
   123 00000016 BF[A0740000]            	mov	edi, bss_start
   124 0000001B B9B1020000              	mov	ecx, (bss_end - bss_start)/4
   125 00000020 31C0                    	xor	eax, eax
   126 00000022 F3AB                    	rep	stosd
   127                                  
   128                                  ; -------------------------------------------------------------
   129                                  
   130                                  	; 21/12/2024
   131                                  	; Detect (& Enable) AC'97 Audio Device
   132 00000024 E85D070000              	call	DetectAC97
   133 00000029 731B                    	jnc	short ac97_hardware_ready
   134                                  
   135                                  	; 30/11/2024
   136                                  	; 30/05/2024
   137                                  _dev_not_ready:
   138                                  	; couldn't find the audio device!
   139                                  	sys	_msg, noDevMsg, 255, 0Fh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000002B BB[7B2A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000030 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000035 BA0F000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000003A B823000000          <1>  mov eax, %1
    99                              <1> 
   100 0000003F CD40                <1>  int 40h
   140 00000041 E9CD040000                      jmp     Exit
   141                                  
   142                                  ac97_hardware_ready:
   143 00000046 E8E6080000              	call	write_audio_dev_info
   144                                  
   145                                  ; -------------------------------------------------------------
   146                                  
   147                                  	; 21/12/2024
   148                                  	;;;
   149                                  	; Read (copy) 8x14 system fonts
   150 0000004B BE[48410000]            	mov	esi, fontbuff1
   151                                  	sys	_video, 0C03h, 256, 0
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000050 BB030C0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000055 B900010000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000005A BA00000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000005F B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 00000064 CD40                <1>  int 40h
   152                                  
   153                                  	; convert 8x14 fonts to 8x16 fonts
   154                                  	; by inserting 2 empty rows to each characters
   155                                  	;mov	esi, fontbuff1
   156 00000066 BF[484F0000]            	mov	edi, fontbuff2
   157                                  	; 18/02/2021
   158                                  	;mov	cx, 256
   159                                  fontconvert:
   160 0000006B 51                      	push	ecx
   161 0000006C 66B90E00                	mov	cx, 14
   162 00000070 F3A4                    	rep	movsb
   163 00000072 28C0                    	sub	al, al
   164 00000074 AA                      	stosb
   165 00000075 AA                      	stosb
   166 00000076 59                      	pop	ecx
   167 00000077 E2F2                    	loop	fontconvert
   168                                  	;;;
   169                                  
   170                                  ; ------------------------------------------------------------- 
   171                                  
   172                                  	; 21/12/2024
   173                                  	; Set Video Mode to 101h ; 640x480, 256 colors
   174                                  	sys	_video, 08FFh, 101h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000079 BBFF080000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000007E B901010000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000083 B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 00000088 CD40                <1>  int 40h
   175 0000008A 09C0                    	or	eax, eax
   176 0000008C 0F847C040000            	jz	terminate    ; nothing to do				
   177                                  	;jz	trdos386_err ; write (OS) error msg and exit
   178                                  
   179                                  set_vesa_mode_101h_ok:
   180                                  	; linear frame buffer access
   181                                  	sys	_video, 06FFh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000092 BBFF060000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000097 B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 0000009C CD40                <1>  int 40h
   182 0000009E 21C0                    	and	eax, eax
   183 000000A0 0F84B3040000            	jz	error_exit ; set text mode and write err msg
   184 000000A6 A3[90740000]            	mov	[LFB_ADDR], eax
   185                                  
   186                                  ; -------------------------------------------------------------
   187                                  
   188                                  	; 07/12/2024
   189                                  GetFileName_@:
   190                                  	; 30/11/2024
   191                                  	; (TRDOS 386 -Retro UNIX 386- argument transfer method)
   192                                  	; (stack: argc,argv0addr,argv1addr,argv2addr ..
   193                                  	;			.. argv0text, argv1text ..) 
   194                                  	; ---- argc, argv[] ----
   195 000000AB 89E6                    	mov	esi, esp
   196 000000AD AD                      	lodsd
   197 000000AE 83F802                  	cmp	eax, 2 ; two arguments 
   198                                  		; (program file name & mod file name)
   199 000000B1 0F8265040000            	jb	pmsg_usage ; nothing to do
   200                                  	; 07/12/2024
   201 000000B7 AD                      	lodsd	; skip program (PRG) file name
   202                                  
   203                                  	; 30/11/2024 (32bit)
   204                                  	; 29/11/2024
   205                                  	; 30/05/2024
   206                                  GetFileName:
   207 000000B8 BF[E47E0000]            	mov	edi, wav_file_name 
   208                                  	; 07/12/2024
   209 000000BD 8B36                    	mov	esi, [esi]
   210 000000BF 31C9                    	xor	ecx, ecx ; 0
   211                                  ScanName:
   212 000000C1 AC                      	lodsb
   213                                  	;test	al, al
   214                                  	;jz	short a_4
   215                                  	; 29/11/2024
   216 000000C2 3C0D                    	cmp	al, 0Dh
   217 000000C4 7638                    	jna	short a_4
   218 000000C6 3C20                    	cmp	al, 20h
   219 000000C8 74F7                    	je	short ScanName	; scan start of name.
   220 000000CA AA                      	stosb
   221 000000CB B4FF                    	mov	ah, 0FFh
   222                                  	;;;
   223                                  	; 14/11/2024
   224                                  	; (max. path length = 64 bytes for MSDOS ?) (*)
   225                                  	;xor	ecx, ecx ; 0
   226                                  	;;;
   227                                  a_0:	
   228 000000CD FEC4                    	inc	ah
   229                                  a_1:
   230                                  	;;;
   231                                  	; 14/11/2024
   232 000000CF 41                      	inc	ecx
   233                                  	;;;
   234 000000D0 AC                      	lodsb
   235 000000D1 AA                      	stosb
   236 000000D2 3C2E                    	cmp	al, '.'
   237 000000D4 74F7                    	je	short a_0
   238                                  	; 29/11/2024
   239 000000D6 3C20                    	cmp	al, 20h
   240                                  	;and	al, al
   241                                  	;jnz	short a_1
   242                                  	;;;
   243                                  	; 14/11/2024
   244 000000D8 7613                    	jna	short a_3
   245 000000DA 20E4                    	and	ah, ah
   246 000000DC 7406                    	jz	short a_2
   247 000000DE 3C2F                    	cmp	al, '/'	; 14/12/2024
   248 000000E0 7502                    	jne	short a_2
   249 000000E2 B400                    	mov	ah, 0
   250                                  a_2:
   251 000000E4 80F94B                  	cmp	cl, 75	; 64+8+'.'+3 -> offset 75 is the last chr
   252 000000E7 72E6                    	jb	short a_1
   253                                  	; 29/11/2024
   254 000000E9 29C9                    	sub	ecx, ecx
   255 000000EB EB11                    	jmp	short a_4
   256                                  a_3:
   257                                  	; 29/11/2024
   258 000000ED 4F                      	dec	edi
   259                                  	;;;
   260 000000EE 08E4                    	or	ah, ah		; if period NOT found,
   261 000000F0 750C                    	jnz	short a_4 	; then add a .WAV extension.
   262                                  SetExt:
   263                                  	; 29/11/2024
   264                                  	;dec	edi
   265 000000F2 C7072E574156            	mov	dword [edi], '.WAV'
   266                                  				; ! 64+12 is DOS limit
   267                                  				; but writing +4 must not
   268                                  				; destroy the following data	 
   269                                  	;mov	byte [edi+4], 0	; so, 80 bytes path + 0 is possible here
   270                                  	; 29/11/2024
   271 000000F8 83C104                  	add	ecx, 4
   272 000000FB 83C704                  	add	edi, 4
   273                                  a_4:	
   274 000000FE C60700                  	mov	byte [edi], 0
   275                                  
   276                                          ; open existing file
   277                                  	; 28/11/2024
   278                                  	;mov	edx, wav_file_name
   279 00000101 E8D2060000                      call    openFile ; no error? ok.
   280 00000106 7325                            jnc     short getwavparms
   281                                  
   282                                  	; 21/12/2024
   283 00000108 E8E9040000              	call	set_text_mode
   284                                  	; file not found!
   285                                  	; 30/11/2024
   286                                  	sys	_msg, noFileErrMsg, 255, 0Ch
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000010D BB[A62A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000112 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000117 BA0C000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000011C B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000121 CD40                <1>  int 40h
   287 00000123 E9EB030000                      jmp     Exit
   288                                  
   289                                  _exit_:
   290 00000128 E9E1030000              	jmp	terminate
   291                                  
   292                                  ; -------------------------------------------------------------
   293                                  
   294                                  getwavparms:
   295                                  	; 14/11/2024
   296 0000012D E8DB060000                     	call    getWAVParameters
   297 00000132 72F4                    	jc	short _exit_		; nothing to do
   298                                  
   299                                  	; 17/11/2024
   300 00000134 B304                    	mov	bl, 4
   301 00000136 2A1D[D07E0000]          	sub	bl, byte [WAVE_BlockAlign]
   302                                  			; = 0 for 16 bit stereo
   303                                  			; = 2 for 8 bit stereo or 16 bit mono
   304                                  			; = 3 for 8 bit mono	
   305                                  
   306 0000013C D0EB                    	shr	bl, 1	;  0 -->  0,  2 -->  1,  3 -->  1
   307                                  	; 15/11/2024
   308 0000013E 80D300                  	adc	bl, 0	; 3 --> 1 --> 2
   309 00000141 881D[367F0000]          	mov	byte [fbs_shift], bl	; = 2 mono and 8 bit
   310                                  					; = 0 stereo and 16 bit
   311                                  					; = 1 mono or 8 bit
   312                                  
   313                                  ; -------------------------------------------------------------
   314                                  
   315                                  	; 26/12/2024
   316                                  	; 21/12/2024
   317                                  	;mov	byte [tcolor], 15
   318                                  
   319                                  Player_SplashScreen:
   320                                  _0:
   321 00000147 E84B040000              	call	drawsplashscreen
   322                                  
   323                                  	; 21/12/2024
   324                                  	;;;
   325                                  	; set wave volume led addresses
   326 0000014C 8B1D[90740000]          	mov	ebx, [LFB_ADDR]
   327 00000152 81C300C70100            	add	ebx, (13*80*8*14)
   328 00000158 BD50000000              	mov	ebp, 80
   329 0000015D BF[485F0000]            	mov	edi, wleds_addr
   330                                  wleds_sa_1:
   331 00000162 B90F000000              	mov	ecx, 15
   332                                  wleds_sa_2:
   333 00000167 B800230000              	mov	eax, 80*8*14 ; 640*14 pixels (next row)
   334 0000016C F7E1                    	mul	ecx
   335 0000016E 01D8                    	add	eax, ebx
   336 00000170 AB                      	stosd
   337 00000171 E2F4                    	loop	wleds_sa_2
   338 00000173 89D8                    	mov	eax, ebx
   339 00000175 AB                      	stosd
   340 00000176 83C308                  	add	ebx, 8
   341 00000179 4D                      	dec	ebp
   342 0000017A 75E6                    	jnz	short wleds_sa_1
   343                                  	;;;
   344                                  
   345                                  	; 24/12/2024
   346                                  	; 07/12/2024
   347                                  	;;; wait for 3 seconds
   348                                  	sys	_time, 0 ; get time in unix epoch format
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000017C BB00000000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000181 B80D000000          <1>  mov eax, %1
    99                              <1> 
   100 00000186 CD40                <1>  int 40h
   349 00000188 89C1                    	mov	ecx, eax
   350 0000018A 83C103                  	add	ecx, 3
   351                                  _wait_3s:
   352 0000018D 90                      	nop
   353                                  	sys	_time, 0
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000018E BB00000000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000193 B80D000000          <1>  mov eax, %1
    99                              <1> 
   100 00000198 CD40                <1>  int 40h
   354 0000019A 39C8                    	cmp	eax, ecx
   355 0000019C 72EF                    	jb	short _wait_3s
   356                                  	;;;
   357                                  
   358                                  ; -------------------------------------------------------------
   359                                  
   360                                  	; 07/12/2024 (playwav9.s)
   361                                  
   362                                  	; 18/11/2023 (ich_wav4.asm)
   363                                  	; 13/11/2023 (ich_wav3.asm)
   364                                  
   365 0000019E 803D[AE7E0000]01        	cmp	byte [VRA], 1
   366 000001A5 7226                    	jb	short chk_sample_rate
   367                                  
   368                                  playwav_48_khz:
   369 000001A7 C705[447F0000]-         	mov	dword [loadfromwavfile], loadFromFile
   369 000001AD [63080000]         
   370                                  	;mov	dword [loadsize], 0 ; 65536
   371                                  	;;;
   372                                  	; 17/11/2024
   373                                  	;mov	word [buffersize], 32768
   374                                  	;mov	ax, BUFFERSIZE/2 ; 32760
   375                                  	; 30/11/2024
   376                                  	;mov	eax, BUFFERSIZE/2 ; 32768
   377                                  	; 07/12/2024
   378 000001B1 B800000100              	mov	eax, BUFFERSIZE ; 65536
   379 000001B6 A3[4C7F0000]            	mov	[buffersize], eax	; 16 bit samples
   380                                  	; 07/12/2024
   381                                  	;shl	eax, 1			; bytes
   382 000001BB 8A0D[367F0000]          	mov	cl, [fbs_shift]
   383 000001C1 D3E8                    	shr	eax, cl 
   384                                  	;mov	[loadsize], ax ; 16380 or 32760 or 65520
   385 000001C3 A3[487F0000]            	mov	[loadsize], eax ; 16384 or 32768 or 65536
   386                                  	;;;
   387                                  	;jmp	PlayNow ; 30/05/2024
   388                                  	; 07/12/2024
   389 000001C8 E9AA020000              	jmp	Player_Template
   390                                  
   391                                  	; 02/02/2025
   392                                  chk_sample_rate:
   393                                  	; set conversion parameters
   394                                  	; (for 8, 11.025, 16, 22.050, 24, 32 kHZ)
   395 000001CD 66A1[C87E0000]          	mov	ax, [WAVE_SampleRate]
   396 000001D3 663D80BB                	cmp	ax, 48000
   397 000001D7 74CE                    	je	short playwav_48_khz
   398                                  chk_22khz:
   399 000001D9 663D2256                	cmp	ax, 22050
   400 000001DD 7545                    	jne	short chk_11khz
   401 000001DF 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   402 000001E6 7615                    	jna	short chk_22khz_1
   403 000001E8 BB[D3170000]            	mov	ebx, load_22khz_stereo_16_bit
   404 000001ED 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   405 000001F4 751A                    	jne	short chk_22khz_2
   406 000001F6 BB[46170000]            	mov	ebx, load_22khz_mono_16_bit
   407 000001FB EB13                    	jmp	short chk_22khz_2
   408                                  chk_22khz_1:
   409 000001FD BB[BF160000]            	mov	ebx, load_22khz_stereo_8_bit
   410 00000202 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   411 00000209 7505                    	jne	short chk_22khz_2
   412 0000020B BB[36160000]            	mov	ebx, load_22khz_mono_8_bit
   413                                  chk_22khz_2:
   414 00000210 B85A1D0000              	mov	eax, 7514  ; (442*17)
   415 00000215 BA25000000              	mov	edx, 37
   416 0000021A B911000000              	mov	ecx, 17
   417 0000021F E926020000              	jmp	set_sizes
   418                                  chk_11khz:
   419 00000224 663D112B                	cmp	ax, 11025
   420 00000228 7545                    	jne	short chk_44khz
   421 0000022A 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   422 00000231 7615                    	jna	short chk_11khz_1
   423 00000233 BB[EF190000]            	mov	ebx, load_11khz_stereo_16_bit
   424 00000238 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   425 0000023F 751A                    	jne	short chk_11khz_2
   426 00000241 BB[76190000]            	mov	ebx, load_11khz_mono_16_bit
   427 00000246 EB13                    	jmp	short chk_11khz_2
   428                                  chk_11khz_1:
   429 00000248 BB[FC180000]            	mov	ebx, load_11khz_stereo_8_bit
   430 0000024D 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   431 00000254 7505                    	jne	short chk_11khz_2
   432 00000256 BB[84180000]            	mov	ebx, load_11khz_mono_8_bit
   433                                  chk_11khz_2:
   434 0000025B B8AD0E0000              	mov	eax, 3757  ; (221*17)
   435 00000260 BA4A000000              	mov	edx, 74
   436 00000265 B911000000              	mov	ecx, 17
   437 0000026A E9DB010000              	jmp	set_sizes
   438                                  chk_44khz:
   439 0000026F 663D44AC                	cmp	ax, 44100
   440 00000273 7545                    	jne	short chk_16khz
   441 00000275 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   442 0000027C 7615                    	jna	short chk_44khz_1
   443 0000027E BB[F61B0000]            	mov	ebx, load_44khz_stereo_16_bit
   444 00000283 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   445 0000028A 751A                    	jne	short chk_44khz_2
   446 0000028C BB[7D1B0000]            	mov	ebx, load_44khz_mono_16_bit
   447 00000291 EB13                    	jmp	short chk_44khz_2
   448                                  chk_44khz_1:
   449 00000293 BB[001B0000]            	mov	ebx, load_44khz_stereo_8_bit
   450 00000298 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   451 0000029F 7505                    	jne	short chk_44khz_2
   452 000002A1 BB[841A0000]            	mov	ebx, load_44khz_mono_8_bit
   453                                  chk_44khz_2:
   454                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   455 000002A6 B8D93A0000              	mov	eax, 15065 ; (655*23)
   456                                  	; 18/11/2023 ((file size + bss + stack) <= 64KB)
   457                                  	;mov	ax, 14076 ; (612*23)
   458                                  	; 17/11/2024
   459                                  	;mov	ax, 12650 ; (550*23)
   460 000002AB BA19000000              	mov	edx, 25
   461 000002B0 B917000000              	mov	ecx, 23
   462 000002B5 E990010000              	jmp	set_sizes
   463                                  chk_16khz:
   464 000002BA 663D803E                	cmp	ax, 16000
   465 000002BE 7545                    	jne	short chk_8khz
   466 000002C0 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   467 000002C7 7615                    	jna	short chk_16khz_1
   468 000002C9 BB[75110000]            	mov	ebx, load_16khz_stereo_16_bit
   469 000002CE 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   470 000002D5 751A                    	jne	short chk_16khz_2
   471 000002D7 BB[F4100000]            	mov	ebx, load_16khz_mono_16_bit
   472 000002DC EB13                    	jmp	short chk_16khz_2
   473                                  chk_16khz_1:
   474 000002DE BB[3A100000]            	mov	ebx, load_16khz_stereo_8_bit
   475 000002E3 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   476 000002EA 7505                    	jne	short chk_16khz_2
   477 000002EC BB[BB0F0000]            	mov	ebx, load_16khz_mono_8_bit
   478                                  chk_16khz_2:
   479                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   480 000002F1 B855150000              	mov	eax, 5461
   481                                  	; 17/11/2024
   482                                  	;mov	ax, 5460
   483 000002F6 BA03000000              	mov	edx, 3
   484 000002FB B901000000              	mov	ecx, 1
   485 00000300 E945010000              	jmp	set_sizes
   486                                  chk_8khz:
   487 00000305 663D401F                	cmp	ax, 8000
   488 00000309 7545                    	jne	short chk_24khz
   489 0000030B 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   490 00000312 7615                    	jna	short chk_8khz_1
   491 00000314 BB[700E0000]            	mov	ebx, load_8khz_stereo_16_bit
   492 00000319 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   493 00000320 751A                    	jne	short chk_8khz_2
   494 00000322 BB[A00D0000]            	mov	ebx, load_8khz_mono_16_bit
   495 00000327 EB13                    	jmp	short chk_8khz_2
   496                                  chk_8khz_1:
   497 00000329 BB[700C0000]            	mov	ebx, load_8khz_stereo_8_bit
   498 0000032E 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   499 00000335 7505                    	jne	short chk_8khz_2
   500 00000337 BB[8C0B0000]            	mov	ebx, load_8khz_mono_8_bit
   501                                  chk_8khz_2:
   502 0000033C B8AA0A0000              	mov	eax, 2730
   503 00000341 BA06000000              	mov	edx, 6
   504 00000346 B901000000              	mov	ecx, 1
   505 0000034B E9FA000000              	jmp	set_sizes
   506                                  chk_24khz:
   507 00000350 663DC05D                	cmp	ax, 24000
   508 00000354 7545                    	jne	short chk_32khz
   509 00000356 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   510 0000035D 7615                    	jna	short chk_24khz_1
   511                                  	; 17/01/2025 (BugFix)
   512                                  	; bx -> ebx
   513 0000035F BB[A2130000]            	mov	ebx, load_24khz_stereo_16_bit
   514 00000364 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   515 0000036B 751A                    	jne	short chk_24khz_2
   516 0000036D BB[3C130000]            	mov	ebx, load_24khz_mono_16_bit
   517 00000372 EB13                    	jmp	short chk_24khz_2
   518                                  chk_24khz_1:
   519 00000374 BB[B2120000]            	mov	ebx, load_24khz_stereo_8_bit
   520 00000379 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   521 00000380 7505                    	jne	short chk_24khz_2
   522 00000382 BB[4B120000]            	mov	ebx, load_24khz_mono_8_bit
   523                                  chk_24khz_2:
   524                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   525 00000387 B800200000              	mov	eax, 8192
   526                                  	; 17/11/2024
   527                                  	;mov	ax, 8190
   528 0000038C BA02000000              	mov	edx, 2
   529 00000391 B901000000              	mov	ecx, 1
   530 00000396 E9AF000000              	jmp	set_sizes ; 02/02/2025	
   531                                  
   532                                  chk_32khz:
   533 0000039B 663D007D                	cmp	ax, 32000
   534                                  	;jne	short vra_needed
   535                                  	; 02/02/2025
   536 0000039F 7563                    	jne	short chk_12khz
   537 000003A1 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   538 000003A8 7615                    	jna	short chk_32khz_1
   539 000003AA BB[A6150000]            	mov	ebx, load_32khz_stereo_16_bit
   540 000003AF 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   541 000003B6 751A                    	jne	short chk_32khz_2
   542 000003B8 BB[39150000]            	mov	ebx, load_32khz_mono_16_bit
   543 000003BD EB13                    	jmp	short chk_32khz_2
   544                                  chk_32khz_1:
   545 000003BF BB[9C140000]            	mov	ebx, load_32khz_stereo_8_bit
   546 000003C4 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   547 000003CB 7505                    	jne	short chk_32khz_2
   548 000003CD BB[29140000]            	mov	ebx, load_32khz_mono_8_bit
   549                                  chk_32khz_2:
   550                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   551 000003D2 B8AA2A0000              	mov	eax, 10922
   552                                  	; 17/11/2024
   553                                  	;mov	ax, 10920
   554 000003D7 BA03000000              	mov	edx, 3
   555 000003DC B902000000              	mov	ecx, 2
   556                                  	; 02/02/2025
   557 000003E1 EB67                    	jmp	short set_sizes
   558                                  
   559                                  	; 07/12/2024
   560                                  vra_needed:
   561                                  	; 30/11/2024 (TRDOS 386, ax -> eax)
   562                                  	; 13/11/2023
   563 000003E3 58                      	pop	eax ; discard return address to the caller
   564                                  	; 30/05/2024
   565                                  vra_err:
   566                                  	; 21/12/2024
   567 000003E4 E80D020000              	call	set_text_mode
   568                                  	; 30/11/2024
   569                                  	sys	_msg, msg_no_vra, 255, 0Fh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000003E9 BB[102B0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000003EE B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000003F3 BA0F000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000003F8 B823000000          <1>  mov eax, %1
    99                              <1> 
   100 000003FD CD40                <1>  int 40h
   570 000003FF E90F010000              	jmp	Exit
   571                                  
   572                                  	;;;;
   573                                  	; 02/02/2025
   574                                  chk_12khz:
   575 00000404 663DE02E                	cmp	ax, 12000
   576 00000408 75D9                    	jne	short vra_needed
   577 0000040A 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8
   578 00000411 7615                    	jna	short chk_12khz_1
   579 00000413 BB[621D0000]            	mov	ebx, load_12khz_stereo_16_bit
   580 00000418 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   581 0000041F 751A                    	jne	short chk_12khz_2
   582 00000421 BB[131D0000]            	mov	ebx, load_12khz_mono_16_bit
   583 00000426 EB13                    	jmp	short chk_12khz_2
   584                                  chk_12khz_1:
   585 00000428 BB[BD1C0000]            	mov	ebx, load_12khz_stereo_8_bit
   586 0000042D 803D[C67E0000]01        	cmp	byte [WAVE_NumChannels], 1
   587 00000434 7505                    	jne	short chk_12khz_2
   588 00000436 BB[751C0000]            	mov	ebx, load_12khz_mono_8_bit
   589                                  chk_12khz_2:
   590 0000043B B800100000              	mov	eax, 4096
   591 00000440 BA04000000              	mov	edx, 4
   592 00000445 B901000000              	mov	ecx, 1
   593                                  	; 02/02/2025
   594                                  	;jmp	short set_sizes
   595                                  	;;;;
   596                                  
   597                                  set_sizes:
   598                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   599                                  	;;;
   600                                  	; 17/11/2024
   601 0000044A 51                      	push	ecx
   602 0000044B B102                    	mov	cl, 2
   603 0000044D 2A0D[367F0000]          	sub	cl, [fbs_shift]
   604                                  		; = 2 for 16 bit stereo
   605                                  		; = 1 for 16 bit mono or 8 bit stereo
   606                                  		; = 0 for 8 bit mono
   607 00000453 D3E0                    	shl	eax, cl
   608 00000455 59                      	pop	ecx
   609 00000456 A3[487F0000]            	mov	[loadsize], eax	; (one) read count in bytes
   610                                  	;;;
   611 0000045B F7E2                    	mul	edx
   612 0000045D 83F901                  	cmp	ecx, 1
   613 00000460 7402                    	je	short s_2
   614                                  s_1:
   615 00000462 F7F1                    	div	ecx
   616                                  s_2:
   617                                  	;;;
   618                                  	; eax = byte count of (to be) converted samples 
   619                                  	
   620                                  	; 17/11/2024
   621                                  	;;;
   622 00000464 8A0D[367F0000]          	mov	cl, [fbs_shift]
   623                                  
   624 0000046A D3E0                    	shl	eax, cl
   625                                  		; *1 for 16 bit stereo
   626                                  		; *2 for 16 bit mono or 8 bit stereo
   627                                  		; *4 for for 8 bit mono
   628                                  	;;;
   629                                  
   630                                  	; eax = 16 bit stereo byte count (target buffer size)
   631                                  	
   632                                  	; 07/12/2024
   633                                  	;shr	eax, 1	; buffer size is 16 bit sample count
   634 0000046C A3[4C7F0000]            	mov	[buffersize], eax ; buffer size in bytes
   635 00000471 891D[447F0000]          	mov	[loadfromwavfile], ebx
   636                                  
   637                                  ; -------------------------------------------------------------
   638                                  
   639                                  Player_Template:
   640                                  	; 21/12/2024
   641 00000477 E80B010000              	call	clearscreen
   642 0000047C E822010000              	call	drawplayingscreen
   643                                  
   644                                  	; 14/11/2024
   645 00000481 E8F8200000              	call	SetTotalTime
   646 00000486 E8C5210000              	call	UpdateFileInfo
   647                                  
   648                                  ; -------------------------------------------------------------
   649                                  
   650                                  StartPlay:
   651                                  	; 21/12/2024 (VGA/LFB modifications)
   652                                  	; (Direct access/map to the LFB is already done here)
   653                                  	; ((this program is in VESA/VBE graphics mode here))
   654                                  PlayNow:
   655                                  	; 07/12/2024
   656                                  	sys	_audio, 0200h, [buffersize], audio_buffer
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000048B BB00020000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000490 8B0D[4C7F0000]      <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000496 BA[00800000]        <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000049B B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000004A0 CD40                <1>  int 40h
   657 000004A2 0F82B1000000            	jc	error_exit ; return to text mode and print err msg
   658                                  
   659                                  	; 01/06/2024
   660                                  	; Initialize Audio Device (bh = 3)
   661                                  	sys	_audio, 0301h, 0, audio_int_handler
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000004A8 BB01030000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000004AD B900000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000004B2 BA[4F080000]        <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000004B7 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000004BC CD40                <1>  int 40h
   662                                  	;jc	short error_exit
   663 000004BE 7279                    	jc	init_err ; return to text mode and print err msg
   664                                  
   665                                  	;;;
   666                                  	; 14/11/2024
   667 000004C0 B003                    	mov	al, 3	; 0 = max, 31 = min
   668                                  	; 15/11/2024
   669 000004C2 E8A5020000              	call	SetMasterVolume
   670                                  	; 07/12/2024
   671                                  	;call	SetPCMOutVolume
   672 000004C7 E805220000              	call	UpdateVolume
   673                                  	;;;
   674                                  	;
   675                                  	; 14/11/2024
   676 000004CC E890220000              	call	UpdateProgressBar
   677                                  	;;;
   678                                  
   679                                   	; 30/05/2024
   680                                  	; playwav4.asm
   681                                  ;_2:	; 24/12/2024
   682                                  	;call	check4keyboardstop	; flush keyboard buffer
   683                                  	;jc	short _2		; 07/11/2023
   684                                  
   685                                  	; 24/12/2024 (setting for wave lighting points)
   686 000004D1 A1[90740000]            	mov	eax, [LFB_ADDR]
   687                                  	;add	eax, 228*640 ; wave graphics start (top) line/row
   688 000004D6 05009A0100              	add	eax, 164*640 ; 256 volume levels ; 24/12/2024
   689 000004DB A3[8C740000]            	mov	[graphstart], eax
   690                                  
   691                                  ; play the .wav file. Most of the good stuff is in here.
   692                                  	
   693                                  	; 05/12/2024
   694 000004E0 E818010000              	call    PlayWav
   695                                  
   696                                  ; close the .wav file and exit.
   697                                  
   698                                  	; 07/12/2024
   699                                  	;;;
   700                                  	; Stop Playing
   701                                  	;sys	_audio, 0700h
   702                                  	; Cancel callback service (for user)
   703                                  	sys	_audio, 0900h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000004E5 BB00090000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000004EA B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000004EF CD40                <1>  int 40h
   704                                  	; Deallocate Audio Buffer (for user)
   705                                  	sys	_audio, 0A00h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000004F1 BB000A0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000004F6 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000004FB CD40                <1>  int 40h
   706                                  	; Disable Audio Device
   707                                  	sys	_audio, 0C00h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000004FD BB000C0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000502 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00000507 CD40                <1>  int 40h
   708                                  	;;;
   709                                  
   710                                  	; 25/12/2024
   711 00000509 E8E8020000              	call	closeFile
   712                                  
   713                                  terminate:
   714 0000050E E8E3000000              	call	set_text_mode
   715                                  Exit:
   716                                  	sys	_exit
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90                              <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000513 B801000000          <1>  mov eax, %1
    99                              <1> 
   100 00000518 CD40                <1>  int 40h
   717                                  halt:
   718 0000051A EBFE                    	jmp	short halt
   719                                  
   720                                  ; -------------------------------------------------------------
   721                                  
   722                                  	; 30/05/2024
   723                                  pmsg_usage:
   724                                  	; 21/12/2024
   725 0000051C E8D5000000              	call	set_text_mode
   726                                  	; 01/12/2024
   727                                  	sys	_msg, msg_usage, 255, 0Fh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000521 BB[5C2A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000526 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000052B BA0F000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000530 B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000535 CD40                <1>  int 40h
   728 00000537 EBDA                    	jmp	short Exit
   729                                  
   730                                  ; -------------------------------------------------------------
   731                                  
   732                                  	; 30/05/2024
   733                                  init_err:
   734                                  	; 21/12/2024
   735 00000539 E8B8000000              	call	set_text_mode
   736                                  	; 01/12/2024
   737                                  	sys	_msg, msg_init_err, 255, 0Fh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000053E BB[DF2A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000543 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000548 BA0F000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000054D B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000552 CD40                <1>  int 40h
   738 00000554 EBBD                    	jmp	short Exit
   739                                  
   740                                  ; -------------------------------------------------------------
   741                                  
   742                                  	; 02/12/2024
   743                                  Player_Quit@:
   744 00000556 58                      	pop	eax ; return addr (call PlayWav@)
   745                                  	
   746                                  	; 29/11/2024
   747                                  Player_Quit:
   748 00000557 EBB5                    	jmp	 short terminate
   749                                  
   750                                  
   751                                  ; -------------------------------------------------------------
   752                                  
   753                                  	; 07/12/2024
   754                                  error_exit:
   755                                  	; 21/12/2024
   756 00000559 E898000000              	call	set_text_mode
   757                                  trdos386_error:
   758                                  	sys	_msg, trdos386_err_msg, 255, 0Eh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000055E BB[BF2A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000563 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000568 BA0E000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000056D B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000572 CD40                <1>  int 40h
   759 00000574 EB9D                    	jmp	short Exit
   760                                  
   761                                  ; -------------------------------------------------------------
   762                                  
   763                                  	; 21/12/2024
   764                                  print_msg:
   765 00000576 B40E                    	mov	ah, 0Eh
   766 00000578 BB07000000              	mov	ebx, 7
   767                                  	;mov	bl, 7 ; char attribute & color
   768                                  p_next_chr:
   769 0000057D AC                      	lodsb
   770 0000057E 08C0                    	or	al, al
   771 00000580 7404                    	jz	short p_retn ; retn
   772 00000582 CD31                    	int	31h
   773 00000584 EBF7                    	jmp	short p_next_chr
   774                                  p_retn:
   775 00000586 C3                      	retn
   776                                  
   777                                  ; -------------------------------------------------------------
   778                                  
   779                                  	; 21/12/2024
   780                                  clearscreen:
   781                                  	; fast clear
   782                                  	; 640*480, 256 colors
   783 00000587 8B3D[90740000]          	mov	edi, [LFB_ADDR]
   784 0000058D B9002C0100              	mov	ecx, (640*480*1)/4 ; 22/12/2024
   785 00000592 31C0                    	xor	eax, eax
   786 00000594 F3AB                    	rep	stosd
   787 00000596 C3                      	retn
   788                                  
   789                                  ; -------------------------------------------------------------
   790                                  
   791                                  	; 21/12/2024
   792                                  drawsplashscreen:
   793 00000597 BD[3C2C0000]            	mov	ebp, SplashScreen
   794                                  	;;mov	dword [nextrow], 00100000h ; 8*16
   795                                  	;mov	dword [nextrow], 000E0000h ; 8*14
   796                                  	;mov	esi, 0 ; row 0, column 0
   797 0000059C BE00000200              	mov	esi, 00020000h ; row 2, column 0 ; top margin = 2
   798 000005A1 EB0A                    	jmp	short p_d_x
   799                                  drawplayingscreen:
   800 000005A3 BD[DD360000]            	mov	ebp, PlayingScreen
   801                                  	;mov	dword [nextrow], 000E0000h ; 8*14
   802                                  	;mov	esi, 0 ; row 0, column 0
   803 000005A8 BE00000700              	mov	esi, 00070000h ; row 7, column 0 ; top margin = 7
   804                                  p_d_x:
   805 000005AD C605[9C740000]50        	mov	byte [columns], 80
   806                                  p_d_x_n:
   807 000005B4 31D2                    	xor	edx, edx
   808 000005B6 8A5500                  	mov	dl, [ebp]
   809 000005B9 20D2                    	and	dl, dl
   810 000005BB 7438                    	jz	short p_d_x_ok
   811 000005BD C1E204                  	shl	edx, 4 ; * 16 (for 8x16 font)
   812                                  
   813 000005C0 BF[484F0000]            	mov	edi, fontbuff2 ; start of user font data
   814 000005C5 01D7                    	add	edi, edx
   815                                  	
   816                                  	;; NOTE: Following system call writes fonts at
   817                                  	;; Std VGA video memory 0A0000h, BL bit 7 selects
   818                                  	;; screen width as 640 pixels (instead of 320 pixels)
   819                                  	;; so 8Fh is sub function 0Fh (write char)
   820                                  	;; with 640 pixels screen witdh. 
   821                                  	;; (Even if VESA VBE mode -LFB- is in use, QEMU and
   822                                  	;; a real computer with NVIDIA GEFORCE FX 550 uses
   823                                  	;; A0000h, so.. even if fonts are written at A0000h-B0000h
   824                                  	;; region, the text is appeared on screen
   825                                  	;; while LFB is at C0000000h or E0000000h.)
   826                                  
   827                                  	;sys	_video, 018Fh, [tcolor], 8001h
   828                                  			;; use STD VGA video memory
   829                                  			;; (0A0000h)
   830                                  	;sys	_video, 020Fh, [tcolor], 8001h ; 8x16 user font
   831                                  		 ; use LFB for current VBE mode
   832                                  		 ; for writing fonts on screen
   833                                  	; 26/12/2024
   834                                  	sys	_video, 020Fh, 0Fh, 8001h ; 8x16 user font
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000005C7 BB0F020000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000005CC B90F000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000005D1 BA01800000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000005D6 B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 000005DB CD40                <1>  int 40h
   835                                  
   836 000005DD 45                      	inc	ebp
   837 000005DE 6683C608                	add	si, 8 ; next char pos
   838 000005E2 FE0D[9C740000]          	dec	byte [columns]
   839 000005E8 75CA                    	jnz	short p_d_x_n	; next column
   840 000005EA 6631F6                  	xor	si, si
   841                                  	;;add	esi, 00100000h	; next row ; 8*16
   842                                  	;add	esi, [nextrow]
   843 000005ED 81C600000E00            	add	esi, 000E0000h	; next row ; 8*14
   844 000005F3 EBB8                    	jmp	short p_d_x
   845                                  p_d_x_ok:
   846 000005F5 C3                      	retn
   847                                  
   848                                  ; -------------------------------------------------------------
   849                                  
   850                                  	; 21/12/2024
   851                                  set_text_mode:
   852 000005F6 30E4                    	xor    ah, ah
   853 000005F8 B003                    	mov    al, 3                        
   854                                   	;int   10h ; al = 03h text mode, int 10 video
   855 000005FA CD31                    	int    31h ; TRDOS 386 - Video interrupt
   856 000005FC C3                      	retn
   857                                  
   858                                  ; -------------------------------------------------------------
   859                                  
   860                                  	; 07/12/2024 (playwav9.s)
   861                                  	; 26/11/2023 (playwav8.s)
   862                                  PlayWav:
   863                                  	; 19/11/2024
   864 000005FD C605[A37E0000]01        	mov	byte [wleds], 1
   865                                  
   866                                  	;;;
   867                                  	; 09/12/2024
   868 00000604 B834290000              	mov	eax, 10548 ; (48000*10/182)*4
   869 00000609 803D[AE7E0000]00        	cmp	byte [VRA], 0
   870 00000610 7614                    	jna	short _3 ; 48kHZ (interpolation)
   871                                  	;;;
   872                                  	; 01/12/2024 (32bit)
   873                                  	;movzx	eax, word [WAVE_SampleRate]
   874                                  	; 09/12/2024
   875 00000612 66A1[C87E0000]          	mov	ax, [WAVE_SampleRate]
   876 00000618 B90A000000              	mov	ecx, 10
   877 0000061D F7E1                    	mul	ecx
   878 0000061F B1B6                    	mov	cl, 182
   879 00000621 F7F1                    	div	ecx
   880                                  	; ax = samples per 1/18.2 second
   881                                  	;mov	cl, byte [WAVE_BlockAlign]
   882                                  	; 09/12/2024 
   883                                  	;mov	cl, 4 ; 16 bit, stereo
   884                                  	;mul	ecx
   885 00000623 C1E002                  	shl	eax, 2 ; * 4
   886                                  _3:
   887 00000626 A3[A47E0000]            	mov	[wleds_dif], eax ; buffer read differential (distance)
   888                                  				; for wave volume leds update
   889                                  				; (byte stream per 1/18.2 second)
   890                                  	;;;
   891                                  	; 24/12/2024
   892 0000062B 3D000A0000              	cmp	eax, 640*4 ; 640 samples (for 640 wave light points)
   893 00000630 7305                    	jnb	short _4
   894 00000632 B8000A0000              	mov	eax, 640*4	
   895                                  _4:
   896 00000637 A3[88740000]            	mov	[wpoints_dif], eax
   897                                  	;;;
   898                                  
   899                                  RePlayWav:
   900                                  	; 07/12/2024
   901 0000063C BF[00800000]            	mov	edi, audio_buffer
   902 00000641 FF15[447F0000]          	call	dword [loadfromwavfile]
   903 00000647 0F820CFFFFFF            	jc	error_exit
   904                                  
   905 0000064D C605[AD7E0000]01        	mov	byte [half_buffer], 1 ; (DMA) Buffer 1
   906                                  
   907 00000654 A1[587F0000]            	mov	eax, [count]
   908 00000659 0105[5C7F0000]          	add	[LoadedDataBytes], eax
   909                                  
   910 0000065F F605[DE7E0000]01        	test    byte [flags], ENDOFFILE  ; end of file
   911 00000666 752C                    	jnz	short _5 ; yes
   912                                  			 ; bypass filling dma half buffer 2
   913                                  
   914                                  	; bh = 16 : update (current, first) dma half buffer
   915                                  	; bl = 0  : then switch to the next (second) half buffer
   916                                  	sys	_audio, 1000h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000668 BB00100000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000066D B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00000672 CD40                <1>  int 40h
   917                                  
   918                                  	; 18/12/2024
   919 00000674 C705[587F0000]0000-     	mov	dword [count], 0
   919 0000067C 0000               
   920                                  
   921                                  	; 07/12/2024
   922 0000067E BF[00800000]            	mov	edi, audio_buffer
   923 00000683 FF15[447F0000]          	call	dword [loadfromwavfile]
   924                                  	;jc	error_exit
   925                                  	
   926 00000689 A1[587F0000]            	mov	eax, [count]
   927 0000068E 0105[5C7F0000]          	add	[LoadedDataBytes], eax
   928                                  _5:
   929                                  	; 07/12/2024
   930 00000694 668B0D[C87E0000]         	mov	cx, [WAVE_SampleRate]
   931 0000069B B303                    	mov	bl, 3	; 16 bit, stereo
   932 0000069D B704                    	mov	bh, 4	; start to play
   933                                  	sys	_audio
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90                              <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000069F B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000006A4 CD40                <1>  int 40h
   934                                  
   935                                  ; -------------------------------------------
   936                                  
   937                                  	; 22/12/2024
   938                                   	; prepare all leds as turned off
   939 000006A6 E8B8210000              	call	reset_wave_leds
   940                                  
   941                                  ; -------------------------------------------
   942                                  
   943                                  	; 07/12/2024 (playwav9.s)
   944                                  	; 01/12/2024 (32bit)
   945                                  	; 29/11/2024
   946                                  tuneLoop:
   947                                  	; 30/05/2024
   948                                  	; 18/11/2023 (ich_wav4.asm)
   949                                  	; 08/11/2023
   950                                  	; 06/11/2023
   951                                  tLWait:
   952                                  	; 18/11/2024
   953 000006AB 803D[A07E0000]00        	cmp	byte [stopped], 0
   954                                  	; 24/11/2024
   955 000006B2 761E                    	jna	short tL1
   956                                  
   957                                  tLWait@:	; 21/11/2024
   958 000006B4 E8911C0000              	call	checkUpdateEvents
   959 000006B9 726E                    	jc	_exitt_
   960 000006BB 803D[A17E0000]30        	cmp	byte [tLO], '0'
   961 000006C2 74E7                    	je	short tLWait
   962 000006C4 E86A000000              	call	tLZ
   963 000006C9 C605[A17E0000]30        	mov	byte [tLO], '0'
   964 000006D0 EBD9                    	jmp	short tLWait
   965                                  tL1:
   966                                  	; 27/11/2024
   967                                  	; Check AC'97 interrupt status
   968 000006D2 803D[377F0000]00        	cmp	byte [SRB], 0
   969 000006D9 7709                    	ja	short tL3
   970                                  tL2:
   971 000006DB E86A1C0000              	call	checkUpdateEvents
   972 000006E0 7247                    	jc	_exitt_
   973 000006E2 EBC7                    	jmp	short tLWait
   974                                  tL3:
   975 000006E4 8035[AD7E0000]01        	xor	byte [half_buffer], 1
   976                                  	; 07/12/2024
   977 000006EB C605[377F0000]00        	mov	byte [SRB], 0
   978                                  
   979                                  	; 07/12/2024
   980 000006F2 BF[00800000]            	mov	edi, audio_buffer
   981                                  	;call	loadFromFile
   982                                  	; 18/11/2023
   983                                  	;call	word [loadfromwavfile]
   984                                  	; 01/12/2024
   985 000006F7 FF15[447F0000]          	call	dword [loadfromwavfile]
   986 000006FD 722A                    	jc	short _exitt_	; end of file
   987                                  
   988                                  	; 07/12/2024
   989                                  	;;;;
   990                                  	; bh = 16 : update (current, first) dma half buffer
   991                                  	; bl = 0  : then switch to the other half buffer
   992                                  	sys	_audio, 1000h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000006FF BB00100000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000704 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00000709 CD40                <1>  int 40h
   993                                  	;;;;
   994                                  
   995                                  	; 26/11/2024
   996 0000070B A0[AD7E0000]            	mov	al, [half_buffer]
   997 00000710 0431                    	add	al, '1'
   998                                  	; 19/11/2024
   999 00000712 A2[A17E0000]            	mov	[tLO], al
  1000 00000717 E819000000              	call	tL0
  1001                                  
  1002                                  	; 24/11/2024
  1003                                  	; 14/11/2024
  1004                                  	;mov	ax, [count]
  1005                                  	;add	[LoadedDataBytes], ax
  1006                                  	;adc	word [LoadedDataBytes+2], 0
  1007                                  	; 01/12/2024
  1008 0000071C A1[587F0000]            	mov	eax, [count]
  1009 00000721 0105[5C7F0000]          	add	[LoadedDataBytes], eax
  1010                                  
  1011                                  	; 07/12/2024 (playwav9.s)
  1012                                  	; 27/11/2024 (playwav9.asm)
  1013 00000727 EBB2                    	jmp	short tL2
  1014                                  
  1015                                  _exitt_:
  1016                                  	; 07/12/2024
  1017                                  	; Stop Playing
  1018                                  	;mov	byte [stopped], 2
  1019                                  	;sys	_audio, 0700h
  1020 00000729 E8E01B0000              	call	ac97_stop
  1021                                  
  1022                                  	;;;
  1023                                  	; 14/11/2024
  1024 0000072E E82E200000              	call	UpdateProgressBar
  1025                                  	;;;
  1026                                  
  1027                                  	; 18/11/2024
  1028                                  tLZ:
  1029                                  	; 30/05/2024
  1030 00000733 B030                    	mov	al, '0'
  1031                                  
  1032                                  	;add	al, '0'
  1033                                  	;call	tL0
  1034                                  	;
  1035                                  	;retn
  1036                                  	; 06/11/2023
  1037                                  	;jmp	short tL0
  1038                                  	;retn
  1039                                  
  1040                                  	; 06/11/2023
  1041                                  tL0:
  1042                                  	; 29/05/2024 (TRDOS 386)
  1043                                  	; 08/11/2023
  1044                                  	; 05/11/2023
  1045                                  	; 17/02/2017 - Buffer switch test (temporary)
  1046                                  	; 06/11/2023
  1047                                  	; al = buffer indicator ('1', '2' or '0' -stop- )
  1048                                  
  1049                                  	; 22/12/2024 (graphics mode modification)
  1050                                  	; (640*480, 256 colors)
  1051                                  	;;;
  1052                                  	;mov	ebp, 16
  1053 00000735 BD0E000000              	mov	ebp, 14
  1054 0000073A 8B3D[90740000]          	mov	edi, [LFB_ADDR]
  1055 00000740 0FB6F0                  	movzx	esi, al
  1056 00000743 C1E604                  	shl	esi, 4 ; * 16
  1057 00000746 81C6[484F0000]          	add	esi, fontbuff2
  1058                                  tL0_1:
  1059 0000074C BA08000000              	mov	edx, 8 ; 8 pixels (8*16 pixel font)
  1060 00000751 8A26                    	mov	ah, [esi]
  1061                                  tL0_2:
  1062 00000753 B00C                    	mov	al, 0Ch ; red
  1063 00000755 D0E4                    	shl	ah, 1
  1064 00000757 7302                    	jnc	short tL0_3
  1065 00000759 B00E                    	mov	al, 0Eh ; yellow
  1066                                  tL0_3:
  1067 0000075B AA                      	stosb
  1068 0000075C 4A                      	dec	edx
  1069 0000075D 75F4                    	jnz	short tL0_2
  1070 0000075F 4D                      	dec	ebp
  1071 00000760 7409                    	jz	short tL0_4
  1072 00000762 81C778020000            	add	edi, 640-8 ; next line
  1073 00000768 46                      	inc	esi
  1074 00000769 EBE1                    	jmp	short tL0_1
  1075                                  tL0_4:
  1076                                  	;;;
  1077 0000076B C3                      	retn
  1078                                  
  1079                                  ; -------------------------------------------
  1080                                  
  1081                                  	; 07/12/2024
  1082                                  SetMasterVolume:
  1083                                  	;cmp	al, 31
  1084                                  	;ja	short setvolume_ok
  1085 0000076C A2[62250000]            	mov	[volume], al  ; max = 0, min = 31
  1086                                  
  1087 00000771 B41F                    	mov	ah, 31
  1088 00000773 28C4                    	sub	ah, al
  1089 00000775 88E0                    	mov	al, ah
  1090                                  
  1091                                  	; Set Master Volume Level (BL=0 or 80h)
  1092                                  	; 	for next playing (BL>=80h)
  1093                                  	;sys	_audio, 0B80h, eax
  1094                                  	sys	_audio, 0B00h, eax
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000777 BB000B0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000077C 89C1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000077E B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00000783 CD40                <1>  int 40h
  1095                                  	
  1096                                  setvolume_ok:
  1097                                  ac97_not_detected:
  1098 00000785 C3                      	retn
  1099                                  
  1100                                  ; -------------------------------------------
  1101                                  
  1102                                  	; 07/12/2024 (playwav9.s)
  1103                                  DetectAC97:
  1104                                  DetectICH:
  1105                                  	; 25/11/2023 (playwav8.s)
  1106                                  	; Detect (BH=1) AC'97 (BL=2) Audio Device
  1107                                          sys	_audio, 0102h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000786 BB02010000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000078B B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00000790 CD40                <1>  int 40h
  1108                                  	;jnc	short d_ac97_@
  1109                                  	;retn
  1110 00000792 72F1                    	jc	short ac97_not_detected
  1111                                  d_ac97_@:
  1112                                  	; 07/12/2024 (playwav9.s)
  1113                                  	; 06/06/2017
  1114                                  	sys	_audio, 0E00h ; get audio controller info
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000794 BB000E0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000799 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 0000079E CD40                <1>  int 40h
  1115 000007A0 0F82B3FDFFFF            	jc	error_exit ; 25/11/2023
  1116                                  
  1117                                  	;cmp	ah, 2 ; ICH ? (Intel AC'97 Audio Controller)
  1118                                  	;jne	_dev_not_ready	
  1119                                  
  1120                                  	; EAX = IRQ Number in AL
  1121                                  	;	Audio Device Number in AH 
  1122                                  	; EBX = DEV/VENDOR ID
  1123                                  	;       (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV)
  1124                                  	; ECX = BUS/DEV/FN 
  1125                                  	;       (00000000BBBBBBBBDDDDDFFF00000000)
  1126                                  	; EDX = NABMBAR/NAMBAR (for AC97)
  1127                                  	;      (Low word, DX = NAMBAR address)
  1128                                  	; EDX = Base IO Addr (DX) for SB16 & VT8233
  1129                                  
  1130 000007A6 891D[3C7F0000]          	mov	[dev_vendor], ebx
  1131 000007AC 890D[387F0000]          	mov	[bus_dev_fn], ecx
  1132                                  
  1133 000007B2 668915[407F0000]                mov     [NAMBAR], dx			; save audio mixer base addr
  1134                                  	;shr	edx, 16
  1135                                          ;mov    [NABMBAR], dx			; save bus master base addr
  1136 000007B9 8915[407F0000]          	mov	[NAMBAR], edx
  1137                                  
  1138 000007BF A2[DF7E0000]            	mov	[ac97_int_ln_reg], al
  1139                                  
  1140                                  	; 07/12/2024
  1141                                  	; 01/06/2024
  1142                                  	; 25/11/2023
  1143                                  	; Get AC'97 Codec info
  1144                                  	; (Function 14, sub function 1)
  1145                                  	sys	_audio, 0E01h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000007C4 BB010E0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000007C9 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000007CE CD40                <1>  int 40h
  1146                                  	; Save Variable Rate Audio support bit
  1147 000007D0 2401                    	and	al, 1
  1148 000007D2 A2[AE7E0000]            	mov	[VRA], al
  1149                                  
  1150                                  	;clc
  1151                                  
  1152 000007D7 C3                      	retn
  1153                                  
  1154                                  ; ----------------------------------
  1155                                  	
  1156                                  	; 01/12/2024
  1157                                  	; 14/11/2024
  1158                                  	; INPUT: ds:dx = file name address
  1159                                  	; OUTPUT: [filehandle] = ; -1 = not open
  1160                                  openFile:
  1161                                  	;mov	ax, 3D00h	; open File for read
  1162                                  	;int	21h
  1163                                  	;jnc	short _of1
  1164                                  	; 01/12/2024 (TRDOS 386)
  1165                                  	;sys	_open, edx, 0
  1166                                  	; 07/12/2024
  1167                                  	sys	_open, wav_file_name, 0
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000007D8 BB[E47E0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000007DD B900000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000007E2 B805000000          <1>  mov eax, %1
    99                              <1> 
   100 000007E7 CD40                <1>  int 40h
  1168 000007E9 7305                    	jnc	short _of1
  1169                                  
  1170 000007EB B8FFFFFFFF              	mov	eax, -1
  1171                                  	; cf = 1 -> not found or access error
  1172                                  _of1:
  1173 000007F0 A3[E07E0000]            	mov	[filehandle], eax
  1174 000007F5 C3                      	retn
  1175                                  
  1176                                  ; ----------------------------------
  1177                                  
  1178                                  ; close the currently open file
  1179                                  
  1180                                  	; 01/12/2024
  1181                                  	; 14/11/2024
  1182                                  	; INPUT: [filehandle] ; -1 = not open
  1183                                  	; OUTPUT: none
  1184                                  closeFile:
  1185 000007F6 833D[E07E0000]FF        	cmp	dword [filehandle], -1
  1186 000007FD 740D                    	jz	short _cf1
  1187                                  	;mov	bx, [filehandle]  
  1188                                  	;mov	ax, 3E00h
  1189                                          ;int	21h              ; close file
  1190                                  	; 01/12/2024
  1191                                  	sys	_close, [filehandle]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000007FF 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000805 B806000000          <1>  mov eax, %1
    99                              <1> 
   100 0000080A CD40                <1>  int 40h
  1192                                  	;mov 	dword [filehandle], -1
  1193                                  _cf1:
  1194 0000080C C3                      	retn
  1195                                  
  1196                                  ; ----------------------------------
  1197                                  
  1198                                  	; 05/02/2025
  1199                                  	; 01/12/2024
  1200                                  	; 14/11/2024 - Erdogan Tan
  1201                                  getWAVParameters:
  1202                                  ; reads WAV file header(s) (44 bytes) from the .wav file.
  1203                                  ; entry: none - assumes file is already open
  1204                                  ; exit: ax = sample rate (11025, 22050, 44100, 48000)
  1205                                  ;	cx = number of channels (mono=1, stereo=2)
  1206                                  ;	dx = bits per sample (8, 16)
  1207                                  ;	bx = number of bytes per sample (1 to 4)
  1208                                  
  1209                                          ;mov	dx, WAVFILEHEADERbuff
  1210                                  	;mov	bx, [filehandle]
  1211                                          ;mov	cx, 44			; 44 bytes
  1212                                  	;mov	ah, 3Fh
  1213                                          ;int	21h
  1214                                  	;jc	short gwavp_retn
  1215                                  	; 01/12/2024 (TRDOS 386)
  1216                                  	sys	_read, [filehandle], WAVFILEHEADERbuff, 44
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000080D 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000813 B9[B07E0000]        <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000818 BA2C000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000081D B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000822 CD40                <1>  int 40h
  1217 00000824 7228                    	jc	short gwavp_retn
  1218                                  
  1219 00000826 83F82C                  	cmp	eax, 44
  1220 00000829 7223                    	jb	short gwavp_retn
  1221                                  
  1222 0000082B 813D[B87E0000]5741-     	cmp	dword [RIFF_Format], 'WAVE'
  1222 00000833 5645               
  1223 00000835 7516                    	jne	short gwavp_stc_retn
  1224                                  
  1225 00000837 66833D[C47E0000]01      	cmp	word [WAVE_AudioFormat], 1 ; Offset 20, must be 1 (= PCM)
  1226                                  	; 05/02/2025
  1227 0000083F 750C                    	jne	short gwavp_stc_retn
  1228                                  	;je	short gwavp_retn ; 15/11/2024
  1229                                  
  1230                                  	; 05/02/2025
  1231                                  	; (Open MPT creates wav files with a new type header,
  1232                                  	;  this program can not use the new type
  1233                                  	;  because of 'data' offset is not at DATA_SubchunkID.)
  1234                                  	; ((GoldWave creates common type wav file.))
  1235 00000841 813D[D47E0000]6461-     	cmp	dword [DATA_SubchunkID], 'data'
  1235 00000849 7461               
  1236 0000084B 7401                    	je	short gwavp_retn
  1237                                  
  1238                                  	; 15/11/2024
  1239                                  	;mov	cx, [WAVE_NumChannels]	; return num of channels in CX
  1240                                          ;mov    ax, [WAVE_SampleRate]	; return sample rate in AX
  1241                                  	;mov	dx, [WAVE_BitsPerSample] 
  1242                                  					; return bits per sample value in DX
  1243                                  	;mov	bx, [WAVE_BlockAlign]	; return bytes per sample in BX
  1244                                  ;gwavp_retn:
  1245                                          ;retn
  1246                                  
  1247                                  gwavp_stc_retn:
  1248 0000084D F9                      	stc
  1249                                  gwavp_retn:
  1250 0000084E C3                      	retn
  1251                                  
  1252                                  ; --------------------------------------------------------
  1253                                  ; 07/12/2024
  1254                                  ; --------------------------------------------------------
  1255                                  ; ref: playwav8.s (04/06/2024)
  1256                                  
  1257                                  audio_int_handler:
  1258                                  	; 18/08/2020 (14/10/2020, 'wavplay2.s')
  1259                                  
  1260                                  	; 07/12/2024
  1261                                  	;mov	al, [stopped]
  1262                                  	;cmp	al, 2
  1263                                  	;je	short _callback_retn
  1264                                  
  1265                                  	; 18/08/2020
  1266                                  	;mov	byte [SRB], 1
  1267                                  	; 07/12/2024
  1268 0000084F FE05[377F0000]          	inc	byte [SRB]
  1269                                  
  1270                                  ;_callback_retn:
  1271                                  	sys	_rele ; return from callback service 
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90                              <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000855 B827000000          <1>  mov eax, %1
    99                              <1> 
   100 0000085A CD40                <1>  int 40h
  1272                                  	; we must not come here !
  1273                                  	sys	_exit
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90                              <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000085C B801000000          <1>  mov eax, %1
    99                              <1> 
   100 00000861 CD40                <1>  int 40h
  1274                                  
  1275                                  ; --------------------------------------------------------
  1276                                  ; 07/12/2024
  1277                                  ; --------------------------------------------------------
  1278                                  
  1279                                  ; /////
  1280                                  	; 14/12/2024
  1281                                  	; 07/12/2024
  1282                                  	; 01/12/2024
  1283                                  	; 30/05/2024 (ich_wav4.asm, 19/05/2024)
  1284                                  loadFromFile:
  1285                                  	; 07/11/2023
  1286                                  
  1287 00000863 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  1288                                  					; last of the file?
  1289 0000086A 7402                    	jz	short lff_0		; no
  1290 0000086C F9                      	stc
  1291 0000086D C3                      	retn
  1292                                  
  1293                                  lff_0:
  1294                                  	; 07/12/2024
  1295                                  	; 26/11/2023 (playwav8.s)
  1296                                  	;mov	edi, audio_buffer
  1297                                  
  1298                                  	; 01/12/2024 (TRDOS 386)
  1299                                  	; edi = audio buffer address
  1300                                  
  1301                                  	; 14/12/2024
  1302                                  	; 01/12/2024
  1303                                  	; 17/11/2024
  1304                                  	;mov	ebx, [filehandle]
  1305                                  	; 02/12/2024
  1306                                  	;mov	edx, [loadsize] 
  1307                                  
  1308                                  	; 17/11/2024
  1309 0000086E 803D[367F0000]00        	cmp	byte [fbs_shift], 0
  1310 00000875 7677                    	jna	short lff_1 ; stereo, 16 bit
  1311                                  
  1312                                  lff_2:
  1313                                  	; 01/12/2024
  1314 00000877 BE[00800100]            	mov	esi, temp_buffer 
  1315                                  	; 14/12/2024
  1316                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000087C 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000882 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000884 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000088A B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000088F CD40                <1>  int 40h
  1317 00000891 0F8289000000            	jc	lff_4 ; error !
  1318                                  
  1319                                  	; 01/12/2024
  1320                                  	; 14/11/2024
  1321 00000897 A3[587F0000]            	mov	[count], eax
  1322                                  
  1323                                  	; 01/12/2024
  1324 0000089C 21C0                    	and	eax, eax
  1325                                  	;jz	short lff_3
  1326                                  	; 14/12/2024
  1327 0000089E 0F8485000000            	jz	lff_10
  1328                                  
  1329 000008A4 8A1D[367F0000]          	mov	bl, [fbs_shift]
  1330                                  
  1331                                  	; 14/12/2024
  1332 000008AA 89FA                    	mov	edx, edi ; audio buffer start address
  1333                                  
  1334                                  	; 01/12/2024
  1335 000008AC 89C1                    	mov	ecx, eax
  1336 000008AE 803D[D27E0000]08        	cmp	byte [WAVE_BitsPerSample], 8 ; bits per sample (8 or 16)
  1337 000008B5 751E                    	jne	short lff_7 ; 16 bit samples
  1338                                  	; 8 bit samples
  1339 000008B7 FECB                    	dec	bl  ; shift count, 1 = stereo, 2 = mono
  1340 000008B9 740E                    	jz	short lff_6 ; 8 bit, stereo
  1341                                  	; 01/12/2024 (32bit registers)
  1342                                  lff_5:
  1343                                  	; mono & 8 bit
  1344 000008BB AC                      	lodsb
  1345 000008BC 2C80                    	sub	al, 80h ; 08/11/2023
  1346 000008BE C1E008                  	shl	eax, 8 ; convert 8 bit sample to 16 bit sample
  1347 000008C1 66AB                    	stosw	; left channel
  1348 000008C3 66AB                    	stosw	; right channel
  1349 000008C5 E2F4                    	loop	lff_5
  1350 000008C7 EB16                    	jmp	short lff_9
  1351                                  lff_6:
  1352                                  	; stereo & 8 bit
  1353 000008C9 AC                      	lodsb
  1354 000008CA 2C80                    	sub	al, 80h ; 08/11/2023
  1355 000008CC C1E008                  	shl	eax, 8 ; convert 8 bit sample to 16 bit sample
  1356 000008CF 66AB                    	stosw
  1357 000008D1 E2F6                    	loop	lff_6
  1358 000008D3 EB0A                    	jmp	short lff_9
  1359                                  lff_7:
  1360 000008D5 D1E9                    	shr	ecx, 1 ; word count
  1361                                  lff_8:
  1362 000008D7 66AD                    	lodsw
  1363 000008D9 66AB                    	stosw	; left channel
  1364 000008DB 66AB                    	stosw	; right channel
  1365 000008DD E2F8                    	loop	lff_8
  1366                                  lff_9:
  1367                                  	; 14/12/2024
  1368 000008DF 89F8                    	mov	eax, edi
  1369 000008E1 8B0D[4C7F0000]          	mov	ecx, [buffersize] 
  1370 000008E7 01D1                    	add	ecx, edx ; + buffer start address
  1371 000008E9 39C8                    	cmp	eax, ecx	
  1372 000008EB 7225                    	jb	short lff_3
  1373 000008ED C3                      	retn
  1374                                  	
  1375                                  lff_1:  
  1376                                  	; 07/12/2024
  1377                                  	; 01/12/2024
  1378                                  	;sys 	_read, [filehandle], esi, [loadsize] ; edx
  1379                                  	; 14/12/2024
  1380                                  	sys 	_read, [filehandle], edi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000008EE 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000008F4 89F9                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000008F6 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000008FC B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000901 CD40                <1>  int 40h
  1381                                  	; 07/11/2023
  1382 00000903 721B                    	jc	short lff_4 ; error !
  1383                                  
  1384                                  	; 01/12/2024
  1385                                  	; 14/11/2024
  1386 00000905 A3[587F0000]            	mov	[count], eax
  1387                                  
  1388                                  	; 02/12/2024
  1389 0000090A 39D0                    	cmp	eax, edx ; cmp eax, [loadsize]	
  1390 0000090C 7411                    	je	short endLFF
  1391                                  	; edi = buffer (start) address
  1392 0000090E 01C7                    	add	edi, eax
  1393 00000910 89D1                    	mov	ecx, edx
  1394                                  lff_3:
  1395                                  	;call	padfill			; blank pad the remainder
  1396                                  	; 21/12/2024
  1397                                  padfill:
  1398                                  	; 14/12/2024
  1399                                  	; 01/12/2024 (TRDOS 386, 32bit registers)
  1400                                  	; 17/11/2024
  1401                                  	;   di = offset (to be filled with ZEROs)
  1402                                  	;   bp = buffer segment
  1403                                  	;   ax = di = number of bytes loaded
  1404                                  	;   cx = buffer size (> loaded bytes)	
  1405                                  	; 07/11/2023
  1406                                  	; 06/11/2023
  1407                                  	; 17/02/2017
  1408                                  	; 01/12/2024
  1409 00000912 29C1                    	sub	ecx, eax
  1410                                  	; 01/12/2024
  1411                                  	; 25/11/2024
  1412 00000914 31C0                    	xor	eax, eax
  1413                                  	; 14/12/2024
  1414 00000916 F3AA                    	rep	stosb
  1415                                  	; 21/12/2024
  1416                                  	;retn
  1417                                  	; ----------
  1418                                          ;clc				; don't exit with CY yet.
  1419 00000918 800D[DE7E0000]01                or	byte [flags], ENDOFFILE	; end of file flag
  1420                                  endLFF:
  1421 0000091F C3                              retn
  1422                                  lff_4:
  1423                                  	; 08/11/2023
  1424 00000920 B021                    	mov	al, '!'  ; error
  1425 00000922 E80EFEFFFF              	call	tL0
  1426                                  
  1427                                  	; 01/12/2024
  1428 00000927 31C0                    	xor	eax, eax
  1429                                  lff_10:
  1430                                  	; 14/12/2024
  1431 00000929 8B0D[4C7F0000]          	mov	ecx, [buffersize]
  1432 0000092F EBE1                    	jmp	short lff_3
  1433                                  
  1434                                  ; /////
  1435                                  
  1436                                  ; --------------------------------------------------------
  1437                                  ; --------------------------------------------------------
  1438                                  	
  1439                                  write_audio_dev_info:
  1440                                  	; 30/05/2024
  1441                                       	;sys_msg msgAudioCardInfo, 0Fh
  1442                                  	; 01/12/2024
  1443                                  	sys 	_msg, msgAudioCardInfo, 255, 0Fh
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000931 BB[332A0000]        <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000936 B9FF000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000093B BA0F000000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000940 B823000000          <1>  mov eax, %1
    99                              <1> 
   100 00000945 CD40                <1>  int 40h
  1444 00000947 C3                      	retn
  1445                                  
  1446                                  ; --------------------------------------------------------
  1447                                  
  1448                                  write_ac97_pci_dev_info:
  1449                                  	; 19/11/2024
  1450                                  	; 30/05/2024
  1451                                  	; 06/06/2017
  1452                                  	; 03/06/2017
  1453                                  	; BUS/DEV/FN
  1454                                  	;	00000000BBBBBBBBDDDDDFFF00000000
  1455                                  	; DEV/VENDOR
  1456                                  	;	DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV
  1457                                  
  1458 00000948 A1[3C7F0000]            	mov	eax, [dev_vendor]
  1459 0000094D 31DB                    	xor	ebx, ebx
  1460 0000094F 88C3                    	mov	bl, al
  1461 00000951 88DA                    	mov	dl, bl
  1462 00000953 80E30F                  	and	bl, 0Fh
  1463 00000956 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1464 0000095C A2[902B0000]            	mov	[msgVendorId+3], al
  1465 00000961 88D3                    	mov	bl, dl
  1466 00000963 C0EB04                  	shr	bl, 4
  1467 00000966 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1468 0000096C A2[8F2B0000]            	mov	[msgVendorId+2], al
  1469 00000971 88E3                    	mov	bl, ah
  1470 00000973 88DA                    	mov	dl, bl
  1471 00000975 80E30F                  	and	bl, 0Fh
  1472 00000978 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1473 0000097E A2[8E2B0000]            	mov	[msgVendorId+1], al
  1474 00000983 88D3                    	mov	bl, dl
  1475 00000985 C0EB04                  	shr	bl, 4
  1476 00000988 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1477 0000098E A2[8D2B0000]            	mov	[msgVendorId], al
  1478 00000993 C1E810                  	shr	eax, 16
  1479 00000996 88C3                    	mov	bl, al
  1480 00000998 88DA                    	mov	dl, bl
  1481 0000099A 80E30F                  	and	bl, 0Fh
  1482 0000099D 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1483 000009A3 A2[A12B0000]            	mov	[msgDevId+3], al
  1484 000009A8 88D3                    	mov	bl, dl
  1485 000009AA C0EB04                  	shr	bl, 4
  1486 000009AD 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1487 000009B3 A2[A02B0000]            	mov	[msgDevId+2], al
  1488 000009B8 88E3                    	mov	bl, ah
  1489 000009BA 88DA                    	mov	dl, bl
  1490 000009BC 80E30F                  	and	bl, 0Fh
  1491 000009BF 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1492 000009C5 A2[9F2B0000]            	mov	[msgDevId+1], al
  1493 000009CA 88D3                    	mov	bl, dl
  1494 000009CC C0EB04                  	shr	bl, 4
  1495 000009CF 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1496 000009D5 A2[9E2B0000]            	mov	[msgDevId], al
  1497                                  
  1498 000009DA A1[387F0000]            	mov	eax, [bus_dev_fn]
  1499 000009DF C1E808                  	shr	eax, 8
  1500 000009E2 88C3                    	mov	bl, al
  1501 000009E4 88DA                    	mov	dl, bl
  1502 000009E6 80E307                  	and	bl, 7 ; bit 0,1,2
  1503 000009E9 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1504 000009EF A2[C62B0000]            	mov	[msgFncNo+1], al
  1505 000009F4 88D3                    	mov	bl, dl
  1506 000009F6 C0EB03                  	shr	bl, 3
  1507 000009F9 88DA                    	mov	dl, bl
  1508 000009FB 80E30F                  	and	bl, 0Fh
  1509 000009FE 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1510 00000A04 A2[B82B0000]            	mov	[msgDevNo+1], al
  1511 00000A09 88D3                    	mov	bl, dl
  1512 00000A0B C0EB04                  	shr	bl, 4
  1513 00000A0E 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1514 00000A14 A2[B72B0000]            	mov	[msgDevNo], al
  1515 00000A19 88E3                    	mov	bl, ah
  1516 00000A1B 88DA                    	mov	dl, bl
  1517 00000A1D 80E30F                  	and	bl, 0Fh
  1518 00000A20 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1519 00000A26 A2[AC2B0000]            	mov	[msgBusNo+1], al
  1520 00000A2B 88D3                    	mov	bl, dl
  1521 00000A2D C0EB04                  	shr	bl, 4
  1522 00000A30 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1523 00000A36 A2[AB2B0000]            	mov	[msgBusNo], al
  1524                                  
  1525                                  	;mov	ax, [ac97_NamBar]
  1526 00000A3B 66A1[407F0000]          	mov	ax, [NAMBAR]
  1527 00000A41 88C3                    	mov	bl, al
  1528 00000A43 88DA                    	mov	dl, bl
  1529 00000A45 80E30F                  	and	bl, 0Fh
  1530 00000A48 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1531 00000A4E A2[D62B0000]            	mov	[msgNamBar+3], al
  1532 00000A53 88D3                    	mov	bl, dl
  1533 00000A55 C0EB04                  	shr	bl, 4
  1534 00000A58 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1535 00000A5E A2[D52B0000]            	mov	[msgNamBar+2], al
  1536 00000A63 88E3                    	mov	bl, ah
  1537 00000A65 88DA                    	mov	dl, bl
  1538 00000A67 80E30F                  	and	bl, 0Fh
  1539 00000A6A 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1540 00000A70 A2[D42B0000]            	mov	[msgNamBar+1], al
  1541 00000A75 88D3                    	mov	bl, dl
  1542 00000A77 C0EB04                  	shr	bl, 4
  1543 00000A7A 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1544 00000A80 A2[D32B0000]            	mov	[msgNamBar], al
  1545                                  
  1546                                  	;mov	ax, [ac97_NabmBar]
  1547 00000A85 66A1[427F0000]          	mov	ax, [NABMBAR]
  1548 00000A8B 88C3                    	mov	bl, al
  1549 00000A8D 88DA                    	mov	dl, bl
  1550 00000A8F 80E30F                  	and	bl, 0Fh
  1551 00000A92 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1552 00000A98 A2[E62B0000]            	mov	[msgNabmBar+3], al
  1553 00000A9D 88D3                    	mov	bl, dl
  1554 00000A9F C0EB04                  	shr	bl, 4
  1555 00000AA2 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1556 00000AA8 A2[E52B0000]            	mov	[msgNabmBar+2], al
  1557 00000AAD 88E3                    	mov	bl, ah
  1558 00000AAF 88DA                    	mov	dl, bl
  1559 00000AB1 80E30F                  	and	bl, 0Fh
  1560 00000AB4 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1561 00000ABA A2[E42B0000]            	mov	[msgNabmBar+1], al
  1562 00000ABF 88D3                    	mov	bl, dl
  1563 00000AC1 C0EB04                  	shr	bl, 4
  1564 00000AC4 8A83[492B0000]          	mov	al, [hex_chars+ebx]
  1565 00000ACA A2[E32B0000]            	mov	[msgNabmBar], al
  1566                                  
  1567 00000ACF 31C0                    	xor	eax, eax
  1568 00000AD1 A0[DF7E0000]            	mov	al, [ac97_int_ln_reg]
  1569 00000AD6 B10A                    	mov	cl, 10
  1570 00000AD8 F6F1                    	div	cl
  1571                                  	; 23/11/2024
  1572                                  	;add	[msgIRQ], ax
  1573 00000ADA 66053030                	add	ax, 3030h
  1574 00000ADE 66A3[EF2B0000]          	mov	[msgIRQ], ax
  1575                                  	;and	al, al
  1576 00000AE4 3C30                    	cmp	al, 30h
  1577 00000AE6 750D                    	jnz	short _w_ac97imsg_
  1578 00000AE8 A0[F02B0000]            	mov	al, byte [msgIRQ+1]
  1579 00000AED B420                    	mov	ah, ' '
  1580 00000AEF 66A3[EF2B0000]          	mov	[msgIRQ], ax
  1581                                  _w_ac97imsg_:
  1582                                  	; 19/11/2024
  1583 00000AF5 E84E1D0000              	call 	clear_window
  1584 00000AFA B60D                    	mov	dh, 13
  1585 00000AFC B200                    	mov	dl, 0
  1586 00000AFE E8601A0000              	call	setCursorPosition
  1587                                  	;;;
  1588                                  	; 21/12/2024
  1589 00000B03 BD[5A2B0000]            	mov	ebp, msgAC97Info ; message
  1590                                  	; 22/12/2024
  1591                                  	;mov	cl, 07h ; color 
  1592 00000B08 E81F000000              	call	sys_gmsg
  1593                                  	;
  1594                                  	; 30/05/2024
  1595                                  write_VRA_info:
  1596                                  	; 21/12/2024
  1597 00000B0D BD[F42B0000]            	mov	ebp, msgVRAheader ; message
  1598                                  	;mov	cl, 07h ; color 
  1599 00000B12 E815000000              	call	sys_gmsg
  1600                                  	;
  1601 00000B17 803D[AE7E0000]00        	cmp	byte [VRA], 0
  1602 00000B1E 7607                    	jna	short _w_VRAi_no
  1603                                  _w_VRAi_yes:
  1604 00000B20 BD[032C0000]            	mov	ebp, msgVRAyes
  1605 00000B25 EB05                    	jmp	short _w_VRAi_yn_msg
  1606                                  _w_VRAi_no:
  1607 00000B27 BD[092C0000]            	mov	ebp, msgVRAno
  1608                                  _w_VRAi_yn_msg:
  1609                                  	;mov	cl, 07h ; color 
  1610                                  	;call	sys_msg
  1611                                  	;retn
  1612                                  	;jmp	short sys_gmsg
  1613                                  	;;;
  1614                                  ; --------------------------------------------------------
  1615                                  
  1616                                  	; 22/12/2024
  1617                                  	;;;
  1618                                  	; 21/12/2024
  1619                                  	; (write message in VGA/VESA-VBE mode)
  1620                                  sys_gmsg:
  1621 00000B2C 8A4500                  	mov	al, [ebp]
  1622 00000B2F 20C0                    	and	al, al
  1623 00000B31 7458                    	jz	short sys_gmsg_ok
  1624 00000B33 3C20                    	cmp	al, 20h
  1625 00000B35 731E                    	jnb	short sys_gmsg_3
  1626 00000B37 3C0D                    	cmp	al, CR ; 13
  1627 00000B39 750C                    	jne	short sys_gmsg_2
  1628                                  	; carriege return, move cursor to column 0
  1629 00000B3B 66C705[94740000]00-     	mov	word [screenpos], 0
  1629 00000B43 00                 
  1630                                  sys_gmsg_1:
  1631 00000B44 45                      	inc	ebp
  1632 00000B45 EBE5                    	jmp	short sys_gmsg
  1633                                  sys_gmsg_2:
  1634 00000B47 3C0A                    	cmp	al, LF ; 10
  1635 00000B49 7540                    	jne	short sys_gmsg_ok ; 22/12/2024
  1636                                  	; line feed, move cursor to next row
  1637 00000B4B 668305[96740000]10      	add	word [screenpos+2], 16
  1638 00000B53 EBEF                    	jmp	short sys_gmsg_1
  1639                                  sys_gmsg_3:
  1640 00000B55 8B35[94740000]          	mov	esi, [screenpos]
  1641                                  		; hw = (cursor) row
  1642                                  		; si = (cursor) column
  1643 00000B5B B907000000              	mov	ecx, 07h ; gray (light)
  1644 00000B60 E8B71B0000              	call	write_character
  1645 00000B65 83C608                  	add	esi, 8
  1646                                  	;;;
  1647 00000B68 6681FE8002              	cmp	si, 640
  1648 00000B6D 7213                    	jb	short sys_gmsg_5
  1649 00000B6F C1EE10                  	shr	esi, 16
  1650 00000B72 6683C610                	add	si, 16
  1651 00000B76 6681FEE001              	cmp	si, 480
  1652 00000B7B 7202                    	jb	short sys_gmsg_4
  1653 00000B7D 31F6                    	xor	esi, esi
  1654                                  sys_gmsg_4:
  1655 00000B7F C1E610                  	shl	esi, 16
  1656                                  	;;;
  1657                                  sys_gmsg_5:
  1658 00000B82 8935[94740000]          	mov	[screenpos], esi
  1659 00000B88 45                      	inc	ebp
  1660 00000B89 EBA1                    	jmp	short sys_gmsg
  1661                                  sys_gmsg_ok:
  1662 00000B8B C3                      	retn
  1663                                  	;;;
  1664                                  
  1665                                  ; --------------------------------------------------------
  1666                                  
  1667                                  ; 02/02/2025
  1668                                  ; 07/12/2024 - playwav9.s
  1669                                  ; 01/12/2024 - ac97play.s
  1670                                  ; 29/05/2024
  1671                                  ; 26/11/2023
  1672                                  ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption)
  1673                                  ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm
  1674                                  ; 14/11/2023
  1675                                  ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion)
  1676                                  ; --------------------------------------------------------
  1677                                  
  1678                                  ;;Note:	At the end of every buffer load,
  1679                                  ;;	during buffer switch/swap, there will be discontinuity
  1680                                  ;;	between the last converted sample and the 1st sample
  1681                                  ;;	of the next buffer.
  1682                                  ;;	(like as a dot noises vaguely between normal sound samples)
  1683                                  ;;	-To avoid this defect, the 1st sample of
  1684                                  ;;	the next buffer may be read from the wav file but
  1685                                  ;;	the file pointer would need to be set to 1 sample back
  1686                                  ;;	again via seek system call. Time comsumption problem! -
  1687                                  ;;
  1688                                  ;;	Erdogan Tan - 15/11/2023
  1689                                  ;;
  1690                                  ;;	((If entire wav data would be loaded at once.. conversion
  1691                                  ;;	defect/noise would disappear.. but for DOS, to keep
  1692                                  ;;	64KB buffer limit is important also it is important
  1693                                  ;;	for running under 1MB barrier without HIMEM.SYS or DPMI.
  1694                                  ;;	I have tested this program by using 2-30MB wav files.))
  1695                                  ;;
  1696                                  ;;	Test Computer:	ASUS desktop/mainboard, M2N4-SLI, 2010.
  1697                                  ;;			AMD Athlon 64 X2 2200 MHZ CPU.
  1698                                  ;;		       	NFORCE4 (CK804) AC97 audio hardware.
  1699                                  ;;			Realtek ALC850 codec.
  1700                                  ;;		       	Retro DOS v4.2 (MSDOS 6.22) operating system.
  1701                                  
  1702                                  load_8khz_mono_8_bit:
  1703                                  	; 02/02/2025
  1704                                  	; 15/11/2023
  1705                                  	; 14/11/2023
  1706                                  	; 13/11/2023
  1707 00000B8C F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  1708                                  					; last of the file?
  1709 00000B93 7402                    	jz	short lff8m_0		; no
  1710 00000B95 F9                      	stc
  1711 00000B96 C3                      	retn
  1712                                  
  1713                                  lff8m_0:
  1714                                  	; 01/12/2024
  1715                                  	; edi = audio buffer address
  1716 00000B97 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  1717                                          ;mov	edx, [loadsize]
  1718                                  
  1719                                  	; esi = buffer address
  1720                                  	;; edx = buffer size
  1721                                  
  1722                                  	; load file into memory
  1723                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000B9C 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000BA2 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000BA4 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000BAA B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000BAF CD40                <1>  int 40h
  1724 00000BB1 7305                    	jnc	short lff8m_6
  1725 00000BB3 E9AF000000              	jmp	lff8m_5  ; error !
  1726                                  
  1727                                  lff8m_6:
  1728                                  	; 01/12/2024
  1729 00000BB8 A3[587F0000]            	mov	[count], eax
  1730                                  	;;;
  1731                                  	; 07/12/2024
  1732                                  	;mov	edi, audio_buffer
  1733                                  	;;;
  1734 00000BBD 21C0                    	and	eax, eax
  1735 00000BBF 0F8499000000            	jz	lff8_eof
  1736                                  
  1737 00000BC5 89C1                    	mov	ecx, eax		; byte count
  1738                                  lff8m_1:
  1739 00000BC7 AC                      	lodsb
  1740 00000BC8 A2[05230000]            	mov	[previous_val], al
  1741 00000BCD 2C80                    	sub	al, 80h
  1742 00000BCF 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  1743 00000BD3 66AB                    	stosw		; original sample (left channel)
  1744 00000BD5 66AB                    	stosw		; original sample (right channel)
  1745                                  	; 02/02/2025
  1746                                  	;xor	eax, eax
  1747 00000BD7 8A06                    	mov	al, [esi]
  1748 00000BD9 49                      	dec	ecx
  1749 00000BDA 7502                    	jnz	short lff8m_2
  1750 00000BDC B080                    	mov	al, 80h
  1751                                  lff8m_2:
  1752                                  	;mov	[next_val], ax
  1753 00000BDE 88C7                    	mov	bh, al	; [next_val]
  1754 00000BE0 8A25[05230000]          	mov	ah, [previous_val]
  1755 00000BE6 00E0                    	add	al, ah	; [previous_val]
  1756 00000BE8 D0D8                    	rcr	al, 1
  1757 00000BEA 88C2                    	mov	dl, al	; this is interpolated middle (3th) sample
  1758 00000BEC 00E0                    	add	al, ah	; [previous_val]
  1759 00000BEE D0D8                    	rcr	al, 1	
  1760 00000BF0 88C3                    	mov	bl, al 	; this is temporary interpolation value
  1761 00000BF2 00E0                    	add	al, ah	; [previous_val]
  1762 00000BF4 D0D8                    	rcr	al, 1
  1763 00000BF6 2C80                    	sub	al, 80h
  1764 00000BF8 66C1E008                	shl	ax, 8	
  1765 00000BFC 66AB                    	stosw		; this is 1st interpolated sample (L)
  1766 00000BFE 66AB                    	stosw		; this is 1st interpolated sample (R)
  1767 00000C00 88D8                    	mov	al, bl
  1768 00000C02 00D0                    	add	al, dl
  1769 00000C04 D0D8                    	rcr	al, 1
  1770 00000C06 2C80                    	sub	al, 80h
  1771 00000C08 66C1E008                	shl	ax, 8
  1772 00000C0C 66AB                    	stosw		; this is 2nd interpolated sample (L)
  1773 00000C0E 66AB                    	stosw		; this is 2nd interpolated sample (R)
  1774 00000C10 88D0                    	mov	al, dl
  1775 00000C12 2C80                    	sub	al, 80h
  1776 00000C14 66C1E008                	shl	ax, 8
  1777 00000C18 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  1778 00000C1A 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  1779                                  	;mov	al, [next_val]
  1780 00000C1C 88F8                    	mov	al, bh
  1781 00000C1E 00D0                    	add	al, dl
  1782 00000C20 D0D8                    	rcr	al, 1
  1783 00000C22 88C3                    	mov	bl, al	; this is temporary interpolation value
  1784 00000C24 00D0                    	add	al, dl
  1785 00000C26 D0D8                    	rcr	al, 1
  1786 00000C28 2C80                    	sub	al, 80h
  1787 00000C2A 66C1E008                	shl	ax, 8
  1788 00000C2E 66AB                    	stosw		; this is 4th interpolated sample (L)
  1789 00000C30 66AB                    	stosw		; this is 4th interpolated sample (R)
  1790                                  	;mov	al, [next_val]
  1791 00000C32 88F8                    	mov	al, bh
  1792 00000C34 00D8                    	add	al, bl
  1793 00000C36 D0D8                    	rcr	al, 1
  1794 00000C38 2C80                    	sub	al, 80h
  1795 00000C3A 66C1E008                	shl	ax, 8
  1796 00000C3E 66AB                    	stosw		; this is 5th interpolated sample (L)
  1797 00000C40 66AB                    	stosw		; this is 5th interpolated sample (R)
  1798                                  	; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  1799 00000C42 09C9                    	or	ecx, ecx
  1800 00000C44 7581                    	jnz	short lff8m_1
  1801                                  
  1802                                  	; --------------
  1803                                  
  1804                                  lff8s_3:
  1805                                  lff8m_3:
  1806                                  lff8s2_3:
  1807                                  lff8m2_3:
  1808                                  lff16s_3:
  1809                                  lff16m_3:
  1810                                  lff16s2_3:
  1811                                  lff16m2_3:
  1812                                  lff24_3:
  1813                                  lff32_3:
  1814                                  lff44_3:
  1815                                  lff22_3:
  1816                                  lff11_3:
  1817                                  lff12_3: 	; 02/02/2025
  1818                                  	; 08/12/2024 (BugFix)
  1819                                  	; 31/05/2024 (BugFix)
  1820 00000C46 8B0D[4C7F0000]          	mov	ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size
  1821                                  	;shl	ecx, 1	; byte count ; Bug !
  1822                                  	; 08/12/2024
  1823 00000C4C 81C1[00800000]          	add	ecx, audio_buffer
  1824 00000C52 29F9                    	sub	ecx, edi
  1825 00000C54 7607                    	jna	short lff8m_4
  1826                                  	;inc	ecx
  1827 00000C56 C1E902                  	shr	ecx, 2
  1828 00000C59 31C0                    	xor	eax, eax ; fill (remain part of) buffer with zeros
  1829 00000C5B F3AB                    	rep	stosd
  1830                                  lff8m_4:
  1831                                  	; 31/05/2024 (BugFix)
  1832                                  	; cf=1 ; Bug !
  1833                                  	; 08/12/2024
  1834                                  	;clc
  1835 00000C5D C3                      	retn
  1836                                  
  1837                                  lff8_eof:
  1838                                  lff16_eof:
  1839                                  lff24_eof:
  1840                                  lff32_eof:
  1841                                  lff44_eof:
  1842                                  lff22_eof:
  1843                                  lff11_eof:
  1844                                  lff12_eof:	; 02/02/2025
  1845                                  	; 15/11/2023
  1846 00000C5E C605[DE7E0000]01        	mov	byte [flags], ENDOFFILE
  1847 00000C65 EBDF                    	jmp	short lff8m_3
  1848                                  
  1849                                  lff8s_5:
  1850                                  lff8m_5:
  1851                                  lff8s2_5:
  1852                                  lff8m2_5:
  1853                                  lff16s_5:
  1854                                  lff16m_5:
  1855                                  lff16s2_5:
  1856                                  lff16m2_5:
  1857                                  lff24_5:
  1858                                  lff32_5:
  1859                                  lff44_5:
  1860                                  lff22_5:
  1861                                  lff11_5:
  1862                                  lff12_5:	; 02/02/2025
  1863 00000C67 B021                    	mov	al, '!'  ; error
  1864 00000C69 E8C7FAFFFF              	call	tL0
  1865                                  	
  1866                                  	;jmp	short lff8m_3
  1867                                  	; 15/11/2023
  1868 00000C6E EBEE                    	jmp	lff8_eof
  1869                                  
  1870                                  	; --------------
  1871                                  
  1872                                  load_8khz_stereo_8_bit:
  1873                                  	; 02/02/2025
  1874                                  	; 15/11/2023
  1875                                  	; 14/11/2023
  1876                                  	; 13/11/2023
  1877 00000C70 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  1878                                  					; last of the file?
  1879 00000C77 7402                    	jz	short lff8s_0		; no
  1880 00000C79 F9                      	stc
  1881 00000C7A C3                      	retn
  1882                                  
  1883                                  lff8s_0:
  1884                                  	; 01/12/2024
  1885                                  	; edi = audio buffer address
  1886 00000C7B BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  1887                                          ;mov	edx, [loadsize]
  1888                                  
  1889                                  	; esi = buffer address
  1890                                  	;; edx = buffer size
  1891                                  
  1892                                  	; load file into memory
  1893                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000C80 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000C86 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000C88 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000C8E B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000C93 CD40                <1>  int 40h
  1894 00000C95 72D0                    	jc	short lff8s_5 ; error !
  1895                                  
  1896                                  	; 01/12/2024
  1897 00000C97 A3[587F0000]            	mov	[count], eax
  1898                                  	;;;
  1899                                  	; 07/12/2024
  1900                                  	;mov	edi, audio_buffer
  1901                                  	;;;
  1902 00000C9C D1E8                    	shr	eax, 1
  1903 00000C9E 74BE                    	jz	short lff8_eof
  1904                                  
  1905 00000CA0 89C1                    	mov	ecx, eax	; word count
  1906                                  lff8s_1:
  1907 00000CA2 AC                      	lodsb
  1908 00000CA3 A2[05230000]            	mov	[previous_val_l], al
  1909 00000CA8 2C80                    	sub	al, 80h
  1910 00000CAA 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  1911 00000CAE 66AB                    	stosw		; original sample (L)
  1912 00000CB0 AC                      	lodsb
  1913 00000CB1 A2[07230000]            	mov	[previous_val_r], al
  1914 00000CB6 2C80                    	sub	al, 80h
  1915 00000CB8 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  1916 00000CBC 66AB                    	stosw		; original sample (R)
  1917                                  
  1918                                  	;xor	eax, eax
  1919                                  	; 02/02/2025
  1920 00000CBE 668B06                  	mov	ax, [esi]
  1921 00000CC1 49                      	dec	ecx
  1922 00000CC2 7504                    	jnz	short lff8s_2
  1923                                  		; convert 8 bit sample to 16 bit sample
  1924 00000CC4 66B88080                	mov	ax, 8080h
  1925                                  lff8s_2:
  1926 00000CC8 A2[09230000]            	mov	[next_val_l], al
  1927 00000CCD 8825[0B230000]          	mov	[next_val_r], ah
  1928 00000CD3 8A25[05230000]          	mov	ah, [previous_val_l]
  1929 00000CD9 00E0                    	add	al, ah
  1930 00000CDB D0D8                    	rcr	al, 1
  1931 00000CDD 88C2                    	mov	dl, al	; this is interpolated middle (3th) sample (L)
  1932 00000CDF 00E0                    	add	al, ah
  1933 00000CE1 D0D8                    	rcr	al, 1
  1934 00000CE3 88C3                    	mov	bl, al	; this is temporary interpolation value (L)
  1935 00000CE5 00E0                    	add	al, ah
  1936 00000CE7 D0D8                    	rcr	al, 1
  1937 00000CE9 2C80                    	sub	al, 80h
  1938 00000CEB 66C1E008                	shl	ax, 8
  1939 00000CEF 66AB                    	stosw		; this is 1st interpolated sample (L)
  1940 00000CF1 A0[0B230000]            	mov	al, [next_val_r]
  1941 00000CF6 8A25[07230000]          	mov	ah, [previous_val_r]
  1942 00000CFC 00E0                    	add	al, ah
  1943 00000CFE D0D8                    	rcr	al, 1
  1944 00000D00 88C6                    	mov	dh, al	; this is interpolated middle (3th) sample (R)
  1945 00000D02 00E0                    	add	al, ah
  1946 00000D04 D0D8                    	rcr	al, 1
  1947 00000D06 88C7                    	mov	bh, al	; this is temporary interpolation value (R)
  1948 00000D08 00E0                    	add	al, ah
  1949 00000D0A D0D8                    	rcr	al, 1
  1950 00000D0C 2C80                    	sub	al, 80h
  1951 00000D0E 66C1E008                	shl	ax, 8
  1952 00000D12 66AB                    	stosw		; this is 1st interpolated sample (R)
  1953 00000D14 88D8                    	mov	al, bl
  1954 00000D16 00D0                    	add	al, dl
  1955 00000D18 D0D8                    	rcr	al, 1
  1956 00000D1A 2C80                    	sub	al, 80h
  1957 00000D1C 66C1E008                	shl	ax, 8
  1958 00000D20 66AB                    	stosw		; this is 2nd interpolated sample (L)
  1959 00000D22 88F8                    	mov	al, bh
  1960 00000D24 00F0                    	add	al, dh
  1961 00000D26 D0D8                    	rcr	al, 1
  1962 00000D28 2C80                    	sub	al, 80h
  1963 00000D2A 66C1E008                	shl	ax, 8
  1964 00000D2E 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  1965 00000D30 88D0                    	mov	al, dl
  1966 00000D32 2C80                    	sub	al, 80h
  1967 00000D34 66C1E008                	shl	ax, 8
  1968 00000D38 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  1969 00000D3A 88F0                    	mov	al, dh
  1970 00000D3C 2C80                    	sub	al, 80h
  1971 00000D3E 66C1E008                	shl	ax, 8
  1972 00000D42 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  1973 00000D44 A0[09230000]            	mov	al, [next_val_l]
  1974 00000D49 00D0                    	add	al, dl
  1975 00000D4B D0D8                    	rcr	al, 1
  1976 00000D4D 88C3                    	mov	bl, al	; this is temporary interpolation value (L)
  1977 00000D4F 00D0                    	add	al, dl
  1978 00000D51 D0D8                    	rcr	al, 1
  1979 00000D53 2C80                    	sub	al, 80h
  1980 00000D55 66C1E008                	shl	ax, 8
  1981 00000D59 66AB                    	stosw		; this is 4th interpolated sample (L)
  1982 00000D5B A0[0B230000]            	mov	al, [next_val_r]
  1983 00000D60 00F0                    	add	al, dh
  1984 00000D62 D0D8                    	rcr	al, 1
  1985 00000D64 88C7                    	mov	bh, al	; this is temporary interpolation value (R)
  1986 00000D66 00F0                    	add	al, dh
  1987 00000D68 D0D8                    	rcr	al, 1
  1988 00000D6A 2C80                    	sub	al, 80h
  1989 00000D6C 66C1E008                	shl	ax, 8
  1990 00000D70 66AB                    	stosw		; this is 4th interpolated sample (R)
  1991 00000D72 A0[09230000]            	mov	al, [next_val_l]
  1992 00000D77 00D8                    	add	al, bl
  1993 00000D79 D0D8                    	rcr	al, 1
  1994 00000D7B 2C80                    	sub	al, 80h
  1995 00000D7D 66C1E008                	shl	ax, 8
  1996 00000D81 66AB                    	stosw		; this is 5th interpolated sample (L)
  1997 00000D83 A0[0B230000]            	mov	al, [next_val_r]
  1998 00000D88 00F8                    	add	al, bh
  1999 00000D8A D0D8                    	rcr	al, 1
  2000 00000D8C 2C80                    	sub	al, 80h
  2001 00000D8E 66C1E008                	shl	ax, 8
  2002 00000D92 66AB                    	stosw		; this is 5th interpolated sample (R)
  2003                                  	; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2004 00000D94 E305                    	jecxz	lff8s_6
  2005 00000D96 E907FFFFFF              	jmp	lff8s_1
  2006                                  lff8s_6:
  2007 00000D9B E9A6FEFFFF              	jmp	lff8s_3
  2008                                  
  2009                                  load_8khz_mono_16_bit:
  2010                                  	; 02/02/2025
  2011                                  	; 13/11/2023
  2012 00000DA0 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2013                                  					; last of the file?
  2014 00000DA7 7402                    	jz	short lff8m2_0		; no
  2015 00000DA9 F9                      	stc
  2016 00000DAA C3                      	retn
  2017                                  
  2018                                  lff8m2_0:
  2019                                  	; 01/12/2024
  2020                                  	; edi = audio buffer address
  2021 00000DAB BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2022                                          ;mov	edx, [loadsize]
  2023                                  
  2024                                  	; esi = buffer address
  2025                                  	;; edx = buffer size
  2026                                  
  2027                                  	; load file into memory
  2028                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000DB0 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000DB6 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000DB8 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000DBE B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000DC3 CD40                <1>  int 40h
  2029 00000DC5 0F82A0000000            	jc	lff8m2_7 ; error !
  2030                                  
  2031                                  	; 01/12/2024
  2032 00000DCB A3[587F0000]            	mov	[count], eax
  2033                                  	;;;
  2034                                  	; 07/12/2024
  2035                                  	;mov	edi, audio_buffer
  2036                                  	;;;
  2037 00000DD0 D1E8                    	shr	eax, 1
  2038 00000DD2 7505                    	jnz	short lff8m2_8
  2039 00000DD4 E985FEFFFF              	jmp	lff8_eof
  2040                                  
  2041                                  lff8m2_8:
  2042 00000DD9 89C1                    	mov	ecx, eax	; word count
  2043                                  lff8m2_1:
  2044 00000DDB 66AD                    	lodsw
  2045 00000DDD 66AB                    	stosw		; original sample (left channel)
  2046 00000DDF 66AB                    	stosw		; original sample (right channel)
  2047 00000DE1 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2048 00000DE4 66A3[05230000]          	mov	[previous_val], ax
  2049                                  	; 02/02/2025
  2050 00000DEA 668B06                  	mov	ax, [esi]
  2051 00000DED 49                      	dec	ecx
  2052 00000DEE 7502                    	jnz	short lff8m2_2
  2053 00000DF0 31C0                    	xor	eax, eax
  2054                                  lff8m2_2:
  2055 00000DF2 80C480                  	add	ah, 80h ; convert sound level to 0-65535 format
  2056 00000DF5 89C5                    	mov	ebp, eax	; [next_val]
  2057 00000DF7 660305[05230000]        	add	ax, [previous_val]
  2058 00000DFE 66D1D8                  	rcr	ax, 1
  2059 00000E01 89C2                    	mov	edx, eax ; this is interpolated middle (3th) sample
  2060 00000E03 660305[05230000]        	add	ax, [previous_val]
  2061 00000E0A 66D1D8                  	rcr	ax, 1	; this is temporary interpolation value
  2062 00000E0D 89C3                    	mov	ebx, eax 		
  2063 00000E0F 660305[05230000]        	add	ax, [previous_val]
  2064 00000E16 66D1D8                  	rcr	ax, 1
  2065 00000E19 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2066 00000E1C 66AB                    	stosw		; this is 1st interpolated sample (L)
  2067 00000E1E 66AB                    	stosw		; this is 1st interpolated sample (R)
  2068 00000E20 89D8                    	mov	eax, ebx
  2069 00000E22 6601D0                  	add	ax, dx
  2070 00000E25 66D1D8                  	rcr	ax, 1
  2071 00000E28 80EC80                  	sub	ah, 80h
  2072 00000E2B 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2073 00000E2D 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2074 00000E2F 89D0                    	mov	eax, edx
  2075 00000E31 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2076 00000E34 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2077 00000E36 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2078 00000E38 89E8                    	mov	eax, ebp
  2079 00000E3A 6601D0                  	add	ax, dx
  2080 00000E3D 66D1D8                  	rcr	ax, 1
  2081 00000E40 89C3                    	mov	ebx, eax ; this is temporary interpolation value
  2082 00000E42 6601D0                  	add	ax, dx
  2083 00000E45 66D1D8                  	rcr	ax, 1
  2084 00000E48 80EC80                  	sub	ah, 80h
  2085 00000E4B 66AB                    	stosw		; this is 4th interpolated sample (L)
  2086 00000E4D 66AB                    	stosw		; this is 4th interpolated sample (R)
  2087 00000E4F 89E8                    	mov	eax, ebp
  2088 00000E51 6601D8                  	add	ax, bx
  2089 00000E54 66D1D8                  	rcr	ax, 1
  2090 00000E57 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2091 00000E5A 66AB                    	stosw		; this is 5th interpolated sample (L)
  2092 00000E5C 66AB                    	stosw		; this is 5th interpolated sample (R)
  2093                                  	; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2094 00000E5E 09C9                    	or	ecx, ecx
  2095 00000E60 0F8575FFFFFF            	jnz	lff8m2_1
  2096 00000E66 E9DBFDFFFF              	jmp	lff8m2_3
  2097                                  
  2098                                  lff8m2_7:
  2099                                  lff8s2_7:
  2100 00000E6B E9F7FDFFFF              	jmp	lff8m2_5  ; error
  2101                                  
  2102                                  load_8khz_stereo_16_bit:
  2103                                  	; 02/02/2025
  2104                                  	; 16/11/2023
  2105                                  	; 15/11/2023
  2106                                  	; 13/11/2023
  2107 00000E70 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2108                                  					; last of the file?
  2109 00000E77 7402                    	jz	short lff8s2_0		; no
  2110 00000E79 F9                      	stc
  2111 00000E7A C3                      	retn
  2112                                  
  2113                                  lff8s2_0:
  2114                                  	; 01/12/2024
  2115                                  	; edi = audio buffer address
  2116 00000E7B BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2117                                          ;mov	edx, [loadsize]
  2118                                  
  2119                                  	; esi = buffer address
  2120                                  	;; edx = buffer size
  2121                                  
  2122                                  	; load file into memory
  2123                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000E80 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000E86 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000E88 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000E8E B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000E93 CD40                <1>  int 40h
  2124 00000E95 72D4                    	jc	short lff8s2_7 ; error !
  2125                                  
  2126                                  	; 01/12/2024
  2127 00000E97 A3[587F0000]            	mov	[count], eax
  2128                                  	;;;
  2129                                  	; 07/12/2024
  2130                                  	;mov	edi, audio_buffer
  2131                                  	;;;
  2132 00000E9C C1E802                  	shr	eax, 2
  2133 00000E9F 7505                    	jnz	short lff8s2_8
  2134 00000EA1 E9B8FDFFFF              	jmp	lff8_eof
  2135                                  
  2136                                  lff8s2_8:
  2137 00000EA6 89C1                    	mov	ecx, eax ; dword count
  2138                                  lff8s2_1:
  2139 00000EA8 66AD                    	lodsw
  2140 00000EAA 66AB                    	stosw		; original sample (L)
  2141                                  	; 15/11/2023
  2142 00000EAC 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2143 00000EAF 66A3[05230000]          	mov	[previous_val_l], ax
  2144 00000EB5 66AD                    	lodsw
  2145 00000EB7 66AB                    	stosw		; original sample (R)
  2146 00000EB9 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2147 00000EBC 66A3[07230000]          	mov	[previous_val_r], ax
  2148                                  	; 02/02/2025
  2149 00000EC2 668B06                  	mov	ax, [esi]
  2150 00000EC5 668B5602                	mov	dx, [esi+2]
  2151                                  	; 16/11/2023
  2152 00000EC9 49                      	dec	ecx
  2153 00000ECA 7504                    	jnz	short lff8s2_2
  2154 00000ECC 31D2                    	xor	edx, edx
  2155 00000ECE 31C0                    	xor	eax, eax
  2156                                  lff8s2_2:
  2157 00000ED0 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2158 00000ED3 66A3[09230000]          	mov	[next_val_l], ax
  2159 00000ED9 80C680                  	add	dh, 80h	; convert sound level to 0-65535 format
  2160 00000EDC 668915[0B230000]        	mov	[next_val_r], dx
  2161 00000EE3 660305[05230000]        	add	ax, [previous_val_l]
  2162 00000EEA 66D1D8                  	rcr	ax, 1
  2163 00000EED 89C2                    	mov	edx, eax ; this is interpolated middle (3th) sample (L)
  2164 00000EEF 660305[05230000]        	add	ax, [previous_val_l]
  2165 00000EF6 66D1D8                  	rcr	ax, 1	
  2166 00000EF9 89C3                    	mov	ebx, eax ; this is temporary interpolation value (L)
  2167 00000EFB 660305[05230000]        	add	ax, [previous_val_l]
  2168 00000F02 66D1D8                  	rcr	ax, 1
  2169 00000F05 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2170 00000F08 66AB                    	stosw		; this is 1st interpolated sample (L)
  2171 00000F0A 66A1[0B230000]          	mov	ax, [next_val_r]
  2172 00000F10 660305[07230000]        	add	ax, [previous_val_r]
  2173 00000F17 66D1D8                  	rcr	ax, 1
  2174 00000F1A 89C5                    	mov	ebp, eax ; this is interpolated middle (3th) sample (R)
  2175 00000F1C 660305[07230000]        	add	ax, [previous_val_r]
  2176 00000F23 66D1D8                  	rcr	ax, 1
  2177 00000F26 50                      	push	eax ; *	; this is temporary interpolation value (R)
  2178 00000F27 660305[07230000]        	add	ax, [previous_val_r]
  2179 00000F2E 66D1D8                  	rcr	ax, 1
  2180 00000F31 80EC80                  	sub	ah, 80h
  2181 00000F34 66AB                    	stosw		; this is 1st interpolated sample (R)
  2182 00000F36 89D8                    	mov	eax, ebx
  2183 00000F38 6601D0                  	add	ax, dx
  2184 00000F3B 66D1D8                  	rcr	ax, 1
  2185 00000F3E 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2186 00000F41 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2187 00000F43 58                      	pop	eax ; *
  2188 00000F44 6601E8                  	add	ax, bp
  2189 00000F47 66D1D8                  	rcr	ax, 1
  2190 00000F4A 80EC80                  	sub	ah, 80h
  2191 00000F4D 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2192 00000F4F 89D0                    	mov	eax, edx
  2193 00000F51 80EC80                  	sub	ah, 80h
  2194 00000F54 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2195 00000F56 89E8                    	mov	eax, ebp
  2196 00000F58 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2197 00000F5B 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2198 00000F5D 66A1[09230000]          	mov	ax, [next_val_l]
  2199 00000F63 6601D0                  	add	ax, dx
  2200 00000F66 66D1D8                  	rcr	ax, 1
  2201 00000F69 89C3                    	mov	ebx, eax ; this is temporary interpolation value (L)
  2202 00000F6B 6601D0                  	add	ax, dx
  2203 00000F6E 66D1D8                  	rcr	ax, 1
  2204 00000F71 80EC80                  	sub	ah, 80h
  2205 00000F74 66AB                    	stosw		; this is 4th interpolated sample (L)
  2206 00000F76 66A1[0B230000]          	mov	ax, [next_val_r]
  2207 00000F7C 6601E8                  	add	ax, bp
  2208 00000F7F 66D1D8                  	rcr	ax, 1
  2209 00000F82 50                      	push	eax ; ** ; this is temporary interpolation value (R)
  2210 00000F83 6601E8                  	add	ax, bp
  2211 00000F86 66D1D8                  	rcr	ax, 1
  2212 00000F89 80EC80                  	sub	ah, 80h
  2213 00000F8C 66AB                    	stosw		; this is 4th interpolated sample (R)
  2214 00000F8E 66A1[09230000]          	mov	ax, [next_val_l]
  2215 00000F94 6601D8                  	add	ax, bx
  2216 00000F97 66D1D8                  	rcr	ax, 1
  2217 00000F9A 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2218 00000F9D 66AB                    	stosw		; this is 5th interpolated sample (L)
  2219 00000F9F 58                      	pop	eax ; **
  2220 00000FA0 660305[0B230000]        	add	ax, [next_val_r]
  2221 00000FA7 66D1D8                  	rcr	ax, 1
  2222 00000FAA 80EC80                  	sub	ah, 80h
  2223 00000FAD 66AB                    	stosw		; this is 5th interpolated sample (R)
  2224                                  	; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2225 00000FAF E305                    	jecxz	lff8_s2_9
  2226 00000FB1 E9F2FEFFFF              	jmp	lff8s2_1
  2227                                  lff8_s2_9:
  2228 00000FB6 E98BFCFFFF              	jmp	lff8s2_3
  2229                                  
  2230                                  ; .....................
  2231                                  
  2232                                  load_16khz_mono_8_bit:
  2233                                  	; 02/02/2025
  2234                                  	; 14/11/2023
  2235                                  	; 13/11/2023
  2236 00000FBB F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2237                                  					; last of the file?
  2238 00000FC2 7402                    	jz	short lff16m_0		; no
  2239 00000FC4 F9                      	stc
  2240 00000FC5 C3                      	retn
  2241                                  
  2242                                  lff16m_0:
  2243                                  	; 01/12/2024
  2244                                  	; edi = audio buffer address
  2245 00000FC6 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2246                                          ;mov	edx, [loadsize]
  2247                                  
  2248                                  	; esi = buffer address
  2249                                  	;; edx = buffer size
  2250                                  
  2251                                  	; load file into memory
  2252                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00000FCB 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00000FD1 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00000FD3 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00000FD9 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00000FDE CD40                <1>  int 40h
  2253 00000FE0 7253                    	jc	short lff16m_7 ; error !
  2254                                  
  2255                                  	; 01/12/2024
  2256 00000FE2 A3[587F0000]            	mov	[count], eax
  2257                                  	;;;
  2258                                  	; 07/12/2024
  2259                                  	;mov	edi, audio_buffer
  2260                                  	;;;
  2261 00000FE7 21C0                    	and	eax, eax
  2262 00000FE9 7505                    	jnz	short lff16m_8
  2263 00000FEB E96EFCFFFF              	jmp	lff16_eof
  2264                                  
  2265                                  lff16m_8:
  2266 00000FF0 89C1                    	mov	ecx, eax		; byte count
  2267                                  lff16m_1:
  2268 00000FF2 AC                      	lodsb
  2269                                  	;mov	[previous_val], al
  2270 00000FF3 88C3                    	mov	bl, al
  2271 00000FF5 2C80                    	sub	al, 80h
  2272 00000FF7 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2273 00000FFB 66AB                    	stosw		; original sample (left channel)
  2274 00000FFD 66AB                    	stosw		; original sample (right channel)
  2275                                  	;xor	eax, eax
  2276                                  	; 02/02/2025
  2277 00000FFF 8A06                    	mov	al, [esi]
  2278 00001001 49                      	dec	ecx
  2279 00001002 7502                    	jnz	short lff16m_2
  2280                                  	; 14/11/2023
  2281 00001004 B080                    	mov	al, 80h
  2282                                  lff16m_2:
  2283                                  	;mov	[next_val], al
  2284 00001006 88C7                    	mov	bh, al
  2285                                  	;add	al, [previous_val]
  2286 00001008 00D8                    	add	al, bl
  2287 0000100A D0D8                    	rcr	al, 1
  2288 0000100C 88C2                    	mov	dl, al	; this is interpolated middle (temp) sample
  2289                                  	;add	al, [previous_val]
  2290 0000100E 00D8                    	add	al, bl
  2291 00001010 D0D8                    	rcr	al, 1
  2292 00001012 2C80                    	sub	al, 80h
  2293 00001014 66C1E008                	shl	ax, 8
  2294 00001018 66AB                    	stosw		; this is 1st interpolated sample (L)
  2295 0000101A 66AB                    	stosw		; this is 1st interpolated sample (R)
  2296                                  	;mov	al, [next_val]
  2297 0000101C 88F8                    	mov	al, bh
  2298 0000101E 00D0                    	add	al, dl
  2299 00001020 D0D8                    	rcr	al, 1
  2300 00001022 2C80                    	sub	al, 80h
  2301 00001024 66C1E008                	shl	ax, 8
  2302 00001028 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2303 0000102A 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2304                                  	
  2305                                  	; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2306 0000102C 09C9                    	or	ecx, ecx
  2307 0000102E 75C2                    	jnz	short lff16m_1
  2308 00001030 E911FCFFFF              	jmp	lff16m_3
  2309                                  
  2310                                  lff16m_7:
  2311                                  lff16s_7:
  2312 00001035 E92DFCFFFF              	jmp	lff16m_5  ; error
  2313                                  
  2314                                  load_16khz_stereo_8_bit:
  2315                                  	; 02/02/2025
  2316                                  	; 14/11/2023
  2317                                  	; 13/11/2023
  2318 0000103A F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2319                                  					; last of the file?
  2320 00001041 7402                    	jz	short lff16s_0		; no
  2321 00001043 F9                      	stc
  2322 00001044 C3                      	retn
  2323                                  
  2324                                  lff16s_0:
  2325                                  	; 01/12/2024
  2326                                  	; edi = audio buffer address
  2327 00001045 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2328                                          ;mov	edx, [loadsize]
  2329                                  
  2330                                  	; esi = buffer address
  2331                                  	;; edx = buffer size
  2332                                  
  2333                                  	; load file into memory
  2334                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000104A 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001050 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001052 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001058 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000105D CD40                <1>  int 40h
  2335 0000105F 72D4                    	jc	short lff16s_7 ; error !
  2336                                  
  2337                                  	; 01/12/2024
  2338 00001061 A3[587F0000]            	mov	[count], eax
  2339                                  	;;;
  2340                                  	; 07/12/2024
  2341                                  	;mov	edi, audio_buffer
  2342                                  	;;;
  2343 00001066 D1E8                    	shr	eax, 1
  2344 00001068 7505                    	jnz	short lff16s_8
  2345 0000106A E9EFFBFFFF              	jmp	lff16_eof
  2346                                  
  2347                                  lff16s_8:
  2348 0000106F 89C1                    	mov	ecx, eax	; word count
  2349                                  lff16s_1:
  2350 00001071 AC                      	lodsb
  2351 00001072 A2[05230000]            	mov	[previous_val_l], al
  2352 00001077 2C80                    	sub	al, 80h
  2353 00001079 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2354 0000107D 66AB                    	stosw		; original sample (L)
  2355 0000107F AC                      	lodsb
  2356 00001080 A2[07230000]            	mov	[previous_val_r], al
  2357 00001085 2C80                    	sub	al, 80h
  2358 00001087 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2359 0000108B 66AB                    	stosw		; original sample (R)
  2360                                  
  2361                                  	;xor	eax, eax
  2362                                  	; 02/02/2025
  2363 0000108D 668B06                  	mov	ax, [esi]
  2364 00001090 49                      	dec	ecx
  2365 00001091 7504                    	jnz	short lff16s_2
  2366                                  		; convert 8 bit sample to 16 bit sample
  2367                                  	; 14/11/2023
  2368 00001093 66B88080                	mov	ax, 8080h
  2369                                  lff16s_2:
  2370                                  	;mov	[next_val_l], al
  2371                                  	;mov	[next_val_r], ah
  2372 00001097 89C3                    	mov	ebx, eax
  2373 00001099 0205[05230000]          	add	al, [previous_val_l]
  2374 0000109F D0D8                    	rcr	al, 1
  2375 000010A1 88C2                    	mov	dl, al	; this is temporary interpolation value (L)
  2376 000010A3 0205[05230000]          	add	al, [previous_val_l]
  2377 000010A9 D0D8                    	rcr	al, 1
  2378 000010AB 2C80                    	sub	al, 80h
  2379 000010AD 66C1E008                	shl	ax, 8
  2380 000010B1 66AB                    	stosw		; this is 1st interpolated sample (L)
  2381 000010B3 88F8                    	mov	al, bh	; [next_val_r]
  2382 000010B5 0205[07230000]          	add	al, [previous_val_r]
  2383 000010BB D0D8                    	rcr	al, 1
  2384 000010BD 88C6                    	mov	dh, al	; this is temporary interpolation value (R)
  2385 000010BF 0205[07230000]          	add	al, [previous_val_r]
  2386 000010C5 D0D8                    	rcr	al, 1
  2387 000010C7 2C80                    	sub	al, 80h
  2388 000010C9 66C1E008                	shl	ax, 8
  2389 000010CD 66AB                    	stosw		; this is 1st interpolated sample (R)
  2390 000010CF 88D0                    	mov	al, dl
  2391 000010D1 00D8                    	add	al, bl	; [next_val_l]
  2392 000010D3 D0D8                    	rcr	al, 1
  2393 000010D5 2C80                    	sub	al, 80h
  2394 000010D7 66C1E008                	shl	ax, 8
  2395 000010DB 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2396 000010DD 88F0                    	mov	al, dh
  2397 000010DF 00F8                    	add	al, bh	; [next_val_r]
  2398 000010E1 D0D8                    	rcr	al, 1
  2399 000010E3 2C80                    	sub	al, 80h
  2400 000010E5 66C1E008                	shl	ax, 8
  2401 000010E9 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2402                                  	
  2403                                  	; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2404 000010EB 09C9                    	or	ecx, ecx
  2405 000010ED 7582                    	jnz	short lff16s_1
  2406 000010EF E952FBFFFF              	jmp	lff16s_3
  2407                                  
  2408                                  load_16khz_mono_16_bit:
  2409                                  	; 02/02/2025
  2410                                  	; 15/11/2023
  2411                                  	; 13/11/2023
  2412 000010F4 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2413                                  					; last of the file?
  2414 000010FB 7402                    	jz	short lff16m2_0		; no
  2415 000010FD F9                      	stc
  2416 000010FE C3                      	retn
  2417                                  
  2418                                  lff16m2_0:
  2419                                  	; 01/12/2024
  2420                                  	; edi = audio buffer address
  2421 000010FF BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2422                                          ;mov	edx, [loadsize]
  2423                                  
  2424                                  	; esi = buffer address
  2425                                  	;; edx = buffer size
  2426                                  
  2427                                  	; load file into memory
  2428                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001104 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000110A 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000110C 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001112 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001117 CD40                <1>  int 40h
  2429 00001119 7255                    	jc	short lff16m2_7 ; error !
  2430                                  
  2431                                  	; 01/12/2024
  2432 0000111B A3[587F0000]            	mov	[count], eax
  2433                                  	;;;
  2434                                  	; 07/12/2024
  2435                                  	;mov	edi, audio_buffer
  2436                                  	;;;
  2437 00001120 D1E8                    	shr	eax, 1
  2438 00001122 7505                    	jnz	short lff16m2_8
  2439 00001124 E935FBFFFF              	jmp	lff16_eof
  2440                                  
  2441                                  lff16m2_8:
  2442 00001129 89C1                    	mov	ecx, eax  ; word count
  2443                                  lff16m2_1:
  2444 0000112B 66AD                    	lodsw
  2445 0000112D 66AB                    	stosw		; original sample (left channel)
  2446 0000112F 66AB                    	stosw		; original sample (right channel)
  2447 00001131 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2448                                  	;mov	[previous_val], ax
  2449 00001134 89C3                    	mov	ebx, eax
  2450                                  	; 02/02/2025
  2451 00001136 668B06                  	mov	ax, [esi]
  2452 00001139 49                      	dec	ecx
  2453 0000113A 7502                    	jnz	short lff16m2_2
  2454 0000113C 31C0                    	xor	eax, eax
  2455                                  lff16m2_2:
  2456 0000113E 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2457 00001141 89C5                    	mov	ebp, eax	; [next_val]
  2458                                  	;add	ax, [previous_val]
  2459 00001143 6601D8                  	add	ax, bx
  2460 00001146 66D1D8                  	rcr	ax, 1
  2461 00001149 89C2                    	mov	edx, eax ; this is temporary interpolation value
  2462                                  	;add	ax, [previous_val]
  2463 0000114B 6601D8                  	add	ax, bx
  2464 0000114E 66D1D8                  	rcr	ax, 1
  2465 00001151 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2466 00001154 66AB                    	stosw		; this is 1st interpolated sample (L)
  2467 00001156 66AB                    	stosw		; this is 1st interpolated sample (R)
  2468 00001158 89E8                    	mov	eax, ebp
  2469 0000115A 6601D0                  	add	ax, dx
  2470 0000115D 66D1D8                  	rcr	ax, 1
  2471 00001160 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2472 00001163 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2473 00001165 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2474                                  	; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2475 00001167 09C9                    	or	ecx, ecx
  2476 00001169 75C0                    	jnz	short lff16m2_1
  2477 0000116B E9D6FAFFFF              	jmp	lff16m2_3
  2478                                  
  2479                                  lff16m2_7:
  2480                                  lff16s2_7:
  2481 00001170 E9F2FAFFFF              	jmp	lff16m2_5  ; error
  2482                                  
  2483                                  load_16khz_stereo_16_bit:
  2484                                  	; 02/02/2025
  2485                                  	; 16/11/2023
  2486                                  	; 15/11/2023
  2487                                  	; 13/11/2023
  2488 00001175 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2489                                  					; last of the file?
  2490 0000117C 7402                    	jz	short lff16s2_0		; no
  2491 0000117E F9                      	stc
  2492 0000117F C3                      	retn
  2493                                  
  2494                                  lff16s2_0:
  2495                                  	; 01/12/2024
  2496                                  	; edi = audio buffer address
  2497 00001180 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2498                                          ;mov	edx, [loadsize]
  2499                                  
  2500                                  	; esi = buffer address
  2501                                  	;; edx = buffer size
  2502                                  
  2503                                  	; load file into memory
  2504                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001185 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000118B 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000118D 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001193 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001198 CD40                <1>  int 40h
  2505 0000119A 72D4                    	jc	short lff16s2_7 ; error !
  2506                                  
  2507                                  	; 01/12/2024
  2508 0000119C A3[587F0000]            	mov	[count], eax
  2509                                  	;;;
  2510                                  	; 07/12/2024
  2511                                  	;mov	edi, audio_buffer
  2512                                  	;;;
  2513 000011A1 C1E802                  	shr	eax, 2
  2514 000011A4 7505                    	jnz	short lff16s2_8
  2515 000011A6 E9B3FAFFFF              	jmp	lff16_eof
  2516                                  
  2517                                  lff16s2_8:
  2518 000011AB 89C1                    	mov	ecx, eax  ; dword count
  2519                                  lff16s2_1:
  2520 000011AD 66AD                    	lodsw
  2521 000011AF 66AB                    	stosw		; original sample (L)
  2522 000011B1 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2523 000011B4 66A3[05230000]          	mov	[previous_val_l], ax
  2524 000011BA 66AD                    	lodsw
  2525 000011BC 66AB                    	stosw		; original sample (R)
  2526 000011BE 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2527 000011C1 66A3[07230000]          	mov	[previous_val_r], ax
  2528                                  	; 02/02/2025
  2529 000011C7 668B06                  	mov	ax, [esi]
  2530 000011CA 668B5602                	mov	dx, [esi+2]
  2531                                  	; 16/11/2023
  2532 000011CE 49                      	dec	ecx
  2533 000011CF 7504                    	jnz	short lff16s2_2
  2534 000011D1 31D2                    	xor	edx, edx
  2535 000011D3 31C0                    	xor	eax, eax
  2536                                  lff16s2_2:
  2537 000011D5 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2538                                  	;mov	[next_val_l], ax
  2539 000011D8 89C5                    	mov	ebp, eax
  2540 000011DA 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  2541 000011DD 668915[0B230000]        	mov	[next_val_r], dx
  2542 000011E4 660305[05230000]        	add	ax, [previous_val_l]
  2543 000011EB 66D1D8                  	rcr	ax, 1
  2544 000011EE 89C2                    	mov	edx, eax ; this is temporary interpolation value (L)
  2545 000011F0 660305[05230000]        	add	ax, [previous_val_l]
  2546 000011F7 66D1D8                  	rcr	ax, 1
  2547 000011FA 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  2548 000011FD 66AB                    	stosw		; this is 1st interpolated sample (L)
  2549 000011FF 66A1[0B230000]          	mov	ax, [next_val_r]
  2550 00001205 660305[07230000]        	add	ax, [previous_val_r]
  2551 0000120C 66D1D8                  	rcr	ax, 1
  2552 0000120F 89C3                    	mov	ebx, eax ; this is temporary interpolation value (R)
  2553 00001211 660305[07230000]        	add	ax, [previous_val_r]
  2554 00001218 66D1D8                  	rcr	ax, 1
  2555 0000121B 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2556 0000121E 66AB                    	stosw		; this is 1st interpolated sample (R)
  2557                                  	;mov	ax, [next_val_l]
  2558 00001220 89E8                    	mov	eax, ebp
  2559 00001222 6601D0                  	add	ax, dx
  2560 00001225 66D1D8                  	rcr	ax, 1
  2561 00001228 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2562 0000122B 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2563 0000122D 66A1[0B230000]          	mov	ax, [next_val_r]
  2564 00001233 6601D8                  	add	ax, bx
  2565 00001236 66D1D8                  	rcr	ax, 1
  2566 00001239 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2567 0000123C 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2568                                  	
  2569                                  	; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2570 0000123E 09C9                    	or	ecx, ecx
  2571 00001240 0F8567FFFFFF            	jnz	lff16s2_1
  2572 00001246 E9FBF9FFFF              	jmp	lff16s2_3
  2573                                  
  2574                                  ; .....................
  2575                                  
  2576                                  load_24khz_mono_8_bit:
  2577                                  	; 02/02/2025
  2578                                  	; 15/11/2023
  2579 0000124B F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2580                                  					; last of the file?
  2581 00001252 7402                    	jz	short lff24m_0		; no
  2582 00001254 F9                      	stc
  2583 00001255 C3                      	retn
  2584                                  
  2585                                  lff24m_0:
  2586                                  	; 01/12/2024
  2587                                  	; edi = audio buffer address
  2588 00001256 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2589                                          ;mov	edx, [loadsize]
  2590                                  
  2591                                  	; esi = buffer address
  2592                                  	;; edx = buffer size
  2593                                  
  2594                                  	; load file into memory
  2595                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000125B 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001261 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001263 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001269 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000126E CD40                <1>  int 40h
  2596 00001270 723B                    	jc	short lff24m_7 ; error !
  2597                                  
  2598                                  	; 01/12/2024
  2599 00001272 A3[587F0000]            	mov	[count], eax
  2600                                  	;;;
  2601                                  	; 07/12/2024
  2602                                  	;mov	edi, audio_buffer
  2603                                  	;;;
  2604 00001277 21C0                    	and	eax, eax
  2605 00001279 7505                    	jnz	short lff24m_8
  2606 0000127B E9DEF9FFFF              	jmp	lff24_eof
  2607                                  
  2608                                  lff24m_8:
  2609 00001280 89C1                    	mov	ecx, eax	; byte count
  2610                                  lff24m_1:
  2611 00001282 AC                      	lodsb
  2612                                  	;mov	[previous_val], al
  2613 00001283 88C3                    	mov	bl, al
  2614 00001285 2C80                    	sub	al, 80h
  2615 00001287 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2616 0000128B 66AB                    	stosw		; original sample (left channel)
  2617 0000128D 66AB                    	stosw		; original sample (right channel)
  2618                                  	;xor	eax, eax
  2619                                  	; 02/02/2025
  2620 0000128F 8A06                    	mov	al, [esi]
  2621 00001291 49                      	dec	ecx
  2622 00001292 7502                    	jnz	short lff24m_2
  2623 00001294 B080                    	mov	al, 80h
  2624                                  lff24m_2:
  2625                                  	;;mov	[next_val], al
  2626                                  	;mov	bh, al
  2627                                  	;add	al, [previous_val]
  2628 00001296 00D8                    	add	al, bl
  2629 00001298 D0D8                    	rcr	al, 1
  2630 0000129A 2C80                    	sub	al, 80h
  2631 0000129C 66C1E008                	shl	ax, 8
  2632 000012A0 66AB                    	stosw		; this is interpolated sample (L)
  2633 000012A2 66AB                    	stosw		; this is interpolated sample (R)
  2634                                  	
  2635                                  	; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2636 000012A4 09C9                    	or	ecx, ecx
  2637 000012A6 75DA                    	jnz	short lff24m_1
  2638 000012A8 E999F9FFFF              	jmp	lff24_3
  2639                                  
  2640                                  lff24m_7:
  2641                                  lff24s_7:
  2642 000012AD E9B5F9FFFF              	jmp	lff24_5  ; error
  2643                                  
  2644                                  load_24khz_stereo_8_bit:
  2645                                  	; 02/02/2025
  2646                                  	; 15/11/2023
  2647 000012B2 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2648                                  					; last of the file?
  2649 000012B9 7402                    	jz	short lff24s_0		; no
  2650 000012BB F9                      	stc
  2651 000012BC C3                      	retn
  2652                                  
  2653                                  lff24s_0:
  2654                                  	; 01/12/2024
  2655                                  	; edi = audio buffer address
  2656 000012BD BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2657                                          ;mov	edx, [loadsize]
  2658                                  
  2659                                  	; esi = buffer address
  2660                                  	;; edx = buffer size
  2661                                  
  2662                                  	; load file into memory
  2663                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000012C2 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000012C8 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000012CA 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000012D0 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000012D5 CD40                <1>  int 40h
  2664 000012D7 72D4                    	jc	short lff24s_7 ; error !
  2665                                  
  2666                                  	; 01/12/2024
  2667 000012D9 A3[587F0000]            	mov	[count], eax
  2668                                  	;;;
  2669                                  	; 07/12/2024
  2670                                  	;mov	edi, audio_buffer
  2671                                  	;;;
  2672 000012DE D1E8                    	shr	eax, 1
  2673 000012E0 7505                    	jnz	short lff24s_8
  2674 000012E2 E977F9FFFF              	jmp	lff24_eof
  2675                                  
  2676                                  lff24s_8:
  2677 000012E7 89C1                    	mov	ecx, eax  ; word count
  2678                                  lff24s_1:
  2679 000012E9 AC                      	lodsb
  2680 000012EA A2[05230000]            	mov	[previous_val_l], al
  2681 000012EF 2C80                    	sub	al, 80h
  2682 000012F1 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2683 000012F5 66AB                    	stosw		; original sample (L)
  2684 000012F7 AC                      	lodsb
  2685 000012F8 A2[07230000]            	mov	[previous_val_r], al
  2686 000012FD 2C80                    	sub	al, 80h
  2687 000012FF 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2688 00001303 66AB                    	stosw		; original sample (R)
  2689                                  
  2690                                  	;xor	eax, eax
  2691                                  	; 02/02/2025
  2692 00001305 668B06                  	mov	ax, [esi]
  2693 00001308 49                      	dec	ecx
  2694 00001309 7504                    	jnz	short lff24s_2
  2695                                  		; convert 8 bit sample to 16 bit sample
  2696 0000130B 66B88080                	mov	ax, 8080h
  2697                                  lff24s_2:
  2698                                  	;;mov	[next_val_l], al
  2699                                  	;;mov	[next_val_r], ah
  2700                                  	;mov	bx, ax
  2701 0000130F 88E7                    	mov	bh, ah
  2702 00001311 0205[05230000]          	add	al, [previous_val_l]
  2703 00001317 D0D8                    	rcr	al, 1
  2704                                  	;mov	dl, al
  2705 00001319 2C80                    	sub	al, 80h
  2706 0000131B 66C1E008                	shl	ax, 8
  2707 0000131F 66AB                    	stosw		; this is interpolated sample (L)
  2708 00001321 88F8                    	mov	al, bh	; [next_val_r]
  2709 00001323 0205[07230000]          	add	al, [previous_val_r]
  2710 00001329 D0D8                    	rcr	al, 1
  2711                                  	;mov	dh, al
  2712 0000132B 2C80                    	sub	al, 80h
  2713 0000132D 66C1E008                	shl	ax, 8
  2714 00001331 66AB                    	stosw		; this is interpolated sample (R)
  2715                                  		
  2716                                  	; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2717 00001333 09C9                    	or	ecx, ecx
  2718 00001335 75B2                    	jnz	short lff24s_1
  2719 00001337 E90AF9FFFF              	jmp	lff24_3
  2720                                  
  2721                                  load_24khz_mono_16_bit:
  2722                                  	; 02/02/2025
  2723                                  	; 15/11/2023
  2724 0000133C F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2725                                  					; last of the file?
  2726 00001343 7402                    	jz	short lff24m2_0		; no
  2727 00001345 F9                      	stc
  2728 00001346 C3                      	retn
  2729                                  
  2730                                  lff24m2_0:
  2731                                  	; 01/12/2024
  2732                                  	; edi = audio buffer address
  2733 00001347 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2734                                          ;mov	edx, [loadsize]
  2735                                  
  2736                                  	; esi = buffer address
  2737                                  	;; edx = buffer size
  2738                                  
  2739                                  	; load file into memory
  2740                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000134C 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001352 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001354 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000135A B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000135F CD40                <1>  int 40h
  2741 00001361 723A                    	jc	short lff24m2_7 ; error !
  2742                                  
  2743                                  	; 01/12/2024
  2744 00001363 A3[587F0000]            	mov	[count], eax
  2745                                  	;;;
  2746                                  	; 07/12/2024
  2747                                  	;mov	edi, audio_buffer
  2748                                  	;;;
  2749 00001368 D1E8                    	shr	eax, 1
  2750 0000136A 7505                    	jnz	short lff24m2_8
  2751 0000136C E9EDF8FFFF              	jmp	lff24_eof
  2752                                  
  2753                                  lff24m2_8:
  2754 00001371 89C1                    	mov	ecx, eax  ; word count
  2755                                  lff24m2_1:
  2756 00001373 66AD                    	lodsw
  2757 00001375 66AB                    	stosw		; original sample (left channel)
  2758 00001377 66AB                    	stosw		; original sample (right channel)
  2759 00001379 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2760                                  	;mov	[previous_val], ax
  2761                                  	;mov	ebx, eax
  2762                                  	; 02/02/2025
  2763 0000137C 668B1E                  	mov	bx, [esi]
  2764 0000137F 49                      	dec	ecx
  2765 00001380 7502                    	jnz	short lff24m2_2
  2766                                  	;xor	eax, eax
  2767 00001382 31DB                    	xor	ebx, ebx
  2768                                  lff24m2_2:
  2769                                  	; 02/02/2025
  2770 00001384 80C780                  	add	bh, 80h ; convert sound level 0 to 65535 format
  2771                                  	;add	ah, 80h
  2772                                  	;mov	ebp, eax	; [next_val]
  2773                                  	;add	ax, [previous_val]
  2774                                  	; ax = [previous_val]
  2775                                  	; bx = [next_val]
  2776 00001387 6601D8                  	add	ax, bx
  2777 0000138A 66D1D8                  	rcr	ax, 1
  2778 0000138D 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2779 00001390 66AB                    	stosw		; this is interpolated sample (L)
  2780 00001392 66AB                    	stosw		; this is interpolated sample (R)
  2781                                  	; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2782 00001394 09C9                    	or	ecx, ecx
  2783 00001396 75DB                    	jnz	short lff24m2_1
  2784 00001398 E9A9F8FFFF              	jmp	lff24_3
  2785                                  
  2786                                  lff24m2_7:
  2787                                  lff24s2_7:
  2788 0000139D E9C5F8FFFF              	jmp	lff24_5  ; error
  2789                                  
  2790                                  load_24khz_stereo_16_bit:
  2791                                  	; 02/02/2025
  2792                                  	; 16/11/2023
  2793                                  	; 15/11/2023
  2794 000013A2 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2795                                  					; last of the file?
  2796 000013A9 7402                    	jz	short lff24s2_0		; no
  2797 000013AB F9                      	stc
  2798 000013AC C3                      	retn
  2799                                  
  2800                                  lff24s2_0:
  2801                                  	; 01/12/2024
  2802                                  	; edi = audio buffer address
  2803 000013AD BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2804                                          ;mov	edx, [loadsize]
  2805                                  
  2806                                  	; esi = buffer address
  2807                                  	;; edx = buffer size
  2808                                  
  2809                                  	; load file into memory
  2810                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000013B2 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000013B8 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000013BA 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000013C0 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000013C5 CD40                <1>  int 40h
  2811 000013C7 72D4                    	jc	short lff24s2_7 ; error !
  2812                                  
  2813                                  	; 01/12/2024
  2814 000013C9 A3[587F0000]            	mov	[count], eax
  2815                                  	;;;
  2816                                  	; 07/12/2024
  2817                                  	;mov	edi, audio_buffer
  2818                                  	;;;
  2819 000013CE C1E802                  	shr	eax, 2
  2820 000013D1 7505                    	jnz	short lff24s2_8
  2821 000013D3 E986F8FFFF              	jmp	lff24_eof
  2822                                  
  2823                                  lff24s2_8:
  2824 000013D8 89C1                    	mov	ecx, eax  ; dword count
  2825                                  lff24s2_1:
  2826 000013DA 66AD                    	lodsw
  2827 000013DC 66AB                    	stosw		; original sample (L)
  2828 000013DE 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2829 000013E1 66A3[05230000]          	mov	[previous_val_l], ax
  2830 000013E7 66AD                    	lodsw
  2831 000013E9 66AB                    	stosw		; original sample (R)
  2832 000013EB 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2833                                  	;mov	[previous_val_r], ax
  2834 000013EE 89C3                    	mov	ebx, eax
  2835                                  	; 02/02/2025
  2836 000013F0 668B06                  	mov	ax, [esi]
  2837 000013F3 668B5602                	mov	dx, [esi+2]
  2838                                  	; 16/11/2023
  2839 000013F7 49                      	dec	ecx
  2840 000013F8 7504                    	jnz	short lff24s2_2
  2841 000013FA 31D2                    	xor	edx, edx
  2842 000013FC 31C0                    	xor	eax, eax
  2843                                  lff24s2_2:
  2844 000013FE 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2845                                  	;;mov	[next_val_l], ax
  2846                                  	;mov	ebp, eax
  2847 00001401 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  2848                                  	;mov	[next_val_r], dx
  2849 00001404 660305[05230000]        	add	ax, [previous_val_l]
  2850 0000140B 66D1D8                  	rcr	ax, 1
  2851 0000140E 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  2852 00001411 66AB                    	stosw		; this is interpolated sample (L)
  2853                                  	;mov	ax, [next_val_r]
  2854 00001413 89D0                    	mov	eax, edx
  2855                                  	;add	ax, [previous_val_r]
  2856 00001415 6601D8                  	add	ax, bx
  2857 00001418 66D1D8                  	rcr	ax, 1
  2858 0000141B 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2859 0000141E 66AB                    	stosw		; this is interpolated sample (R)
  2860                                  	
  2861                                  	; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2862 00001420 09C9                    	or	ecx, ecx
  2863 00001422 75B6                    	jnz	short lff24s2_1
  2864 00001424 E91DF8FFFF              	jmp	lff24_3
  2865                                  
  2866                                  ; .....................
  2867                                  
  2868                                  load_32khz_mono_8_bit:
  2869                                  	; 02/02/2025
  2870                                  	; 15/11/2023
  2871 00001429 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2872                                  					; last of the file?
  2873 00001430 7402                    	jz	short lff32m_0		; no
  2874 00001432 F9                      	stc
  2875 00001433 C3                      	retn
  2876                                  
  2877                                  lff32m_0:
  2878                                  	; 01/12/2024
  2879                                  	; edi = audio buffer address
  2880 00001434 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2881                                          ;mov	edx, [loadsize]
  2882                                  
  2883                                  	; esi = buffer address
  2884                                  	;; edx = buffer size
  2885                                  
  2886                                  	; load file into memory
  2887                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001439 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000143F 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001441 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001447 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000144C CD40                <1>  int 40h
  2888 0000144E 7247                    	jc	short lff32m_7 ; error !
  2889                                  
  2890                                  	; 01/12/2024
  2891 00001450 A3[587F0000]            	mov	[count], eax
  2892                                  	;;;
  2893                                  	; 07/12/2024
  2894                                  	;mov	edi, audio_buffer
  2895                                  	;;;
  2896 00001455 21C0                    	and	eax, eax
  2897 00001457 7505                    	jnz	short lff32m_8
  2898 00001459 E900F8FFFF              	jmp	lff32_eof
  2899                                  
  2900                                  lff32m_8:
  2901 0000145E 89C1                    	mov	ecx, eax	; byte count
  2902                                  lff32m_1:
  2903 00001460 AC                      	lodsb
  2904                                  	;mov	[previous_val], al
  2905 00001461 88C3                    	mov	bl, al
  2906 00001463 2C80                    	sub	al, 80h
  2907 00001465 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2908 00001469 66AB                    	stosw		; original sample (left channel)
  2909 0000146B 66AB                    	stosw		; original sample (right channel)
  2910                                  	;xor	eax, eax
  2911                                  	; 02/02/2025
  2912 0000146D 8A06                    	mov	al, [esi]
  2913 0000146F 49                      	dec	ecx
  2914 00001470 7502                    	jnz	short lff32m_2
  2915 00001472 B080                    	mov	al, 80h
  2916                                  lff32m_2:
  2917                                  	;;mov	[next_val], al
  2918                                  	;mov	bh, al
  2919                                  	;add	al, [previous_val]
  2920 00001474 00D8                    	add	al, bl
  2921 00001476 D0D8                    	rcr	al, 1
  2922 00001478 2C80                    	sub	al, 80h
  2923 0000147A 66C1E008                	shl	ax, 8
  2924 0000147E 66AB                    	stosw		; this is interpolated sample (L)
  2925 00001480 66AB                    	stosw		; this is interpolated sample (R)
  2926                                  	
  2927                                  	; different than 8-16-24 kHZ !
  2928                                  	; 'original-interpolated-original' trio samples
  2929 00001482 E30E                    	jecxz	lff32m_3
  2930                                  
  2931 00001484 AC                      	lodsb
  2932 00001485 2C80                    	sub	al, 80h
  2933 00001487 66C1E008                	shl	ax, 8
  2934 0000148B 66AB                    	stosw		; original sample (left channel)
  2935 0000148D 66AB                    	stosw		; original sample (right channel)
  2936                                  
  2937                                  	; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2938 0000148F 49                      	dec	ecx
  2939 00001490 75CE                    	jnz	short lff32m_1
  2940                                  lff32m_3:
  2941 00001492 E9AFF7FFFF              	jmp	lff32_3
  2942                                  
  2943                                  lff32m_7:
  2944                                  lff32s_7:
  2945 00001497 E9CBF7FFFF              	jmp	lff32_5  ; error
  2946                                  
  2947                                  load_32khz_stereo_8_bit:
  2948                                  	; 02/02/2025
  2949                                  	; 15/11/2023
  2950 0000149C F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2951                                  					; last of the file?
  2952 000014A3 7402                    	jz	short lff32s_0		; no
  2953 000014A5 F9                      	stc
  2954 000014A6 C3                      	retn
  2955                                  
  2956                                  lff32s_0:
  2957                                  	; 01/12/2024
  2958                                  	; edi = audio buffer address
  2959 000014A7 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2960                                          ;mov	edx, [loadsize]
  2961                                  
  2962                                  	; esi = buffer address
  2963                                  	;; edx = buffer size
  2964                                  
  2965                                  	; load file into memory
  2966                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000014AC 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000014B2 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000014B4 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000014BA B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000014BF CD40                <1>  int 40h
  2967 000014C1 72D4                    	jc	short lff32s_7 ; error !
  2968                                  
  2969                                  	; 01/12/2024
  2970 000014C3 A3[587F0000]            	mov	[count], eax
  2971                                  	;;;
  2972                                  	; 07/12/2024
  2973                                  	;mov	edi, audio_buffer
  2974                                  	;;;
  2975 000014C8 D1E8                    	shr	eax, 1
  2976 000014CA 7505                    	jnz	short lff32s_8
  2977 000014CC E98DF7FFFF              	jmp	lff32_eof
  2978                                  
  2979                                  lff32s_8:
  2980 000014D1 89C1                    	mov	ecx, eax  ; word count
  2981                                  lff32s_1:
  2982 000014D3 AC                      	lodsb
  2983 000014D4 A2[05230000]            	mov	[previous_val_l], al
  2984 000014D9 2C80                    	sub	al, 80h
  2985 000014DB 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2986 000014DF 66AB                    	stosw		; original sample (L)
  2987 000014E1 AC                      	lodsb
  2988 000014E2 A2[07230000]            	mov	[previous_val_r], al
  2989 000014E7 2C80                    	sub	al, 80h
  2990 000014E9 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2991 000014ED 66AB                    	stosw		; original sample (R)
  2992                                  
  2993                                  	;xor	eax, eax
  2994                                  	; 02/02/2025
  2995 000014EF 668B06                  	mov	ax, [esi]
  2996 000014F2 49                      	dec	ecx
  2997 000014F3 7504                    	jnz	short lff32s_2
  2998                                  		; convert 8 bit sample to 16 bit sample
  2999 000014F5 66B88080                	mov	ax, 8080h
  3000                                  lff32s_2:
  3001                                  	;;mov	[next_val_l], al
  3002                                  	;;mov	[next_val_r], ah
  3003                                  	;mov	bx, ax
  3004 000014F9 88E7                    	mov	bh, ah
  3005 000014FB 0205[05230000]          	add	al, [previous_val_l]
  3006 00001501 D0D8                    	rcr	al, 1
  3007                                  	;mov	dl, al
  3008 00001503 2C80                    	sub	al, 80h
  3009 00001505 66C1E008                	shl	ax, 8
  3010 00001509 66AB                    	stosw		; this is interpolated sample (L)
  3011 0000150B 88F8                    	mov	al, bh	; [next_val_r]
  3012 0000150D 0205[07230000]          	add	al, [previous_val_r]
  3013 00001513 D0D8                    	rcr	al, 1
  3014                                  	;mov	dh, al
  3015 00001515 2C80                    	sub	al, 80h
  3016 00001517 66C1E008                	shl	ax, 8
  3017 0000151B 66AB                    	stosw		; this is interpolated sample (R)
  3018                                  
  3019                                  	; different than 8-16-24 kHZ !
  3020                                  	; 'original-interpolated-original' trio samples
  3021 0000151D E315                    	jecxz	lff32s_3
  3022                                  
  3023 0000151F AC                      	lodsb
  3024 00001520 2C80                    	sub	al, 80h
  3025 00001522 66C1E008                	shl	ax, 8
  3026 00001526 66AB                    	stosw		; original sample (left channel)
  3027                                  
  3028 00001528 AC                      	lodsb
  3029 00001529 2C80                    	sub	al, 80h
  3030 0000152B 66C1E008                	shl	ax, 8
  3031 0000152F 66AB                    	stosw		; original sample (right channel)
  3032                                  		
  3033                                  	; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  3034 00001531 49                      	dec	ecx
  3035 00001532 759F                    	jnz	short lff32s_1
  3036                                  lff32s_3:
  3037 00001534 E90DF7FFFF              	jmp	lff32_3
  3038                                  
  3039                                  load_32khz_mono_16_bit:
  3040                                  	; 02/02/2025
  3041                                  	; 15/11/2023
  3042 00001539 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3043                                  					; last of the file?
  3044 00001540 7402                    	jz	short lff32m2_0		; no
  3045 00001542 F9                      	stc
  3046 00001543 C3                      	retn
  3047                                  
  3048                                  lff32m2_0:
  3049                                  	; 01/12/2024
  3050                                  	; edi = audio buffer address
  3051 00001544 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3052                                          ;mov	edx, [loadsize]
  3053                                  
  3054                                  	; esi = buffer address
  3055                                  	;; edx = buffer size
  3056                                  
  3057                                  	; load file into memory
  3058                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001549 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000154F 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001551 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001557 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000155C CD40                <1>  int 40h
  3059 0000155E 7241                    	jc	short lff32m2_7 ; error !
  3060                                  
  3061                                  	; 01/12/2024
  3062 00001560 A3[587F0000]            	mov	[count], eax
  3063                                  	;;;
  3064                                  	; 07/12/2024
  3065                                  	;mov	edi, audio_buffer
  3066                                  	;;;
  3067 00001565 D1E8                    	shr	eax, 1
  3068 00001567 7505                    	jnz	short lff32m2_8
  3069 00001569 E9F0F6FFFF              	jmp	lff32_eof
  3070                                  
  3071                                  lff32m2_8:
  3072 0000156E 89C1                    	mov	ecx, eax  ; word count
  3073                                  lff32m2_1:
  3074 00001570 66AD                    	lodsw
  3075 00001572 66AB                    	stosw		; original sample (left channel)
  3076 00001574 66AB                    	stosw		; original sample (right channel)
  3077 00001576 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  3078                                  	;mov	[previous_val], ax
  3079                                  	;mov	ebx, eax
  3080                                  	;xor	eax, eax
  3081                                  	; 02/02/2025
  3082                                  	;mov	ax, [esi]
  3083 00001579 668B1E                  	mov	bx, [esi]
  3084 0000157C 49                      	dec	ecx
  3085 0000157D 7502                    	jnz	short lff32m2_2
  3086 0000157F 31DB                    	xor	ebx, ebx
  3087                                  lff32m2_2:
  3088                                  	; 02/02/2025
  3089 00001581 80C780                  	add	bh, 80h ; convert sound level 0 to 65535 format
  3090                                  	;add	ah, 80h
  3091                                  	;mov	ebp, eax ; [next_val]
  3092                                  	;add	ax, [previous_val]
  3093                                  	; ax = [previous_val]
  3094                                  	; bx = [next_val]
  3095 00001584 6601D8                  	add	ax, bx
  3096 00001587 66D1D8                  	rcr	ax, 1
  3097 0000158A 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3098 0000158D 66AB                    	stosw		; this is interpolated sample (L)
  3099 0000158F 66AB                    	stosw		; this is interpolated sample (R)
  3100                                  
  3101                                  	; different than 8-16-24 kHZ !
  3102                                  	; 'original-interpolated-original' trio samples 
  3103 00001591 E309                    	jecxz	lff32m2_3
  3104                                  
  3105 00001593 66AD                    	lodsw
  3106 00001595 66AB                    	stosw		; original sample (left channel)
  3107 00001597 66AB                    	stosw		; original sample (right channel)
  3108                                  
  3109                                  	; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  3110 00001599 49                      	dec	ecx
  3111 0000159A 75D4                    	jnz	short lff32m2_1
  3112                                  lff32m2_3:
  3113 0000159C E9A5F6FFFF              	jmp	lff32_3
  3114                                  
  3115                                  lff32m2_7:
  3116                                  lff32s2_7:
  3117 000015A1 E9C1F6FFFF              	jmp	lff32_5  ; error
  3118                                  
  3119                                  load_32khz_stereo_16_bit:
  3120                                  	; 02/02/2025
  3121                                  	; 16/11/2023
  3122                                  	; 15/11/2023
  3123 000015A6 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3124                                  					; last of the file?
  3125 000015AD 7402                    	jz	short lff32s2_0		; no
  3126 000015AF F9                      	stc
  3127 000015B0 C3                      	retn
  3128                                  
  3129                                  lff32s2_0:
  3130                                  	; 01/12/2024
  3131                                  	; edi = audio buffer address
  3132 000015B1 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3133                                          ;mov	edx, [loadsize]
  3134                                  
  3135                                  	; esi = buffer address
  3136                                  	;; edx = buffer size
  3137                                  
  3138                                  	; load file into memory
  3139                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000015B6 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000015BC 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000015BE 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000015C4 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000015C9 CD40                <1>  int 40h
  3140 000015CB 72D4                    	jc	short lff32s2_7 ; error !
  3141                                  
  3142                                  	; 01/12/2024
  3143 000015CD A3[587F0000]            	mov	[count], eax
  3144                                  	;;;
  3145                                  	; 07/12/2024
  3146                                  	;mov	edi, audio_buffer
  3147                                  	;;;
  3148 000015D2 C1E802                  	shr	eax, 2
  3149 000015D5 7505                    	jnz	short lff32s2_8
  3150 000015D7 E982F6FFFF              	jmp	lff32_eof
  3151                                  
  3152                                  lff32s2_8:
  3153 000015DC 89C1                    	mov	ecx, eax ; dword count
  3154                                  lff32s2_1:
  3155 000015DE 66AD                    	lodsw
  3156 000015E0 66AB                    	stosw		; original sample (L)
  3157 000015E2 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format 
  3158 000015E5 66A3[05230000]          	mov	[previous_val_l], ax
  3159 000015EB 66AD                    	lodsw
  3160 000015ED 66AB                    	stosw		; original sample (R)
  3161 000015EF 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format 
  3162                                  	;mov	[previous_val_r], ax
  3163 000015F2 89C3                    	mov	ebx, eax
  3164                                  	; 02/02/2025
  3165 000015F4 668B06                  	mov	ax, [esi]
  3166 000015F7 668B5602                	mov	dx, [esi+2]
  3167                                  	; 16/11/2023
  3168 000015FB 49                      	dec	ecx
  3169 000015FC 7504                    	jnz	short lff32s2_2
  3170 000015FE 31D2                    	xor	edx, edx
  3171 00001600 31C0                    	xor	eax, eax
  3172                                  lff32s2_2:
  3173 00001602 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  3174                                  	;;mov	[next_val_l], ax
  3175                                  	;mov	ebp, eax
  3176 00001605 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  3177                                  	;mov	[next_val_r], dx
  3178 00001608 660305[05230000]        	add	ax, [previous_val_l]
  3179 0000160F 66D1D8                  	rcr	ax, 1
  3180 00001612 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  3181 00001615 66AB                    	stosw		; this is interpolated sample (L)
  3182                                  	;mov	ax, [next_val_r]
  3183 00001617 89D0                    	mov	eax, edx
  3184                                  	;add	ax, [previous_val_r]
  3185 00001619 6601D8                  	add	ax, bx
  3186 0000161C 66D1D8                  	rcr	ax, 1
  3187 0000161F 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3188 00001622 66AB                    	stosw		; this is interpolated sample (R)
  3189                                  
  3190                                  	; different than 8-16-24 kHZ !
  3191                                  	; 'original-interpolated-original' trio samples
  3192 00001624 E30B                    	jecxz	lff32s2_3
  3193                                  
  3194 00001626 66AD                    	lodsw
  3195 00001628 66AB                    	stosw	; original sample (L)
  3196 0000162A 66AD                    	lodsw
  3197 0000162C 66AB                    	stosw	; original sample (R)
  3198                                  	
  3199                                  	; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  3200 0000162E 49                      	dec	ecx
  3201 0000162F 75AD                    	jnz	short lff32s2_1
  3202                                  lff32s2_3:
  3203 00001631 E910F6FFFF              	jmp	lff32_3
  3204                                  
  3205                                  ; .....................
  3206                                  
  3207                                  load_22khz_mono_8_bit:
  3208                                  	; 02/02/2025
  3209                                  	; 16/11/2023
  3210 00001636 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3211                                  					; last of the file?
  3212 0000163D 7402                    	jz	short lff22m_0		; no
  3213 0000163F F9                      	stc
  3214 00001640 C3                      	retn
  3215                                  
  3216                                  lff22m_0:
  3217                                  	; 01/12/2024
  3218                                  	; edi = audio buffer address
  3219 00001641 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3220                                          ;mov	edx, [loadsize]
  3221                                  
  3222                                  	; esi = buffer address
  3223                                  	;; edx = buffer size
  3224                                  
  3225                                  	; load file into memory
  3226                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001646 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000164C 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000164E 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001654 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001659 CD40                <1>  int 40h
  3227 0000165B 725D                    	jc	short lff22m_7 ; error !
  3228                                  
  3229                                  	; 01/12/2024
  3230 0000165D A3[587F0000]            	mov	[count], eax
  3231                                  	;;;
  3232                                  	; 07/12/2024
  3233                                  	;mov	edi, audio_buffer
  3234                                  	;;;
  3235 00001662 21C0                    	and	eax, eax
  3236 00001664 7505                    	jnz	short lff22m_8
  3237 00001666 E9F3F5FFFF              	jmp	lff22_eof
  3238                                  
  3239                                  lff22m_8:
  3240 0000166B 89C1                    	mov	ecx, eax	; byte count
  3241                                  lff22m_9:
  3242 0000166D BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3243 00001672 C605[0D230000]03        	mov	byte [faz], 3  ; 3 steps/phases
  3244                                  lff22m_1:
  3245                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3246 00001679 AC                      	lodsb
  3247                                  	; 02/02/2025
  3248 0000167A 8A16                    	mov	dl, [esi]
  3249 0000167C 49                      	dec	ecx
  3250 0000167D 7502                    	jnz	short lff22m_2_1
  3251 0000167F B280                    	mov	dl, 80h
  3252                                  lff22m_2_1:	
  3253                                  	; al = [previous_val]
  3254                                  	; dl = [next_val]
  3255 00001681 E835070000              	call	interpolating_3_8bit_mono ; 1 of 17
  3256 00001686 E32D                    	jecxz	lff22m_3
  3257                                  lff22m_2_2:
  3258 00001688 AC                      	lodsb
  3259                                  	; 02/02/2025
  3260 00001689 8A16                    	mov	dl, [esi]
  3261 0000168B 49                      	dec	ecx
  3262 0000168C 7502                    	jnz	short lff22m_2_3
  3263 0000168E B280                    	mov	dl, 80h
  3264                                  lff22m_2_3:
  3265 00001690 E8B0070000               	call	interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17
  3266 00001695 E31E                    	jecxz	lff22m_3
  3267 00001697 4D                      	dec	ebp
  3268 00001698 75EE                    	jnz	short lff22m_2_2
  3269                                  
  3270 0000169A A0[0D230000]            	mov	al, [faz]
  3271 0000169F FEC8                    	dec	al
  3272 000016A1 74CA                    	jz	short lff22m_9
  3273 000016A3 FE0D[0D230000]          	dec	byte [faz]
  3274 000016A9 BD04000000              	mov	ebp, 4
  3275 000016AE FEC8                    	dec	al
  3276 000016B0 75C7                    	jnz	short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17
  3277 000016B2 45                      	inc	ebp ; 5
  3278 000016B3 EBC4                    	jmp	short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3279                                  
  3280                                  lff22m_3:
  3281                                  lff22s_3:
  3282 000016B5 E98CF5FFFF              	jmp	lff22_3	; padfill
  3283                                  		; (put zeros in the remain words of the buffer)
  3284                                  lff22m_7:
  3285                                  lff22s_7:
  3286 000016BA E9A8F5FFFF              	jmp	lff22_5  ; error
  3287                                  
  3288                                  load_22khz_stereo_8_bit:
  3289                                  	; 02/02/2025
  3290                                  	; 16/11/2023
  3291 000016BF F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3292                                  					; last of the file?
  3293 000016C6 7402                    	jz	short lff22s_0		; no
  3294 000016C8 F9                      	stc
  3295 000016C9 C3                      	retn
  3296                                  
  3297                                  lff22s_0:
  3298                                  	; 01/12/2024
  3299                                  	; edi = audio buffer address
  3300 000016CA BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3301                                          ;mov	edx, [loadsize]
  3302                                  
  3303                                  	; esi = buffer address
  3304                                  	;; edx = buffer size
  3305                                  
  3306                                  	; load file into memory
  3307                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000016CF 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000016D5 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000016D7 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000016DD B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000016E2 CD40                <1>  int 40h
  3308 000016E4 72D4                    	jc	short lff22s_7 ; error !
  3309                                  
  3310                                  	; 01/12/2024
  3311 000016E6 A3[587F0000]            	mov	[count], eax
  3312                                  	;;;
  3313                                  	; 07/12/2024
  3314                                  	;mov	edi, audio_buffer
  3315                                  	;;;
  3316 000016EB D1E8                    	shr	eax, 1
  3317 000016ED 7505                    	jnz	short lff22s_8
  3318 000016EF E96AF5FFFF              	jmp	lff22_eof
  3319                                  
  3320                                  lff22s_8:
  3321 000016F4 89C1                    	mov	ecx, eax	; word count
  3322                                  lff22s_9:
  3323 000016F6 BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3324 000016FB C605[0D230000]03        	mov	byte [faz], 3  ; 3 steps/phase
  3325                                  lff22s_1:
  3326                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3327 00001702 66AD                    	lodsw
  3328                                  	; 02/02/2025
  3329 00001704 668B16                  	mov	dx, [esi]
  3330 00001707 49                      	dec	ecx
  3331 00001708 7504                    	jnz	short lff22s_2_1
  3332 0000170A 66BA8080                	mov	dx, 8080h
  3333                                  lff22s_2_1:	
  3334                                  	; al = [previous_val_l]
  3335                                  	; ah = [previous_val_r]
  3336                                  	; dl = [next_val_l]
  3337                                  	; dh = [next_val_r]
  3338 0000170E E8DB060000              	call	interpolating_3_8bit_stereo ; 1 of 17
  3339 00001713 E3A0                    	jecxz	lff22s_3
  3340                                  lff22s_2_2:
  3341 00001715 66AD                    	lodsw
  3342                                  	; 02/02/2025
  3343 00001717 668B16                  	mov	dx, [esi]
  3344 0000171A 49                      	dec	ecx
  3345 0000171B 7504                    	jnz	short lff22s_2_3
  3346 0000171D 66BA8080                	mov	dx, 8080h
  3347                                  lff22s_2_3:
  3348 00001721 E83C070000               	call	interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17
  3349 00001726 E38D                    	jecxz	lff22s_3
  3350 00001728 4D                      	dec	ebp
  3351 00001729 75EA                    	jnz	short lff22s_2_2
  3352                                  
  3353 0000172B A0[0D230000]            	mov	al, [faz]
  3354 00001730 FEC8                    	dec	al
  3355 00001732 74C2                    	jz	short lff22s_9
  3356 00001734 FE0D[0D230000]          	dec	byte [faz]
  3357 0000173A BD04000000              	mov	ebp, 4
  3358 0000173F FEC8                    	dec	al
  3359 00001741 75BF                    	jnz	short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17
  3360 00001743 45                      	inc	ebp ; 5
  3361 00001744 EBBC                    	jmp	short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3362                                  
  3363                                  load_22khz_mono_16_bit:
  3364                                  	; 02/02/2025
  3365                                  	; 16/11/2023
  3366 00001746 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3367                                  					; last of the file?
  3368 0000174D 7402                    	jz	short lff22m2_0		; no
  3369 0000174F F9                      	stc
  3370 00001750 C3                      	retn
  3371                                  
  3372                                  lff22m2_0:
  3373                                  	; 01/12/2024
  3374                                  	; edi = audio buffer address
  3375 00001751 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3376                                          ;mov	edx, [loadsize]
  3377                                  
  3378                                  	; esi = buffer address
  3379                                  	;; edx = buffer size
  3380                                  
  3381                                  	; load file into memory
  3382                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001756 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000175C 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000175E 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001764 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001769 CD40                <1>  int 40h
  3383 0000176B 7261                    	jc	short lff22m2_7 ; error !
  3384                                  
  3385                                  	; 01/12/2024
  3386 0000176D A3[587F0000]            	mov	[count], eax
  3387                                  	;;;
  3388                                  	; 07/12/2024
  3389                                  	;mov	edi, audio_buffer
  3390                                  	;;;
  3391 00001772 D1E8                    	shr	eax, 1
  3392 00001774 7505                    	jnz	short lff22m2_8
  3393 00001776 E9E3F4FFFF              	jmp	lff22_eof
  3394                                  
  3395                                  lff22m2_8:
  3396 0000177B 89C1                    	mov	ecx, eax	; word count
  3397                                  lff22m2_9:
  3398 0000177D BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3399 00001782 C605[0D230000]03        	mov	byte [faz], 3  ; 3 steps/phases
  3400                                  lff22m2_1:
  3401                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3402 00001789 66AD                    	lodsw
  3403                                  	; 02/02/2025
  3404 0000178B 668B16                  	mov	dx, [esi]
  3405 0000178E 49                      	dec	ecx
  3406 0000178F 7502                    	jnz	short lff22m2_2_1
  3407 00001791 31D2                    	xor	edx, edx
  3408                                  lff22m2_2_1:	
  3409                                  	; ax = [previous_val]
  3410                                  	; dx = [next_val]
  3411 00001793 E8FB060000              	call	interpolating_3_16bit_mono ; 1 of 17
  3412 00001798 E32F                    	jecxz	lff22m2_3
  3413                                  lff22m2_2_2:
  3414 0000179A 66AD                    	lodsw
  3415                                  	; 02/02/2025
  3416 0000179C 668B16                  	mov	dx, [esi]
  3417 0000179F 49                      	dec	ecx
  3418 000017A0 7502                    	jnz	short lff22m2_2_3
  3419 000017A2 31D2                    	xor	edx, edx
  3420                                  lff22m2_2_3:
  3421 000017A4 E87D070000               	call	interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17
  3422 000017A9 E31E                    	jecxz	lff22m2_3
  3423 000017AB 4D                      	dec	ebp
  3424 000017AC 75EC                    	jnz	short lff22m2_2_2
  3425                                  
  3426 000017AE A0[0D230000]            	mov	al, [faz]
  3427 000017B3 FEC8                    	dec	al
  3428 000017B5 74C6                    	jz	short lff22m2_9
  3429 000017B7 FE0D[0D230000]          	dec	byte [faz]
  3430 000017BD BD04000000              	mov	ebp, 4
  3431 000017C2 FEC8                    	dec	al
  3432 000017C4 75C3                    	jnz	short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17
  3433 000017C6 45                      	inc	ebp ; 5
  3434 000017C7 EBC0                    	jmp	short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3435                                  
  3436                                  lff22m2_3:
  3437                                  lff22s2_3:
  3438 000017C9 E978F4FFFF              	jmp	lff22_3	; padfill
  3439                                  		; (put zeros in the remain words of the buffer)
  3440                                  lff22m2_7:
  3441                                  lff22s2_7:
  3442 000017CE E994F4FFFF              	jmp	lff22_5  ; error
  3443                                  
  3444                                  load_22khz_stereo_16_bit:
  3445                                  	; 16/11/2023
  3446 000017D3 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3447                                  					; last of the file?
  3448 000017DA 7402                    	jz	short lff22s2_0		; no
  3449 000017DC F9                      	stc
  3450 000017DD C3                      	retn
  3451                                  
  3452                                  lff22s2_0:
  3453                                  	; 01/12/2024
  3454                                  	; edi = audio buffer address
  3455 000017DE BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3456                                          ;mov	edx, [loadsize]
  3457                                  
  3458                                  	; esi = buffer address
  3459                                  	;; edx = buffer size
  3460                                  
  3461                                  	; load file into memory
  3462                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000017E3 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000017E9 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000017EB 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000017F1 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000017F6 CD40                <1>  int 40h
  3463 000017F8 72D4                    	jc	short lff22s2_7 ; error !
  3464                                  
  3465                                  	; 01/12/2024
  3466 000017FA A3[587F0000]            	mov	[count], eax
  3467                                  	;;;
  3468                                  	; 07/12/2024
  3469                                  	;mov	edi, audio_buffer
  3470                                  	;;;
  3471 000017FF C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  3472 00001802 7505                    	jnz	short lff22s2_8
  3473 00001804 E955F4FFFF              	jmp	lff22_eof
  3474                                  
  3475                                  lff22s2_8:
  3476 00001809 89C1                    	mov	ecx, eax	; dword count
  3477                                  lff22s2_9:
  3478 0000180B BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3479 00001810 C605[0D230000]03        	mov	byte [faz], 3  ; 3 steps/phase
  3480                                  lff22s2_1:
  3481                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3482 00001817 66AD                    	lodsw
  3483 00001819 89C3                    	mov	ebx, eax
  3484 0000181B 66AD                    	lodsw
  3485 0000181D 8B16                    	mov	edx, [esi]
  3486 0000181F 668915[09230000]        	mov	[next_val_l], dx
  3487                                  	; 26/11/2023
  3488 00001826 C1EA10                  	shr	edx, 16
  3489 00001829 49                      	dec	ecx
  3490 0000182A 7509                    	jnz	short lff22s2_2_1
  3491 0000182C 31D2                    	xor	edx, edx ; 0
  3492 0000182E 668915[09230000]        	mov	[next_val_l], dx
  3493                                  lff22s2_2_1:
  3494                                  	; bx = [previous_val_l]
  3495                                  	; ax = [previous_val_r]
  3496                                  	; [next_val_l]
  3497                                  	; dx = [next_val_r]
  3498 00001835 E889060000              	call	interpolating_3_16bit_stereo ; 1 of 17
  3499 0000183A E38D                    	jecxz	lff22s2_3
  3500                                  lff22s2_2_2:
  3501 0000183C 66AD                    	lodsw
  3502 0000183E 89C3                    	mov	ebx, eax
  3503 00001840 66AD                    	lodsw
  3504 00001842 8B16                    	mov	edx, [esi]
  3505 00001844 668915[09230000]        	mov	[next_val_l], dx
  3506                                  	; 26/11/2023
  3507 0000184B C1EA10                  	shr	edx, 16
  3508 0000184E 49                      	dec	ecx
  3509 0000184F 7509                    	jnz	short lff22s2_2_3
  3510 00001851 31D2                    	xor	edx, edx ; 0
  3511 00001853 668915[09230000]        	mov	[next_val_l], dx
  3512                                  lff22s2_2_3:
  3513 0000185A E8DF060000               	call	interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17
  3514 0000185F E31E                    	jecxz	lff22s2_2_4
  3515                                  
  3516 00001861 4D                      	dec	ebp
  3517 00001862 75D8                    	jnz	short lff22s2_2_2
  3518                                  
  3519 00001864 A0[0D230000]            	mov	al, [faz]
  3520 00001869 FEC8                    	dec	al
  3521 0000186B 749E                    	jz	short lff22s2_9
  3522 0000186D FE0D[0D230000]          	dec	byte [faz]
  3523 00001873 BD04000000              	mov	ebp, 4
  3524 00001878 FEC8                    	dec	al
  3525 0000187A 759B                    	jnz	short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17
  3526 0000187C 45                      	inc	ebp ; 5
  3527 0000187D EB98                    	jmp	short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3528                                  
  3529                                  lff22s2_2_4:
  3530                                  	; 26/11/2023
  3531 0000187F E9C2F3FFFF              	jmp	lff22_3	; padfill
  3532                                  
  3533                                  ; .....................
  3534                                  
  3535                                  load_11khz_mono_8_bit:
  3536                                  	; 02/02/2025
  3537                                  	; 18/11/2023
  3538 00001884 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3539                                  					; last of the file?
  3540 0000188B 7402                    	jz	short lff11m_0		; no
  3541 0000188D F9                      	stc
  3542 0000188E C3                      	retn
  3543                                  
  3544                                  lff11m_0:
  3545                                  	; 01/12/2024
  3546                                  	; edi = audio buffer address
  3547 0000188F BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3548                                          ;mov	edx, [loadsize]
  3549                                  
  3550                                  	; esi = buffer address
  3551                                  	;; edx = buffer size
  3552                                  
  3553                                  	; load file into memory
  3554                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001894 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000189A 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000189C 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000018A2 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 000018A7 CD40                <1>  int 40h
  3555 000018A9 7247                    	jc	short lff11m_7 ; error !
  3556                                  
  3557                                  	; 01/12/2024
  3558 000018AB A3[587F0000]            	mov	[count], eax
  3559                                  	;;;
  3560                                  	; 07/12/2024
  3561                                  	;mov	edi, audio_buffer
  3562                                  	;;;
  3563 000018B0 21C0                    	and	eax, eax
  3564 000018B2 7505                    	jnz	short lff11m_8
  3565 000018B4 E9A5F3FFFF              	jmp	lff11_eof
  3566                                  
  3567                                  lff11m_8:
  3568 000018B9 89C1                    	mov	ecx, eax		; byte count
  3569                                  lff11m_9:
  3570 000018BB BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3571                                  lff11m_1:
  3572                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3573 000018C0 AC                      	lodsb
  3574                                  	; 02/02/2025
  3575 000018C1 8A16                    	mov	dl, [esi]
  3576 000018C3 49                      	dec	ecx
  3577 000018C4 7502                    	jnz	short lff11m_2_1
  3578 000018C6 B280                    	mov	dl, 80h
  3579                                  lff11m_2_1:	
  3580                                  	; al = [previous_val]
  3581                                  	; dl = [next_val]
  3582 000018C8 E8A0060000              	call	interpolating_5_8bit_mono
  3583 000018CD E328                    	jecxz	lff11m_3
  3584                                  lff11m_2_2:
  3585 000018CF AC                      	lodsb
  3586                                  	; 02/02/2025
  3587 000018D0 8A16                    	mov	dl, [esi]
  3588 000018D2 49                      	dec	ecx
  3589 000018D3 7502                    	jnz	short lff11m_2_3
  3590 000018D5 B280                    	mov	dl, 80h
  3591                                  lff11m_2_3:
  3592 000018D7 E89D070000               	call	interpolating_4_8bit_mono
  3593 000018DC E319                    	jecxz	lff11m_3
  3594                                  
  3595 000018DE 4D                      	dec	ebp
  3596 000018DF 74DA                    	jz	short lff11m_9
  3597                                  
  3598 000018E1 AC                      	lodsb
  3599                                  	; 02/02/2025
  3600 000018E2 8A16                    	mov	dl, [esi]
  3601 000018E4 49                      	dec	ecx
  3602 000018E5 7502                    	jnz	short lff11m_2_4
  3603 000018E7 B280                    	mov	dl, 80h
  3604                                  lff11m_2_4:
  3605 000018E9 E88B070000              	call	interpolating_4_8bit_mono
  3606 000018EE E307                    	jecxz	lff11m_3
  3607 000018F0 EBCE                    	jmp	short lff11m_1
  3608                                  
  3609                                  lff11m_7:
  3610                                  lff11s_7:
  3611 000018F2 E970F3FFFF              	jmp	lff11_5  ; error
  3612                                  
  3613                                  lff11m_3:
  3614                                  lff11s_3:
  3615 000018F7 E94AF3FFFF              	jmp	lff11_3	; padfill
  3616                                  		; (put zeros in the remain words of the buffer)
  3617                                  
  3618                                  load_11khz_stereo_8_bit:
  3619                                  	; 02/02/2025
  3620                                  	; 18/11/2023
  3621 000018FC F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3622                                  					; last of the file?
  3623 00001903 7402                    	jz	short lff11s_0		; no
  3624 00001905 F9                      	stc
  3625 00001906 C3                      	retn
  3626                                  
  3627                                  lff11s_0:
  3628                                  	; 01/12/2024
  3629                                  	; edi = audio buffer address
  3630 00001907 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3631                                          ;mov	edx, [loadsize]
  3632                                  
  3633                                  	; esi = buffer address
  3634                                  	;; edx = buffer size
  3635                                  
  3636                                  	; load file into memory
  3637                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000190C 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001912 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001914 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000191A B803000000          <1>  mov eax, %1
    99                              <1> 
   100 0000191F CD40                <1>  int 40h
  3638 00001921 72CF                    	jc	short lff11s_7 ; error !
  3639                                  
  3640                                  	; 01/12/2024
  3641 00001923 A3[587F0000]            	mov	[count], eax
  3642                                  	;;;
  3643                                  	; 07/12/2024
  3644                                  	;mov	edi, audio_buffer
  3645                                  	;;;
  3646 00001928 D1E8                    	shr	eax, 1
  3647 0000192A 7505                    	jnz	short lff11s_8
  3648 0000192C E92DF3FFFF              	jmp	lff11_eof
  3649                                  
  3650                                  lff11s_8:
  3651 00001931 89C1                    	mov	ecx, eax	; word count
  3652                                  lff11s_9:
  3653 00001933 BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3654                                  lff11s_1:
  3655                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3656 00001938 66AD                    	lodsw
  3657                                  	; 02/02/2025
  3658 0000193A 668B16                  	mov	dx, [esi]
  3659 0000193D 49                      	dec	ecx
  3660 0000193E 7504                    	jnz	short lff11s_2_1
  3661 00001940 66BA8080                	mov	dx, 8080h
  3662                                  lff11s_2_1:	
  3663                                  	; al = [previous_val_l]
  3664                                  	; ah = [previous_val_r]
  3665                                  	; dl = [next_val_l]
  3666                                  	; dh = [next_val_r]
  3667 00001944 E883060000              	call	interpolating_5_8bit_stereo
  3668 00001949 E3AC                    	jecxz	lff11s_3
  3669                                  lff11s_2_2:
  3670 0000194B 66AD                    	lodsw
  3671                                  	; 02/02/2025
  3672 0000194D 668B16                  	mov	dx, [esi]
  3673 00001950 49                      	dec	ecx
  3674 00001951 7504                    	jnz	short lff11s_2_3
  3675 00001953 66BA8080                	mov	dx, 8080h
  3676                                  lff11s_2_3:
  3677 00001957 E85C070000               	call	interpolating_4_8bit_stereo
  3678 0000195C E399                    	jecxz	lff11s_3
  3679                                  	
  3680 0000195E 4D                      	dec	ebp
  3681 0000195F 74D2                    	jz	short lff11s_9
  3682                                  
  3683 00001961 66AD                    	lodsw
  3684                                  	; 02/02/2025
  3685 00001963 668B16                  	mov	dx, [esi]
  3686 00001966 49                      	dec	ecx
  3687 00001967 7504                    	jnz	short lff11s_2_4
  3688 00001969 66BA8080                	mov	dx, 8080h
  3689                                  lff11s_2_4:
  3690 0000196D E846070000              	call	interpolating_4_8bit_stereo
  3691 00001972 E383                    	jecxz	lff11s_3
  3692 00001974 EBC2                    	jmp	short lff11s_1
  3693                                  
  3694                                  load_11khz_mono_16_bit:
  3695                                  	; 02/02/2025
  3696                                  	; 18/11/2023
  3697 00001976 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3698                                  					; last of the file?
  3699 0000197D 7402                    	jz	short lff11m2_0		; no
  3700 0000197F F9                      	stc
  3701 00001980 C3                      	retn
  3702                                  
  3703                                  lff11m2_0:
  3704                                  	; 01/12/2024
  3705                                  	; edi = audio buffer address
  3706 00001981 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3707                                          ;mov	edx, [loadsize]
  3708                                  
  3709                                  	; esi = buffer address
  3710                                  	;; edx = buffer size
  3711                                  
  3712                                  	; load file into memory
  3713                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001986 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000198C 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 0000198E 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001994 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001999 CD40                <1>  int 40h
  3714 0000199B 724D                    	jc	short lff11m2_7 ; error !
  3715                                  
  3716                                  	; 01/12/2024
  3717 0000199D A3[587F0000]            	mov	[count], eax
  3718                                  	;;;
  3719                                  	; 07/12/2024
  3720                                  	;mov	edi, audio_buffer
  3721                                  	;;;
  3722 000019A2 D1E8                    	shr	eax, 1
  3723 000019A4 7505                    	jnz	short lff11m2_8
  3724 000019A6 E9B3F2FFFF              	jmp	lff11_eof
  3725                                  
  3726                                  lff11m2_8:
  3727 000019AB 89C1                    	mov	ecx, eax	; word count
  3728                                  lff11m2_9:
  3729 000019AD BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3730                                  lff11m2_1:
  3731                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3732 000019B2 66AD                    	lodsw
  3733                                  	; 02/02/2025
  3734 000019B4 668B16                  	mov	dx, [esi]
  3735 000019B7 49                      	dec	ecx
  3736 000019B8 7502                    	jnz	short lff11m2_2_1
  3737 000019BA 31D2                    	xor	edx, edx
  3738                                  lff11m2_2_1:	
  3739                                  	; ax = [previous_val]
  3740                                  	; dx = [next_val]
  3741 000019BC E864070000              	call	interpolating_5_16bit_mono
  3742 000019C1 E362                    	jecxz	lff11m2_3
  3743                                  lff11m2_2_2:
  3744 000019C3 66AD                    	lodsw
  3745                                  	; 02/02/2025
  3746 000019C5 668B16                  	mov	dx, [esi]
  3747 000019C8 49                      	dec	ecx
  3748 000019C9 7502                    	jnz	short lff11m2_2_3
  3749 000019CB 31D2                    	xor	edx, edx
  3750                                  lff11m2_2_3:
  3751 000019CD E87D080000               	call	interpolating_4_16bit_mono
  3752 000019D2 E351                    	jecxz	lff11m2_3
  3753                                  
  3754 000019D4 4D                      	dec	ebp
  3755 000019D5 74D6                    	jz	short lff11m2_9
  3756                                  
  3757 000019D7 66AD                    	lodsw
  3758                                  	; 02/02/2025
  3759 000019D9 668B16                  	mov	dx, [esi]
  3760 000019DC 49                      	dec	ecx
  3761 000019DD 7502                    	jnz	short lff11m2_2_4
  3762 000019DF 31D2                    	xor	edx, edx
  3763                                  lff11m2_2_4:
  3764 000019E1 E869080000               	call	interpolating_4_16bit_mono
  3765 000019E6 E33D                    	jecxz	lff11m2_3
  3766 000019E8 EBC8                    	jmp	short lff11m2_1
  3767                                  
  3768                                  lff11m2_7:
  3769                                  lff11s2_7:
  3770 000019EA E978F2FFFF              	jmp	lff11_5  ; error
  3771                                  
  3772                                  load_11khz_stereo_16_bit:
  3773                                  	; 17/01/2025
  3774                                  	; 18/11/2023
  3775 000019EF F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3776                                  					; last of the file?
  3777 000019F6 7402                    	jz	short lff11s2_0		; no
  3778 000019F8 F9                      	stc
  3779 000019F9 C3                      	retn
  3780                                  
  3781                                  lff11s2_0:
  3782                                  	; 01/12/2024
  3783                                  	; edi = audio buffer address
  3784 000019FA BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3785                                          ;mov	edx, [loadsize]
  3786                                  
  3787                                  	; esi = buffer address
  3788                                  	;; edx = buffer size
  3789                                  
  3790                                  	; load file into memory
  3791                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000019FF 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001A05 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001A07 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001A0D B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001A12 CD40                <1>  int 40h
  3792 00001A14 72D4                    	jc	short lff11s2_7 ; error !
  3793                                  
  3794                                  	; 01/12/2024
  3795 00001A16 A3[587F0000]            	mov	[count], eax
  3796                                  	;;;
  3797                                  	; 07/12/2024
  3798                                  	;mov	edi, audio_buffer
  3799                                  	;;;
  3800 00001A1B C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  3801 00001A1E 750A                    	jnz	short lff11s2_8
  3802 00001A20 E939F2FFFF              	jmp	lff11_eof
  3803                                  
  3804                                  lff11m2_3:
  3805                                  lff11s2_3:
  3806 00001A25 E91CF2FFFF              	jmp	lff11_3	; padfill
  3807                                  		; (put zeros in the remain words of the buffer)
  3808                                  
  3809                                  lff11s2_8:
  3810 00001A2A 89C1                    	mov	ecx, eax	; dword count
  3811                                  lff11s2_9:
  3812 00001A2C BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3813                                  lff11s2_1:
  3814                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3815 00001A31 66AD                    	lodsw
  3816 00001A33 89C3                    	mov	ebx, eax
  3817 00001A35 66AD                    	lodsw
  3818 00001A37 8B16                    	mov	edx, [esi]
  3819                                  	; 17/01/2025
  3820                                  	;mov	[next_val_l], edx
  3821                                  	; 26/11/2023
  3822                                  	;shr	edx, 16
  3823                                  	;mov	[next_val_r], dx
  3824 00001A39 49                      	dec	ecx
  3825 00001A3A 7502                    	jnz	short lff11s2_2_1
  3826 00001A3C 31D2                    	xor	edx, edx ; 0
  3827                                  	;mov	[next_val_l], dx
  3828                                  	;mov	[next_val_r], dx
  3829                                  lff11s2_2_1:
  3830                                  	; bx = [previous_val_l]
  3831                                  	; ax = [previous_val_r]
  3832                                  	; [next_val_l]
  3833                                  	; dx = [next_val_r]
  3834                                  	;;;
  3835                                  	; 17/01/2025 (BugFix)
  3836 00001A3E 8915[09230000]          	mov	[next_val_l], edx
  3837                                  	;;;
  3838 00001A44 E837070000              	call	interpolating_5_16bit_stereo
  3839 00001A49 E3DA                    	jecxz	lff11s2_3
  3840                                  lff11s2_2_2:
  3841 00001A4B 66AD                    	lodsw
  3842 00001A4D 89C3                    	mov	ebx, eax
  3843 00001A4F 66AD                    	lodsw
  3844 00001A51 8B16                    	mov	edx, [esi]
  3845                                  	; 17/01/2025
  3846                                  	;mov	[next_val_l], dx
  3847                                  	; 26/11/2023
  3848                                  	;shr	edx, 16
  3849                                  	;mov	[next_val_r], dx
  3850 00001A53 49                      	dec	ecx
  3851 00001A54 7502                    	jnz	short lff11s2_2_3
  3852 00001A56 31D2                    	xor	edx, edx ; 0
  3853                                  	;mov	[next_val_l], dx
  3854                                  	;mov	[next_val_r], dx
  3855                                  lff11s2_2_3:
  3856                                  	;;;
  3857                                  	; 17/01/2025 (BugFix)
  3858 00001A58 8915[09230000]          	mov	[next_val_l], edx
  3859                                  	;;;
  3860 00001A5E E825080000              	call	interpolating_4_16bit_stereo
  3861 00001A63 E3C0                    	jecxz	lff11s2_3
  3862                                  	
  3863 00001A65 4D                      	dec	ebp
  3864 00001A66 74C4                    	jz	short lff11s2_9
  3865                                  
  3866 00001A68 66AD                    	lodsw
  3867 00001A6A 89C3                    	mov	ebx, eax
  3868 00001A6C 66AD                    	lodsw
  3869 00001A6E 8B16                    	mov	edx, [esi]
  3870                                  	; 17/01/2025
  3871                                  	;mov	[next_val_l], dx
  3872                                  	; 26/11/2023
  3873                                  	;shr	edx, 16
  3874                                  	;mov	[next_val_r], dx
  3875 00001A70 49                      	dec	ecx
  3876 00001A71 7502                    	jnz	short lff11s2_2_4
  3877 00001A73 31D2                    	xor	edx, edx ; 0
  3878                                  	;mov	[next_val_l], dx
  3879                                  	;mov	[next_val_r], dx
  3880                                  lff11s2_2_4:
  3881                                  	;;;
  3882                                  	; 17/01/2025 (BugFix)
  3883 00001A75 8915[09230000]          	mov	[next_val_l], edx
  3884                                  	;;;
  3885 00001A7B E808080000               	call	interpolating_4_16bit_stereo
  3886 00001A80 E3A3                    	jecxz	lff11s2_3
  3887 00001A82 EBAD                    	jmp	short lff11s2_1
  3888                                  
  3889                                  ; .....................
  3890                                  
  3891                                  load_44khz_mono_8_bit:
  3892                                  	; 02/02/2025
  3893                                  	; 18/11/2023
  3894 00001A84 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3895                                  					; last of the file?
  3896 00001A8B 7402                    	jz	short lff44m_0		; no
  3897 00001A8D F9                      	stc
  3898 00001A8E C3                      	retn
  3899                                  
  3900                                  lff44m_0:
  3901                                  	; 01/12/2024
  3902                                  	; edi = audio buffer address
  3903 00001A8F BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3904                                          ;mov	edx, [loadsize]
  3905                                  
  3906                                  	; esi = buffer address
  3907                                  	;; edx = buffer size
  3908                                  
  3909                                  	; load file into memory
  3910                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001A94 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001A9A 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001A9C 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001AA2 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001AA7 CD40                <1>  int 40h
  3911 00001AA9 7250                    	jc	short lff44m_7 ; error !
  3912                                  
  3913                                  	; 01/12/2024
  3914 00001AAB A3[587F0000]            	mov	[count], eax
  3915                                  	;;;
  3916                                  	; 07/12/2024
  3917                                  	;mov	edi, audio_buffer
  3918                                  	;;;
  3919 00001AB0 21C0                    	and	eax, eax
  3920 00001AB2 7505                    	jnz	short lff44m_8
  3921 00001AB4 E9A5F1FFFF              	jmp	lff44_eof
  3922                                  
  3923                                  lff44m_8:
  3924 00001AB9 89C1                    	mov	ecx, eax	; byte count
  3925                                  lff44m_9:
  3926 00001ABB BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  3927 00001AC0 C605[0D230000]02        	mov	byte [faz], 2  ; 2 steps/phases
  3928                                  lff44m_1:
  3929                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  3930                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  3931 00001AC7 AC                      	lodsb
  3932                                  	; 02/02/2025
  3933 00001AC8 8A16                    	mov	dl, [esi]
  3934 00001ACA 49                      	dec	ecx
  3935 00001ACB 7502                    	jnz	short lff44m_2_1
  3936 00001ACD B280                    	mov	dl, 80h
  3937                                  lff44m_2_1:	
  3938                                  	; al = [previous_val]
  3939                                  	; dl = [next_val]
  3940 00001ACF E871030000              	call	interpolating_2_8bit_mono
  3941 00001AD4 E320                    	jecxz	lff44m_3
  3942                                  lff44m_2_2:
  3943 00001AD6 AC                      	lodsb
  3944 00001AD7 2C80                    	sub	al, 80h
  3945 00001AD9 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  3946 00001ADD 66AB                    	stosw		; (L)
  3947 00001ADF 66AB                    	stosw		; (R)
  3948                                  
  3949 00001AE1 49                      	dec	ecx
  3950 00001AE2 7412                    	jz	short lff44m_3
  3951 00001AE4 4D                      	dec	ebp
  3952 00001AE5 75EF                    	jnz	short lff44m_2_2
  3953                                  	
  3954 00001AE7 FE0D[0D230000]          	dec	byte [faz]
  3955 00001AED 74CC                    	jz	short lff44m_9 
  3956 00001AEF BD0B000000              	mov	ebp, 11
  3957 00001AF4 EBD1                    	jmp	short lff44m_1
  3958                                  
  3959                                  lff44m_3:
  3960                                  lff44s_3:
  3961 00001AF6 E94BF1FFFF              	jmp	lff44_3	; padfill
  3962                                  		; (put zeros in the remain words of the buffer)
  3963                                  lff44m_7:
  3964                                  lff44s_7:
  3965 00001AFB E967F1FFFF              	jmp	lff44_5  ; error
  3966                                  
  3967                                  load_44khz_stereo_8_bit:
  3968                                  	; 02/02/2025
  3969                                  	; 16/11/2023
  3970 00001B00 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3971                                  					; last of the file?
  3972 00001B07 7402                    	jz	short lff44s_0		; no
  3973 00001B09 F9                      	stc
  3974 00001B0A C3                      	retn
  3975                                  
  3976                                  lff44s_0:
  3977                                  	; 01/12/2024
  3978                                  	; edi = audio buffer address
  3979 00001B0B BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3980                                          ;mov	edx, [loadsize]
  3981                                  
  3982                                  	; esi = buffer address
  3983                                  	;; edx = buffer size
  3984                                  
  3985                                  	; load file into memory
  3986                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001B10 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001B16 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001B18 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001B1E B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001B23 CD40                <1>  int 40h
  3987 00001B25 72D4                    	jc	short lff44s_7 ; error !
  3988                                  
  3989                                  	; 01/12/2024
  3990 00001B27 A3[587F0000]            	mov	[count], eax
  3991                                  	;;;
  3992                                  	; 07/12/2024
  3993                                  	;mov	edi, audio_buffer
  3994                                  	;;;
  3995 00001B2C D1E8                    	shr	eax, 1
  3996 00001B2E 7505                    	jnz	short lff44s_8
  3997 00001B30 E929F1FFFF              	jmp	lff44_eof
  3998                                  
  3999                                  lff44s_8:
  4000 00001B35 89C1                    	mov	ecx, eax	; word count
  4001                                  lff44s_9:
  4002 00001B37 BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4003 00001B3C C605[0D230000]02        	mov	byte [faz], 2  ; 2 steps/phase
  4004                                  lff44s_1:
  4005                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4006                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4007 00001B43 66AD                    	lodsw
  4008                                  	; 02/02/2025
  4009 00001B45 668B16                  	mov	dx, [esi]
  4010 00001B48 49                      	dec	ecx
  4011 00001B49 7504                    	jnz	short lff44s_2_1
  4012 00001B4B 66BA8080                	mov	dx, 8080h
  4013                                  lff44s_2_1:	
  4014                                  	; al = [previous_val_l]
  4015                                  	; ah = [previous_val_r]
  4016                                  	; dl = [next_val_l]
  4017                                  	; dh = [next_val_r]
  4018 00001B4F E80E030000              	call	interpolating_2_8bit_stereo
  4019 00001B54 E3A0                    	jecxz	lff44s_3
  4020                                  lff44s_2_2:
  4021 00001B56 AC                      	lodsb
  4022 00001B57 2C80                    	sub	al, 80h
  4023 00001B59 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4024 00001B5D 66AB                    	stosw		; (L)
  4025 00001B5F AC                      	lodsb
  4026 00001B60 2C80                    	sub	al, 80h
  4027 00001B62 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4028 00001B66 66AB                    	stosw		; (R)
  4029                                  
  4030 00001B68 49                      	dec	ecx
  4031 00001B69 748B                    	jz	short lff44s_3
  4032 00001B6B 4D                      	dec	ebp
  4033 00001B6C 75E8                    	jnz	short lff44s_2_2
  4034                                  	
  4035 00001B6E FE0D[0D230000]          	dec	byte [faz]
  4036 00001B74 74C1                    	jz	short lff44s_9 
  4037 00001B76 BD0B000000              	mov	ebp, 11
  4038 00001B7B EBC6                    	jmp	short lff44s_1
  4039                                  
  4040                                  load_44khz_mono_16_bit:
  4041                                  	; 02/02/2025
  4042                                  	; 18/11/2023
  4043 00001B7D F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4044                                  					; last of the file?
  4045 00001B84 7402                    	jz	short lff44m2_0		; no
  4046 00001B86 F9                      	stc
  4047 00001B87 C3                      	retn
  4048                                  
  4049                                  lff44m2_0:
  4050                                  	; 01/12/2024
  4051                                  	; edi = audio buffer address
  4052 00001B88 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4053                                          ;mov	edx, [loadsize]
  4054                                  
  4055                                  	; esi = buffer address
  4056                                  	;; edx = buffer size
  4057                                  
  4058                                  	; load file into memory
  4059                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001B8D 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001B93 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001B95 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001B9B B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001BA0 CD40                <1>  int 40h
  4060 00001BA2 724D                    	jc	short lff44m2_7 ; error !
  4061                                  
  4062                                  	; 01/12/2024
  4063 00001BA4 A3[587F0000]            	mov	[count], eax
  4064                                  	;;;
  4065                                  	; 07/12/2024
  4066                                  	;mov	edi, audio_buffer
  4067                                  	;;;
  4068 00001BA9 D1E8                    	shr	eax, 1
  4069 00001BAB 7505                    	jnz	short lff44m2_8
  4070 00001BAD E9ACF0FFFF              	jmp	lff44_eof
  4071                                  
  4072                                  lff44m2_8:
  4073 00001BB2 89C1                    	mov	ecx, eax	; word count
  4074                                  lff44m2_9:
  4075 00001BB4 BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4076 00001BB9 C605[0D230000]02        	mov	byte [faz], 2  ; 2 steps/phases
  4077                                  lff44m2_1:
  4078                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4079                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4080 00001BC0 66AD                    	lodsw
  4081                                  	; 02/02/2025
  4082 00001BC2 668B16                  	mov	dx, [esi]
  4083 00001BC5 49                      	dec	ecx
  4084 00001BC6 7502                    	jnz	short lff44m2_2_1
  4085 00001BC8 31D2                    	xor	edx, edx
  4086                                  lff44m2_2_1:	
  4087                                  	; ax = [previous_val]
  4088                                  	; dx = [next_val]
  4089 00001BCA E857030000              	call	interpolating_2_16bit_mono
  4090 00001BCF E31B                    	jecxz	lff44m2_3
  4091                                  lff44m2_2_2:
  4092 00001BD1 66AD                    	lodsw
  4093 00001BD3 66AB                    	stosw		; (L)eft Channel
  4094 00001BD5 66AB                    	stosw		; (R)ight Channel
  4095                                  
  4096 00001BD7 49                      	dec	ecx
  4097 00001BD8 7412                    	jz	short lff44m2_3
  4098 00001BDA 4D                      	dec	ebp
  4099 00001BDB 75F4                    	jnz	short lff44m2_2_2
  4100                                  	
  4101 00001BDD FE0D[0D230000]          	dec	byte [faz]
  4102 00001BE3 74CF                    	jz	short lff44m2_9
  4103 00001BE5 BD0B000000              	mov	ebp, 11
  4104 00001BEA EBD4                    	jmp	short lff44m2_1
  4105                                  
  4106                                  lff44m2_3:
  4107                                  lff44s2_3:
  4108 00001BEC E955F0FFFF              	jmp	lff44_3	; padfill
  4109                                  		; (put zeros in the remain words of the buffer)
  4110                                  lff44m2_7:
  4111                                  lff44s2_7:
  4112 00001BF1 E971F0FFFF              	jmp	lff44_5  ; error
  4113                                  
  4114                                  load_44khz_stereo_16_bit:
  4115                                  	; 18/11/2023
  4116 00001BF6 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4117                                  					; last of the file?
  4118 00001BFD 7402                    	jz	short lff44s2_0		; no
  4119 00001BFF F9                      	stc
  4120 00001C00 C3                      	retn
  4121                                  
  4122                                  lff44s2_0:
  4123                                  	; 01/12/2024
  4124                                  	; edi = audio buffer address
  4125 00001C01 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4126                                          ;mov	edx, [loadsize]
  4127                                  
  4128                                  	; esi = buffer address
  4129                                  	;; edx = buffer size
  4130                                  
  4131                                  	; load file into memory
  4132                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001C06 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001C0C 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001C0E 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001C14 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001C19 CD40                <1>  int 40h
  4133 00001C1B 72D4                    	jc	short lff44s2_7 ; error !
  4134                                  
  4135                                  	; 01/12/2024
  4136 00001C1D A3[587F0000]            	mov	[count], eax
  4137                                  	;;;
  4138                                  	; 07/12/2024
  4139                                  	;mov	edi, audio_buffer
  4140                                  	;;;
  4141 00001C22 C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  4142 00001C25 7505                    	jnz	short lff44s2_8
  4143 00001C27 E932F0FFFF              	jmp	lff44_eof
  4144                                  
  4145                                  lff44s2_8:
  4146 00001C2C 89C1                    	mov	ecx, eax	; dword count
  4147                                  lff44s2_9:
  4148 00001C2E BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4149 00001C33 C605[0D230000]02        	mov	byte [faz], 2  ; 2 steps/phase
  4150                                  lff44s2_1:
  4151                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4152                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4153 00001C3A 66AD                    	lodsw
  4154 00001C3C 89C3                    	mov	ebx, eax
  4155 00001C3E 66AD                    	lodsw
  4156                                  	;mov	dx, [esi]
  4157                                  	;mov	[next_val_l], dx
  4158                                  	;mov	dx, [esi+2]
  4159                                  	; 26/11/2023
  4160 00001C40 8B16                    	mov	edx, [esi]
  4161 00001C42 668915[09230000]        	mov	[next_val_l], dx
  4162 00001C49 C1EA10                  	shr	edx, 16
  4163 00001C4C 49                      	dec	ecx
  4164 00001C4D 7509                    	jnz	short lff44s2_2_1
  4165 00001C4F 31D2                    	xor	edx, edx ; 0
  4166 00001C51 668915[09230000]        	mov	[next_val_l], dx
  4167                                  lff44s2_2_1:
  4168                                  	; bx = [previous_val_l]
  4169                                  	; ax = [previous_val_r]
  4170                                  	; [next_val_l]
  4171                                  	; dx = [next_val_r]
  4172 00001C58 E8E1020000              	call	interpolating_2_16bit_stereo
  4173 00001C5D E38D                    	jecxz	lff44s2_3
  4174                                  lff44s2_2_2:
  4175                                  	;movsw		; (L)eft Channel
  4176                                  	;movsw		; (R)ight Channel
  4177 00001C5F A5                      	movsd
  4178                                  
  4179 00001C60 49                      	dec	ecx
  4180 00001C61 7489                    	jz	short lff44s2_3	
  4181 00001C63 4D                      	dec	ebp
  4182 00001C64 75F9                    	jnz	short lff44s2_2_2
  4183                                  	
  4184 00001C66 FE0D[0D230000]          	dec	byte [faz]
  4185 00001C6C 74C0                    	jz	short lff44s2_9 
  4186 00001C6E BD0B000000              	mov	ebp, 11
  4187 00001C73 EBC5                    	jmp	short lff44s2_1
  4188                                  
  4189                                  ; .....................
  4190                                  
  4191                                  	; 02/02/2025
  4192                                  load_12khz_mono_8_bit:
  4193 00001C75 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4194                                  					; last of the file?
  4195 00001C7C 7402                    	jz	short lff12m_0		; no
  4196 00001C7E F9                      	stc
  4197 00001C7F C3                      	retn
  4198                                  
  4199                                  lff12m_0:
  4200                                  	; edi = audio buffer address
  4201 00001C80 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4202                                  
  4203                                  	; load file into memory
  4204                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001C85 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001C8B 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001C8D 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001C93 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001C98 CD40                <1>  int 40h
  4205 00001C9A 7256                    	jc	short lff12m_7 ; error !
  4206                                  
  4207 00001C9C A3[587F0000]            	mov	[count], eax
  4208                                  
  4209 00001CA1 21C0                    	and	eax, eax
  4210 00001CA3 7505                    	jnz	short lff12m_8
  4211 00001CA5 E9B4EFFFFF              	jmp	lff12_eof
  4212                                  
  4213                                  lff12m_8:
  4214 00001CAA 89C1                    	mov	ecx, eax		; byte count
  4215                                  lff12m_1:
  4216                                  	; original-interpolated-interpolated-interpolated
  4217 00001CAC AC                      	lodsb
  4218                                  	; 02/02/2025
  4219 00001CAD 8A16                    	mov	dl, [esi]
  4220 00001CAF 49                      	dec	ecx
  4221 00001CB0 7502                    	jnz	short lff12m_2
  4222 00001CB2 B280                    	mov	dl, 80h
  4223                                  lff12m_2:	
  4224                                  	; al = [previous_val]
  4225                                  	; dl = [next_val]
  4226 00001CB4 E8C0030000               	call	interpolating_4_8bit_mono
  4227 00001CB9 E353                    	jecxz	lff12m_3
  4228 00001CBB EBEF                    	jmp	short lff12m_1
  4229                                  
  4230                                  	; 02/02/2025
  4231                                  load_12khz_stereo_8_bit:
  4232 00001CBD F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4233                                  					; last of the file?
  4234 00001CC4 7402                    	jz	short lff12s_0		; no
  4235 00001CC6 F9                      	stc
  4236 00001CC7 C3                      	retn
  4237                                  
  4238                                  lff12s_0:
  4239                                  	; edi = audio buffer address
  4240 00001CC8 BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4241                                  
  4242                                  	; load file into memory
  4243                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001CCD 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001CD3 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001CD5 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001CDB B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001CE0 CD40                <1>  int 40h
  4244 00001CE2 720E                    	jc	short lff12s_7 ; error !
  4245                                  
  4246 00001CE4 A3[587F0000]            	mov	[count], eax
  4247                                  
  4248 00001CE9 D1E8                    	shr	eax, 1
  4249 00001CEB 750A                    	jnz	short lff12s_8
  4250 00001CED E96CEFFFFF              	jmp	lff12_eof
  4251                                  
  4252                                  lff12m_7:
  4253                                  lff12s_7:
  4254 00001CF2 E970EFFFFF              	jmp	lff12_5  ; error
  4255                                  
  4256                                  lff12s_8:
  4257 00001CF7 89C1                    	mov	ecx, eax	; word count
  4258                                  lff12s_1:
  4259                                  	; original-interpolated-interpolated-interpolated
  4260 00001CF9 66AD                    	lodsw
  4261                                  	; 02/02/2025
  4262 00001CFB 668B16                  	mov	dx, [esi]
  4263 00001CFE 49                      	dec	ecx
  4264 00001CFF 7504                    	jnz	short lff12s_2
  4265 00001D01 66BA8080                	mov	dx, 8080h
  4266                                  lff12s_2:	
  4267                                  	; al = [previous_val_l]
  4268                                  	; ah = [previous_val_r]
  4269                                  	; dl = [next_val_l]
  4270                                  	; dh = [next_val_r]
  4271 00001D05 E8AE030000              	call	interpolating_4_8bit_stereo
  4272 00001D0A E302                    	jecxz	lff12s_3
  4273 00001D0C EBEB                    	jmp	short lff12s_1
  4274                                  
  4275                                  lff12m_3:
  4276                                  lff12s_3:
  4277 00001D0E E933EFFFFF              	jmp	lff12_3	; padfill
  4278                                  		; (put zeros in the remain words of the buffer)
  4279                                  
  4280                                  	; 02/02/2025
  4281                                  load_12khz_mono_16_bit:
  4282 00001D13 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4283                                  					; last of the file?
  4284 00001D1A 7402                    	jz	short lff12m2_0		; no
  4285 00001D1C F9                      	stc
  4286 00001D1D C3                      	retn
  4287                                  
  4288                                  lff12m2_0:
  4289                                  	; edi = audio buffer address
  4290 00001D1E BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4291                                  
  4292                                  	; load file into memory
  4293                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001D23 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001D29 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001D2B 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001D31 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001D36 CD40                <1>  int 40h
  4294 00001D38 7223                    	jc	short lff12m2_7 ; error !
  4295                                  
  4296 00001D3A A3[587F0000]            	mov	[count], eax
  4297                                  
  4298 00001D3F D1E8                    	shr	eax, 1
  4299 00001D41 7505                    	jnz	short lff12m2_8
  4300 00001D43 E916EFFFFF              	jmp	lff12_eof
  4301                                  
  4302                                  lff12m2_8:
  4303 00001D48 89C1                    	mov	ecx, eax	; word count
  4304                                  lff12m2_1:
  4305                                  	; original-interpolated-interpolated-interpolated
  4306 00001D4A 66AD                    	lodsw
  4307                                  	; 02/02/2025
  4308 00001D4C 668B16                  	mov	dx, [esi]
  4309 00001D4F 49                      	dec	ecx
  4310 00001D50 7502                    	jnz	short lff12m2_2
  4311 00001D52 31D2                    	xor	edx, edx
  4312                                  lff12m2_2:	
  4313                                  	; ax = [previous_val]
  4314                                  	; dx = [next_val]
  4315 00001D54 E8F6040000               	call	interpolating_4_16bit_mono
  4316 00001D59 E3B3                    	jecxz	lff12m_3
  4317 00001D5B EBED                    	jmp	short lff12m2_1
  4318                                  
  4319                                  lff12m2_7:
  4320                                  lff12s2_7:
  4321 00001D5D E905EFFFFF              	jmp	lff12_5  ; error
  4322                                  
  4323                                  	; 02/02/2025
  4324                                  load_12khz_stereo_16_bit:
  4325 00001D62 F605[DE7E0000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4326                                  					; last of the file?
  4327 00001D69 7402                    	jz	short lff12s2_0		; no
  4328 00001D6B F9                      	stc
  4329 00001D6C C3                      	retn
  4330                                  
  4331                                  lff12s2_0:
  4332                                  	; edi = audio buffer address
  4333 00001D6D BE[00800100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4334                                  
  4335                                  	; load file into memory
  4336                                  	sys 	_read, [filehandle], esi, [loadsize]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00001D72 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 00001D78 89F1                <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00001D7A 8B15[487F0000]      <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00001D80 B803000000          <1>  mov eax, %1
    99                              <1> 
   100 00001D85 CD40                <1>  int 40h
  4337 00001D87 72D4                    	jc	short lff12s2_7 ; error !
  4338                                  
  4339 00001D89 A3[587F0000]            	mov	[count], eax
  4340                                  
  4341 00001D8E C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  4342 00001D91 750A                    	jnz	short lff12s2_8
  4343 00001D93 E9C6EEFFFF              	jmp	lff12_eof
  4344                                  
  4345                                  lff12m2_3:
  4346                                  lff12s2_3:
  4347 00001D98 E9A9EEFFFF              	jmp	lff12_3	; padfill
  4348                                  		; (put zeros in the remain words of the buffer)
  4349                                  
  4350                                  lff12s2_8:
  4351 00001D9D 89C1                    	mov	ecx, eax	; dword count
  4352                                  lff12s2_1:
  4353                                  	; original-interpolated-interpolated-interpolated
  4354 00001D9F 66AD                    	lodsw
  4355 00001DA1 89C3                    	mov	ebx, eax
  4356 00001DA3 66AD                    	lodsw
  4357 00001DA5 8B16                    	mov	edx, [esi]
  4358 00001DA7 49                      	dec	ecx
  4359 00001DA8 7502                    	jnz	short lff12s2_2
  4360 00001DAA 31D2                    	xor	edx, edx ; 0
  4361                                  lff12s2_2:
  4362                                  	;mov	[next_val_l], dx
  4363                                  	;shr	edx, 16
  4364                                  	;mov	[next_val_r], dx
  4365                                  	; 02/02/2025
  4366 00001DAC 8915[09230000]          	mov	[next_val_l], edx
  4367                                  
  4368                                  	; bx = [previous_val_l]
  4369                                  	; ax = [previous_val_r]
  4370                                  	; [next_val_l]
  4371                                  	; [next_val_r]
  4372 00001DB2 E8D1040000              	call	interpolating_4_16bit_stereo
  4373 00001DB7 E3DF                    	jecxz	lff12s2_3
  4374 00001DB9 EBE4                    	jmp	short lff12s2_1
  4375                                  
  4376                                  ; .....................
  4377                                  
  4378                                  interpolating_3_8bit_mono:
  4379                                  	; 02/02/2025
  4380                                  	; 16/11/2023
  4381                                  	; al = [previous_val]
  4382                                  	; dl = [next_val]
  4383                                  	; original-interpolated-interpolated
  4384 00001DBB 88C3                    	mov	bl, al
  4385 00001DBD 2C80                    	sub	al, 80h
  4386 00001DBF 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4387 00001DC3 66AB                    	stosw		; original sample (L)
  4388 00001DC5 66AB                    	stosw		; original sample (R)
  4389 00001DC7 88D8                    	mov	al, bl
  4390 00001DC9 00D0                    	add	al, dl
  4391 00001DCB D0D8                    	rcr	al, 1
  4392 00001DCD 88C7                    	mov	bh, al	; interpolated middle (temporary)
  4393 00001DCF 00D8                    	add	al, bl
  4394 00001DD1 D0D8                    	rcr	al, 1
  4395 00001DD3 2C80                    	sub	al, 80h
  4396 00001DD5 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4397 00001DD9 66AB                    	stosw		; interpolated sample 1 (L)
  4398 00001DDB 66AB                    	stosw		; interpolated sample 1 (R)
  4399 00001DDD 88F8                    	mov	al, bh
  4400 00001DDF 00D0                    	add	al, dl	; [next_val]
  4401 00001DE1 D0D8                    	rcr	al, 1
  4402                                  	; 02/02/2025
  4403 00001DE3 2C80                    	sub	al, 80h
  4404 00001DE5 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4405 00001DE9 66AB                    	stosw		; interpolated sample 2 (L)
  4406 00001DEB 66AB                    	stosw		; interpolated sample 2 (R)
  4407 00001DED C3                      	retn
  4408                                  
  4409                                  interpolating_3_8bit_stereo:
  4410                                  	; 02/02/2025
  4411                                  	; 16/11/2023
  4412                                  	; al = [previous_val_l]
  4413                                  	; ah = [previous_val_r]
  4414                                  	; dl = [next_val_l]
  4415                                  	; dh = [next_val_r]	
  4416                                  	; original-interpolated-interpolated
  4417 00001DEE 89C3                    	mov	ebx, eax
  4418 00001DF0 2C80                    	sub	al, 80h
  4419 00001DF2 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4420 00001DF6 66AB                    	stosw		; original sample (L)
  4421 00001DF8 88F8                    	mov	al, bh
  4422 00001DFA 2C80                    	sub	al, 80h
  4423 00001DFC 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4424 00001E00 66AB                    	stosw		; original sample (R)
  4425 00001E02 88D8                    	mov	al, bl
  4426 00001E04 00D0                    	add	al, dl	; [next_val_l]
  4427 00001E06 D0D8                    	rcr	al, 1
  4428 00001E08 50                      	push	eax ; *	; al = interpolated middle (L) (temporary)
  4429 00001E09 00D8                    	add	al, bl	; [previous_val_l]
  4430 00001E0B D0D8                    	rcr	al, 1
  4431 00001E0D 2C80                    	sub	al, 80h
  4432 00001E0F 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4433 00001E13 66AB                    	stosw		; interpolated sample 1 (L)
  4434 00001E15 88F8                    	mov	al, bh
  4435 00001E17 00F0                    	add	al, dh	; [next_val_r]
  4436 00001E19 D0D8                    	rcr	al, 1
  4437 00001E1B 50                      	push	eax ; ** ; al = interpolated middle (R) (temporary)
  4438 00001E1C 00F8                    	add	al, bh	; [previous_val_r]
  4439 00001E1E D0D8                    	rcr	al, 1
  4440 00001E20 2C80                    	sub	al, 80h
  4441 00001E22 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4442 00001E26 66AB                    	stosw		; interpolated sample 1 (R)
  4443 00001E28 5B                      	pop	ebx ; **
  4444 00001E29 58                      	pop	eax ; *
  4445 00001E2A 00D0                    	add	al, dl	; [next_val_l]
  4446 00001E2C D0D8                    	rcr	al, 1
  4447                                  	; 02/02/2025
  4448 00001E2E 2C80                    	sub	al, 80h
  4449 00001E30 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4450 00001E34 66AB                    	stosw		; interpolated sample 2 (L)
  4451 00001E36 88D8                    	mov	al, bl
  4452 00001E38 00F0                    	add	al, dh	; [next_val_r]
  4453 00001E3A D0D8                    	rcr	al, 1
  4454                                  	; 02/02/2025
  4455 00001E3C 2C80                    	sub	al, 80h
  4456 00001E3E 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4457 00001E42 66AB                    	stosw		; interpolated sample 2 (R)
  4458 00001E44 C3                      	retn
  4459                                  
  4460                                  interpolating_2_8bit_mono:
  4461                                  	; 16/11/2023
  4462                                  	; al = [previous_val]
  4463                                  	; dl = [next_val]
  4464                                  	; original-interpolated
  4465 00001E45 88C3                    	mov	bl, al
  4466 00001E47 2C80                    	sub	al, 80h
  4467 00001E49 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4468 00001E4D 66AB                    	stosw		; original sample (L)
  4469 00001E4F 66AB                    	stosw		; original sample (R)
  4470 00001E51 88D8                    	mov	al, bl
  4471 00001E53 00D0                    	add	al, dl
  4472 00001E55 D0D8                    	rcr	al, 1
  4473 00001E57 2C80                    	sub	al, 80h
  4474 00001E59 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4475 00001E5D 66AB                    	stosw		; interpolated sample (L)
  4476 00001E5F 66AB                    	stosw		; interpolated sample (R)
  4477 00001E61 C3                      	retn
  4478                                  
  4479                                  interpolating_2_8bit_stereo:
  4480                                  	; 16/11/2023
  4481                                  	; al = [previous_val_l]
  4482                                  	; ah = [previous_val_r]
  4483                                  	; dl = [next_val_l]
  4484                                  	; dh = [next_val_r]
  4485                                  	; original-interpolated
  4486 00001E62 89C3                    	mov	ebx, eax
  4487 00001E64 2C80                    	sub	al, 80h
  4488 00001E66 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4489 00001E6A 66AB                    	stosw		; original sample (L)
  4490 00001E6C 88F8                    	mov	al, bh
  4491 00001E6E 2C80                    	sub	al, 80h
  4492 00001E70 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4493 00001E74 66AB                    	stosw		; original sample (R)
  4494 00001E76 88D8                    	mov	al, bl	; [previous_val_l]
  4495 00001E78 00D0                    	add	al, dl	; [next_val_l]
  4496 00001E7A D0D8                    	rcr	al, 1
  4497 00001E7C 2C80                    	sub	al, 80h
  4498 00001E7E 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4499 00001E82 66AB                    	stosw		; interpolated sample (L)
  4500 00001E84 88F8                    	mov	al, bh
  4501 00001E86 00F0                    	add	al, dh	; [next_val_r]
  4502 00001E88 D0D8                    	rcr	al, 1
  4503 00001E8A 2C80                    	sub	al, 80h
  4504 00001E8C 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4505 00001E90 66AB                    	stosw		; interpolated sample (R)
  4506 00001E92 C3                      	retn
  4507                                  
  4508                                  interpolating_3_16bit_mono:
  4509                                  	; 16/11/2023
  4510                                  	; ax = [previous_val]
  4511                                  	; dx = [next_val]
  4512                                  	; original-interpolated-interpolated
  4513                                  
  4514 00001E93 66AB                    	stosw		; original sample (L)
  4515 00001E95 66AB                    	stosw		; original sample (R)
  4516 00001E97 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4517 00001E9A 50                      	push	eax ; *	; [previous_val]
  4518 00001E9B 80C680                  	add	dh, 80h
  4519 00001E9E 6601D0                  	add	ax, dx
  4520 00001EA1 66D1D8                  	rcr	ax, 1
  4521 00001EA4 5B                      	pop	ebx ; *
  4522 00001EA5 93                      	xchg	ebx, eax ; bx  = interpolated middle (temporary)
  4523 00001EA6 6601D8                  	add	ax, bx	; [previous_val] + interpolated middle
  4524 00001EA9 66D1D8                  	rcr	ax, 1
  4525 00001EAC 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4526 00001EAF 66AB                    	stosw 		; interpolated sample 1 (L)
  4527 00001EB1 66AB                    	stosw		; interpolated sample 1 (R)
  4528 00001EB3 89D8                    	mov	eax, ebx
  4529 00001EB5 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  4530 00001EB8 66D1D8                  	rcr	ax, 1
  4531 00001EBB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4532 00001EBE 66AB                    	stosw		; interpolated sample 2 (L)
  4533 00001EC0 66AB                    	stosw		; interpolated sample 2 (R)
  4534 00001EC2 C3                      	retn
  4535                                  
  4536                                  interpolating_3_16bit_stereo:
  4537                                  	; 16/11/2023
  4538                                  	; bx = [previous_val_l]
  4539                                  	; ax = [previous_val_r]
  4540                                  	; [next_val_l]
  4541                                  	; dx = [next_val_r]
  4542                                  	; original-interpolated-interpolated
  4543                                  
  4544 00001EC3 93                      	xchg	eax, ebx
  4545 00001EC4 66AB                    	stosw		; original sample (L)
  4546 00001EC6 93                      	xchg	eax, ebx
  4547 00001EC7 66AB                    	stosw		; original sample (R)
  4548 00001EC9 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4549 00001ECC 50                      	push	eax ; *	; [previous_val_r]
  4550 00001ECD 80C780                  	add	bh, 80h
  4551 00001ED0 8005[0A230000]80        	add	byte [next_val_l+1], 80h
  4552 00001ED7 66A1[09230000]          	mov	ax, [next_val_l]
  4553 00001EDD 6601D8                  	add	ax, bx	; [previous_val_l]
  4554 00001EE0 66D1D8                  	rcr	ax, 1
  4555 00001EE3 93                      	xchg	eax, ebx ; ax = [previous_val_l]
  4556 00001EE4 6601D8                  	add	ax, bx	; bx = interpolated middle (L)
  4557 00001EE7 66D1D8                  	rcr	ax, 1
  4558 00001EEA 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4559 00001EED 66AB                    	stosw 		; interpolated sample 1 (L)
  4560 00001EEF 58                      	pop	eax  ; *
  4561 00001EF0 80C680                  	add	dh, 80h ; convert sound level 0 to 65535 format
  4562 00001EF3 52                      	push	edx  ; * ; [next_val_r]
  4563 00001EF4 92                      	xchg	eax, edx
  4564 00001EF5 6601D0                  	add	ax, dx	; [next_val_r] + [previous_val_r]
  4565 00001EF8 66D1D8                  	rcr	ax, 1	; / 2
  4566 00001EFB 50                      	push	eax ; ** ; interpolated middle (R)
  4567 00001EFC 6601D0                  	add	ax, dx	; + [previous_val_r]
  4568 00001EFF 66D1D8                  	rcr	ax, 1
  4569 00001F02 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4570 00001F05 66AB                    	stosw 		; interpolated sample 1 (R)
  4571 00001F07 66A1[09230000]          	mov	ax, [next_val_l]
  4572 00001F0D 6601D8                  	add	ax, bx	; + interpolated middle (L)
  4573 00001F10 66D1D8                  	rcr	ax, 1
  4574 00001F13 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4575 00001F16 66AB                    	stosw 		; interpolated sample 2 (L)
  4576 00001F18 58                      	pop	eax ; **
  4577 00001F19 5A                      	pop	edx ; *
  4578 00001F1A 6601D0                  	add	ax, dx	; interpolated middle + [next_val_r]
  4579 00001F1D 66D1D8                  	rcr	ax, 1	; / 2
  4580 00001F20 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4581 00001F23 66AB                    	stosw 		; interpolated sample 2 (L)
  4582 00001F25 C3                      	retn
  4583                                  
  4584                                  interpolating_2_16bit_mono:
  4585                                  	; 16/11/2023
  4586                                  	; ax = [previous_val]
  4587                                  	; dx = [next_val]
  4588                                  	; original-interpolated
  4589                                  
  4590 00001F26 66AB                    	stosw		; original sample (L)
  4591 00001F28 66AB                    	stosw		; original sample (R)
  4592 00001F2A 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4593 00001F2D 80C680                  	add	dh, 80h
  4594 00001F30 6601D0                  	add	ax, dx
  4595 00001F33 66D1D8                  	rcr	ax, 1
  4596 00001F36 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4597 00001F39 66AB                    	stosw		; interpolated sample (L)
  4598 00001F3B 66AB                    	stosw		; interpolated sample (R)
  4599 00001F3D C3                      	retn
  4600                                  
  4601                                  interpolating_2_16bit_stereo:
  4602                                  	; 17/01/2025
  4603                                  	; 16/11/2023
  4604                                  	; bx = [previous_val_l]
  4605                                  	; ax = [previous_val_r]
  4606                                  	; [next_val_l]
  4607                                  	; dx = [next_val_r]
  4608                                  	; original-interpolated
  4609                                  
  4610 00001F3E 93                      	xchg	eax, ebx
  4611 00001F3F 66AB                    	stosw		; original sample (L)
  4612 00001F41 93                      	xchg	eax, ebx
  4613 00001F42 66AB                    	stosw		; original sample (R)
  4614 00001F44 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4615 00001F47 80C680                  	add	dh, 80h
  4616 00001F4A 6601D0                  	add	ax, dx	; [previous_val_r] + [next_val_r]
  4617 00001F4D 66D1D8                  	rcr	ax, 1	; / 2
  4618                                  	; 17/01/2025
  4619 00001F50 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4620                                  	;push	eax ; *	; interpolated sample (R)
  4621                                  	; 17/01/2025
  4622 00001F53 C1E010                  	shl	eax, 16
  4623 00001F56 66A1[09230000]          	mov	ax, [next_val_l]
  4624 00001F5C 80C480                  	add	ah, 80h
  4625 00001F5F 80C780                  	add	bh, 80h
  4626 00001F62 6601D8                  	add	ax, bx	; [next_val_l] + [previous_val_l]
  4627 00001F65 66D1D8                  	rcr	ax, 1	; / 2
  4628 00001F68 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4629                                  	; 17/01/2025
  4630                                  	;stosw 		; interpolated sample (L)
  4631                                  	;pop	eax ; *
  4632                                  	;sub	ah, 80h	; -32768 to +32767 format again
  4633                                  	;stosw 		; interpolated sample (R)
  4634                                  	; 17/01/2025
  4635 00001F6B AB                      	stosd
  4636 00001F6C C3                      	retn
  4637                                  
  4638                                  interpolating_5_8bit_mono:
  4639                                  	; 17/11/2023
  4640                                  	; al = [previous_val]
  4641                                  	; dl = [next_val]
  4642                                  	; original-interpltd-interpltd-interpltd-interpltd
  4643 00001F6D 88C3                    	mov	bl, al
  4644 00001F6F 2C80                    	sub	al, 80h
  4645 00001F71 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4646 00001F75 66AB                    	stosw		; original sample (L)
  4647 00001F77 66AB                    	stosw		; original sample (R)
  4648 00001F79 88D8                    	mov	al, bl
  4649 00001F7B 00D0                    	add	al, dl
  4650 00001F7D D0D8                    	rcr	al, 1
  4651 00001F7F 88C7                    	mov	bh, al	; interpolated middle (temporary)
  4652 00001F81 00D8                    	add	al, bl  ; [previous_val]
  4653 00001F83 D0D8                    	rcr	al, 1 	
  4654 00001F85 88C6                    	mov	dh, al	; interpolated 1st quarter (temporary)
  4655 00001F87 00D8                    	add	al, bl
  4656 00001F89 D0D8                    	rcr	al, 1
  4657 00001F8B 2C80                    	sub	al, 80h
  4658 00001F8D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4659 00001F91 66AB                    	stosw		; interpolated sample 1 (L)
  4660 00001F93 66AB                    	stosw		; interpolated sample 1 (R)
  4661 00001F95 88F8                    	mov	al, bh
  4662 00001F97 00F0                    	add	al, dh
  4663 00001F99 D0D8                    	rcr	al, 1
  4664 00001F9B 2C80                    	sub	al, 80h
  4665 00001F9D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4666 00001FA1 66AB                    	stosw		; interpolated sample 2 (L)
  4667 00001FA3 66AB                    	stosw		; interpolated sample 2 (R)
  4668 00001FA5 88F8                    	mov	al, bh
  4669 00001FA7 00D0                    	add	al, dl	; [next_val]
  4670 00001FA9 D0D8                    	rcr	al, 1
  4671 00001FAB 88C6                    	mov	dh, al	; interpolated 3rd quarter (temporary)
  4672 00001FAD 00F8                    	add	al, bh
  4673 00001FAF D0D8                    	rcr	al, 1
  4674 00001FB1 2C80                    	sub	al, 80h
  4675 00001FB3 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4676 00001FB7 66AB                    	stosw		; interpolated sample 3 (L)
  4677 00001FB9 66AB                    	stosw		; interpolated sample 3 (R)
  4678 00001FBB 88F0                    	mov	al, dh
  4679 00001FBD 00D0                    	add	al, dl
  4680 00001FBF D0D8                    	rcr	al, 1
  4681 00001FC1 2C80                    	sub	al, 80h
  4682 00001FC3 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4683 00001FC7 66AB                    	stosw		; interpolated sample 4 (L)
  4684 00001FC9 66AB                    	stosw		; interpolated sample 4 (R)
  4685 00001FCB C3                      	retn
  4686                                  
  4687                                  interpolating_5_8bit_stereo:
  4688                                  	; 17/11/2023
  4689                                  	; al = [previous_val_l]
  4690                                  	; ah = [previous_val_r]
  4691                                  	; dl = [next_val_l]
  4692                                  	; dh = [next_val_r]
  4693                                  	; original-interpltd-interpltd-interpltd-interpltd
  4694 00001FCC 89C3                    	mov	ebx, eax
  4695 00001FCE 2C80                    	sub	al, 80h
  4696 00001FD0 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4697 00001FD4 66AB                    	stosw		; original sample (L)
  4698 00001FD6 88F8                    	mov	al, bh
  4699 00001FD8 2C80                    	sub	al, 80h
  4700 00001FDA 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4701 00001FDE 66AB                    	stosw		; original sample (R)
  4702 00001FE0 52                      	push	edx ; *
  4703 00001FE1 88D8                    	mov	al, bl
  4704 00001FE3 00D0                    	add	al, dl	; [next_val_l]
  4705 00001FE5 D0D8                    	rcr	al, 1
  4706 00001FE7 50                      	push	eax ; ** ; al = interpolated middle (L) (temporary)
  4707 00001FE8 00D8                    	add	al, bl	; [previous_val_l]
  4708 00001FEA D0D8                    	rcr	al, 1
  4709 00001FEC 86D8                    	xchg	al, bl
  4710 00001FEE 00D8                    	add	al, bl	; bl = interpolated 1st quarter (L) (temp)
  4711 00001FF0 D0D8                    	rcr	al, 1
  4712 00001FF2 2C80                    	sub	al, 80h
  4713 00001FF4 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4714 00001FF8 66AB                    	stosw		; interpolated sample 1 (L)
  4715 00001FFA 88F8                    	mov	al, bh
  4716 00001FFC 00F0                    	add	al, dh	; [next_val_r]
  4717 00001FFE D0D8                    	rcr	al, 1
  4718 00002000 50                      	push	eax ; *** ; al = interpolated middle (R) (temporary)
  4719 00002001 00F8                    	add	al, bh	; [previous_val_r]
  4720 00002003 D0D8                    	rcr	al, 1
  4721 00002005 86F8                    	xchg	al, bh
  4722 00002007 00F8                    	add	al, bh	; bh = interpolated 1st quarter (R) (temp)
  4723 00002009 D0D8                    	rcr	al, 1
  4724 0000200B 2C80                    	sub	al, 80h
  4725 0000200D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4726 00002011 66AB                    	stosw		; interpolated sample 1 (R)
  4727 00002013 5A                      	pop	edx ; ***
  4728 00002014 58                      	pop	eax ; ** ; al = interpolated middle (L) (temporary)
  4729 00002015 86D8                    	xchg	al, bl	; al = interpolated 1st quarter (L) (temp)
  4730 00002017 00D8                    	add	al, bl	; bl = interpolated middle (L) (temporary)
  4731 00002019 D0D8                    	rcr	al, 1
  4732 0000201B 2C80                    	sub	al, 80h
  4733 0000201D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4734 00002021 66AB                    	stosw		; interpolated sample 2 (L)	
  4735 00002023 88D0                    	mov	al, dl 	; interpolated middle (R) (temporary)
  4736 00002025 86F8                    	xchg	al, bh	; al = interpolated 1st quarter (R) (temp)
  4737 00002027 00F8                    	add	al, bh	; bh = interpolated middle (R) (temporary)
  4738 00002029 D0D8                    	rcr	al, 1
  4739 0000202B 2C80                    	sub	al, 80h
  4740 0000202D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4741 00002031 66AB                    	stosw		; interpolated sample 2 (R)
  4742 00002033 5A                      	pop	edx ; *
  4743 00002034 88D8                    	mov	al, bl	; interpolated middle (L) (temporary)
  4744 00002036 00D0                    	add	al, dl	; [next_val_l]
  4745 00002038 D0D8                    	rcr	al, 1
  4746 0000203A 86D8                    	xchg	al, bl	; al = interpolated middle (R) (temporary)
  4747 0000203C 00D8                    	add	al, bl	; bl = interpolated 3rd quarter (L) (temp)
  4748 0000203E D0D8                    	rcr	al, 1
  4749 00002040 2C80                    	sub	al, 80h
  4750 00002042 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4751 00002046 66AB                    	stosw		; interpolated sample 3 (L)
  4752 00002048 88F8                    	mov	al, bh	
  4753 0000204A 00F0                    	add	al, dh	; interpolated middle (R) + [next_val_r]
  4754 0000204C D0D8                    	rcr	al, 1
  4755 0000204E 86F8                    	xchg	al, bh	; al = interpolated middle (R)
  4756 00002050 00F8                    	add	al, bh	; bh = interpolated 3rd quarter (R) (temp)
  4757 00002052 D0D8                    	rcr	al, 1
  4758 00002054 2C80                    	sub	al, 80h
  4759 00002056 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4760 0000205A 66AB                    	stosw		; interpolated sample 3 (R)
  4761 0000205C 88D8                    	mov	al, bl
  4762 0000205E 00D0                    	add	al, dl	; [next_val_l]
  4763 00002060 D0D8                    	rcr	al, 1
  4764 00002062 2C80                    	sub	al, 80h
  4765 00002064 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4766 00002068 66AB                    	stosw		; interpolated sample 4 (L)
  4767 0000206A 88F8                    	mov	al, bh
  4768 0000206C 00F0                    	add	al, dh	; [next_val_r]
  4769 0000206E D0D8                    	rcr	al, 1
  4770 00002070 2C80                    	sub	al, 80h
  4771 00002072 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4772 00002076 66AB                    	stosw		; interpolated sample 4 (R)
  4773 00002078 C3                      	retn
  4774                                  
  4775                                  interpolating_4_8bit_mono:
  4776                                  	; 17/11/2023
  4777                                  	; al = [previous_val]
  4778                                  	; dl = [next_val]
  4779                                  	; original-interpolated-interpolated-interpolated
  4780 00002079 88C3                    	mov	bl, al
  4781 0000207B 2C80                    	sub	al, 80h
  4782 0000207D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4783 00002081 66AB                    	stosw		; original sample (L)
  4784 00002083 66AB                    	stosw		; original sample (R)
  4785 00002085 88D8                    	mov	al, bl
  4786 00002087 00D0                    	add	al, dl
  4787 00002089 D0D8                    	rcr	al, 1
  4788 0000208B 86D8                    	xchg	al, bl  ; al = [previous_val]
  4789 0000208D 00D8                    	add	al, bl	; bl = interpolated middle (sample 2)
  4790 0000208F D0D8                    	rcr	al, 1
  4791 00002091 2C80                    	sub	al, 80h
  4792 00002093 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4793 00002097 66AB                    	stosw		; interpolated sample 1 (L)
  4794 00002099 66AB                    	stosw		; interpolated sample 1 (R)
  4795 0000209B 88D8                    	mov	al, bl	; interpolated middle (sample 2)
  4796 0000209D 2C80                    	sub	al, 80h
  4797 0000209F 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4798 000020A3 66AB                    	stosw		; interpolated sample 2 (L)
  4799 000020A5 66AB                    	stosw		; interpolated sample 2 (R)
  4800 000020A7 88D8                    	mov	al, bl
  4801 000020A9 00D0                    	add	al, dl	; [next_val]
  4802 000020AB D0D8                    	rcr	al, 1
  4803 000020AD 2C80                    	sub	al, 80h
  4804 000020AF 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4805 000020B3 66AB                    	stosw		; interpolated sample 3 (L)
  4806 000020B5 66AB                    	stosw		; interpolated sample 3 (R)
  4807 000020B7 C3                      	retn
  4808                                  
  4809                                  interpolating_4_8bit_stereo:
  4810                                  	; 17/11/2023
  4811                                  	; al = [previous_val_l]
  4812                                  	; ah = [previous_val_r]
  4813                                  	; dl = [next_val_l]
  4814                                  	; dh = [next_val_r]
  4815                                  	; original-interpolated-interpolated-interpolated
  4816 000020B8 89C3                    	mov	ebx, eax
  4817 000020BA 2C80                    	sub	al, 80h
  4818 000020BC 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4819 000020C0 66AB                    	stosw		; original sample (L)
  4820 000020C2 88F8                    	mov	al, bh
  4821 000020C4 2C80                    	sub	al, 80h
  4822 000020C6 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4823 000020CA 66AB                    	stosw		; original sample (R)
  4824 000020CC 88D8                    	mov	al, bl
  4825 000020CE 00D0                    	add	al, dl	; [next_val_l]
  4826 000020D0 D0D8                    	rcr	al, 1
  4827 000020D2 86D8                    	xchg	al, bl	; al = [previous_val_l]
  4828 000020D4 00D8                    	add	al, bl	; bl = interpolated middle (L) (sample 2)
  4829 000020D6 D0D8                    	rcr	al, 1
  4830 000020D8 2C80                    	sub	al, 80h
  4831 000020DA 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4832 000020DE 66AB                    	stosw		; interpolated sample 1 (L)
  4833 000020E0 88F8                    	mov	al, bh
  4834 000020E2 00F0                    	add	al, dh	; [next_val_r]
  4835 000020E4 D0D8                    	rcr	al, 1
  4836 000020E6 86F8                    	xchg	al, bh	; al = [previous_val_h]
  4837 000020E8 00F8                    	add	al, bh	; bh = interpolated middle (R) (sample 2)
  4838 000020EA D0D8                    	rcr	al, 1
  4839 000020EC 2C80                    	sub	al, 80h
  4840 000020EE 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4841 000020F2 66AB                    	stosw		; interpolated sample 1 (R)
  4842 000020F4 88D8                    	mov	al, bl	; interpolated middle (L) (sample 2)
  4843 000020F6 2C80                    	sub	al, 80h
  4844 000020F8 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4845 000020FC 66AB                    	stosw		; interpolated sample 2 (L)
  4846 000020FE 88F8                    	mov	al, bh	; interpolated middle (L) (sample 2)
  4847 00002100 2C80                    	sub	al, 80h
  4848 00002102 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4849 00002106 66AB                    	stosw		; interpolated sample 2 (L)
  4850 00002108 88D8                    	mov	al, bl
  4851 0000210A 00D0                    	add	al, dl	; [next_val_l]
  4852 0000210C D0D8                    	rcr	al, 1
  4853 0000210E 2C80                    	sub	al, 80h
  4854 00002110 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4855 00002114 66AB                    	stosw		; interpolated sample 3 (L)
  4856 00002116 88F8                    	mov	al, bh
  4857 00002118 00F0                    	add	al, dh	; [next_val_r]
  4858 0000211A D0D8                    	rcr	al, 1
  4859 0000211C 2C80                    	sub	al, 80h
  4860 0000211E 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4861 00002122 66AB                    	stosw		; interpolated sample 3 (R)
  4862 00002124 C3                      	retn
  4863                                  
  4864                                  interpolating_5_16bit_mono:
  4865                                  	; 18/11/2023
  4866                                  	; ax = [previous_val]
  4867                                  	; dx = [next_val]
  4868                                  	; original-interpltd-interpltd-interpltd-interpltd
  4869 00002125 66AB                    	stosw		; original sample (L)
  4870 00002127 66AB                    	stosw		; original sample (R)
  4871 00002129 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4872 0000212C 89C3                    	mov	ebx, eax ; [previous_val]
  4873 0000212E 80C680                  	add	dh, 80h
  4874 00002131 6601D0                  	add	ax, dx
  4875 00002134 66D1D8                  	rcr	ax, 1
  4876 00002137 50                      	push	eax ; *	; interpolated middle (temporary)
  4877 00002138 6601D8                  	add	ax, bx	; interpolated middle + [previous_val]
  4878 0000213B 66D1D8                  	rcr	ax, 1
  4879 0000213E 50                      	push	eax ; **	; interpolated 1st quarter (temporary)
  4880 0000213F 6601D8                  	add	ax, bx	; 1st quarter + [previous_val]
  4881 00002142 66D1D8                  	rcr	ax, 1	
  4882 00002145 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4883 00002148 66AB                    	stosw 		; interpolated sample 1 (L)
  4884 0000214A 66AB                    	stosw		; interpolated sample 1 (R)
  4885 0000214C 58                      	pop	eax ; **
  4886 0000214D 5B                      	pop	ebx ; *
  4887 0000214E 6601D8                  	add	ax, bx	; 1st quarter + middle
  4888 00002151 66D1D8                  	rcr	ax, 1	; / 2
  4889 00002154 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again	
  4890 00002157 66AB                    	stosw		; interpolated sample 2 (L)
  4891 00002159 66AB                    	stosw		; interpolated sample 2 (R)
  4892 0000215B 89D8                    	mov	eax, ebx
  4893 0000215D 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  4894 00002160 66D1D8                  	rcr	ax, 1
  4895 00002163 50                      	push	eax ; *	; interpolated 3rd quarter (temporary)
  4896 00002164 6601D8                  	add	ax, bx	; + interpolated middle
  4897 00002167 66D1D8                  	rcr	ax, 1
  4898 0000216A 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4899 0000216D 66AB                    	stosw		; interpolated sample 3 (L)
  4900 0000216F 66AB                    	stosw		; interpolated sample 3 (R)
  4901 00002171 58                      	pop	eax ; *	
  4902 00002172 6601D0                  	add	ax, dx	; 3rd quarter + [next_val]
  4903 00002175 66D1D8                  	rcr	ax, 1	; / 2
  4904 00002178 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4905 0000217B 66AB                    	stosw		; interpolated sample 4 (L)
  4906 0000217D 66AB                    	stosw		; interpolated sample 4 (R)
  4907 0000217F C3                      	retn
  4908                                  
  4909                                  interpolating_5_16bit_stereo:
  4910                                  	; 18/11/2023
  4911                                  	; bx = [previous_val_l]
  4912                                  	; ax = [previous_val_r]
  4913                                  	; [next_val_l]
  4914                                  	; [next_val_r]
  4915                                  	; original-interpltd-interpltd-interpltd-interpltd
  4916 00002180 51                      	push	ecx ; !
  4917 00002181 93                      	xchg	eax, ebx
  4918 00002182 66AB                    	stosw		; original sample (L)
  4919 00002184 93                      	xchg	eax, ebx
  4920 00002185 66AB                    	stosw		; original sample (R)
  4921 00002187 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4922 0000218A 50                      	push	eax ; *	; [previous_val_r]
  4923 0000218B 80C780                  	add	bh, 80h
  4924 0000218E 8005[0A230000]80        	add	byte [next_val_l+1], 80h
  4925 00002195 66A1[09230000]          	mov	ax, [next_val_l]
  4926 0000219B 6601D8                  	add	ax, bx	; [previous_val_l]
  4927 0000219E 66D1D8                  	rcr	ax, 1
  4928 000021A1 89C1                    	mov	ecx, eax ; interpolated middle (L)
  4929 000021A3 6601D8                  	add	ax, bx	
  4930 000021A6 66D1D8                  	rcr	ax, 1
  4931 000021A9 89C2                    	mov	edx, eax ; interpolated 1st quarter (L)
  4932 000021AB 6601D8                  	add	ax, bx	; [previous_val_l]
  4933 000021AE 66D1D8                  	rcr	ax, 1
  4934 000021B1 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4935 000021B4 66AB                    	stosw 		; interpolated sample 1 (L)
  4936 000021B6 89C8                    	mov	eax, ecx
  4937 000021B8 6601D0                  	add	ax, dx	; middle (L) + 1st quarter (L)
  4938 000021BB 66D1D8                  	rcr	ax, 1	; / 2
  4939 000021BE 89C3                    	mov	ebx, eax  ; interpolated sample 2 (L)
  4940 000021C0 5A                      	pop	edx ; *	; [previous_val_r]
  4941 000021C1 89D0                    	mov	eax, edx
  4942 000021C3 8005[0C230000]80        	add	byte [next_val_r+1], 80h
  4943 000021CA 660305[0B230000]        	add	ax, [next_val_r]
  4944 000021D1 66D1D8                  	rcr	ax, 1
  4945 000021D4 50                      	push	eax ; *	; interpolated middle (R)
  4946 000021D5 6601D0                  	add	ax, dx
  4947 000021D8 66D1D8                  	rcr	ax, 1
  4948 000021DB 50                      	push	eax ; ** ; interpolated 1st quarter (R)
  4949 000021DC 6601D0                  	add	ax, dx	; [previous_val_r]
  4950 000021DF 66D1D8                  	rcr	ax, 1
  4951 000021E2 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4952 000021E5 66AB                    	stosw 		; interpolated sample 1 (R)
  4953 000021E7 89D8                    	mov	eax, ebx
  4954 000021E9 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4955 000021EC 66AB                    	stosw 		; interpolated sample 2 (L)
  4956 000021EE 58                      	pop	eax ; **
  4957 000021EF 5A                      	pop	edx ; *
  4958 000021F0 6601D0                  	add	ax, dx	; 1st quarter (R) + middle (R)
  4959 000021F3 66D1D8                  	rcr	ax, 1	; / 2
  4960 000021F6 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4961 000021F9 66AB                    	stosw 		; interpolated sample 2 (R)
  4962 000021FB 89C8                    	mov	eax, ecx
  4963 000021FD 660305[09230000]        	add	ax, [next_val_l]
  4964 00002204 66D1D8                  	rcr	ax, 1
  4965 00002207 50                      	push	eax ; * ; interpolated 3rd quarter (L)
  4966 00002208 6601C8                  	add	ax, cx	; interpolated middle (L)
  4967 0000220B 66D1D8                  	rcr	ax, 1
  4968 0000220E 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4969 00002211 66AB                    	stosw 		; interpolated sample 3 (L)
  4970 00002213 89D0                    	mov	eax, edx
  4971 00002215 660305[0B230000]        	add	ax, [next_val_r]
  4972 0000221C 66D1D8                  	rcr	ax, 1
  4973 0000221F 50                      	push	eax ; ** ; interpolated 3rd quarter (R)
  4974 00002220 6601D0                  	add	ax, dx	; interpolated middle (R)
  4975 00002223 66D1D8                  	rcr	ax, 1
  4976 00002226 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4977 00002229 66AB                    	stosw 		; interpolated sample 3 (R)
  4978 0000222B 5B                      	pop	ebx ; **
  4979 0000222C 58                      	pop	eax ; *
  4980 0000222D 660305[09230000]        	add	ax, [next_val_l]
  4981 00002234 66D1D8                  	rcr	ax, 1
  4982 00002237 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4983 0000223A 66AB                    	stosw 		; interpolated sample 4 (L)
  4984 0000223C 89D8                    	mov	eax, ebx	
  4985 0000223E 660305[0B230000]        	add	ax, [next_val_r]
  4986 00002245 66D1D8                  	rcr	ax, 1
  4987 00002248 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4988 0000224B 66AB                    	stosw 		; interpolated sample 4 (R)
  4989 0000224D 59                      	pop	ecx ; !
  4990 0000224E C3                      	retn
  4991                                  
  4992                                  interpolating_4_16bit_mono:
  4993                                  	; 18/11/2023
  4994                                  	; ax = [previous_val]
  4995                                  	; dx = [next_val]
  4996                                  	; 02/02/2025
  4997                                  	; original-interpolated-interpolated-interpolated
  4998                                  
  4999 0000224F 66AB                    	stosw		; original sample (L)
  5000 00002251 66AB                    	stosw		; original sample (R)
  5001 00002253 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5002 00002256 89C3                    	mov	ebx, eax ; [previous_val]
  5003 00002258 80C680                  	add	dh, 80h
  5004 0000225B 6601D0                  	add	ax, dx	; [previous_val] + [next_val]
  5005 0000225E 66D1D8                  	rcr	ax, 1
  5006 00002261 93                      	xchg	eax, ebx
  5007 00002262 6601D8                  	add	ax, bx	; [previous_val] + interpolated middle
  5008 00002265 66D1D8                  	rcr	ax, 1
  5009 00002268 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5010 0000226B 66AB                    	stosw 		; interpolated sample 1 (L)
  5011 0000226D 66AB                    	stosw		; interpolated sample 1 (R)
  5012 0000226F 89D8                    	mov	eax, ebx ; interpolated middle
  5013 00002271 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5014 00002274 66AB                    	stosw 		; interpolated sample 2 (L)
  5015 00002276 66AB                    	stosw		; interpolated sample 2 (R)
  5016 00002278 89D8                    	mov	eax, ebx
  5017 0000227A 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  5018 0000227D 66D1D8                  	rcr	ax, 1
  5019 00002280 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5020 00002283 66AB                    	stosw		; interpolated sample 3 (L)
  5021 00002285 66AB                    	stosw		; interpolated sample 3 (R)
  5022 00002287 C3                      	retn
  5023                                  
  5024                                  interpolating_4_16bit_stereo:
  5025                                  	; 18/11/2023
  5026                                  	; bx = [previous_val_l]
  5027                                  	; ax = [previous_val_r]
  5028                                  	; [next_val_l]
  5029                                  	; [next_val_r]
  5030                                  	; original-interpolated-interpolated-interpolated
  5031 00002288 93                      	xchg	eax, ebx
  5032 00002289 66AB                    	stosw		; original sample (L)
  5033 0000228B 93                      	xchg	eax, ebx
  5034 0000228C 66AB                    	stosw		; original sample (R)
  5035 0000228E 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5036 00002291 89C2                    	mov	edx, eax ; [previous_val_r]
  5037 00002293 80C780                  	add	bh, 80h
  5038 00002296 8005[0A230000]80        	add	byte [next_val_l+1], 80h
  5039 0000229D 66A1[09230000]          	mov	ax, [next_val_l]
  5040 000022A3 6601D8                  	add	ax, bx	; [previous_val_l]
  5041 000022A6 66D1D8                  	rcr	ax, 1
  5042 000022A9 93                      	xchg	eax, ebx	
  5043 000022AA 6601D8                  	add	ax, bx	; bx = interpolated middle (L)
  5044 000022AD 66D1D8                  	rcr	ax, 1
  5045 000022B0 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5046 000022B3 66AB                    	stosw 		; interpolated sample 1 (L)
  5047 000022B5 8005[0C230000]80        	add	byte [next_val_r+1], 80h
  5048 000022BC 89D0                    	mov	eax, edx ; [previous_val_r]
  5049 000022BE 660305[0B230000]        	add	ax, [next_val_r]
  5050 000022C5 66D1D8                  	rcr	ax, 1
  5051 000022C8 92                      	xchg	eax, edx	
  5052 000022C9 6601D0                  	add	ax, dx	; dx = interpolated middle (R)
  5053 000022CC 66D1D8                  	rcr	ax, 1
  5054 000022CF 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5055 000022D2 66AB                    	stosw 		; interpolated sample 1 (R)
  5056 000022D4 89D8                    	mov	eax, ebx
  5057 000022D6 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5058 000022D9 66AB                    	stosw 		; interpolated sample 2 (L)
  5059 000022DB 89D0                    	mov	eax, edx
  5060 000022DD 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5061 000022E0 66AB                    	stosw 		; interpolated sample 2 (R)
  5062 000022E2 89D8                    	mov	eax, ebx
  5063 000022E4 660305[09230000]        	add	ax, [next_val_l]
  5064 000022EB 66D1D8                  	rcr	ax, 1
  5065 000022EE 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5066 000022F1 66AB                    	stosw 		; interpolated sample 3 (L)
  5067 000022F3 89D0                    	mov	eax, edx
  5068 000022F5 660305[0B230000]        	add	ax, [next_val_r]
  5069 000022FC 66D1D8                  	rcr	ax, 1
  5070 000022FF 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5071 00002302 66AB                    	stosw 		; interpolated sample 3 (R)
  5072 00002304 C3                      	retn
  5073                                  
  5074                                  ; 13/11/2023
  5075                                  previous_val:
  5076 00002305 0000                    previous_val_l: dw 0
  5077 00002307 0000                    previous_val_r: dw 0
  5078                                  next_val:
  5079 00002309 0000                    next_val_l: dw 0
  5080 0000230B 0000                    next_val_r: dw 0
  5081                                  
  5082                                  ; 16/11/2023
  5083 0000230D 00                      faz:	db 0
  5084                                  
  5085                                  ; --------------------------------------------------------
  5086                                  ; --------------------------------------------------------
  5087                                  
  5088                                  ; 07/12/2024
  5089                                  ; Ref: TRDOS 386 v2.0.9, trdosk8.s (18/09/2024)
  5090                                  ;		'sysaudio' system call (23/08/2024)
  5091                                  ; 18/11/2024
  5092                                  ; Ref: TRDOS 386 v2.0.9, audio.s, Erdogan Tan, 06/06/2024
  5093                                  
  5094                                  ac97_stop: 
  5095                                  	; 18/11/2024
  5096 0000230E C605[A07E0000]02        	mov	byte [stopped], 2
  5097                                  	; 07/12/2024
  5098                                  	sys	_audio, 0700h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00002315 BB00070000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000231A B820000000          <1>  mov eax, %1
    99                              <1> 
   100 0000231F CD40                <1>  int 40h
  5099 00002321 C3                      	retn
  5100                                  
  5101                                  ac97_pause:
  5102                                  	; 18/11/2024
  5103 00002322 C605[A07E0000]01        	mov	byte [stopped], 1 ; paused
  5104                                  	; 07/12/2024
  5105                                  	sys	_audio, 0500h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00002329 BB00050000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000232E B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00002333 CD40                <1>  int 40h
  5106 00002335 C3                      	retn
  5107                                  
  5108                                  ac97_play: ; continue to play (after pause)
  5109                                  	; 18/11/2024
  5110 00002336 C605[A07E0000]00        	mov	byte [stopped], 0
  5111                                  	; 07/12/2024	
  5112                                  	sys	_audio, 0600h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000233D BB00060000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00002342 B820000000          <1>  mov eax, %1
    99                              <1> 
   100 00002347 CD40                <1>  int 40h
  5113 00002349 C3                      	retn
  5114                                  	
  5115                                  ; --------------------------------------------------------
  5116                                  ; 14/11/2024 - Erdogan Tan
  5117                                  ; --------------------------------------------------------
  5118                                  
  5119                                  	; 07/12/2024
  5120                                  	; 01/12/2024 (32bit registers)
  5121                                  	; 29/11/2024
  5122                                  checkUpdateEvents:
  5123 0000234A E8BC010000              	call	check4keyboardstop
  5124 0000234F 7279                    	jc	short c4ue_ok
  5125                                  
  5126                                  	; 18/11/2024
  5127 00002351 50                      	push	eax ; *
  5128 00002352 09C0                    	or	eax, eax
  5129 00002354 0F84F2000000            	jz	c4ue_cpt
  5130                                  
  5131                                  	; 18/11/2024
  5132 0000235A 3C20                    	cmp	al, 20h ; SPACE (spacebar) ; pause/play
  5133 0000235C 7543                    	jne	short c4ue_chk_s
  5134 0000235E 803D[A07E0000]00        	cmp	byte [stopped], 0
  5135 00002365 7714                    	ja	short c4ue_chk_ps
  5136                                  	; pause
  5137 00002367 E8B6FFFFFF              	call	ac97_pause
  5138                                  	; 21/11/2024
  5139 0000236C A0[A17E0000]            	mov	al, [tLO]
  5140 00002371 A2[A27E0000]            	mov	byte [tLP], al
  5141 00002376 E9D1000000              	jmp	c4ue_cpt
  5142                                  c4ue_chk_ps:
  5143 0000237B 803D[A07E0000]01        	cmp	byte [stopped], 1
  5144 00002382 770A                    	ja	short c4ue_replay
  5145                                  	; continue to play (after a pause)
  5146 00002384 E8ADFFFFFF              	call	ac97_play 
  5147 00002389 E9BE000000              	jmp	c4ue_cpt
  5148                                  c4ue_replay:
  5149                                  	; 19/11/2024
  5150 0000238E 58                      	pop	eax ; *
  5151 0000238F 58                      	pop	eax ; return address
  5152                                  	; 07/02/2024
  5153                                  	;mov	al, [volume]
  5154                                  	;call	SetmasterVolume
  5155 00002390 C605[A07E0000]00        	mov	byte [stopped], 0
  5156 00002397 E87D040000              	call	move_to_beginning
  5157                                  	;jmp	PlayWav
  5158                                  	; 07/12/2024
  5159 0000239C E99BE2FFFF              	jmp	RePlayWav
  5160                                  
  5161                                  c4ue_chk_s:
  5162 000023A1 3C53                    	cmp	al, 'S'	; stop
  5163 000023A3 7526                    	jne	short c4ue_chk_fb
  5164 000023A5 803D[A07E0000]00        	cmp	byte [stopped], 0
  5165 000023AC 0F879A000000            	ja	c4ue_cpt ; Already stopped/paused
  5166 000023B2 E857FFFFFF              	call	ac97_stop
  5167                                  	; 19/11/2024
  5168 000023B7 C605[A17E0000]00        	mov	byte [tLO], 0
  5169                                  	; 21/11/2024
  5170 000023BE C605[A27E0000]30        	mov	byte [tLP], '0'
  5171 000023C5 E982000000              	jmp	c4ue_cpt
  5172                                  
  5173                                  	; 01/12/2024
  5174                                  	; 18/11/2024
  5175                                  c4ue_ok:
  5176 000023CA C3                      	retn
  5177                                  
  5178                                  c4ue_chk_fb:
  5179                                  	; 17/11/2024
  5180 000023CB 3C46                    	cmp	al, 'F'
  5181 000023CD 7507                    	jne	short c4ue_chk_b
  5182 000023CF E81D040000              	call 	Player_ProcessKey_Forwards
  5183 000023D4 EB76                    	jmp	short c4ue_cpt
  5184                                  
  5185                                  c4ue_chk_b:
  5186 000023D6 3C42                    	cmp	al, 'B'
  5187                                  	;;jne	short c4ue_cpt
  5188                                  	; 19/11/2024
  5189 000023D8 7507                    	jne	short c4ue_chk_h
  5190 000023DA E80E040000              	call 	Player_ProcessKey_Backwards
  5191 000023DF EB6B                    	jmp	short c4ue_cpt
  5192                                  
  5193                                  c4ue_chk_h:
  5194                                  	; 19/11/2024
  5195 000023E1 3C48                    	cmp	al, 'H'
  5196 000023E3 7515                    	jne	short c4ue_chk_cr
  5197 000023E5 C605[A37E0000]00        	mov	byte [wleds], 0
  5198 000023EC E857E5FFFF              	call 	write_ac97_pci_dev_info
  5199                                  	;;;
  5200                                  	;24/12/2024 (wave lighting points option)
  5201 000023F1 C605[AF7E0000]01        	mov	byte [p_mode], 1
  5202                                  	;;;
  5203                                  	;mov	dh, 24
  5204                                  	;mov	dl, 79
  5205                                  	;call	setCursorPosition
  5206                                  	; 21/12/2024
  5207 000023F8 EB52                    	jmp	short c4ue_cpt
  5208                                  c4ue_chk_cr:
  5209                                  	;;;
  5210                                  	; 24/12/2024 (wave lighting points option)
  5211 000023FA 8A25[A37E0000]          	mov	ah, [wleds]
  5212 00002400 3C47                    	cmp	al, 'G'
  5213 00002402 7432                    	je	short c4ue_g
  5214                                  	;;;
  5215                                  	; 19/11/2024
  5216 00002404 3C0D                    	cmp	al, 0Dh ; ENTER/CR key
  5217 00002406 7544                    	jne	short c4ue_cpt
  5218                                  	;inc	byte [wleds]
  5219                                  	;jnz	short c4ue_cpt
  5220                                  	;inc	byte [wleds]
  5221                                  	;;;
  5222                                  	; 24/12/2024
  5223                                  	; 22/12/2024 (faster method)
  5224                                  	; (UpdateWaveLeds procedure turns off previously
  5225                                  	;  lighting wave leds only)
  5226                                  	;call	reset_wave_leds ; prepare all leds as turned off
  5227                                  	;;;
  5228                                  	; 23/11/2024
  5229 00002408 31DB                    	xor	ebx, ebx
  5230                                  	; 24/12/2024 (wave lighting points option)
  5231 0000240A 881D[AF7E0000]          	mov	[p_mode], bl ; 0
  5232                                  	;
  5233                                  	;mov	bl, [wleds]
  5234 00002410 88E3                    	mov	bl, ah ; 24/12/2024
  5235 00002412 FEC3                    	inc	bl
  5236 00002414 80E30F                  	and	bl, 0Fh
  5237 00002417 7501                    	jnz	short c4ue_sc
  5238 00002419 43                      	inc	ebx
  5239                                  c4ue_sc:
  5240 0000241A 881D[A37E0000]          	mov	[wleds], bl
  5241 00002420 D0EB                    	shr	bl, 1
  5242 00002422 8A83[3D410000]          	mov	al, [ebx+colors]
  5243                                  	; 24/12/2024
  5244 00002428 A2[45410000]            	mov	[ccolor], al
  5245 0000242D 7211                    	jc	short c4ue_g_@
  5246                                  	; 24/12/2024
  5247 0000242F E82F040000              	call	reset_wave_leds ; prepare all leds as turned off
  5248 00002434 EB16                    	jmp	short c4ue_cpt
  5249                                  	; 24/12/2024
  5250                                  c4ue_g:
  5251 00002436 08E4                    	or	ah, ah	; byte [wleds]
  5252 00002438 7506                    	jnz	short c4ue_g_@
  5253 0000243A FE05[A37E0000]          	inc	byte [wleds]	; force wave lighting ('G' key)
  5254                                  c4ue_g_@:
  5255                                  	; 24/12/2024 (wave lighting points option)
  5256 00002440 C605[AF7E0000]01        	mov	byte [p_mode], 1
  5257 00002447 E8FC030000              	call	clear_window
  5258                                  	;;;
  5259                                  c4ue_cpt:
  5260                                  	; 24/12/2024
  5261                                  	; 18/11/2024
  5262 0000244C 59                      	pop	ecx ; *
  5263                                  	;;;
  5264                                  	; 24/12/2024 (skip wave lighting if data is not loaded yet)
  5265 0000244D 803D[377F0000]00        	cmp	byte [SRB], 0
  5266 00002454 7751                    	ja	short c4ue_vb_ok
  5267                                  	;;;
  5268                                  	; 01/12/2024 (TRDOS 386)
  5269                                  	sys	_time, 4 ; get timer ticks (18.2 ticks/second),
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00002456 BB04000000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 0000245B B80D000000          <1>  mov eax, %1
    99                              <1> 
   100 00002460 CD40                <1>  int 40h
  5270                                  	; 24/12/2024
  5271                                  	; 18/11/2024
  5272                                  	;pop	ecx ; *
  5273                                  	; 01/12/2024
  5274 00002462 3B05[607F0000]          	cmp	eax, [timerticks]
  5275                                  	;je	short c4ue_ok
  5276                                  	; 18/11/2024
  5277 00002468 7407                    	je	short c4ue_skip_utt
  5278                                  c4ue_utt:	
  5279                                  	; 01/12/2024
  5280 0000246A A3[607F0000]            	mov	[timerticks], eax
  5281 0000246F EB04                    	jmp	short c4ue_cpt_@
  5282                                  c4ue_skip_utt:
  5283                                  	; 18/11/2024
  5284 00002471 21C9                    	and	ecx, ecx
  5285 00002473 7432                    	jz	short c4ue_vb_ok
  5286                                  c4ue_cpt_@:
  5287                                  	; 18/11/2024
  5288 00002475 803D[A07E0000]00        	cmp	byte [stopped], 0
  5289 0000247C 7729                    	ja	short c4ue_vb_ok
  5290                                  	
  5291 0000247E E8AD010000              	call	CalcProgressTime
  5292                                  
  5293                                  	;cmp	ax, [ProgressTime]
  5294                                  	; 01/12/2024
  5295 00002483 3B05[547F0000]          	cmp	eax, [ProgressTime]
  5296                                  	;je	short c4ue_vb_ok
  5297                                  			; same second, no need to update
  5298                                  	; 23/11/2024
  5299 00002489 7405                    	je	short c4ue_uvb
  5300                                  
  5301                                  	;call	UpdateProgressTime
  5302                                  	;call	UpdateProgressBar@
  5303 0000248B E8D1020000              	call	UpdateProgressBar
  5304                                  
  5305                                  	; 23/11/2024
  5306                                  c4ue_uvb:
  5307 00002490 803D[A37E0000]00        	cmp	byte [wleds], 0
  5308 00002497 760E                    	jna	short c4ue_vb_ok
  5309                                  
  5310                                  	; 24/12/2024 (wave points mode)
  5311 00002499 803D[AF7E0000]00        	cmp	byte [p_mode], 0
  5312 000024A0 7706                    	ja	short c4ue_uwp
  5313                                  
  5314 000024A2 E806040000              	call	UpdateWaveLeds
  5315                                  
  5316                                  c4ue_vb_ok:
  5317 000024A7 C3                      	retn
  5318                                  
  5319                                  	; 22/12/2024
  5320                                  c4ue_uwp:
  5321                                  	;call	UpdateWavePoints
  5322                                  	;retn
  5323                                  
  5324                                  ; --------------------------------------------------------
  5325                                  ; 24/12/2024 - Erdogan Tan
  5326                                  ; --------------------------------------------------------
  5327                                  
  5328                                  	; 28/12/2024 (dplayw2.s)
  5329                                  	; 27/12/2024 (DMA Buffer Tracking) (vgaplay2.s)
  5330                                  	; 26/12/2024
  5331                                  	; 24/12/2024
  5332                                  UpdateWavePoints:
  5333 000024A8 BE[A0740000]            	mov	esi, prev_points
  5334 000024AD 833E00                  	cmp	dword [esi], 0
  5335 000024B0 740B                    	jz	short lights_off_ok
  5336 000024B2 B980020000              	mov	ecx, 640
  5337                                  light_off:
  5338 000024B7 AD                      	lodsd
  5339                                  	; eax = wave point (lighting point) address
  5340 000024B8 C60000                  	mov	byte [eax], 0 ; black point (light off)
  5341 000024BB E2FA                    	loop	light_off
  5342                                  
  5343                                  lights_off_ok:
  5344                                  	; 27/12/2024
  5345                                  	; ref: modplay8.s (02/06/2024)
  5346                                  	; ----------------------------
  5347                                  	; Get Current Sound Data (in DMA buffer) ((320 bytes))
  5348                                  	; 23/06/2017
  5349                                  	; 22/06/2017
  5350                                  	; bh = 15, get current sound data/samples
  5351                                  	; bl = 0, for PCM OUT
  5352                                  	; ecx = count of sample/data bytes (1 to 4096)
  5353                                  	; edx = destination buffer address
  5354                                  	;	(page aligned address is better)
  5355                                  
  5356 000024BD BE[00800200]            	mov	esi, g_buff
  5357                                  
  5358                                  	sys	_audio, 0F00h, 640*4, esi ; 27/12/2024
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 000024C2 BB000F0000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 000024C7 B9000A0000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 000024CC 89F2                <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 000024CE B820000000          <1>  mov eax, %1
    99                              <1> 
   100 000024D3 CD40                <1>  int 40h
  5359                                  	;jnc	short lgbuff_ok
  5360                                  	; clear g_buff content
  5361                                  	;mov	edi, esi
  5362                                  	;sub	eax, eax
  5363                                  	;shr	ecx, 2
  5364                                  	;rep	stosd
  5365                                  	;mov	ecx, 640
  5366                                  ;lgbuff_ok:
  5367                                  
  5368 000024D5 B980020000              	mov	ecx, 640
  5369 000024DA 89CD                    	mov	ebp, ecx
  5370                                  	; 26/12/2024
  5371 000024DC BF[A0740000]            	mov	edi, prev_points
  5372 000024E1 8B1D[8C740000]          	mov	ebx, [graphstart] ; start (top) line
  5373                                  lights_on_4:
  5374 000024E7 31C0                    	xor	eax, eax ; 0
  5375 000024E9 66AD                    	lodsw	; left
  5376 000024EB 80C480                  	add	ah, 80h
  5377 000024EE 89C2                    	mov	edx, eax
  5378 000024F0 66AD                    	lodsw	; right
  5379                                  	;add	ax, dx
  5380 000024F2 80C480                  	add	ah, 80h
  5381                                  	;shr	eax, 9	; 128 volume levels
  5382 000024F5 01D0                    	add	eax, edx
  5383                                  	;shr	eax, 10	; (L+R/2) & 128 volume levels
  5384 000024F7 C1E809                  	shr	eax, 9	; (L+R/2) & 256 volume levels
  5385 000024FA F7E5                    	mul	ebp	; * 640 (row)
  5386 000024FC 01D8                    	add	eax, ebx ; + column
  5387 000024FE 8A15[45410000]          	mov	dl, [ccolor]
  5388 00002504 8810                    	mov	[eax], dl ; pixel (light on) color
  5389 00002506 AB                      	stosd		; save light on addr in prev_points
  5390 00002507 43                      	inc	ebx
  5391 00002508 E2DD                    	loop	lights_on_4
  5392 0000250A C3                      	retn
  5393                                  
  5394                                  ; --------------------------------------------------------
  5395                                  ; 19/05/2024 - (playwav4.asm) ich_wav4.asm
  5396                                  ; --------------------------------------------------------
  5397                                  
  5398                                  	; 07/12/2024
  5399                                  	; 01/12/2024 (TRDOS 386)
  5400                                  	; 29/11/2024
  5401                                  check4keyboardstop:
  5402                                  	; 19/05/2024
  5403                                  	; 08/11/2023
  5404                                  	; 04/11/2023
  5405 0000250B B401                    	mov	ah, 1
  5406                                  	;int	16h
  5407                                  	; 01/12/2024 (TRDOS 386 keyboard interrupt)
  5408 0000250D CD32                    	int	32h
  5409                                  	;clc
  5410 0000250F 7433                    	jz	short _cksr
  5411                                  
  5412 00002511 30E4                    	xor	ah, ah
  5413                                  	;int	16h
  5414                                  	; 01/12/2024 (TRDOS 386 keyboard interrupt)
  5415 00002513 CD32                    	int	32h
  5416                                  
  5417                                  	;;;
  5418                                  	; 19/05/2024 (change PCM out volume)
  5419 00002515 3C2B                    	cmp	al, '+'
  5420 00002517 750D                    	jne	short p_1
  5421                                  	
  5422 00002519 A0[62250000]            	mov	al, [volume]
  5423 0000251E 3C00                    	cmp	al, 0
  5424 00002520 7624                    	jna	short p_3
  5425 00002522 FEC8                    	dec	al
  5426 00002524 EB0F                    	jmp	short p_2
  5427                                  p_1:
  5428 00002526 3C2D                    	cmp	al, '-'
  5429 00002528 751D                    	jne	short p_4
  5430                                  
  5431 0000252A A0[62250000]            	mov	al, [volume]
  5432 0000252F 3C1F                    	cmp	al, 31
  5433 00002531 7313                    	jnb	short p_3
  5434 00002533 FEC0                    	inc	al
  5435                                  p_2:
  5436 00002535 A2[62250000]            	mov	[volume], al
  5437                                  	; 14/11/2024
  5438                                  	;call	SetPCMOutVolume
  5439                                  	; 15/11/2024 (QEMU)
  5440                                  	; 07/12/2024
  5441 0000253A E82DE2FFFF              	call	SetMasterVolume
  5442                                  	;call	UpdateVolume
  5443                                  	;;clc
  5444                                  	;retn
  5445 0000253F E98D010000              	jmp	UpdateVolume
  5446                                  	;mov	ah, al
  5447                                  	;mov    dx, [NAMBAR]
  5448                                    	;;add   dx, CODEC_MASTER_VOL_REG
  5449                                  	;add	dx, CODEC_PCM_OUT_REG
  5450                                  	;out    dx, ax
  5451                                  	;
  5452                                  	;call   delay1_4ms
  5453                                          ;call   delay1_4ms
  5454                                          ;call   delay1_4ms
  5455                                          ;call   delay1_4ms
  5456                                  _cksr:		; 19/05/2024
  5457                                  	; 18/12/2024
  5458 00002544 31C0                    	xor	eax, eax
  5459                                  	;clc
  5460                                  p_3:
  5461 00002546 C3                      	retn
  5462                                  p_4:
  5463                                  	; 17/11/2024
  5464 00002547 80FC01                  	cmp	ah, 01h  ; ESC
  5465 0000254A 7414                        	je	short p_q
  5466                                  	;cmp	ax, 2E03h ; 21/12/2024 
  5467 0000254C 3C03                    	cmp	al, 03h  ; CTRL+C
  5468 0000254E 7410                    	je	short p_q
  5469                                  
  5470                                  	; 18/11/2024
  5471 00002550 3C20                    	cmp	al, 20h
  5472 00002552 740D                    	je	short p_r
  5473                                  
  5474                                  	; 19/11/2024
  5475 00002554 3C0D                    	cmp	al, 0Dh ; CR/ENTER
  5476 00002556 7409                    	je	short p_r
  5477                                  
  5478 00002558 24DF                    	and	al, 0DFh
  5479                                  
  5480                                  	;cmp	al, 'B'
  5481                                  	;je	short p_r
  5482                                  	;cmp	al, 'F'
  5483                                  	;je	short p_r
  5484                                  
  5485 0000255A 3C51                    	cmp	al, 'Q'
  5486                                  	;je	short p_q
  5487 0000255C 7402                    	je	short p_quit ; 29/11/2024
  5488                                  
  5489 0000255E F8                      	clc
  5490 0000255F C3                      	retn
  5491                                  
  5492                                  	;;;
  5493                                  ;_cskr:	
  5494                                  p_q:
  5495                                  p_quit:
  5496 00002560 F9                      	stc
  5497                                  p_r:
  5498 00002561 C3                      	retn
  5499                                  
  5500                                  ; 29/05/2024
  5501                                  ; 19/05/2024
  5502 00002562 02                      volume: db	02h
  5503                                  
  5504                                  ; --------------------------------------------------------
  5505                                  
  5506                                  	; 22/12/2024
  5507                                  	; 21/12/2024
  5508                                  	; simulate cursor position in VGA (VESA VBE) mode
  5509                                  	; ! for 640*480, 256 colors (1 byte/pixel) !
  5510                                  setCursorPosition:
  5511                                  	; dh = Row
  5512                                  	; dl = Column
  5513                                  	
  5514 00002563 31C0                    	xor	eax, eax
  5515 00002565 B00E                    	mov	al, 14	; row height is 14 pixels (8*14)
  5516 00002567 F6E6                    	mul	dh
  5517 00002569 6683C007                	add	ax, 7	; top margin
  5518 0000256D C1E010                  	shl	eax, 16
  5519 00002570 88D0                    	mov	al, dl	; * 8 ; character width = 8 pixels
  5520 00002572 66C1E003                	shl	ax, 3
  5521                                  			; hw = row, ax = column
  5522 00002576 A3[94740000]            	mov	[screenpos], eax
  5523                                  	; 22/12/2024
  5524 0000257B 31C0                    	xor	eax, eax
  5525 0000257D C3                      	retn
  5526                                  	
  5527                                  ; --------------------------------------------------------
  5528                                  ; 14/11/2024
  5529                                  ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017)
  5530                                  
  5531                                  ;; NAME:	SetTotalTime
  5532                                  ;; DESCRIPTION: Calculates the total time in seconds in file
  5533                                  ;; INPUT:	DATA_SubchunkSize, WAVE_SampleRate, WAVE_BlockAlign
  5534                                  ;; OUTPUT:	CurrentTotalTime=Total time in seconds in file,
  5535                                  ;; 		Output on the screen of the total time in seconds
  5536                                  
  5537                                  	; 01/12/2024 (32 bit registers)
  5538                                  SetTotalTime:
  5539                                  	;; Calculate total seconds in file
  5540                                  	;mov	ax, [DATA_SubchunkSize]
  5541                                  	;mov	dx, [DATA_SubchunkSize + 2]
  5542                                  	;mov	bx, [WAVE_SampleRate]
  5543                                  	;div	bx
  5544                                  	;xor	dx, dx
  5545                                  	; 01/12/2024
  5546 0000257E A1[D87E0000]            	mov	eax, [DATA_SubchunkSize]
  5547 00002583 0FB71D[C87E0000]        	movzx	ebx, word [WAVE_SampleRate]
  5548 0000258A 31D2                    	xor	edx, edx
  5549 0000258C F7F3                    	div	ebx
  5550                                  
  5551                                  	;mov	bx, [WAVE_BlockAlign]
  5552                                  	;div	bx
  5553                                  	; 01/12/2024
  5554 0000258E 668B1D[D07E0000]        	mov	bx, [WAVE_BlockAlign]
  5555 00002595 31D2                    	xor	edx, edx
  5556 00002597 F7F3                    	div	ebx
  5557                                  
  5558                                  	;mov	[TotalTime], ax
  5559 00002599 A3[507F0000]            	mov	[TotalTime], eax
  5560                                  
  5561 0000259E B33C                    	mov	bl, 60
  5562 000025A0 F6F3                    	div	bl
  5563                                  
  5564                                  	;; al = minutes, ah = seconds
  5565 000025A2 50                      	push	eax ; **
  5566 000025A3 50                      	push	eax ; *
  5567                                  
  5568                                  	;mov	dh, 24
  5569                                  	; 21/12/2024 (640*480)
  5570 000025A4 B620                    	mov	dh, 32
  5571 000025A6 B22A                    	mov	dl, 42
  5572 000025A8 E8B6FFFFFF              	call	setCursorPosition
  5573                                  
  5574 000025AD 58                      	pop	eax ; *
  5575 000025AE 30E4                    	xor	ah, ah
  5576 000025B0 BD02000000              	mov	ebp, 2
  5577 000025B5 E812000000              	call	PrintNumber
  5578                                  	
  5579                                  	;mov	dh, 24
  5580                                  	; 21/12/2024 (640*480)
  5581 000025BA B620                    	mov	dh, 32
  5582 000025BC B22D                    	mov	dl, 45
  5583 000025BE E8A0FFFFFF              	call	setCursorPosition
  5584                                  
  5585 000025C3 58                      	pop	eax ; **
  5586 000025C4 88E0                    	mov	al, ah
  5587 000025C6 30E4                    	xor	ah, ah
  5588                                  	; 21/12/2024
  5589 000025C8 66BD0200                	mov	bp, 2
  5590                                  	;jmp	short PrintNumber
  5591                                  
  5592                                  ; --------------------------------------------------------
  5593                                  
  5594                                  	; 21/12/2024 (write numbers in VESA VBE graphics mode)
  5595                                  	; 01/12/2024 (32bit registers)
  5596                                  PrintNumber:
  5597                                  	; eax = binary number
  5598                                  	; ebp = digits
  5599 000025CC 8B35[94740000]          	mov	esi, [screenpos]
  5600                                  		; hw = row, si = column
  5601 000025D2 BB0A000000              	mov	ebx, 10
  5602 000025D7 31C9                    	xor	ecx, ecx
  5603                                  printNumber_CutNumber:
  5604 000025D9 41                      	inc	ecx
  5605 000025DA 31D2                    	xor	edx, edx
  5606 000025DC F7F3                    	div	ebx
  5607 000025DE 52                      	push	edx
  5608 000025DF 39E9                    	cmp	ecx, ebp
  5609 000025E1 7402                    	je	short printNumber_printloop
  5610 000025E3 EBF4                    	jmp	printNumber_CutNumber
  5611                                  
  5612                                  printNumber_printloop:
  5613 000025E5 58                      	pop	eax
  5614                                  	; 21/12/2024
  5615                                  	; ebp = count of digits
  5616                                  	; eax <= 9
  5617                                  
  5618 000025E6 0430                    	add	al, '0'
  5619                                  	
  5620                                  	; esi = pixel position (hw = row, si = column)
  5621                                  	; eax = al = character
  5622                                  	;call	write_character
  5623                                  	; 22/12/2024
  5624 000025E8 E82A010000              	call	write_character_white
  5625                                  
  5626 000025ED 4D                      	dec	ebp
  5627 000025EE 7405                     	jz	short printNumber_ok
  5628 000025F0 83C608                  	add	esi, 8	; next column
  5629 000025F3 EBF0                    	jmp	short printNumber_printloop
  5630                                  printNumber_ok:
  5631 000025F5 C3                      	retn
  5632                                  
  5633                                  ; --------------------------------------------------------
  5634                                  
  5635                                  	; 14/11/2024 - Erdogan Tan
  5636                                  SetProgressTime:
  5637                                  	;; Calculate playing/progress seconds in file
  5638 000025F6 E835000000              	call	CalcProgressTime
  5639                                  
  5640                                  	; 01/12/2024 (32bit registers)
  5641                                  UpdateProgressTime:
  5642                                  	; eax = (new) progress time 
  5643                                  
  5644 000025FB A3[547F0000]            	mov	[ProgressTime], eax
  5645                                  
  5646 00002600 B33C                    	mov	bl, 60
  5647 00002602 F6F3                    	div	bl
  5648                                  
  5649                                  	;; al = minutes, ah = seconds
  5650 00002604 50                      	push	eax ; **
  5651 00002605 50                      	push	eax ; *
  5652                                  
  5653                                  	;mov	dh, 24
  5654                                  	; 21/12/2024 (640*480)
  5655 00002606 B620                    	mov	dh, 32
  5656 00002608 B221                    	mov	dl, 33
  5657 0000260A E854FFFFFF              	call	setCursorPosition
  5658                                  
  5659 0000260F 58                      	pop	eax ; *
  5660 00002610 30E4                    	xor	ah, ah
  5661 00002612 BD02000000              	mov	ebp, 2
  5662 00002617 E8B0FFFFFF              	call	PrintNumber
  5663                                  	
  5664                                  	;mov	dh, 24
  5665                                  	; 21/12/2024 (640*480)
  5666 0000261C B620                    	mov	dh, 32
  5667 0000261E B224                    	mov	dl, 36
  5668 00002620 E83EFFFFFF              	call	setCursorPosition
  5669                                  
  5670 00002625 58                      	pop	eax ; **
  5671 00002626 88E0                    	mov	al, ah
  5672 00002628 30E4                    	xor	ah, ah
  5673                                  	; 21/12/2024
  5674 0000262A 66BD0200                	mov	bp, 2
  5675 0000262E EB9C                    	jmp	short PrintNumber
  5676                                  
  5677                                  ; --------------------------------------------------------
  5678                                  
  5679                                  	; 01/12/2024 (32bit registers)
  5680                                  	; 17/11/2024
  5681                                  	; 14/11/2024
  5682                                  CalcProgressTime:
  5683                                  	;mov	ax, [LoadedDataBytes]
  5684                                  	;mov	dx, [LoadedDataBytes+2]
  5685                                  	;mov	bx, ax
  5686                                  	;or	bx, dx
  5687                                  	;jz	short cpt_ok
  5688                                  	; 01/12/2024
  5689 00002630 A1[5C7F0000]            	mov	eax, [LoadedDataBytes]
  5690 00002635 09C0                    	or	eax, eax
  5691 00002637 7416                    	jz	short cpt_ok
  5692                                  
  5693                                  	;mov	bx, [WAVE_SampleRate]
  5694                                  	;div	bx
  5695                                  	;xor	dx, dx
  5696                                  	;mov	bx, [WAVE_BlockAlign]
  5697                                  	;div	bx
  5698                                  	; 01/12/2024
  5699 00002639 0FB71D[C87E0000]        	movzx	ebx, word [WAVE_SampleRate]
  5700 00002640 31D2                    	xor	edx, edx
  5701 00002642 F7F3                    	div	ebx
  5702 00002644 31D2                    	xor	edx, edx
  5703 00002646 668B1D[D07E0000]        	mov	bx, [WAVE_BlockAlign]
  5704 0000264D F7F3                    	div	ebx
  5705                                  cpt_ok:
  5706                                  	; eax = (new) progress time
  5707 0000264F C3                      	retn
  5708                                  
  5709                                  ; --------------------------------------------------------
  5710                                  ; 14/11/2024
  5711                                  ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017)
  5712                                  
  5713                                  ;; DESCRIPTION: Update file information on template
  5714                                  ;; PARAMS:	WAVE parameters and other variables
  5715                                  ;; REGS:	AX(RW)
  5716                                  ;; VARS:	CurrentFileName, WAVE_SampleRate, 
  5717                                  ;; RETURNS:	On-screen file info is updated.
  5718                                  
  5719                                  	; 01/12/2024 (32bit registers)
  5720                                  UpdateFileInfo:
  5721                                  	;; Print File Name
  5722                                  	;mov	dh, 9
  5723                                  	; 21/12/2024 (640*480 graphics display)
  5724 00002650 B608                    	mov	dh, 8
  5725 00002652 B217                    	mov	dl, 23
  5726 00002654 E80AFFFFFF              	call	setCursorPosition
  5727                                  	
  5728 00002659 BE[E47E0000]            	mov	esi, wav_file_name
  5729                                  	
  5730                                  	;;;
  5731                                  	; 14/11/2024
  5732                                  	; skip directory separators
  5733                                  	; (note: asciiz string, max. 79 bytes except zero tail)
  5734 0000265E 89F3                    	mov	ebx, esi
  5735                                  chk4_nxt_sep:
  5736 00002660 AC                      	lodsb
  5737 00002661 3C2F                    	cmp	al, '/'	; 14/12/2024
  5738 00002663 7406                    	je	short chg_fpos
  5739 00002665 20C0                    	and	al, al
  5740 00002667 7406                    	jz	short chg_fpos_ok
  5741 00002669 EBF5                    	jmp	short chk4_nxt_sep
  5742                                  chg_fpos:
  5743 0000266B 89F3                    	mov	ebx, esi
  5744 0000266D EBF1                    	jmp	short chk4_nxt_sep
  5745                                  chg_fpos_ok:
  5746 0000266F 89DE                    	mov	esi, ebx ; file name (without its path/directory)
  5747                                  
  5748                                  	;;;
  5749                                  _fnl_chk:
  5750                                  	; 26/12/2024 (file name length limit -display-)
  5751                                  	;mov	ebx, 12
  5752 00002671 BB11000000              	mov	ebx, 17 ; ????????.wav?????
  5753 00002676 56                      	push	esi
  5754                                  _fnl_chk_loop:
  5755 00002677 AC                      	lodsb
  5756 00002678 20C0                    	and	al, al
  5757 0000267A 7406                    	jz	short _fnl_ok
  5758 0000267C 4B                       	dec	ebx
  5759 0000267D 75F8                    	jnz	short _fnl_chk_loop
  5760 0000267F C60600                  	mov	byte [esi], 0
  5761                                  _fnl_ok:
  5762 00002682 5E                      	pop	esi
  5763                                  	;;;
  5764                                  
  5765 00002683 E870000000              	call	PrintString
  5766                                  	
  5767                                  	;; Print Frequency
  5768                                  	;mov	dh, 10
  5769                                  	; 21/12/2024 (640*480 graphics display)
  5770 00002688 B609                    	mov	dh, 9
  5771 0000268A B217                    	mov	dl, 23
  5772 0000268C E8D2FEFFFF              	call	setCursorPosition
  5773                                  	;movzx	eax, word [WAVE_SampleRate]
  5774                                  	; 22/12/2024
  5775                                  	; eax = 0
  5776 00002691 66A1[C87E0000]          	mov	ax, [WAVE_SampleRate]
  5777 00002697 BD05000000              	mov	ebp, 5
  5778 0000269C E82BFFFFFF              	call	PrintNumber
  5779                                  
  5780                                  	;; Print BitRate
  5781                                  	;mov	dh, 9
  5782                                  	; 21/12/2024 (640*480 graphics display)
  5783 000026A1 B608                    	mov	dh, 8
  5784 000026A3 B239                    	mov	dl, 57
  5785 000026A5 E8B9FEFFFF              	call	setCursorPosition
  5786 000026AA 66A1[D27E0000]          	mov	ax, [WAVE_BitsPerSample]
  5787 000026B0 66BD0200                	mov	bp, 2
  5788 000026B4 E813FFFFFF              	call	PrintNumber
  5789                                  
  5790                                  	;; Print Channel Number
  5791                                  	;mov	dh, 10
  5792                                  	; 21/12/2024 (640*480 graphics display)
  5793 000026B9 B609                    	mov	dh, 9
  5794 000026BB B239                    	mov	dl, 57
  5795 000026BD E8A1FEFFFF              	call	setCursorPosition
  5796 000026C2 66A1[C67E0000]          	mov	ax, [WAVE_NumChannels]
  5797 000026C8 66BD0100                	mov	bp, 1
  5798 000026CC E8FBFEFFFF              	call	PrintNumber
  5799                                  
  5800                                  	;call	UpdateVolume
  5801                                  	;retn
  5802                                  
  5803                                  ; --------------------------------------------------------
  5804                                  
  5805                                  	; 14/11/2024
  5806                                  UpdateVolume:
  5807                                  	;; Print Volume
  5808                                  	;mov	dh, 24
  5809                                  	; 21/12/2024 (640*480)
  5810 000026D1 B620                    	mov	dh, 32
  5811 000026D3 B24B                    	mov	dl, 75
  5812 000026D5 E889FEFFFF              	call	setCursorPosition
  5813                                  	; 22/12/2024
  5814                                  	; eax = 0
  5815                                  
  5816 000026DA A0[62250000]            	mov	al, [volume]
  5817                                  
  5818 000026DF B364                    	mov	bl, 100
  5819 000026E1 F6E3                    	mul	bl
  5820                                  
  5821 000026E3 B31F                    	mov	bl, 31
  5822 000026E5 F6F3                    	div	bl
  5823                                  
  5824                                  	;neg	ax
  5825                                  	;add	ax, 100	
  5826                                  	; 01/12/2024
  5827 000026E7 B464                    	mov	ah, 100
  5828 000026E9 28C4                    	sub	ah, al
  5829 000026EB 0FB6C4                  	movzx	eax, ah
  5830                                  	;xor	ah, ah
  5831                                  	;mov	bp, 3
  5832 000026EE BD03000000              	mov	ebp, 3
  5833                                  	;call	PrintNumber
  5834                                  	;retn
  5835 000026F3 E9D4FEFFFF              	jmp	PrintNumber	
  5836                                  
  5837                                  ; --------------------------------------------------------
  5838                                  
  5839                                  	; 21/12/2024
  5840                                  	; write text in VESA VBE graphics mode
  5841                                  PrintString:
  5842                                  	; esi = string address
  5843                                  printstr_loop:
  5844 000026F8 31C0                    	xor	eax, eax
  5845 000026FA AC                      	lodsb
  5846 000026FB 08C0                    	or	al, al
  5847 000026FD 7417                    	jz	short printstr_ok
  5848                                  
  5849 000026FF 56                      	push	esi
  5850                                  
  5851 00002700 8B35[94740000]          	mov	esi, [screenpos]
  5852                                  
  5853                                  	; esi = pixel position (hw = row, si = column)
  5854                                  	; eax = al = character
  5855                                  	;call	write_character
  5856                                  	; 22/12/2024
  5857 00002706 E80C000000              	call	write_character_white
  5858                                  
  5859 0000270B 668305[94740000]08      	add	word [screenpos], 8 ; update column (only, not row)
  5860                                  
  5861 00002713 5E                      	pop	esi
  5862 00002714 EBE2                    	jmp	short printstr_loop
  5863                                  
  5864                                  printstr_ok:
  5865 00002716 C3                      	retn
  5866                                  
  5867                                  ; --------------------------------------------------------
  5868                                  
  5869                                  	; 21/12/2024
  5870                                  	; write character (at cursor position)
  5871                                  	; in graphics mode (640*480, 256 colors)
  5872                                  	; 22/12/2024
  5873                                  write_character_white:
  5874 00002717 B90F000000              	mov	ecx, 0Fh
  5875                                  write_character:
  5876                                  	; esi = pixel position (hw = row, si = column)
  5877                                  	; eax = al = character
  5878                                  	; cl = color
  5879 0000271C 890D[98740000]          	mov	[wcolor], ecx ; 22/12/2024
  5880                                  
  5881                                  	; 22/12/2024
  5882 00002722 50                      	push	eax
  5883                                  	; clear previous character pixels
  5884 00002723 BF[2D410000]            	mov	edi, fillblock
  5885                                  	sys	_video, 020Fh, 0, 8001h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00002728 BB0F020000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000272D B900000000          <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00002732 BA01800000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00002737 B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 0000273C CD40                <1>  int 40h
  5886 0000273E 58                      	pop	eax
  5887                                  
  5888 0000273F C1E004                  	shl	eax, 4 ; 8*16 pixel user font
  5889 00002742 BF[484F0000]            	mov	edi, fontbuff2 ; start of user font data
  5890 00002747 01C7                    	add	edi, eax
  5891                                  
  5892                                  	; 21/12/2024
  5893                                  	; NOTE:
  5894                                  	; TRDOS 386 does not use 8*14 pixel fonts in sysvideo
  5895                                  	; system calls -in graphics mode-
  5896                                  	; because 8*16 pixel operations are faster
  5897                                  	;			than 8*14 pixel operations.
  5898                                  	; ((so, 8*14 fonts can be converted to 8*16 fonts by
  5899                                  	; adding 2 empty lines))
  5900                                  	; (8*14 characters can be written via pixel operations)
  5901                                    	
  5902                                  	; 21/12/2024 (TRDOS 386 v2.0.9, trdosk6.s, 27/09/2024)
  5903                                  	;;;;;;;;;;;;;;;;; ; sysvideo system call
  5904                                  	;sysvideo:
  5905                                  	;   function in BH
  5906                                  	;	02h: Super VGA, LINEAR FRAME BUFFER data transfers
  5907                                  	;   sub function in BL
  5908                                  	;	0Fh: WRITE CHARACTER (FONT)
  5909                                  	;          CL = char's color (8 bit, 256 colors)
  5910                                  	;	If DH bit 7 = 1
  5911                                  	;	   USER FONT (from user buffer)
  5912                                  	;	         DL = 1 -> 8x16 pixel font
  5913                                   	;	   EDI = user's font buffer address
  5914                                  	;		(NOTE: byte order is as row0,row1,row2..)
  5915                                  	;	   ESI = start position (row, column)
  5916                                  	;		(HW = row, SI = column)
  5917                                  	;;;;;;;;;;;;;;;;;
  5918                                  
  5919                                  	sys	_video, 020Fh, [wcolor], 8001h
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 00002749 BB0F020000          <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92 0000274E 8B0D[98740000]      <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94 00002754 BA01800000          <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00002759 B81F000000          <1>  mov eax, %1
    99                              <1> 
   100 0000275E CD40                <1>  int 40h
  5920                                  
  5921 00002760 C3                      	retn
  5922                                  
  5923                                  ; --------------------------------------------------------
  5924                                  
  5925                                  	; 22/12/2024
  5926                                  	; 21/12/2024
  5927                                  	; (write chars in VESA VBE graphics mode)
  5928                                  	; 14/11/2024
  5929                                  	; (Ref: player.asm, Matan Alfasi, 2017)
  5930                                  	; (Modification: Erdogan Tan, 14/11/2024)
  5931                                  
  5932                                  	;PROGRESSBAR_ROW equ 23
  5933                                  	; 21/12/2024 (640*480)
  5934                                  	PROGRESSBAR_ROW equ 31
  5935                                  
  5936                                  UpdateProgressBar:
  5937 00002761 E890FEFFFF              	call	SetProgressTime	; 14/11/2024
  5938                                  
  5939                                  	; 01/12/2024 (32bit registers)
  5940 00002766 A1[547F0000]            	mov	eax, [ProgressTime]
  5941                                  UpdateProgressBar@:
  5942 0000276B BA50000000              	mov	edx, 80
  5943 00002770 F7E2                    	mul	edx
  5944 00002772 8B1D[507F0000]          	mov	ebx, [TotalTime]
  5945 00002778 F7F3                    	div	ebx
  5946                                  
  5947                                  	; 22/12/2024
  5948                                  	; check progress bar indicator position if it is same 
  5949 0000277A 3A05[9D740000]          	cmp	al, [pbprev]
  5950 00002780 7430                    	je	short UpdateProgressBar_ok
  5951 00002782 A2[9D740000]            	mov	[pbprev], al
  5952                                  
  5953                                  UpdateProgressBar@@:
  5954                                  	;; Push for the 'Clean' part
  5955 00002787 50                      	push	eax ; **
  5956 00002788 50                      	push	eax ; *
  5957                                  
  5958                                  	;; Set cursor position
  5959 00002789 B61F                    	mov	dh, PROGRESSBAR_ROW
  5960 0000278B B200                    	mov	dl, 0
  5961 0000278D E8D1FDFFFF              	call	setCursorPosition
  5962                                  
  5963 00002792 58                      	pop	eax ; *
  5964 00002793 09C0                    	or	eax, eax
  5965 00002795 742D                    	jz	short UpdateProgressBar_Clean
  5966                                  
  5967                                  UpdateProgressBar_DrawProgress:
  5968                                  	; 22/12/2024
  5969                                  	; 21/12/2024
  5970                                  	; (write progress bar chars in graphics mode)
  5971                                  	;;;;
  5972 00002797 89C5                    	mov	ebp, eax
  5973 00002799 50                      	push	eax ; ***
  5974 0000279A 8B35[94740000]          	mov	esi, [screenpos]
  5975                                  UpdateProgressBar_DrawProgress_@:
  5976 000027A0 B8DF000000              	mov	eax, 223
  5977                                  	
  5978                                  	; esi = pixel position (hw = row, si = column)
  5979                                  	; eax = al = character
  5980                                  	;call	write_character
  5981                                  	; 22/12/2024
  5982 000027A5 E86DFFFFFF              	call	write_character_white
  5983                                  
  5984 000027AA 4D                      	dec	ebp
  5985 000027AB 7406                    	jz	short UpdateProgressBar_DrawCursor
  5986                                  
  5987 000027AD 83C608                  	add	esi, 8 ; next column
  5988 000027B0 EBEE                    	jmp	short UpdateProgressBar_DrawProgress_@
  5989                                  	;;;
  5990                                  
  5991                                  UpdateProgressBar_ok:
  5992 000027B2 C3                      	retn
  5993                                  
  5994                                  UpdateProgressBar_DrawCursor:
  5995                                  	; 22/12/2024
  5996 000027B3 5A                      	pop	edx ; ***
  5997 000027B4 B61F                    	mov	dh, PROGRESSBAR_ROW
  5998 000027B6 E8A8FDFFFF              	call	setCursorPosition
  5999                                  
  6000                                  	; 21/12/2024
  6001                                  	; (write progress bar character in graphics mode)
  6002                                  	;;;;
  6003                                  	;;;mov	eax, 223
  6004                                  	;;;shl	eax, 4 ; 8*16 pixel user font
  6005                                  	;;mov	eax, 223*16
  6006                                  	;;mov	edi, fontbuff2 ; start of user font data
  6007                                  	;;add	edi, eax
  6008                                  	;mov	edi, fontbuff2+(223*16)
  6009                                  	;
  6010                                  	;sys	_video, 020Fh, 0Ch, 8001h
  6011                                  	; 22/12/2024
  6012                                  	;mov	eax, 223
  6013                                  	; eax = 0
  6014 000027BB B0DF                    	mov	al, 223
  6015 000027BD B10C                    	mov	cl, 0Ch ; red
  6016 000027BF E858FFFFFF              	call	write_character
  6017                                  	;;;;
  6018                                  
  6019                                  UpdateProgressBar_Clean:
  6020                                  	;pop	eax  ; **
  6021                                  	; 22/12/2024
  6022 000027C4 5A                      	pop	edx  ; **
  6023                                  	; 21/12/2024
  6024 000027C5 BD50000000              	mov	ebp, 80
  6025                                  	;sub	bp, ax
  6026 000027CA 6629D5                  	sub	bp, dx ; 22/12/2024
  6027 000027CD 74E3                    	jz	short UpdateProgressBar_ok
  6028                                  
  6029 000027CF B61F                    	mov	dh, PROGRESSBAR_ROW
  6030                                  	;mov	dl, al ; 22/12/2024
  6031 000027D1 E88DFDFFFF              	call	setCursorPosition
  6032                                  
  6033                                  	; 21/12/2024
  6034                                  	; (write progress bar chars in graphics mode)
  6035                                  	;;;;
  6036 000027D6 8B35[94740000]          	mov	esi, [screenpos]
  6037                                  UpdateProgressBar_Clean_@:
  6038                                  	;;;mov	eax, 223
  6039                                  	;;;shl	eax, 4 ; 8*16 pixel user font
  6040                                  	;;mov	eax, 223*16
  6041                                  	;mov	edi, fontbuff2 ; start of user font data
  6042                                  	;add	edi, eax
  6043                                  	;mov	edi, fontbuff2+(223*16)
  6044                                  	;
  6045                                  	;sys	_video, 020Fh, 08h, 8001h
  6046                                  	; 22/12/2024
  6047                                  	;mov	eax, 223
  6048                                  	; eax = 0
  6049 000027DC B0DF                    	mov	al, 223
  6050 000027DE B108                    	mov	cl, 08h ; gray (dark)
  6051 000027E0 E837FFFFFF              	call	write_character
  6052                                  	;;;;
  6053                                  
  6054 000027E5 4D                      	dec	ebp
  6055 000027E6 74CA                    	jz	short UpdateProgressBar_ok
  6056                                  
  6057 000027E8 83C608                  	add	esi, 8 ; next column
  6058 000027EB EBEF                    	jmp	short UpdateProgressBar_Clean_@
  6059                                  	;;;;
  6060                                  
  6061                                  ; --------------------------------------------------------
  6062                                  ; 17/11/2024
  6063                                  
  6064                                  Player_ProcessKey_Backwards:
  6065                                  	;; In order to go backwards 5 seconds:
  6066                                  	;; Update file pointer to the beginning, skip headers
  6067 000027ED B142                    	mov	cl, 'B'
  6068 000027EF EB02                    	jmp	short Player_ProcessKey_B_or_F
  6069                                  
  6070                                  Player_ProcessKey_Forwards:
  6071                                  	;; In order to fast-forward 5 seconds, set the file pointer
  6072                                  	;; to CUR_SEEK + 5 * Freq
  6073                                  
  6074 000027F1 B146                    	mov	cl, 'F'
  6075                                  	;jmp	short Player_ProcessKey_B_or_F
  6076                                  
  6077                                  	; 01/12/2024 (32bit regsisters)
  6078                                  Player_ProcessKey_B_or_F:
  6079                                  	; 17/11/2024
  6080                                  	; 04/11/2024
  6081                                  	; (Ref: player.asm, Matan Alfasi, 2017)
  6082                                    
  6083                                  	; 04/11/2024
  6084 000027F3 B805000000              	mov	eax, 5
  6085 000027F8 0FB71D[D07E0000]        	movzx	ebx, word [WAVE_BlockAlign]
  6086 000027FF F7E3                    	mul	ebx
  6087 00002801 668B1D[C87E0000]        	mov	bx, [WAVE_SampleRate]
  6088 00002808 F7E3                    	mul	ebx
  6089                                  	; eax = transfer byte count for 5 seconds
  6090                                  	
  6091                                  	; 17/11/2024
  6092 0000280A 80F942                  	cmp	cl, 'B'
  6093                                  	;mov	bx, [LoadedDataBytes]
  6094                                  	;mov	cx, [LoadedDataBytes+2]
  6095                                  	; 01/12/2024
  6096 0000280D 8B0D[5C7F0000]          	mov	ecx, [LoadedDataBytes]
  6097 00002813 7508                    	jne	short move_forward ; cl = 'F'
  6098                                  move_backward:
  6099                                  	;sub	bx, ax
  6100                                  	;sbb	cx, dx
  6101 00002815 29C1                    	sub	ecx, eax
  6102 00002817 7316                    	jnc	short move_file_pointer
  6103                                  move_to_beginning:
  6104                                  	;xor	cx, cx ; 0
  6105                                  	;xor	bx, bx ; 0
  6106 00002819 31C9                    	xor	ecx, ecx
  6107 0000281B EB12                    	jmp	short move_file_pointer
  6108                                  move_forward: 
  6109                                  	;add	bx, ax
  6110                                  	;adc	cx, dx
  6111 0000281D 01C1                    	add	ecx, eax
  6112 0000281F 7208                    	jc	short move_to_end
  6113                                  	;cmp	cx, [DATA_SubchunkSize+2]
  6114                                  	;ja	short move_to_end
  6115                                  	;jb	short move_file_pointer
  6116                                  	;cmp	bx, [DATA_SubchunkSize]
  6117                                  	;jna	short move_file_pointer
  6118 00002821 3B0D[D87E0000]          	cmp	ecx, [DATA_SubchunkSize]
  6119 00002827 7606                    	jna	short move_file_pointer
  6120                                  move_to_end:
  6121                                  	;mov	bx, [DATA_SubchunkSize]
  6122                                  	;mov	cx, [DATA_SubchunkSize+2]
  6123 00002829 8B0D[D87E0000]          	mov	ecx, [DATA_SubchunkSize]
  6124                                  move_file_pointer:
  6125                                  	;mov	dx, bx    
  6126                                  	;mov	[LoadedDataBytes], dx
  6127                                  	;mov	[LoadedDataBytes+2], cx
  6128 0000282F 890D[5C7F0000]          	mov	[LoadedDataBytes], ecx
  6129                                  	;add	dx, 44 ; + header
  6130                                  	;adc	cx, 0
  6131 00002835 83C12C                  	add	ecx, 44 
  6132                                  
  6133                                  	; seek
  6134                                  	;mov	bx, [filehandle]
  6135                                  	;mov	ax, 4200h
  6136                                  	;int	21h
  6137                                  	; 01/12/2024
  6138 00002838 31D2                    	xor	edx, edx ; offset from beginning of the file
  6139                                  	; ecx = offset	
  6140                                  	; ebx = file handle
  6141                                  	; edx = 0
  6142                                  	sys	_seek, [filehandle]
    85                              <1> 
    86                              <1> 
    87                              <1> 
    88                              <1> 
    89                              <1>  %if %0 >= 2
    90 0000283A 8B1D[E07E0000]      <1>  mov ebx, %2
    91                              <1>  %if %0 >= 3
    92                              <1>  mov ecx, %3
    93                              <1>  %if %0 = 4
    94                              <1>  mov edx, %4
    95                              <1>  %endif
    96                              <1>  %endif
    97                              <1>  %endif
    98 00002840 B813000000          <1>  mov eax, %1
    99                              <1> 
   100 00002845 CD40                <1>  int 40h
  6143 00002847 C3                      	retn
  6144                                  
  6145                                  ; --------------------------------------------------------
  6146                                  
  6147                                  	; 25/12/2024
  6148                                  	; 22/12/2024 (VESA VBE mode graphics) 
  6149                                  	; (640*480, 256 colors)
  6150                                  clear_window:
  6151 00002848 8B3D[90740000]          	mov	edi, [LFB_ADDR]
  6152                                  	;add	edi, (13*80*8*14)
  6153                                  	; 25/12/2024
  6154 0000284E 81C7009A0100            	add	edi, 164*640
  6155 00002854 29C0                    	sub	eax, eax
  6156                                  	;mov	ecx, (16*640*14)/4 ; 16 rows
  6157 00002856 B900A00000              	mov	ecx, 64*640 ; 256 volume level points
  6158 0000285B F3AB                    	rep	stosd
  6159                                  	; 24/12/2024
  6160 0000285D A3[A0740000]            	mov	[prev_points], eax ; 0
  6161                                  	;
  6162 00002862 C3                      	retn
  6163                                  
  6164                                  ; --------------------------------------------------------
  6165                                  
  6166                                  	; 22/12/2024
  6167                                  	; 21/12/2024
  6168                                  	; (simulate wave leds in graphics mode)
  6169                                  	; (640*480, 256 colors)
  6170                                  reset_wave_leds:
  6171                                  	; 22/12/2024
  6172 00002863 C705[48730000]0000-     	mov	dword [prev_leds], 0
  6172 0000286B 0000               
  6173                                  	;
  6174 0000286D BD00050000              	mov	ebp, 16*80 ; 80 columns with 16 levels
  6175 00002872 BE[485F0000]            	mov	esi, wleds_addr
  6176                                  next_led:
  6177 00002877 AD                      	lodsd
  6178 00002878 89C7                    	mov	edi, eax
  6179 0000287A BA0E000000              	mov	edx, 14 ; 14 lines (8*14 pixel font)
  6180 0000287F BB[285F0000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6181                                  led_line:
  6182 00002884 8A23                    	mov	ah, [ebx]
  6183 00002886 B908000000              	mov	ecx, 8 ; 8 pixels (8*16 pixel font)
  6184                                  next_pixel:
  6185 0000288B D0E4                    	shl	ah, 1
  6186 0000288D 7308                    	jnc	short skip_this
  6187 0000288F B008                    	mov	al, 8 ; gray
  6188 00002891 AA                      	stosb
  6189 00002892 49                      	dec	ecx
  6190 00002893 75F6                    	jnz	short next_pixel
  6191 00002895 EB06                    	jmp	short next_line
  6192                                  skip_this:
  6193 00002897 B000                    	mov	al, 0 ; black
  6194 00002899 AA                      	stosb
  6195 0000289A 49                      	dec	ecx
  6196 0000289B 75EE                    	jnz	short next_pixel
  6197                                  next_line:
  6198 0000289D 4A                      	dec	edx
  6199 0000289E 7504                    	jnz	short next_line_@
  6200 000028A0 4D                      	dec	ebp
  6201 000028A1 75D4                    	jnz	short next_led
  6202                                  	;clc	; 25/12/2024
  6203 000028A3 C3                      	retn
  6204                                  next_line_@:
  6205                                  	; 22/12/2024
  6206 000028A4 81C778020000            	add	edi, 640-8 ; next line
  6207 000028AA 43                      	inc	ebx
  6208 000028AB EBD7                    	jmp	short led_line	
  6209                                  
  6210                                  ; --------------------------------------------------------
  6211                                  
  6212                                  	; 22/12/2024 (graphics mode)
  6213                                  	; 09/12/2024
  6214                                  	; 19/11/2024
  6215                                  UpdateWaveLeds:
  6216                                  	; 23/11/2024
  6217                                  	;call	reset_wave_leds
  6218                                  	; 22/12/2024 (faster method, 80 against 80*16)
  6219                                  	; turn off previously lighting wave leds at first
  6220                                  	;;;
  6221 000028AD BE[48730000]            	mov	esi, prev_leds
  6222 000028B2 833E00                  	cmp	dword [esi], 0
  6223 000028B5 7433                    	jz	short UpdateWaveLeds_ok
  6224 000028B7 B950000000              	mov	ecx, 80
  6225                                  turn_off_led:
  6226 000028BC AD                      	lodsd
  6227 000028BD 89C7                    	mov	edi, eax
  6228                                  	; edi = wave led address
  6229 000028BF BD0E000000              	mov	ebp, 14
  6230 000028C4 BB[285F0000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6231 000028C9 31D2                    	xor	edx, edx
  6232 000028CB B008                    	mov	al, 8 ; gray (dark)
  6233                                  toffl_next_line:
  6234                                  	;;mov	edx, 8 ; 8 pixels (8*14 pixel font)
  6235                                  	;mov	dl, 8
  6236 000028CD 88C2                    	mov	dl, al ; 8
  6237 000028CF 8A23                    	mov	ah, [ebx]
  6238                                  toffl_next_pixel:
  6239 000028D1 D0E4                    	shl	ah, 1
  6240 000028D3 7310                    	jnc	short toffl_skip_this
  6241 000028D5 AA                      	stosb
  6242                                  toffl_next_pixel_@:
  6243 000028D6 4A                      	dec	edx
  6244 000028D7 75F8                    	jnz	short toffl_next_pixel
  6245 000028D9 4D                      	dec	ebp
  6246 000028DA 740C                    	jz	short toffl_next_led
  6247 000028DC 81C778020000            	add	edi, 640-8 ; next line
  6248 000028E2 43                      	inc	ebx
  6249 000028E3 EBE8                    	jmp	short toffl_next_line
  6250                                  toffl_skip_this:
  6251 000028E5 47                      	inc	edi
  6252 000028E6 EBEE                    	jmp	short toffl_next_pixel_@
  6253                                  toffl_next_led:
  6254 000028E8 E2D2                    	loop	turn_off_led
  6255                                  UpdateWaveLeds_ok:
  6256                                  	;;;
  6257                                  	; 09/12/2024
  6258                                  	;jmp	short turn_on_leds
  6259                                  
  6260                                  ; --------------------------------------------------------
  6261                                  
  6262                                  	; 21/12/2024 (VESA VBE Mode, 640*480, 256 colors)
  6263                                  	; 09/12/2024
  6264                                  	; 01/12/2024 (TRDOS 386, 32bit registers, flat memory)
  6265                                  	; 23/11/2024 (Retro DOS, 16bit registers, segmented)
  6266                                  	; 21/11/2024, 22/11/2024
  6267                                  	; 19/11/2024
  6268                                  turn_on_leds:
  6269                                  	; 09/12/2024
  6270                                  	; 07/12/2024
  6271 000028EA 8A15[AD7E0000]          	mov	dl, [half_buffer]
  6272                                  tol_@:
  6273                                  	; 07/12/2024
  6274 000028F0 3815[AC7E0000]          	cmp	[pbuf_s], dl
  6275 000028F6 7520                    	jne	short tol_ns_buf
  6276 000028F8 8B1D[A47E0000]          	mov	ebx, [wleds_dif]
  6277 000028FE 8B35[A87E0000]          	mov	esi, [pbuf_o]
  6278 00002904 8B0D[4C7F0000]          	mov	ecx, [buffersize] ; bytes
  6279 0000290A 29D9                    	sub	ecx, ebx ; sub ecx, [wleds_dif]
  6280 0000290C 01DE                    	add	esi, ebx
  6281 0000290E 7204                    	jc	short tol_o_@
  6282 00002910 39CE                    	cmp	esi, ecx
  6283 00002912 760C                    	jna	short tol_s_buf
  6284                                  tol_o_@:
  6285 00002914 89CE                    	mov	esi, ecx
  6286 00002916 EB08                    	jmp	short tol_s_buf
  6287                                  
  6288                                  tol_ns_buf:
  6289 00002918 8815[AC7E0000]          	mov	[pbuf_s], dl
  6290 0000291E 31F6                    	xor	esi, esi ; 0
  6291                                  tol_s_buf:
  6292 00002920 8935[A87E0000]          	mov	[pbuf_o], esi
  6293                                  
  6294                                  tol_buf_@:
  6295                                  	; 07/12/2024
  6296 00002926 81C6[00800000]          	add	esi, audio_buffer
  6297 0000292C B950000000              	mov	ecx, 80
  6298                                  	;xor	eax, eax ; 0
  6299 00002931 BB[485F0000]            	mov	ebx, wleds_addr
  6300                                  	; 22/12/2024
  6301 00002936 BF[48730000]            	mov	edi, prev_leds
  6302                                  tol_fill_c:
  6303 0000293B 31C0                    	xor	eax, eax ; 0 ; 22/12/2024
  6304 0000293D 66AD                    	lodsw	; left
  6305 0000293F 80C480                  	add	ah, 80h	; 24/12/2024
  6306 00002942 89C2                    	mov	edx, eax
  6307 00002944 66AD                    	lodsw	; right
  6308                                  	;add	ax, dx
  6309 00002946 80C480                  	add	ah, 80h
  6310                                  	;; 21/12/2024 (16 volume levels)
  6311                                  	;shr	eax, 12
  6312                                  	; 24/12/2024
  6313 00002949 01D0                    	add	eax, edx
  6314 0000294B C1E80D                  	shr	eax, 13	; (L+R/2) & 16 volume levels
  6315                                  
  6316 0000294E 53                      	push	ebx ; *
  6317                                  	; 01/12/2024
  6318 0000294F C1E002                  	shl	eax, 2
  6319 00002952 01C3                    	add	ebx, eax
  6320                                  	; 01/12/2024 (32bit address)
  6321                                  	;mov	edi, [ebx]
  6322                                  	; 22/12/2024
  6323 00002954 8B03                    	mov	eax, [ebx]
  6324 00002956 AB                      	stosd
  6325 00002957 57                      	push	edi ; **
  6326 00002958 89C7                    	mov	edi, eax
  6327                                  	;;;
  6328                                  	; 21/12/2024
  6329                                  	; (simulate wave leds in graphics mode)
  6330                                  	; (640*480, 256 colors)
  6331                                  turn_on_led:
  6332                                  	; edi = wave led address
  6333 0000295A BD0E000000              	mov	ebp, 14
  6334 0000295F BB[285F0000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6335 00002964 A0[45410000]            	mov	al, [ccolor]
  6336                                  tol_next_line:
  6337 00002969 BA08000000              	mov	edx, 8 ; 8 pixels (8*14 pixel font)
  6338 0000296E 8A23                    	mov	ah, [ebx]
  6339                                  tol_next_pixel:
  6340 00002970 D0E4                    	shl	ah, 1
  6341 00002972 7310                    	jnc	short tol_skip_this
  6342 00002974 AA                      	stosb
  6343                                  tol_next_pixel_@:
  6344 00002975 4A                      	dec	edx
  6345 00002976 75F8                    	jnz	short tol_next_pixel
  6346 00002978 4D                      	dec	ebp
  6347 00002979 740C                    	jz	short tol_next_led
  6348                                  	; 22/12/2024
  6349 0000297B 81C778020000            	add	edi, 640-8 ; next line
  6350 00002981 43                      	inc	ebx
  6351 00002982 EBE5                    	jmp	short tol_next_line
  6352                                  tol_skip_this:
  6353 00002984 47                      	inc	edi
  6354 00002985 EBEE                    	jmp	short tol_next_pixel_@
  6355                                  tol_next_led:
  6356                                  	; 22/12/2024
  6357 00002987 5F                      	pop	edi ; **
  6358                                  	;;;
  6359 00002988 5B                      	pop	ebx ; *
  6360 00002989 83C340                  	add	ebx, 16*4
  6361 0000298C E2AD                    	loop	tol_fill_c
  6362                                  
  6363 0000298E C3                      	retn
  6364                                  
  6365                                  ; -------------------------------------------------------------
  6366                                  
  6367                                  ; -------------------------------------------------------------
  6368                                  ; ac97.inc (11/11/2023)
  6369                                  ; -------------------------------------------------------------
  6370                                  
  6371                                  ; special characters
  6372                                  LF      EQU 10
  6373                                  CR      EQU 13
  6374                                  
  6375                                  ; PCI stuff
  6376                                  
  6377                                  ; Intel ICH2 equates. It is assumed that ICH0 and plain ole ICH are compatible.
  6378                                  
  6379                                  INTEL_VID       equ     8086h           ; Intel's PCI vendor ID
  6380                                  ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004)
  6381                                  SIS_VID		equ	1039h
  6382                                  NVIDIA_VID	equ	10DEh	 ; Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source c.
  6383                                  AMD_VID		equ	1022h
  6384                                  
  6385                                  ICH_DID         equ     2415h           ; ICH device ID
  6386                                  ICH0_DID        equ     2425h           ; ICH0
  6387                                  ICH2_DID        equ     2445h           ; ICH2 I think there are more ICHes.
  6388                                                                          ; they all should be compatible.
  6389                                  
  6390                                  ; 17/02/2017 (Erdogan Tan, ref: ALSA Device IDs, ALSA project)
  6391                                  ICH3_DID	equ     2485h           ; ICH3
  6392                                  ICH4_DID        equ     24C5h           ; ICH4
  6393                                  ICH5_DID	equ     24D5h           ; ICH5
  6394                                  ICH6_DID	equ     266Eh           ; ICH6
  6395                                  ESB6300_DID	equ     25A6h           ; 6300ESB
  6396                                  ESB631X_DID	equ     2698h           ; 631XESB
  6397                                  ICH7_DID	equ	27DEh		; ICH7
  6398                                  ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004)
  6399                                  MX82440_DID	equ	7195h
  6400                                  SI7012_DID	equ	7012h
  6401                                  NFORCE_DID	equ	01B1h
  6402                                  NFORCE2_DID	equ	006Ah
  6403                                  AMD8111_DID	equ	746Dh
  6404                                  AMD768_DID	equ	7445h
  6405                                  ; 03/11/2023 - Erdogan Tan - Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source code
  6406                                  CK804_DID	equ	0059h
  6407                                  MCP04_DID	equ	003Ah
  6408                                  CK8_DID		equ	008Ah
  6409                                  NFORCE3_DID	equ	00DAh
  6410                                  CK8S_DID	equ	00EAh
  6411                                  
  6412                                  ; -------------------------------------------------------------
  6413                                  
  6414                                  ; 22/12/2024
  6415 0000298F 90                      align 4
  6416                                  
  6417                                  ; 13/11/2024
  6418                                  ; ('<<' to 'shl' conversion for FASM)
  6419                                  ;
  6420                                  ; 29/05/2024 (TRDOS 386)
  6421                                  ; 17/02/2017
  6422                                  ; Valid ICH device IDs
  6423                                  
  6424                                  valid_ids:
  6425                                  	;dd (ICH_DID shl 16) + INTEL_VID	; 8086h:2415h
  6426 00002990 86801524                	dd (ICH_DID << 16) + INTEL_VID		; 8086h:2415h
  6427 00002994 86802524                	dd (ICH0_DID << 16) + INTEL_VID		; 8086h:2425h
  6428 00002998 86804524                	dd (ICH2_DID << 16) + INTEL_VID		; 8086h:2445h
  6429 0000299C 86808524                	dd (ICH3_DID << 16) + INTEL_VID		; 8086h:2485h
  6430 000029A0 8680C524                	dd (ICH4_DID << 16) + INTEL_VID		; 8086h:24C5h
  6431 000029A4 8680D524                	dd (ICH5_DID << 16) + INTEL_VID		; 8086h:24D5h
  6432 000029A8 86806E26                	dd (ICH6_DID << 16) + INTEL_VID		; 8086h:266Eh
  6433 000029AC 8680A625                	dd (ESB6300_DID << 16) + INTEL_VID	; 8086h:25A6h
  6434 000029B0 86809826                	dd (ESB631X_DID << 16) + INTEL_VID	; 8086h:2698h
  6435 000029B4 8680DE27                	dd (ICH7_DID << 16) + INTEL_VID		; 8086h:27DEh
  6436                                  	; 03/11/2023 - Erdogan Tan
  6437 000029B8 86809571                	dd (MX82440_DID << 16) + INTEL_VID	; 8086h:7195h
  6438 000029BC 39101270                	dd (SI7012_DID << 16)  + SIS_VID	; 1039h:7012h
  6439 000029C0 DE10B101                	dd (NFORCE_DID << 16)  + NVIDIA_VID	; 10DEh:01B1h
  6440 000029C4 DE106A00                	dd (NFORCE2_DID << 16) + NVIDIA_VID	; 10DEh:006Ah
  6441 000029C8 22106D74                	dd (AMD8111_DID << 16) + AMD_VID	; 1022h:746Dh
  6442 000029CC 22104574                	dd (AMD768_DID << 16)  + AMD_VID	; 1022h:7445h
  6443 000029D0 DE105900                	dd (CK804_DID << 16) + NVIDIA_VID	; 10DEh:0059h
  6444 000029D4 DE103A00                	dd (MCP04_DID << 16) + NVIDIA_VID	; 10DEh:003Ah
  6445 000029D8 DE108A00                	dd (CK8_DID << 16) + NVIDIA_VID		; 1022h:008Ah
  6446 000029DC DE10DA00                	dd (NFORCE3_DID << 16) + NVIDIA_VID	; 10DEh:00DAh
  6447 000029E0 DE10EA00                	dd (CK8S_DID << 16) + NVIDIA_VID	; 10DEh:00EAh
  6448                                  
  6449                                  valid_id_count equ (($ - valid_ids)>>2)	; 05/11/2023
  6450                                  ; 13/11/2024
  6451                                  ;valid_id_count = ($ - valid_ids) shr 2	; 05/11/2023
  6452                                  
  6453 000029E4 00000000                	dd 0
  6454                                  
  6455                                  Credits:
  6456 000029E8 564741205741562050-     	db 'VGA WAV Player for TRDOS 386 by Erdogan Tan. '
  6456 000029F1 6C6179657220666F72-
  6456 000029FA 205452444F53203338-
  6456 00002A03 36206279204572646F-
  6456 00002A0C 67616E2054616E2E20 
  6457                                  	;;db 'December 2024.', 10,13,0
  6458                                  	;db 'January 2025.', 10,13,0
  6459 00002A15 466562727561727920-     	db 'February 2025.', 10,13,0
  6459 00002A1E 323032352E0A0D00   
  6460                                  	;;db '28/12/2024', 10,13
  6461                                  	;;db '18/01/2025', 10,13
  6462                                  	;db '02/02/2025', 10,13
  6463 00002A26 30352F30322F323032-     	db '05/02/2025', 10,13
  6463 00002A2F 350A0D             
  6464                                  ; 15/11/2024
  6465                                  reset:
  6466 00002A32 00                      	db 0
  6467                                  
  6468                                  msgAudioCardInfo:
  6469 00002A33 666F7220496E74656C-     	db 'for Intel AC97 (ICH) Audio Controller.', 10,13,0
  6469 00002A3C 204143393720284943-
  6469 00002A45 482920417564696F20-
  6469 00002A4E 436F6E74726F6C6C65-
  6469 00002A57 722E0A0D00         
  6470                                  
  6471                                  	; 21/12/2024
  6472                                  msg_usage:
  6473 00002A5C 75736167653A206470-     	db 'usage: dplaywav filename.wav',10,13,0
  6473 00002A65 6C6179776176206669-
  6473 00002A6E 6C656E616D652E7761-
  6473 00002A77 760A0D00           
  6474                                  
  6475                                  noDevMsg:
  6476 00002A7B 4572726F723A20556E-     	db 'Error: Unable to find AC97 audio device!'
  6476 00002A84 61626C6520746F2066-
  6476 00002A8D 696E64204143393720-
  6476 00002A96 617564696F20646576-
  6476 00002A9F 69636521           
  6477 00002AA3 0A0D00                  	db 10,13,0
  6478                                  
  6479                                  noFileErrMsg:
  6480 00002AA6 4572726F723A206669-     	db 'Error: file not found.',10,13,0
  6480 00002AAF 6C65206E6F7420666F-
  6480 00002AB8 756E642E0A0D00     
  6481                                  
  6482                                  ; 07/12/2024
  6483                                  trdos386_err_msg:
  6484 00002ABF 5452444F5320333836-     	db 'TRDOS 386 System call error !',10,13,0
  6484 00002AC8 2053797374656D2063-
  6484 00002AD1 616C6C206572726F72-
  6484 00002ADA 20210A0D00         
  6485                                  
  6486                                  ; 29/05/2024
  6487                                  ; 11/11/2023
  6488                                  msg_init_err:
  6489 00002ADF 0D0A                    	db CR, LF
  6490 00002AE1 4143393720436F6E74-     	db 'AC97 Controller/Codec initialization error !'
  6490 00002AEA 726F6C6C65722F436F-
  6490 00002AF3 64656320696E697469-
  6490 00002AFC 616C697A6174696F6E-
  6490 00002B05 206572726F722021   
  6491 00002B0D 0D0A00                  	db CR, LF, 0 ; 07/12/2024
  6492                                  
  6493                                  ; 25/11/2023
  6494                                  msg_no_vra:
  6495 00002B10 0A0D                    	db 10,13
  6496 00002B12 4E6F20565241207375-     	db 'No VRA support ! Only 48 kHZ sample rate supported !'
  6496 00002B1B 70706F72742021204F-
  6496 00002B24 6E6C79203438206B48-
  6496 00002B2D 5A2073616D706C6520-
  6496 00002B36 726174652073757070-
  6496 00002B3F 6F727465642021     
  6497 00002B46 0A0D00                  	db 10,13,0
  6498                                  
  6499                                  ; 19/11/2024
  6500                                  ; 03/06/2017
  6501                                  hex_chars:
  6502 00002B49 303132333435363738-     	db '0123456789ABCDEF', 0
  6502 00002B52 3941424344454600   
  6503                                  msgAC97Info:
  6504 00002B5A 0D0A                    	db 0Dh, 0Ah
  6505 00002B5C 204143393720417564-     	db ' AC97 Audio Controller & Codec Info', 0Dh, 0Ah 
  6505 00002B65 696F20436F6E74726F-
  6505 00002B6E 6C6C6572202620436F-
  6505 00002B77 64656320496E666F0D-
  6505 00002B80 0A                 
  6506 00002B81 2056656E646F722049-     	db ' Vendor ID: '
  6506 00002B8A 443A20             
  6507                                  msgVendorId:
  6508 00002B8D 303030306820446576-     	db '0000h Device ID: '
  6508 00002B96 6963652049443A20   
  6509                                  msgDevId:
  6510 00002B9E 30303030680D0A          	db '0000h', 0Dh, 0Ah
  6511 00002BA5 204275733A20            	db ' Bus: '
  6512                                  msgBusNo:
  6513 00002BAB 303068204465766963-     	db '00h Device: '
  6513 00002BB4 653A20             
  6514                                  msgDevNo:
  6515 00002BB7 3030682046756E6374-     	db '00h Function: '
  6515 00002BC0 696F6E3A20         
  6516                                  msgFncNo:
  6517 00002BC5 303068                  	db '00h'
  6518 00002BC8 0D0A                    	db 0Dh, 0Ah
  6519 00002BCA 204E414D4241523A20      	db ' NAMBAR: '
  6520                                  msgNamBar:
  6521 00002BD3 30303030682020          	db '0000h  '
  6522 00002BDA 4E41424D4241523A20      	db 'NABMBAR: '
  6523                                  msgNabmBar:
  6524 00002BE3 303030306820204952-     	db '0000h  IRQ: '
  6524 00002BEC 513A20             
  6525                                  msgIRQ:
  6526 00002BEF 3030                    	dw 3030h
  6527 00002BF1 0D0A00                  	db 0Dh, 0Ah, 0
  6528                                  ; 25/11/2023
  6529                                  msgVRAheader:
  6530 00002BF4 205652412073757070-     	db ' VRA support: '
  6530 00002BFD 6F72743A20         
  6531 00002C02 00                      	db 0	
  6532                                  msgVRAyes:
  6533 00002C03 5945530D0A00            	db 'YES', 0Dh, 0Ah, 0
  6534                                  msgVRAno:
  6535 00002C09 4E4F200D0A              	db 'NO ', 0Dh, 0Ah
  6536 00002C0E 2028496E746572706F-     	db ' (Interpolated sample rate playing method)'
  6536 00002C17 6C617465642073616D-
  6536 00002C20 706C65207261746520-
  6536 00002C29 706C6179696E67206D-
  6536 00002C32 6574686F6429       
  6537 00002C38 0D0A00                  	db 0Dh, 0Ah, 0
  6538                                  
  6539 00002C3B 90                      align 4
  6540                                  
  6541                                  ; -------------------------------------------------------------
  6542                                  
  6543                                  	; 21/12/2024
  6544                                  SplashScreen:
  6545 00002C3C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6545 00002C45 202020202020202020-
  6545 00002C4E 202020202020202020-
  6545 00002C57 202020202020202020-
  6545 00002C60 202020202020202020-
  6545 00002C69 202020202020202020-
  6545 00002C72 202020202020202020-
  6545 00002C7B 202020202020202020-
  6545 00002C84 2020202020DDDBDE   
  6546 00002C8C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6546 00002C95 202020202020202020-
  6546 00002C9E 202020202020202020-
  6546 00002CA7 202020202020202020-
  6546 00002CB0 202020202020202020-
  6546 00002CB9 202020202020202020-
  6546 00002CC2 202020202020202020-
  6546 00002CCB 202020202020202020-
  6546 00002CD4 2020202020DDDBDE   
  6547 00002CDC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6547 00002CE5 202020202020202020-
  6547 00002CEE 202020202020202020-
  6547 00002CF7 202020202020202020-
  6547 00002D00 202020202020202020-
  6547 00002D09 202020202020202020-
  6547 00002D12 202020202020202020-
  6547 00002D1B 202020202020202020-
  6547 00002D24 2020202020DDDBDE   
  6548 00002D2C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6548 00002D35 202020202020202020-
  6548 00002D3E 202020202020202020-
  6548 00002D47 202020202020202020-
  6548 00002D50 202020202020202020-
  6548 00002D59 202020202020202020-
  6548 00002D62 202020202020202020-
  6548 00002D6B 202020202020202020-
  6548 00002D74 2020202020DDDBDE   
  6549 00002D7C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6549 00002D85 202020202020202020-
  6549 00002D8E 202020202020202020-
  6549 00002D97 202020202020202020-
  6549 00002DA0 202020202020202020-
  6549 00002DA9 202020202020202020-
  6549 00002DB2 202020202020202020-
  6549 00002DBB 202020202020202020-
  6549 00002DC4 2020202020DDDBDE   
  6550 00002DCC DDDBDE202020202020-     	db  221, 219, 222, "                     _______   ______        _______.                     ", 221, 219, 222
  6550 00002DD5 202020202020202020-
  6550 00002DDE 2020202020205F5F5F-
  6550 00002DE7 5F5F5F5F2020205F5F-
  6550 00002DF0 5F5F5F5F2020202020-
  6550 00002DF9 2020205F5F5F5F5F5F-
  6550 00002E02 5F2E20202020202020-
  6550 00002E0B 202020202020202020-
  6550 00002E14 2020202020DDDBDE   
  6551 00002E1C DDDBDE202020202020-     	db  221, 219, 222, "                    |       \ /  __  \      /       |                     ", 221, 219, 222
  6551 00002E25 202020202020202020-
  6551 00002E2E 20202020207C202020-
  6551 00002E37 202020205C202F2020-
  6551 00002E40 5F5F20205C20202020-
  6551 00002E49 20202F202020202020-
  6551 00002E52 207C20202020202020-
  6551 00002E5B 202020202020202020-
  6551 00002E64 2020202020DDDBDE   
  6552 00002E6C DDDBDE202020202020-     	db  221, 219, 222, "                    |  .--.  |  |  |  |    |   (----`                     ", 221, 219, 222
  6552 00002E75 202020202020202020-
  6552 00002E7E 20202020207C20202E-
  6552 00002E87 2D2D2E20207C20207C-
  6552 00002E90 20207C20207C202020-
  6552 00002E99 207C202020282D2D2D-
  6552 00002EA2 2D6020202020202020-
  6552 00002EAB 202020202020202020-
  6552 00002EB4 2020202020DDDBDE   
  6553 00002EBC DDDBDE202020202020-     	db  221, 219, 222, "                    |  |  |  |  |  |  |     \   \                         ", 221, 219, 222
  6553 00002EC5 202020202020202020-
  6553 00002ECE 20202020207C20207C-
  6553 00002ED7 20207C20207C20207C-
  6553 00002EE0 20207C20207C202020-
  6553 00002EE9 20205C2020205C2020-
  6553 00002EF2 202020202020202020-
  6553 00002EFB 202020202020202020-
  6553 00002F04 2020202020DDDBDE   
  6554 00002F0C DDDBDE202020202020-     	db  221, 219, 222, "                    |  '--'  |  `--'  | .----)   |                        ", 221, 219, 222
  6554 00002F15 202020202020202020-
  6554 00002F1E 20202020207C202027-
  6554 00002F27 2D2D2720207C202060-
  6554 00002F30 2D2D2720207C202E2D-
  6554 00002F39 2D2D2D292020207C20-
  6554 00002F42 202020202020202020-
  6554 00002F4B 202020202020202020-
  6554 00002F54 2020202020DDDBDE   
  6555 00002F5C DDDBDE202020202020-     	db  221, 219, 222, "                    |_______/ \______/  |_______/                         ", 221, 219, 222
  6555 00002F65 202020202020202020-
  6555 00002F6E 20202020207C5F5F5F-
  6555 00002F77 5F5F5F5F2F205C5F5F-
  6555 00002F80 5F5F5F5F2F20207C5F-
  6555 00002F89 5F5F5F5F5F5F2F2020-
  6555 00002F92 202020202020202020-
  6555 00002F9B 202020202020202020-
  6555 00002FA4 2020202020DDDBDE   
  6556 00002FAC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6556 00002FB5 202020202020202020-
  6556 00002FBE 202020202020202020-
  6556 00002FC7 202020202020202020-
  6556 00002FD0 202020202020202020-
  6556 00002FD9 202020202020202020-
  6556 00002FE2 202020202020202020-
  6556 00002FEB 202020202020202020-
  6556 00002FF4 2020202020DDDBDE   
  6557 00002FFC DDDBDE20202020202E-     	db  221, 219, 222, "     .______    __          ___   ____    ____  _______ .______           ", 221, 219, 222
  6557 00003005 5F5F5F5F5F5F202020-
  6557 0000300E 205F5F202020202020-
  6557 00003017 202020205F5F5F2020-
  6557 00003020 205F5F5F5F20202020-
  6557 00003029 5F5F5F5F20205F5F5F-
  6557 00003032 5F5F5F5F202E5F5F5F-
  6557 0000303B 5F5F5F202020202020-
  6557 00003044 2020202020DDDBDE   
  6558 0000304C DDDBDE20202020207C-     	db  221, 219, 222, "     |   _  \  |  |        /   \  \   \  /   / |   ____||   _  \          ", 221, 219, 222
  6558 00003055 2020205F20205C2020-
  6558 0000305E 7C20207C2020202020-
  6558 00003067 2020202F2020205C20-
  6558 00003070 205C2020205C20202F-
  6558 00003079 2020202F207C202020-
  6558 00003082 5F5F5F5F7C7C202020-
  6558 0000308B 5F20205C2020202020-
  6558 00003094 2020202020DDDBDE   
  6559 0000309C DDDBDE20202020207C-     	db  221, 219, 222, "     |  |_)  | |  |       /  ^  \  \   \/   /  |  |__   |  |_)  |         ", 221, 219, 222
  6559 000030A5 20207C5F2920207C20-
  6559 000030AE 7C20207C2020202020-
  6559 000030B7 20202F20205E20205C-
  6559 000030C0 20205C2020205C2F20-
  6559 000030C9 20202F20207C20207C-
  6559 000030D2 5F5F2020207C20207C-
  6559 000030DB 5F2920207C20202020-
  6559 000030E4 2020202020DDDBDE   
  6560 000030EC DDDBDE20202020207C-     	db  221, 219, 222, "     |   ___/  |  |      /  /_\  \  \_    _/   |   __|  |      /          ", 221, 219, 222
  6560 000030F5 2020205F5F5F2F2020-
  6560 000030FE 7C20207C2020202020-
  6560 00003107 202F20202F5F5C2020-
  6560 00003110 5C20205C5F20202020-
  6560 00003119 5F2F2020207C202020-
  6560 00003122 5F5F7C20207C202020-
  6560 0000312B 2020202F2020202020-
  6560 00003134 2020202020DDDBDE   
  6561 0000313C DDDBDE20202020207C-     	db  221, 219, 222, "     |  |      |  `----./  _____  \   |  |     |  |____ |  |\  \----.     ", 221, 219, 222
  6561 00003145 20207C202020202020-
  6561 0000314E 7C2020602D2D2D2D2E-
  6561 00003157 2F20205F5F5F5F5F20-
  6561 00003160 205C2020207C20207C-
  6561 00003169 20202020207C20207C-
  6561 00003172 5F5F5F5F207C20207C-
  6561 0000317B 5C20205C2D2D2D2D2E-
  6561 00003184 2020202020DDDBDE   
  6562 0000318C DDDBDE20202020207C-     	db  221, 219, 222, "     | _|      |_______/__/     \__\  |__|     |_______|| _| `._____|     ", 221, 219, 222
  6562 00003195 205F7C202020202020-
  6562 0000319E 7C5F5F5F5F5F5F5F2F-
  6562 000031A7 5F5F2F20202020205C-
  6562 000031B0 5F5F5C20207C5F5F7C-
  6562 000031B9 20202020207C5F5F5F-
  6562 000031C2 5F5F5F5F7C7C205F7C-
  6562 000031CB 20602E5F5F5F5F5F7C-
  6562 000031D4 2020202020DDDBDE   
  6563 000031DC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6563 000031E5 202020202020202020-
  6563 000031EE 202020202020202020-
  6563 000031F7 202020202020202020-
  6563 00003200 202020202020202020-
  6563 00003209 202020202020202020-
  6563 00003212 202020202020202020-
  6563 0000321B 202020202020202020-
  6563 00003224 2020202020DDDBDE   
  6564 0000322C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6564 00003235 202020202020202020-
  6564 0000323E 202020202020202020-
  6564 00003247 202020202020202020-
  6564 00003250 202020202020202020-
  6564 00003259 202020202020202020-
  6564 00003262 202020202020202020-
  6564 0000326B 202020202020202020-
  6564 00003274 2020202020DDDBDE   
  6565 0000327C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6565 00003285 202020202020202020-
  6565 0000328E 202020202020202020-
  6565 00003297 202020202020202020-
  6565 000032A0 202020202020202020-
  6565 000032A9 202020202020202020-
  6565 000032B2 202020202020202020-
  6565 000032BB 202020202020202020-
  6565 000032C4 2020202020DDDBDE   
  6566 000032CC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6566 000032D5 202020202020202020-
  6566 000032DE 202020202020202020-
  6566 000032E7 202020202020202020-
  6566 000032F0 202020202020202020-
  6566 000032F9 202020202020202020-
  6566 00003302 202020202020202020-
  6566 0000330B 202020202020202020-
  6566 00003314 2020202020DDDBDE   
  6567 0000331C DDDBDE202020202020-     	db  221, 219, 222, "                                WELCOME TO                                ", 221, 219, 222
  6567 00003325 202020202020202020-
  6567 0000332E 202020202020202020-
  6567 00003337 202020202020202057-
  6567 00003340 454C434F4D4520544F-
  6567 00003349 202020202020202020-
  6567 00003352 202020202020202020-
  6567 0000335B 202020202020202020-
  6567 00003364 2020202020DDDBDE   
  6568 0000336C DDDBDE202020202020-     	db  221, 219, 222, "                                DOS PLAYER                                ", 221, 219, 222
  6568 00003375 202020202020202020-
  6568 0000337E 202020202020202020-
  6568 00003387 202020202020202044-
  6568 00003390 4F5320504C41594552-
  6568 00003399 202020202020202020-
  6568 000033A2 202020202020202020-
  6568 000033AB 202020202020202020-
  6568 000033B4 2020202020DDDBDE   
  6569 000033BC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6569 000033C5 202020202020202020-
  6569 000033CE 202020202020202020-
  6569 000033D7 202020202020202020-
  6569 000033E0 202020202020202020-
  6569 000033E9 202020202020202020-
  6569 000033F2 202020202020202020-
  6569 000033FB 202020202020202020-
  6569 00003404 2020202020DDDBDE   
  6570 0000340C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6570 00003415 202020202020202020-
  6570 0000341E 202020202020202020-
  6570 00003427 202020202020202020-
  6570 00003430 202020202020202020-
  6570 00003439 202020202020202020-
  6570 00003442 202020202020202020-
  6570 0000344B 202020202020202020-
  6570 00003454 2020202020DDDBDE   
  6571 0000345C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6571 00003465 202020202020202020-
  6571 0000346E 202020202020202020-
  6571 00003477 202020202020202020-
  6571 00003480 202020202020202020-
  6571 00003489 202020202020202020-
  6571 00003492 202020202020202020-
  6571 0000349B 202020202020202020-
  6571 000034A4 2020202020DDDBDE   
  6572 000034AC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6572 000034B5 202020202020202020-
  6572 000034BE 202020202020202020-
  6572 000034C7 202020202020202020-
  6572 000034D0 202020202020202020-
  6572 000034D9 202020202020202020-
  6572 000034E2 202020202020202020-
  6572 000034EB 202020202020202020-
  6572 000034F4 2020202020DDDBDE   
  6573 000034FC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6573 00003505 202020202020202020-
  6573 0000350E 202020202020202020-
  6573 00003517 202020202020202020-
  6573 00003520 202020202020202020-
  6573 00003529 202020202020202020-
  6573 00003532 202020202020202020-
  6573 0000353B 202020202020202020-
  6573 00003544 2020202020DDDBDE   
  6574 0000354C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6574 00003555 202020202020202020-
  6574 0000355E 202020202020202020-
  6574 00003567 202020202020202020-
  6574 00003570 202020202020202020-
  6574 00003579 202020202020202020-
  6574 00003582 202020202020202020-
  6574 0000358B 202020202020202020-
  6574 00003594 2020202020DDDBDE   
  6575 0000359C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6575 000035A5 202020202020202020-
  6575 000035AE 202020202020202020-
  6575 000035B7 202020202020202020-
  6575 000035C0 202020202020202020-
  6575 000035C9 202020202020202020-
  6575 000035D2 202020202020202020-
  6575 000035DB 202020202020202020-
  6575 000035E4 2020202020DDDBDE   
  6576 000035EC DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6576 000035F5 202020202020202020-
  6576 000035FE 202020202020202020-
  6576 00003607 202020202020202020-
  6576 00003610 202020202020202020-
  6576 00003619 202020202020202020-
  6576 00003622 202020202020202020-
  6576 0000362B 202020202020202020-
  6576 00003634 2020202020DDDBDE   
  6577 0000363C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6577 00003645 202020202020202020-
  6577 0000364E 202020202020202020-
  6577 00003657 202020202020202020-
  6577 00003660 202020202020202020-
  6577 00003669 202020202020202020-
  6577 00003672 202020202020202020-
  6577 0000367B 202020202020202020-
  6577 00003684 2020202020DDDBDE   
  6578 0000368C DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6578 00003695 202020202020202020-
  6578 0000369E 202020202020202020-
  6578 000036A7 202020202020202020-
  6578 000036B0 202020202020202020-
  6578 000036B9 202020202020202020-
  6578 000036C2 202020202020202020-
  6578 000036CB 202020202020202020-
  6578 000036D4 2020202020DDDBDE   
  6579 000036DC 00                      	db 0
  6580                                  
  6581                                  ; -------------------------------------------------------------
  6582                                  
  6583                                  	; 22/12/2024
  6584                                  	; 21/12/2024
  6585                                  PlayingScreen:
  6586 000036DD DBDBDBDBDBDBDBDBDB-     	db  34 dup(219), " DOS Player ", 34 dup(219)
  6586 000036E6 DBDBDBDBDBDBDBDBDB-
  6586 000036EF DBDBDBDBDBDBDBDBDB-
  6586 000036F8 DBDBDBDBDBDBDB2044-
  6586 00003701 4F5320506C61796572-
  6586 0000370A 20DBDBDBDBDBDBDBDB-
  6586 00003713 DBDBDBDBDBDBDBDBDB-
  6586 0000371C DBDBDBDBDBDBDBDBDB-
  6586 00003725 DBDBDBDBDBDBDBDB   
  6587 0000372D C9CDCDCDCDCDCDCDCD-     	db  201, 78 dup(205), 187
  6587 00003736 CDCDCDCDCDCDCDCDCD-
  6587 0000373F CDCDCDCDCDCDCDCDCD-
  6587 00003748 CDCDCDCDCDCDCDCDCD-
  6587 00003751 CDCDCDCDCDCDCDCDCD-
  6587 0000375A CDCDCDCDCDCDCDCDCD-
  6587 00003763 CDCDCDCDCDCDCDCDCD-
  6587 0000376C CDCDCDCDCDCDCDCDCD-
  6587 00003775 CDCDCDCDCDCDCDBB   
  6588 0000377D BA2020202020202020-     	db  186, 33 dup(32), " User Guide ", 33 dup(32), 186
  6588 00003786 202020202020202020-
  6588 0000378F 202020202020202020-
  6588 00003798 202020202020202055-
  6588 000037A1 736572204775696465-
  6588 000037AA 202020202020202020-
  6588 000037B3 202020202020202020-
  6588 000037BC 202020202020202020-
  6588 000037C5 20202020202020BA   
  6589 000037CD BA2020202020203C53-     	db  186, 6  dup(32), "<Space>         Play/Pause    ", 4 dup(32), "<H>             Hardware Info", 9 dup(32), 186
  6589 000037D6 706163653E20202020-
  6589 000037DF 2020202020506C6179-
  6589 000037E8 2F5061757365202020-
  6589 000037F1 20202020203C483E20-
  6589 000037FA 202020202020202020-
  6589 00003803 202020486172647761-
  6589 0000380C 726520496E666F2020-
  6589 00003815 20202020202020BA   
  6590                                  	; 25/12/2024
  6591 0000381D BA2020202020203C53-     	db  186, 6  dup(32), "<S>             Stop          ", 4 dup(32), "<Enter>/<G>     Wave Lighting", 9 dup(32), 186
  6591 00003826 3E2020202020202020-
  6591 0000382F 202020202053746F70-
  6591 00003838 202020202020202020-
  6591 00003841 20202020203C456E74-
  6591 0000384A 65723E2F3C473E2020-
  6591 00003853 20202057617665204C-
  6591 0000385C 69676874696E672020-
  6591 00003865 20202020202020BA   
  6592 0000386D BA2020202020203C46-     	db  186, 6  dup(32), "<F>             Forwards      ", 4 dup(32), "<+>/<->         Inc/Dec Volume", 8 dup(32), 186
  6592 00003876 3E2020202020202020-
  6592 0000387F 2020202020466F7277-
  6592 00003888 617264732020202020-
  6592 00003891 20202020203C2B3E2F-
  6592 0000389A 3C2D3E202020202020-
  6592 000038A3 202020496E632F4465-
  6592 000038AC 6320566F6C756D6520-
  6592 000038B5 20202020202020BA   
  6593 000038BD BA2020202020203C42-     	db  186, 6  dup(32), "<B>             Backwards     ", 4 dup(32), "<Q>             Quit Program ", 9 dup(32), 186
  6593 000038C6 3E2020202020202020-
  6593 000038CF 20202020204261636B-
  6593 000038D8 776172647320202020-
  6593 000038E1 20202020203C513E20-
  6593 000038EA 202020202020202020-
  6593 000038F3 202020517569742050-
  6593 000038FC 726F6772616D202020-
  6593 00003905 20202020202020BA   
  6594 0000390D CCCDCDCDCDCDCDCDCD-     	db  204, 78 dup(205), 185
  6594 00003916 CDCDCDCDCDCDCDCDCD-
  6594 0000391F CDCDCDCDCDCDCDCDCD-
  6594 00003928 CDCDCDCDCDCDCDCDCD-
  6594 00003931 CDCDCDCDCDCDCDCDCD-
  6594 0000393A CDCDCDCDCDCDCDCDCD-
  6594 00003943 CDCDCDCDCDCDCDCDCD-
  6594 0000394C CDCDCDCDCDCDCDCDCD-
  6594 00003955 CDCDCDCDCDCDCDB9   
  6595 0000395D BA2020202020204669-     	db  186, 6  dup(32), "File Name :                   ", 4 dup(32), "Bit-Rate  :     0  Bits      ", 9 dup(32), 186
  6595 00003966 6C65204E616D65203A-
  6595 0000396F 202020202020202020-
  6595 00003978 202020202020202020-
  6595 00003981 20202020204269742D-
  6595 0000398A 5261746520203A2020-
  6595 00003993 202020302020426974-
  6595 0000399C 732020202020202020-
  6595 000039A5 20202020202020BA   
  6596 000039AD BA2020202020204672-     	db  186, 6  dup(32), "Frequency :     0     Hz      ", 4 dup(32), "#-Channels:     0            ", 9 dup(32), 186
  6596 000039B6 657175656E6379203A-
  6596 000039BF 202020202030202020-
  6596 000039C8 2020487A2020202020-
  6596 000039D1 2020202020232D4368-
  6596 000039DA 616E6E656C733A2020-
  6596 000039E3 202020302020202020-
  6596 000039EC 202020202020202020-
  6596 000039F5 20202020202020BA   
  6597 000039FD C8CDCDCDCDCDCDCDCD-     	db  200, 78 dup(205), 188
  6597 00003A06 CDCDCDCDCDCDCDCDCD-
  6597 00003A0F CDCDCDCDCDCDCDCDCD-
  6597 00003A18 CDCDCDCDCDCDCDCDCD-
  6597 00003A21 CDCDCDCDCDCDCDCDCD-
  6597 00003A2A CDCDCDCDCDCDCDCDCD-
  6597 00003A33 CDCDCDCDCDCDCDCDCD-
  6597 00003A3C CDCDCDCDCDCDCDCDCD-
  6597 00003A45 CDCDCDCDCDCDCDBC   
  6598 00003A4D 202020202020202020-     	db  80 dup(32)
  6598 00003A56 202020202020202020-
  6598 00003A5F 202020202020202020-
  6598 00003A68 202020202020202020-
  6598 00003A71 202020202020202020-
  6598 00003A7A 202020202020202020-
  6598 00003A83 202020202020202020-
  6598 00003A8C 202020202020202020-
  6598 00003A95 2020202020202020   
  6599                                  improper_samplerate_txt:
  6600                                  read_error_txt:
  6601 00003A9D 202020202020202020-     	db  80 dup(32)
  6601 00003AA6 202020202020202020-
  6601 00003AAF 202020202020202020-
  6601 00003AB8 202020202020202020-
  6601 00003AC1 202020202020202020-
  6601 00003ACA 202020202020202020-
  6601 00003AD3 202020202020202020-
  6601 00003ADC 202020202020202020-
  6601 00003AE5 2020202020202020   
  6602 00003AED 202020202020202020-     	db  80 dup(32)
  6602 00003AF6 202020202020202020-
  6602 00003AFF 202020202020202020-
  6602 00003B08 202020202020202020-
  6602 00003B11 202020202020202020-
  6602 00003B1A 202020202020202020-
  6602 00003B23 202020202020202020-
  6602 00003B2C 202020202020202020-
  6602 00003B35 2020202020202020   
  6603 00003B3D 202020202020202020-     	db  80 dup(32)
  6603 00003B46 202020202020202020-
  6603 00003B4F 202020202020202020-
  6603 00003B58 202020202020202020-
  6603 00003B61 202020202020202020-
  6603 00003B6A 202020202020202020-
  6603 00003B73 202020202020202020-
  6603 00003B7C 202020202020202020-
  6603 00003B85 2020202020202020   
  6604 00003B8D 202020202020202020-     	db  80 dup(32)
  6604 00003B96 202020202020202020-
  6604 00003B9F 202020202020202020-
  6604 00003BA8 202020202020202020-
  6604 00003BB1 202020202020202020-
  6604 00003BBA 202020202020202020-
  6604 00003BC3 202020202020202020-
  6604 00003BCC 202020202020202020-
  6604 00003BD5 2020202020202020   
  6605 00003BDD 202020202020202020-     	db  80 dup(32)
  6605 00003BE6 202020202020202020-
  6605 00003BEF 202020202020202020-
  6605 00003BF8 202020202020202020-
  6605 00003C01 202020202020202020-
  6605 00003C0A 202020202020202020-
  6605 00003C13 202020202020202020-
  6605 00003C1C 202020202020202020-
  6605 00003C25 2020202020202020   
  6606 00003C2D 202020202020202020-     	db  80 dup(32)
  6606 00003C36 202020202020202020-
  6606 00003C3F 202020202020202020-
  6606 00003C48 202020202020202020-
  6606 00003C51 202020202020202020-
  6606 00003C5A 202020202020202020-
  6606 00003C63 202020202020202020-
  6606 00003C6C 202020202020202020-
  6606 00003C75 2020202020202020   
  6607 00003C7D 202020202020202020-     	db  80 dup(32)
  6607 00003C86 202020202020202020-
  6607 00003C8F 202020202020202020-
  6607 00003C98 202020202020202020-
  6607 00003CA1 202020202020202020-
  6607 00003CAA 202020202020202020-
  6607 00003CB3 202020202020202020-
  6607 00003CBC 202020202020202020-
  6607 00003CC5 2020202020202020   
  6608 00003CCD 202020202020202020-     	db  80 dup(32)
  6608 00003CD6 202020202020202020-
  6608 00003CDF 202020202020202020-
  6608 00003CE8 202020202020202020-
  6608 00003CF1 202020202020202020-
  6608 00003CFA 202020202020202020-
  6608 00003D03 202020202020202020-
  6608 00003D0C 202020202020202020-
  6608 00003D15 2020202020202020   
  6609 00003D1D 202020202020202020-     	db  80 dup(32)
  6609 00003D26 202020202020202020-
  6609 00003D2F 202020202020202020-
  6609 00003D38 202020202020202020-
  6609 00003D41 202020202020202020-
  6609 00003D4A 202020202020202020-
  6609 00003D53 202020202020202020-
  6609 00003D5C 202020202020202020-
  6609 00003D65 2020202020202020   
  6610 00003D6D 202020202020202020-     	db  80 dup(32)
  6610 00003D76 202020202020202020-
  6610 00003D7F 202020202020202020-
  6610 00003D88 202020202020202020-
  6610 00003D91 202020202020202020-
  6610 00003D9A 202020202020202020-
  6610 00003DA3 202020202020202020-
  6610 00003DAC 202020202020202020-
  6610 00003DB5 2020202020202020   
  6611 00003DBD 202020202020202020-     	db  80 dup(32)
  6611 00003DC6 202020202020202020-
  6611 00003DCF 202020202020202020-
  6611 00003DD8 202020202020202020-
  6611 00003DE1 202020202020202020-
  6611 00003DEA 202020202020202020-
  6611 00003DF3 202020202020202020-
  6611 00003DFC 202020202020202020-
  6611 00003E05 2020202020202020   
  6612 00003E0D 202020202020202020-     	db  80 dup(32)
  6612 00003E16 202020202020202020-
  6612 00003E1F 202020202020202020-
  6612 00003E28 202020202020202020-
  6612 00003E31 202020202020202020-
  6612 00003E3A 202020202020202020-
  6612 00003E43 202020202020202020-
  6612 00003E4C 202020202020202020-
  6612 00003E55 2020202020202020   
  6613 00003E5D 202020202020202020-     	db  80 dup(32)
  6613 00003E66 202020202020202020-
  6613 00003E6F 202020202020202020-
  6613 00003E78 202020202020202020-
  6613 00003E81 202020202020202020-
  6613 00003E8A 202020202020202020-
  6613 00003E93 202020202020202020-
  6613 00003E9C 202020202020202020-
  6613 00003EA5 2020202020202020   
  6614 00003EAD 202020202020202020-     	db  80 dup(32)
  6614 00003EB6 202020202020202020-
  6614 00003EBF 202020202020202020-
  6614 00003EC8 202020202020202020-
  6614 00003ED1 202020202020202020-
  6614 00003EDA 202020202020202020-
  6614 00003EE3 202020202020202020-
  6614 00003EEC 202020202020202020-
  6614 00003EF5 2020202020202020   
  6615 00003EFD 202020202020202020-     	db  80 dup(32)
  6615 00003F06 202020202020202020-
  6615 00003F0F 202020202020202020-
  6615 00003F18 202020202020202020-
  6615 00003F21 202020202020202020-
  6615 00003F2A 202020202020202020-
  6615 00003F33 202020202020202020-
  6615 00003F3C 202020202020202020-
  6615 00003F45 2020202020202020   
  6616 00003F4D 202020202020202020-     	db  80 dup(32)
  6616 00003F56 202020202020202020-
  6616 00003F5F 202020202020202020-
  6616 00003F68 202020202020202020-
  6616 00003F71 202020202020202020-
  6616 00003F7A 202020202020202020-
  6616 00003F83 202020202020202020-
  6616 00003F8C 202020202020202020-
  6616 00003F95 2020202020202020   
  6617 00003F9D 202020202020202020-     	db  80 dup(32)
  6617 00003FA6 202020202020202020-
  6617 00003FAF 202020202020202020-
  6617 00003FB8 202020202020202020-
  6617 00003FC1 202020202020202020-
  6617 00003FCA 202020202020202020-
  6617 00003FD3 202020202020202020-
  6617 00003FDC 202020202020202020-
  6617 00003FE5 2020202020202020   
  6618 00003FED 202020202020202020-     	db  80 dup(32)
  6618 00003FF6 202020202020202020-
  6618 00003FFF 202020202020202020-
  6618 00004008 202020202020202020-
  6618 00004011 202020202020202020-
  6618 0000401A 202020202020202020-
  6618 00004023 202020202020202020-
  6618 0000402C 202020202020202020-
  6618 00004035 2020202020202020   
  6619 0000403D CDCDCDCDCDCDCDCDCD-     	db  80 dup(205)
  6619 00004046 CDCDCDCDCDCDCDCDCD-
  6619 0000404F CDCDCDCDCDCDCDCDCD-
  6619 00004058 CDCDCDCDCDCDCDCDCD-
  6619 00004061 CDCDCDCDCDCDCDCDCD-
  6619 0000406A CDCDCDCDCDCDCDCDCD-
  6619 00004073 CDCDCDCDCDCDCDCDCD-
  6619 0000407C CDCDCDCDCDCDCDCDCD-
  6619 00004085 CDCDCDCDCDCDCDCD   
  6620 0000408D 202020202020202020-     	db  80 dup(32)
  6620 00004096 202020202020202020-
  6620 0000409F 202020202020202020-
  6620 000040A8 202020202020202020-
  6620 000040B1 202020202020202020-
  6620 000040BA 202020202020202020-
  6620 000040C3 202020202020202020-
  6620 000040CC 202020202020202020-
  6620 000040D5 2020202020202020   
  6621 000040DD 202020202020202020-     	db  33 dup(32), "00:00 ", 174, 175, " 00:00", 24 dup(32), "VOL 000%"
  6621 000040E6 202020202020202020-
  6621 000040EF 202020202020202020-
  6621 000040F8 20202020202030303A-
  6621 00004101 303020AEAF2030303A-
  6621 0000410A 303020202020202020-
  6621 00004113 202020202020202020-
  6621 0000411C 202020202020202056-
  6621 00004125 4F4C2030303025     
  6622 0000412C 00                      	db 0
  6623                                  
  6624                                  ; -------------------------------------------------------------
  6625                                  
  6626                                  	; 22/12/2024
  6627                                  fillblock:
  6628 0000412D FF<rep Eh>              	times 14 db 0FFh
  6629 0000413B 0000                    	dw 0
  6630                                  
  6631                                  ; -------------------------------------------------------------
  6632                                  
  6633                                  ; 23/11/2024
  6634                                  colors:
  6635 0000413D 0F0B0A0C0E090D0F        	db 0Fh, 0Bh, 0Ah, 0Ch, 0Eh, 09h, 0Dh, 0Fh
  6636                                  	; white, cyan, green, red, yellow, blue, magenta
  6637 00004145 0B                      ccolor:	db 0Bh	; cyan
  6638                                  
  6639                                  EOF: 
  6640                                  
  6641                                  ; -------------------------------------------------------------
  6642                                  
  6643                                  bss:
  6644                                  
  6645                                  ABSOLUTE bss
  6646                                  
  6647 00004146 ????                    alignb 4
  6648                                  
  6649                                  ; 21/12/2024
  6650                                  fontbuff1:
  6651 00004148 <res E00h>              	resb 256*14 ; 8x14 font data (from system)
  6652                                  fontbuff2:
  6653 00004F48 <res 1000h>             	resb 256*16 ; 8x16 font data (modif. from 8x14)
  6654                                  
  6655                                  ; 11/12/2024
  6656                                  wleds_addr:
  6657 00005F48 <res 1400h>             	resd 80*16 ; 32 bit addrs, 80 leds, 16 volume levels
  6658                                  ; 22/12/2024
  6659                                  prev_leds:
  6660 00007348 <res 140h>              	resd 80	; previous lighting leds
  6661                                  
  6662                                  ; 24/12/2024
  6663                                  wpoints_dif:	; wave lighting points factor (differential) 
  6664 00007488 ????????                	resd 1	; required bytes for 1/18 second wave lighting
  6665                                  graphstart:
  6666 0000748C ????????                	resd 1	; start (top) line/row for wave lighting points 	 
  6667                                  
  6668                                  LFB_ADDR:
  6669 00007490 ????????                	resd 1
  6670                                  ;nextrow:
  6671                                  	;resd 1
  6672                                  screenpos: ; hw = (cursor) row, lw = (cursor) column
  6673 00007494 ????????                	resd 1
  6674 00007498 ????????                wcolor:	resd 1
  6675                                  ; 26/12/2024
  6676                                  ;tcolor: resb 1 ; text color
  6677                                  columns:
  6678 0000749C ??                      	resb 1
  6679 0000749D ??                      pbprev:	resb 1 ; previous progress bar indicator position
  6680                                  
  6681 0000749E ????                    alignb 4
  6682                                  
  6683                                  bss_start:
  6684                                  
  6685                                  ; 24/12/2024
  6686                                  prev_points:
  6687 000074A0 <res A00h>              	resd 640 ; previous wave points (which are lighting)	
  6688                                  
  6689                                  ; 18/11/2024
  6690                                  stopped:
  6691 00007EA0 ??                      	resb 1
  6692 00007EA1 ??                      tLO:	resb 1
  6693                                  ; 21/11/2024
  6694 00007EA2 ??                      tLP:	resb 1
  6695                                  ; 19/11/2024
  6696 00007EA3 ??                      wleds:	resb 1
  6697                                  wleds_dif:
  6698 00007EA4 ????????                	resd 1
  6699 00007EA8 ????????                pbuf_o:	resd 1
  6700                                  ; 07/12/2024
  6701 00007EAC ??                      pbuf_s:	resb 1
  6702                                  
  6703                                  ; 07/12/2024
  6704                                  ; 24/11/2024
  6705                                  half_buffer:
  6706 00007EAD ??                      	resb 1	; dma half buffer 1 or 2 (0 or 1)
  6707                                  
  6708                                  ; 30/05/2024
  6709 00007EAE ??                      VRA:	resb 1	; Variable Rate Audio Support Status
  6710                                  
  6711                                  ; 24/12/2024
  6712 00007EAF ??                      p_mode: resb 1	; point mode (as alternative to LED mode)
  6713                                  
  6714                                  ; 30/11/2024
  6715                                  alignb 4
  6716                                  
  6717                                  ;;;;;;;;;;;;;;
  6718                                  ; 14/11/2024
  6719                                  ; (Ref: player.asm, Matan Alfasi, 2017)  
  6720                                  WAVFILEHEADERbuff:
  6721                                  RIFF_ChunkID:
  6722 00007EB0 ????????                	resd 1	; Must be equal to "RIFF" - big-endian
  6723                                  		; 0x52494646
  6724                                  RIFF_ChunkSize:
  6725 00007EB4 ????????                	resd 1	; Represents total file size, not 
  6726                                          	; including the first 2 fields 
  6727                                  		; (Total_File_Size - 8), little-endian
  6728                                  RIFF_Format:
  6729 00007EB8 ????????                	resd 1	; Must be equal to "WAVE" - big-endian
  6730                                  		; 0x57415645
  6731                                  
  6732                                  ;; WAVE header parameters ("Sub-chunk")
  6733                                  WAVE_SubchunkID:
  6734 00007EBC ????????                	resd 1	; Must be equal to "fmt " - big-endian
  6735                                  		; 0x666d7420
  6736                                  WAVE_SubchunkSize:
  6737 00007EC0 ????????                	resd 1	; Represents total chunk size
  6738                                  WAVE_AudioFormat:
  6739 00007EC4 ????                    	resw 1	; PCM (Raw) - is 1, other - is a form 
  6740                                  		; of compression, not supported.
  6741                                  WAVE_NumChannels:
  6742 00007EC6 ????                    	resw 1	; Number of channels, Mono-1, Stereo-2
  6743                                  WAVE_SampleRate:
  6744 00007EC8 ????????                	resd 1	; Frequency rate, in Hz (8000, 44100 ...)
  6745                                  WAVE_ByteRate:
  6746 00007ECC ????????                	resd 1	; SampleRate * NumChannels * BytesPerSample
  6747                                  WAVE_BlockAlign:
  6748 00007ED0 ????                    	resw 1	; NumChannels * BytesPerSample
  6749                                  		; Number of bytes for one sample.
  6750                                  WAVE_BitsPerSample:
  6751 00007ED2 ????                    	resw 1	; 8 = 8 bits, 16 = 16 bits, etc.
  6752                                  
  6753                                  ;; DATA header parameters
  6754                                  DATA_SubchunkID:
  6755 00007ED4 ????????                	resd 1	; Must be equal to "data" - big-endian
  6756                                          	; 0x64617461
  6757                                  DATA_SubchunkSize:
  6758 00007ED8 ????????                	resd 1	; NumSamples * NumChannels * BytesPerSample
  6759                                          	; Number of bytes in the data.
  6760                                  ;;;;;;;;;;;;;;
  6761                                  
  6762                                  ; 28/12/2024
  6763                                  ; 15/11/2024
  6764                                  ;cursortype:
  6765 00007EDC ????                    	resw 1
  6766 00007EDE ??                      flags:	resb 1
  6767                                  ; 06/11/2023
  6768                                  ac97_int_ln_reg:
  6769 00007EDF ??                      	resb 1
  6770                                  filehandle:
  6771 00007EE0 ????????                	resd 1
  6772                                  
  6773                                  ; 30/05/2024
  6774                                  wav_file_name:
  6775 00007EE4 <res 50h>               	resb 80	; wave file, path name (<= 80 bytes)
  6776 00007F34 ????                    	resw 1	; 30/11/2024
  6777                                  
  6778                                  ; 08/11/2023
  6779                                  ; 07/11/2023
  6780                                  fbs_shift:
  6781 00007F36 ??                      	resb 1
  6782                                  ; 07/12/2024
  6783 00007F37 ??                      SRB:	resb 1
  6784                                  
  6785                                  ; 12/11/2016 - Erdogan Tan
  6786                                  bus_dev_fn:
  6787 00007F38 ????????                	resd 1
  6788                                  dev_vendor:
  6789 00007F3C ????????                	resd 1
  6790                                  
  6791                                  ; 17/02/2017
  6792                                  ; NAMBAR:  Native Audio Mixer Base Address Register
  6793                                  ;    (ICH, Audio D31:F5, PCI Config Space) Address offset: 10h-13h
  6794                                  ; NABMBAR: Native Audio Bus Mastering Base Address register
  6795                                  ;    (ICH, Audio D31:F5, PCI Config Space) Address offset: 14h-17h
  6796 00007F40 ????                    NAMBAR:	resw 1	; BAR for mixer
  6797                                  NABMBAR:
  6798 00007F42 ????                    	resw 1	; BAR for bus master regs
  6799                                  
  6800                                  ; 15/11/2024
  6801                                  loadfromwavfile:
  6802 00007F44 ????????                	resd 1	; 'loadfromfile' or load+conversion proc address
  6803                                  loadsize:
  6804 00007F48 ????????                	resd 1	; (.wav file) read count (bytes) per one time
  6805                                  buffersize:
  6806 00007F4C ????????                	resd 1	; 16 bit samples (not bytes)
  6807                                  		
  6808                                  ; 14/11/2024
  6809                                  TotalTime:
  6810 00007F50 ????????                	resd 1	; Total (WAV File) Playing Time in seconds
  6811                                  ProgressTime:
  6812 00007F54 ????????                	resd 1
  6813 00007F58 ????????                count:	resd 1	; byte count of one (wav file) read
  6814                                  LoadedDataBytes:
  6815 00007F5C ????????                	resd 1	; total read/load count
  6816                                  
  6817                                  timerticks:
  6818 00007F60 ????????                	resd 1	; (to eliminate excessive lookup of events in tuneloop)
  6819                                  		; (in order to get the emulator/qemu to run correctly)
  6820                                  ; 14/11/2024	
  6821                                  bss_end:
  6822                                  
  6823                                  ; 02/12/2024
  6824 00007F64 <res 9Ch>               alignb 4096
  6825                                  
  6826                                  ; 07/12/2024
  6827                                  ; 26/11/2023
  6828                                  audio_buffer:
  6829 00008000 <res 10000h>            	resb 65536  ; DMA Buffer Size / 2	
  6830                                  
  6831                                  ; 01/12/2024
  6832                                  ; 26/11/2023
  6833                                  temp_buffer:
  6834 00018000 <res 10000h>            	resb 65536  ;  rb BUFFERSIZE
  6835                                  
  6836                                  ; 28/12/2024
  6837                                  alignb 4096
  6838 00028000 <res A00h>              g_buff:	resb 640*4
