     1                                  ; ****************************************************************************
     2                                  ; vgaplay.s - TRDOS 386 (TRDOS v2.0.9) WAV PLAYER - VESA VBE Video Mode 101h
     3                                  ; ----------------------------------------------------------------------------
     4                                  ; VGAPLAY.PRG ! AC'97 (ICH) .WAV PLAYER program by Erdogan TAN
     5                                  ;
     6                                  ; 25/12/2024				- play music from multiple wav files -
     7                                  ;
     8                                  ; [ Last Modification: 05/02/2025 ]
     9                                  ;
    10                                  ; Modified from DPLAYWAV.PRG .wav player program by Erdogan Tan, 25/12/2024
    11                                  ;	    and AC97PLAY.PRG, 18/12/2024	
    12                                  ;
    13                                  ; ****************************************************************************
    14                                  ; nasm vgaplay.s -l vgaplay.txt -o VGAPLAY.PRG -Z error.txt
    15                                  
    16                                  ; dplayvga.s (25/12/2024) - play music from single wav file -
    17                                  ; ac97play.s (18/12/2024) - play music from multiple wav files -
    18                                  
    19                                  ; 07/12/2024 - playwav9.s - interrupt (srb) + tuneloop version
    20                                  ; ------------------------------------------------------------
    21                                  ; INTERRUPT (SRB) + TUNELOOP version ; 24/11/2024 (PLAYWAV9.ASM)
    22                                  ;	(running in DOSBOX, VIRTUALBOX, QEMU is ok)
    23                                  ; Signal Response Byte = message/signal to user about an event/interrupt
    24                                  ;	    as requested (TuneLoop procedure continuously checks this SRB)
    25                                  ; (TRDOS 386 v2 feature is used here as very simple interrupt handler output)
    26                                  
    27                                  ; ------------------------------------------------------------
    28                                  
    29                                  ; 30/11/2024
    30                                  ; 20/08/2024 ; TRDOS 386 v2.0.9
    31                                  ; 29/04/2016
    32                                  _ver 	equ 0
    33                                  _exit 	equ 1
    34                                  _fork 	equ 2
    35                                  _read 	equ 3
    36                                  _write	equ 4
    37                                  _open	equ 5
    38                                  _close 	equ 6
    39                                  _wait 	equ 7
    40                                  _creat 	equ 8
    41                                  _link 	equ 9
    42                                  _unlink	equ 10
    43                                  _exec	equ 11
    44                                  _chdir	equ 12
    45                                  _time 	equ 13
    46                                  _mkdir 	equ 14
    47                                  _chmod	equ 15
    48                                  _chown	equ 16
    49                                  _break	equ 17
    50                                  _stat	equ 18
    51                                  _seek	equ 19
    52                                  _tell 	equ 20
    53                                  _mount	equ 21
    54                                  _umount	equ 22
    55                                  _setuid	equ 23
    56                                  _getuid	equ 24
    57                                  _stime	equ 25
    58                                  _quit	equ 26
    59                                  _intr	equ 27
    60                                  _fstat	equ 28
    61                                  _emt 	equ 29
    62                                  _mdate 	equ 30
    63                                  _video 	equ 31
    64                                  _audio	equ 32
    65                                  _timer	equ 33
    66                                  _sleep	equ 34
    67                                  _msg    equ 35
    68                                  _geterr	equ 36
    69                                  _fpsave	equ 37
    70                                  _pri	equ 38
    71                                  _rele	equ 39
    72                                  _fff	equ 40
    73                                  _fnf	equ 41
    74                                  _alloc	equ 42
    75                                  _dalloc equ 43
    76                                  _calbac equ 44
    77                                  _dma	equ 45
    78                                  _stdio  equ 46
    79                                  
    80                                  ; ------------------------------------------------------------
    81                                  
    82                                  %macro sys 1-4
    83                                      ; 29/04/2016 - TRDOS 386 (TRDOS v2.0)
    84                                      ; 03/09/2015
    85                                      ; 13/04/2015
    86                                      ; Retro UNIX 386 v1 system call.
    87                                      %if %0 >= 2
    88                                          mov ebx, %2
    89                                          %if %0 >= 3
    90                                              mov ecx, %3
    91                                              %if %0 = 4
    92                                                 mov edx, %4
    93                                              %endif
    94                                          %endif
    95                                      %endif
    96                                      mov eax, %1
    97                                      ;int 30h
    98                                      int 40h ; TRDOS 386 (TRDOS v2.0)
    99                                  %endmacro
   100                                  
   101                                  ; Retro UNIX 386 v1 system call format:
   102                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
   103                                  
   104                                  ; ------------------------------------------------------------
   105                                  
   106                                  ; player internal variables and other equates.
   107                                  BUFFERSIZE	equ 65536
   108                                  ENDOFFILE	equ 1		; flag for knowing end of file
   109                                  
   110                                  ; ------------------------------------------------------------
   111                                  
   112                                  [BITS 32] ; 32-bit intructions
   113                                  
   114                                  [ORG 0]
   115                                  
   116                                  START_CODE:
   117                                  	; Prints the Credits Text.
   118                                  	sys	_msg, Credits, 255, 0Bh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000000 BB[C42B0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000005 B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000000A BA0B000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000000F B823000000          <1>  mov eax, %1
    97                              <1> 
    98 00000014 CD40                <1>  int 40h
   119                                  
   120                                  	; clear bss
   121 00000016 BF[B4760000]            	mov	edi, bss_start
   122 0000001B B9B5020000              	mov	ecx, (bss_end - bss_start)/4
   123 00000020 31C0                    	xor	eax, eax
   124 00000022 F3AB                    	rep	stosd
   125                                  
   126                                  ; -------------------------------------------------------------
   127                                  
   128                                  	; 21/12/2024
   129                                  	; Detect (& Enable) AC'97 Audio Device
   130 00000024 E8F3080000              	call	DetectAC97
   131 00000029 731B                    	jnc	short ac97_hardware_ready
   132                                  
   133                                  	; 30/11/2024
   134                                  	; 30/05/2024
   135                                  _dev_not_ready:
   136                                  	; couldn't find the audio device!
   137                                  	sys	_msg, noDevMsg, 255, 0Fh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000002B BB[812C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000030 B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000035 BA0F000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000003A B823000000          <1>  mov eax, %1
    97                              <1> 
    98 0000003F CD40                <1>  int 40h
   138 00000041 E9E6050000                      jmp     Exit
   139                                  
   140                                  ac97_hardware_ready:
   141 00000046 E8790A0000              	call	write_audio_dev_info
   142                                  
   143                                  ; -------------------------------------------------------------
   144                                  
   145                                  	; 21/12/2024
   146                                  	;;;
   147                                  	; Read (copy) 8x14 system fonts
   148 0000004B BE[5C430000]            	mov	esi, fontbuff1
   149                                  	sys	_video, 0C03h, 256, 0
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000050 BB030C0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000055 B900010000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000005A BA00000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000005F B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 00000064 CD40                <1>  int 40h
   150                                  
   151                                  	; convert 8x14 fonts to 8x16 fonts
   152                                  	; by inserting 2 empty rows to each characters
   153                                  	;mov	esi, fontbuff1
   154 00000066 BF[5C510000]            	mov	edi, fontbuff2
   155                                  	; 18/02/2021
   156                                  	;mov	cx, 256
   157                                  fontconvert:
   158 0000006B 51                      	push	ecx
   159 0000006C 66B90E00                	mov	cx, 14
   160 00000070 F3A4                    	rep	movsb
   161 00000072 28C0                    	sub	al, al
   162 00000074 AA                      	stosb
   163 00000075 AA                      	stosb
   164 00000076 59                      	pop	ecx
   165 00000077 E2F2                    	loop	fontconvert
   166                                  	;;;
   167                                  
   168                                  ; ------------------------------------------------------------- 
   169                                  
   170                                  	; 21/12/2024
   171                                  	; Set Video Mode to 101h ; 640x480, 256 colors
   172                                  	sys	_video, 08FFh, 101h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000079 BBFF080000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000007E B901010000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000083 B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 00000088 CD40                <1>  int 40h
   173 0000008A 09C0                    	or	eax, eax
   174 0000008C 0F8495050000            	jz	terminate    ; nothing to do				
   175                                  	;jz	trdos386_err ; write (OS) error msg and exit
   176                                  
   177                                  set_vesa_mode_101h_ok:
   178                                  	; linear frame buffer access
   179                                  	sys	_video, 06FFh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000092 BBFF060000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000097 B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 0000009C CD40                <1>  int 40h
   180 0000009E 21C0                    	and	eax, eax
   181 000000A0 0F84CC050000            	jz	error_exit ; set text mode and write err msg
   182 000000A6 A3[A4760000]            	mov	[LFB_ADDR], eax
   183                                  
   184                                  ; -------------------------------------------------------------
   185                                  
   186                                  	; 25/12/2024
   187                                  	; 28/11/2024
   188                                  Player_InitalizePSP:
   189                                  	; 30/11/2024
   190                                  	; (TRDOS 386 -Retro UNIX 386- argument transfer method)
   191                                  	; (stack: argc,argv0addr,argv1addr,argv2addr ..
   192                                  	;			.. argv0text, argv1text ..) 
   193                                  	; ---- argc, argv[] ----
   194 000000AB 89E6                    	mov	esi, esp
   195 000000AD AD                      	lodsd
   196 000000AE 83F802                  	cmp	eax, 2 ; two arguments 
   197                                  		; (program file name & mod file name)
   198 000000B1 0F827E050000            	jb	pmsg_usage ; nothing to do
   199                                  	;mov	[argc], al
   200 000000B7 C1E002                  	shl	eax, 2 ; *4
   201 000000BA 01E0                    	add	eax, esp
   202                                  	; eax = last argument's address pointer
   203 000000BC A3[04810000]            	mov	[argvl], eax ; last wav file (argument)
   204 000000C1 8935[FC800000]          	mov	[argv], esi ; current argument (PRG file name)
   205 000000C7 AD                      	lodsd	; skip program (PRG) file name
   206 000000C8 8935[00810000]          	mov	[argvf], esi ; 1st wav file (argument)
   207                                  
   208                                  	; 25/12/2024
   209                                  Player_ParseParameters:
   210                                  	; 30/11/2024
   211                                  	; 29/11/2024
   212                                  	; 18/12/2024
   213                                  	;mov	edx, wav_file_name
   214                                  	
   215                                  	; 26/12/2024
   216                                  	;cmp	byte [IsInSplash], 0
   217                                  	;jna	short check_p_command
   218                                  
   219 000000CE BA[36430000]            	mov	edx, SplashFileName
   220 000000D3 EB3E                    	jmp	short _1
   221                                  
   222                                  	; 25/12/2024
   223                                  check_p_command:
   224                                  	; 07/12/2024
   225 000000D5 8B35[FC800000]          	mov	esi, [argv]
   226                                  	;
   227 000000DB 803D[C4800000]50          	cmp	byte [command], 'P'
   228 000000E2 7410                    	je	short Player_ParsePreviousParameter
   229                                      
   230                                  	; 07/12/2024
   231                                  	; 30/11/2024
   232                                  	;mov	esi, [argv] ; current argument (wav file) ptr
   233 000000E4 83C604                  	add	esi, 4
   234 000000E7 3B35[04810000]          	cmp	esi, [argvl] ; last argument (wav file) ptr
   235 000000ED 7610                    	jna	short Player_ParseNextParameter
   236                                  jmp_Player_Quit:
   237 000000EF E97C050000              	jmp	Player_Quit
   238                                  
   239                                  Player_ParsePreviousParameter:
   240                                  	; 29/11/2024
   241                                  	;mov	byte [command], 0
   242                                  	; 30/11/2024
   243                                  	;mov	esi, [argv] ; 07/12/2024	
   244 000000F4 3B35[00810000]          	cmp	esi, [argvf] ; first argument (wav file) ptr
   245 000000FA 7603                    	jna	short Player_ParseNextParameter
   246 000000FC 83EE04                  	sub	esi, 4
   247                                  Player_ParseNextParameter:
   248                                  	; 30/11/2024
   249 000000FF 8935[FC800000]          	mov	[argv], esi  ; set as current argument
   250                                  	; 01/12/2024
   251 00000105 8B36                    	mov	esi, [esi]
   252                                  	; 07/12/2024
   253                                  	;mov	ecx, esi
   254                                  	;mov	esi, [ecx]
   255                                  
   256                                  	; 29/11/2024
   257 00000107 E84D000000              	call	GetFileName
   258                                  	;jcxz	jmp_Player_Quit
   259 0000010C E3E1                    	jecxz	jmp_Player_Quit ; 30/11/2024
   260                                  
   261                                  	; 30/11/2024
   262                                  	; 28/11/2024
   263 0000010E BA[08810000]            	mov	edx, wav_file_name
   264                                  	;;;
   265                                  _1:
   266                                  
   267                                  ; open the file
   268                                          ; open existing file
   269                                  	; 28/11/2024
   270                                  	;mov	edx, wav_file_name
   271 00000113 E856080000                      call	openFile ; no error? ok.
   272 00000118 0F8383000000                    jnc	getwavparms	; 14/11/2024
   273                                  
   274                                  	; 28/11/2024
   275 0000011E 803D[35430000]00        	cmp	byte [IsInSplash], 0
   276 00000125 0F8799000000            	ja	Player_SplashScreen
   277                                  
   278                                  	; 29/11/2024
   279 0000012B 803D[C5800000]00        	cmp	byte [filecount], 0
   280 00000132 77A1                    	ja	short check_p_command
   281                                  
   282                                  	; 25/12/2024
   283                                  	; 21/12/2024
   284 00000134 E8D6050000              	call	set_text_mode
   285                                  	; file not found!
   286                                  	; 30/11/2024
   287                                  	sys	_msg, noFileErrMsg, 255, 0Ch
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000139 BB[AC2C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000013E B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000143 BA0C000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000148 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 0000014D CD40                <1>  int 40h
   288 0000014F E9D8040000                      jmp     Exit
   289                                  
   290                                  _exit_:
   291 00000154 E9CE040000              	jmp	terminate
   292                                  
   293                                  ; -------------------------------------------------------------
   294                                  
   295                                  	; 26/12/2024
   296                                  	; 25/12/2024
   297                                  	; 30/11/2024 (32bit)
   298                                  	; 29/11/2024
   299                                  	; 30/05/2024
   300                                  GetFileName:
   301 00000159 BF[08810000]            	mov	edi, wav_file_name 
   302                                  	; 30/11/2024
   303                                  	;mov	esi, [argv]
   304 0000015E 31C9                    	xor	ecx, ecx ; 0
   305                                  ScanName:
   306 00000160 AC                      	lodsb
   307                                  	;test	al, al
   308                                  	;jz	short a_4
   309                                  	; 29/11/2024
   310 00000161 3C0D                    	cmp	al, 0Dh
   311 00000163 7638                    	jna	short a_4
   312 00000165 3C20                    	cmp	al, 20h
   313 00000167 74F7                    	je	short ScanName	; scan start of name.
   314 00000169 AA                      	stosb
   315 0000016A B4FF                    	mov	ah, 0FFh
   316                                  	;;;
   317                                  	; 14/11/2024
   318                                  	; (max. path length = 64 bytes for MSDOS ?) (*)
   319                                  	;xor	ecx, ecx ; 0
   320                                  	;;;
   321                                  a_0:	
   322 0000016C FEC4                    	inc	ah
   323                                  a_1:
   324                                  	;;;
   325                                  	; 14/11/2024
   326 0000016E 41                      	inc	ecx
   327                                  	;;;
   328 0000016F AC                      	lodsb
   329 00000170 AA                      	stosb
   330 00000171 3C2E                    	cmp	al, '.'
   331 00000173 74F7                    	je	short a_0
   332                                  	; 29/11/2024
   333 00000175 3C20                    	cmp	al, 20h
   334                                  	;and	al, al
   335                                  	;jnz	short a_1
   336                                  	;;;
   337                                  	; 14/11/2024
   338 00000177 7613                    	jna	short a_3
   339 00000179 20E4                    	and	ah, ah
   340 0000017B 7406                    	jz	short a_2
   341 0000017D 3C2F                    	cmp	al, '/'	; 14/12/2024
   342 0000017F 7502                    	jne	short a_2
   343 00000181 B400                    	mov	ah, 0
   344                                  a_2:
   345 00000183 80F94B                  	cmp	cl, 75	; 64+8+'.'+3 -> offset 75 is the last chr
   346 00000186 72E6                    	jb	short a_1
   347                                  	; 29/11/2024
   348 00000188 29C9                    	sub	ecx, ecx
   349 0000018A EB11                    	jmp	short a_4
   350                                  a_3:
   351                                  	; 29/11/2024
   352 0000018C 4F                      	dec	edi
   353                                  	;;;
   354 0000018D 08E4                    	or	ah, ah		; if period NOT found,
   355 0000018F 750C                    	jnz	short a_4 	; then add a .WAV extension.
   356                                  SetExt:
   357                                  	; 29/11/2024
   358                                  	;dec	edi
   359 00000191 C7072E574156            	mov	dword [edi], '.WAV'
   360                                  				; ! 64+12 is DOS limit
   361                                  				; but writing +4 must not
   362                                  				; destroy the following data	 
   363                                  	;mov	byte [edi+4], 0	; so, 80 bytes path + 0 is possible here
   364                                  	; 29/11/2024
   365 00000197 83C104                  	add	ecx, 4
   366 0000019A 83C704                  	add	edi, 4
   367                                  a_4:	
   368 0000019D C60700                  	mov	byte [edi], 0
   369                                  	; 30/11/2024
   370 000001A0 C3                      	retn
   371                                  
   372                                  ; -------------------------------------------------------------
   373                                  
   374                                  getwavparms:
   375                                  	; 14/11/2024
   376 000001A1 E8FA070000                     	call    getWAVParameters
   377 000001A6 72AC                    	jc	short _exit_		; nothing to do
   378                                  
   379                                  	; 17/11/2024
   380 000001A8 B304                    	mov	bl, 4
   381 000001AA 2A1D[E8800000]          	sub	bl, byte [WAVE_BlockAlign]
   382                                  			; = 0 for 16 bit stereo
   383                                  			; = 2 for 8 bit stereo or 16 bit mono
   384                                  			; = 3 for 8 bit mono	
   385                                  
   386 000001B0 D0EB                    	shr	bl, 1	;  0 -->  0,  2 -->  1,  3 -->  1
   387                                  	; 15/11/2024
   388 000001B2 80D300                  	adc	bl, 0	; 3 --> 1 --> 2
   389 000001B5 881D[5A810000]          	mov	byte [fbs_shift], bl	; = 2 mono and 8 bit
   390                                  					; = 0 stereo and 16 bit
   391                                  					; = 1 mono or 8 bit
   392                                  
   393                                  ; -------------------------------------------------------------
   394                                  
   395                                  	; 25/12/2024
   396 000001BB 803D[35430000]00        	cmp 	byte [IsInSplash], 0
   397                                  	;jna	short StartPlay
   398                                  	; 27/12/2024
   399 000001C2 7672                    	jna	short StartPlay@
   400                                  
   401                                  ; -------------------------------------------------------------
   402                                  
   403                                  	; 26/12/2024
   404                                  Player_SplashScreen:
   405                                  	; 21/12/2024
   406                                  	;mov	byte [tcolor], 15
   407                                  _0:
   408 000001C4 E8E7040000              	call	drawsplashscreen
   409                                  
   410                                  	; 21/12/2024
   411                                  	;;;
   412                                  	; set wave volume led addresses
   413 000001C9 8B1D[A4760000]          	mov	ebx, [LFB_ADDR]
   414 000001CF 81C300C70100            	add	ebx, (13*80*8*14)
   415 000001D5 BD50000000              	mov	ebp, 80
   416 000001DA BF[5C610000]            	mov	edi, wleds_addr
   417                                  wleds_sa_1:
   418 000001DF B90F000000              	mov	ecx, 15
   419                                  wleds_sa_2:
   420 000001E4 B800230000              	mov	eax, 80*8*14 ; 640*14 pixels (next row)
   421 000001E9 F7E1                    	mul	ecx
   422 000001EB 01D8                    	add	eax, ebx
   423 000001ED AB                      	stosd
   424 000001EE E2F4                    	loop	wleds_sa_2
   425 000001F0 89D8                    	mov	eax, ebx
   426 000001F2 AB                      	stosd
   427 000001F3 83C308                  	add	ebx, 8
   428 000001F6 4D                      	dec	ebp
   429 000001F7 75E6                    	jnz	short wleds_sa_1
   430                                  	;;;
   431                                  
   432                                  	; 25/12/5024
   433                                  	; 28/11/2024 
   434 000001F9 833D[F8800000]FF        	cmp	dword [filehandle], -1
   435 00000200 7540                    	jne	short StartPlay
   436                                  
   437                                  	; 24/12/2024
   438                                  	; 07/12/2024
   439                                  	;;; wait for 3 seconds
   440                                  	sys	_time, 0 ; get time in unix epoch format
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000202 BB00000000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000207 B80D000000          <1>  mov eax, %1
    97                              <1> 
    98 0000020C CD40                <1>  int 40h
   441 0000020E 89C1                    	mov	ecx, eax
   442 00000210 83C103                  	add	ecx, 3
   443                                  _wait_3s:
   444 00000213 90                      	nop
   445                                  	sys	_time, 0
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000214 BB00000000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000219 B80D000000          <1>  mov eax, %1
    97                              <1> 
    98 0000021E CD40                <1>  int 40h
   446 00000220 39C8                    	cmp	eax, ecx
   447 00000222 72EF                    	jb	short _wait_3s
   448                                  	;;;
   449                                  
   450                                  	; 25/12/2024
   451                                  	; 28/11/2024
   452 00000224 C605[35430000]00        	mov	byte [IsInSplash], 0
   453                                  	;mov	edx, wav_file_name
   454                                  	; 30/11/2024
   455 0000022B 8B35[00810000]          	mov	esi, [argvf]
   456                                  	; 29/11/2024
   457 00000231 E9C9FEFFFF              	jmp	Player_ParseNextParameter
   458                                  
   459                                  ; -------------------------------------------------------------
   460                                  
   461                                  	; 27/12/2024
   462                                  StartPlay@:
   463                                  
   464                                  	; 27/12/2024 (Detect & Enable AC97 hardware again)
   465                                  	; (this is needed after disabling audio system)
   466                                  	; Detect (BH=1) AC'97 (BL=2) Audio Device
   467                                          sys	_audio, 0102h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000236 BB02010000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000023B B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000240 CD40                <1>  int 40h
   468                                  	; ignore error at this stage
   469                                  	;jc	short ac97_not_detected
   470                                  
   471                                  ; -------------------------------------------------------------
   472                                  
   473                                  	; 25/12/2024
   474                                  StartPlay:
   475 00000242 FE05[C5800000]          	inc	byte [filecount]
   476 00000248 C605[C4800000]00        	mov	byte [command], 0
   477                                  
   478                                  ; -------------------------------------------------------------
   479                                  
   480                                  	; 07/12/2024 (playwav9.s)
   481                                  
   482                                  	; 18/11/2023 (ich_wav4.asm)
   483                                  	; 13/11/2023 (ich_wav3.asm)
   484                                  
   485 0000024F 803D[C2800000]01        	cmp	byte [VRA], 1
   486 00000256 7226                    	jb	short chk_sample_rate
   487                                  
   488                                  playwav_48_khz:
   489 00000258 C705[68810000]-         	mov	dword [loadfromwavfile], loadFromFile
   489 0000025E [F6090000]         
   490                                  	;mov	dword [loadsize], 0 ; 65536
   491                                  	;;;
   492                                  	; 17/11/2024
   493                                  	;mov	word [buffersize], 32768
   494                                  	;mov	ax, BUFFERSIZE/2 ; 32760
   495                                  	; 30/11/2024
   496                                  	;mov	eax, BUFFERSIZE/2 ; 32768
   497                                  	; 07/12/2024
   498 00000262 B800000100              	mov	eax, BUFFERSIZE ; 65536
   499 00000267 A3[70810000]            	mov	[buffersize], eax	; 16 bit samples
   500                                  	; 07/12/2024
   501                                  	;shl	eax, 1			; bytes
   502 0000026C 8A0D[5A810000]          	mov	cl, [fbs_shift]
   503 00000272 D3E8                    	shr	eax, cl 
   504                                  	;mov	[loadsize], ax ; 16380 or 32760 or 65520
   505 00000274 A3[6C810000]            	mov	[loadsize], eax ; 16384 or 32768 or 65536
   506                                  	;;;
   507                                  	;jmp	PlayNow ; 30/05/2024
   508                                  	; 07/12/2024
   509 00000279 E9AA020000              	jmp	Player_Template
   510                                  
   511                                  	; 05/02/2025
   512                                  chk_sample_rate:
   513                                  	; set conversion parameters
   514                                  	; (for 8, 11.025, 16, 22.050, 24, 32 kHZ)
   515 0000027E 66A1[E0800000]          	mov	ax, [WAVE_SampleRate]
   516 00000284 663D80BB                	cmp	ax, 48000
   517 00000288 74CE                    	je	short playwav_48_khz
   518                                  chk_22khz:
   519 0000028A 663D2256                	cmp	ax, 22050
   520 0000028E 7545                    	jne	short chk_11khz
   521 00000290 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   522 00000297 7615                    	jna	short chk_22khz_1
   523 00000299 BB[66190000]            	mov	ebx, load_22khz_stereo_16_bit
   524 0000029E 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   525 000002A5 751A                    	jne	short chk_22khz_2
   526 000002A7 BB[D9180000]            	mov	ebx, load_22khz_mono_16_bit
   527 000002AC EB13                    	jmp	short chk_22khz_2
   528                                  chk_22khz_1:
   529 000002AE BB[52180000]            	mov	ebx, load_22khz_stereo_8_bit
   530 000002B3 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   531 000002BA 7505                    	jne	short chk_22khz_2
   532 000002BC BB[C9170000]            	mov	ebx, load_22khz_mono_8_bit
   533                                  chk_22khz_2:
   534 000002C1 B85A1D0000              	mov	eax, 7514  ; (442*17)
   535 000002C6 BA25000000              	mov	edx, 37
   536 000002CB B911000000              	mov	ecx, 17
   537 000002D0 E926020000              	jmp	set_sizes
   538                                  chk_11khz:
   539 000002D5 663D112B                	cmp	ax, 11025
   540 000002D9 7545                    	jne	short chk_44khz
   541 000002DB 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   542 000002E2 7615                    	jna	short chk_11khz_1
   543 000002E4 BB[821B0000]            	mov	ebx, load_11khz_stereo_16_bit
   544 000002E9 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   545 000002F0 751A                    	jne	short chk_11khz_2
   546 000002F2 BB[091B0000]            	mov	ebx, load_11khz_mono_16_bit
   547 000002F7 EB13                    	jmp	short chk_11khz_2
   548                                  chk_11khz_1:
   549 000002F9 BB[8F1A0000]            	mov	ebx, load_11khz_stereo_8_bit
   550 000002FE 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1 
   551 00000305 7505                    	jne	short chk_11khz_2
   552 00000307 BB[171A0000]            	mov	ebx, load_11khz_mono_8_bit
   553                                  chk_11khz_2:
   554 0000030C B8AD0E0000              	mov	eax, 3757  ; (221*17)
   555 00000311 BA4A000000              	mov	edx, 74
   556 00000316 B911000000              	mov	ecx, 17
   557 0000031B E9DB010000              	jmp	set_sizes
   558                                  chk_44khz:
   559 00000320 663D44AC                	cmp	ax, 44100
   560 00000324 7545                    	jne	short chk_16khz
   561 00000326 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   562 0000032D 7615                    	jna	short chk_44khz_1
   563 0000032F BB[891D0000]            	mov	ebx, load_44khz_stereo_16_bit
   564 00000334 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   565 0000033B 751A                    	jne	short chk_44khz_2
   566 0000033D BB[101D0000]            	mov	ebx, load_44khz_mono_16_bit
   567 00000342 EB13                    	jmp	short chk_44khz_2
   568                                  chk_44khz_1:
   569 00000344 BB[931C0000]            	mov	ebx, load_44khz_stereo_8_bit
   570 00000349 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   571 00000350 7505                    	jne	short chk_44khz_2
   572 00000352 BB[171C0000]            	mov	ebx, load_44khz_mono_8_bit
   573                                  chk_44khz_2:
   574                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   575 00000357 B8D93A0000              	mov	eax, 15065 ; (655*23)
   576                                  	; 18/11/2023 ((file size + bss + stack) <= 64KB)
   577                                  	;mov	ax, 14076 ; (612*23)
   578                                  	; 17/11/2024
   579                                  	;mov	ax, 12650 ; (550*23)
   580 0000035C BA19000000              	mov	edx, 25
   581 00000361 B917000000              	mov	ecx, 23
   582 00000366 E990010000              	jmp	set_sizes
   583                                  chk_16khz:
   584 0000036B 663D803E                	cmp	ax, 16000
   585 0000036F 7545                    	jne	short chk_8khz
   586 00000371 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   587 00000378 7615                    	jna	short chk_16khz_1
   588 0000037A BB[08130000]            	mov	ebx, load_16khz_stereo_16_bit
   589 0000037F 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1 
   590 00000386 751A                    	jne	short chk_16khz_2
   591 00000388 BB[87120000]            	mov	ebx, load_16khz_mono_16_bit
   592 0000038D EB13                    	jmp	short chk_16khz_2
   593                                  chk_16khz_1:
   594 0000038F BB[CD110000]            	mov	ebx, load_16khz_stereo_8_bit
   595 00000394 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   596 0000039B 7505                    	jne	short chk_16khz_2
   597 0000039D BB[4E110000]            	mov	ebx, load_16khz_mono_8_bit
   598                                  chk_16khz_2:
   599                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   600 000003A2 B855150000              	mov	eax, 5461
   601                                  	; 17/11/2024
   602                                  	;mov	ax, 5460
   603 000003A7 BA03000000              	mov	edx, 3
   604 000003AC B901000000              	mov	ecx, 1
   605 000003B1 E945010000              	jmp	set_sizes
   606                                  chk_8khz:
   607 000003B6 663D401F                	cmp	ax, 8000
   608 000003BA 7545                    	jne	short chk_24khz
   609 000003BC 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   610 000003C3 7615                    	jna	short chk_8khz_1
   611 000003C5 BB[03100000]            	mov	ebx, load_8khz_stereo_16_bit
   612 000003CA 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   613 000003D1 751A                    	jne	short chk_8khz_2
   614 000003D3 BB[330F0000]            	mov	ebx, load_8khz_mono_16_bit
   615 000003D8 EB13                    	jmp	short chk_8khz_2
   616                                  chk_8khz_1:
   617 000003DA BB[030E0000]            	mov	ebx, load_8khz_stereo_8_bit
   618 000003DF 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1 
   619 000003E6 7505                    	jne	short chk_8khz_2
   620 000003E8 BB[1F0D0000]            	mov	ebx, load_8khz_mono_8_bit
   621                                  chk_8khz_2:
   622 000003ED B8AA0A0000              	mov	eax, 2730
   623 000003F2 BA06000000              	mov	edx, 6
   624 000003F7 B901000000              	mov	ecx, 1
   625 000003FC E9FA000000              	jmp	set_sizes
   626                                  chk_24khz:
   627 00000401 663DC05D                	cmp	ax, 24000
   628 00000405 7545                    	jne	short chk_32khz
   629 00000407 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   630 0000040E 7615                    	jna	short chk_24khz_1
   631                                  	; 18/01/2025 (BugFix)
   632                                  	; bx -> ebx
   633 00000410 BB[35150000]            	mov	ebx, load_24khz_stereo_16_bit
   634 00000415 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   635 0000041C 751A                    	jne	short chk_24khz_2
   636 0000041E BB[CF140000]            	mov	ebx, load_24khz_mono_16_bit
   637 00000423 EB13                    	jmp	short chk_24khz_2
   638                                  chk_24khz_1:
   639 00000425 BB[45140000]            	mov	ebx, load_24khz_stereo_8_bit
   640 0000042A 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1 
   641 00000431 7505                    	jne	short chk_24khz_2
   642 00000433 BB[DE130000]            	mov	ebx, load_24khz_mono_8_bit
   643                                  chk_24khz_2:
   644                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   645 00000438 B800200000              	mov	eax, 8192
   646                                  	; 17/11/2024
   647                                  	;mov	ax, 8190
   648 0000043D BA02000000              	mov	edx, 2
   649 00000442 B901000000              	mov	ecx, 1
   650 00000447 E9AF000000              	jmp	set_sizes ; 02/02/2025	
   651                                  
   652                                  chk_32khz:
   653 0000044C 663D007D                	cmp	ax, 32000
   654                                  	;jne	short vra_needed
   655                                  	; 05/02/2025
   656 00000450 7563                    	jne	short chk_12khz
   657 00000452 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   658 00000459 7615                    	jna	short chk_32khz_1
   659 0000045B BB[39170000]            	mov	ebx, load_32khz_stereo_16_bit
   660 00000460 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   661 00000467 751A                    	jne	short chk_32khz_2
   662 00000469 BB[CC160000]            	mov	ebx, load_32khz_mono_16_bit
   663 0000046E EB13                    	jmp	short chk_32khz_2
   664                                  chk_32khz_1:
   665 00000470 BB[2F160000]            	mov	ebx, load_32khz_stereo_8_bit
   666 00000475 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   667 0000047C 7505                    	jne	short chk_32khz_2
   668 0000047E BB[BC150000]            	mov	ebx, load_32khz_mono_8_bit
   669                                  chk_32khz_2:
   670                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   671 00000483 B8AA2A0000              	mov	eax, 10922
   672                                  	; 17/11/2024
   673                                  	;mov	ax, 10920
   674 00000488 BA03000000              	mov	edx, 3
   675 0000048D B902000000              	mov	ecx, 2
   676                                  	; 05/02/2025
   677 00000492 EB67                    	jmp	short set_sizes
   678                                  
   679                                  	; 07/12/2024
   680                                  vra_needed:
   681                                  	; 30/11/2024 (TRDOS 386, ax -> eax)
   682                                  	; 13/11/2023
   683 00000494 58                      	pop	eax ; discard return address to the caller
   684                                  	; 30/05/2024
   685                                  vra_err:
   686                                  	; 21/12/2024
   687 00000495 E875020000              	call	set_text_mode
   688                                  	; 30/11/2024
   689                                  	sys	_msg, msg_no_vra, 255, 0Fh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000049A BB[162D0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000049F B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000004A4 BA0F000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000004A9 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 000004AE CD40                <1>  int 40h
   690 000004B0 E977010000              	jmp	Exit
   691                                  
   692                                  	;;;;
   693                                  	; 05/02/2025
   694                                  chk_12khz:
   695 000004B5 663DE02E                	cmp	ax, 12000
   696 000004B9 75D9                    	jne	short vra_needed
   697 000004BB 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8
   698 000004C2 7615                    	jna	short chk_12khz_1
   699 000004C4 BB[F51E0000]            	mov	ebx, load_12khz_stereo_16_bit
   700 000004C9 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   701 000004D0 751A                    	jne	short chk_12khz_2
   702 000004D2 BB[A61E0000]            	mov	ebx, load_12khz_mono_16_bit
   703 000004D7 EB13                    	jmp	short chk_12khz_2
   704                                  chk_12khz_1:
   705 000004D9 BB[501E0000]            	mov	ebx, load_12khz_stereo_8_bit
   706 000004DE 803D[DE800000]01        	cmp	byte [WAVE_NumChannels], 1
   707 000004E5 7505                    	jne	short chk_12khz_2
   708 000004E7 BB[081E0000]            	mov	ebx, load_12khz_mono_8_bit
   709                                  chk_12khz_2:
   710 000004EC B800100000              	mov	eax, 4096
   711 000004F1 BA04000000              	mov	edx, 4
   712 000004F6 B901000000              	mov	ecx, 1
   713                                  	; 05/02/2025
   714                                  	;jmp	short set_sizes
   715                                  	;;;;
   716                                  
   717                                  set_sizes:
   718                                  	; 30/11/2024 (TRDOS 386, 32bit DOS)
   719                                  	;;;
   720                                  	; 17/11/2024
   721 000004FB 51                      	push	ecx
   722 000004FC B102                    	mov	cl, 2
   723 000004FE 2A0D[5A810000]          	sub	cl, [fbs_shift]
   724                                  		; = 2 for 16 bit stereo
   725                                  		; = 1 for 16 bit mono or 8 bit stereo
   726                                  		; = 0 for 8 bit mono
   727 00000504 D3E0                    	shl	eax, cl
   728 00000506 59                      	pop	ecx	
   729 00000507 A3[6C810000]            	mov	[loadsize], eax	; (one) read count in bytes
   730                                  	;;;
   731 0000050C F7E2                    	mul	edx
   732 0000050E 83F901                  	cmp	ecx, 1
   733 00000511 7402                    	je	short s_2
   734                                  s_1:
   735 00000513 F7F1                    	div	ecx
   736                                  s_2:
   737                                  	;;;
   738                                  	; eax = byte count of (to be) converted samples 
   739                                  	
   740                                  	; 17/11/2024
   741                                  	;;;
   742 00000515 8A0D[5A810000]          	mov	cl, [fbs_shift]
   743                                  
   744 0000051B D3E0                    	shl	eax, cl
   745                                  		; *1 for 16 bit stereo
   746                                  		; *2 for 16 bit mono or 8 bit stereo
   747                                  		; *4 for for 8 bit mono
   748                                  	;;;
   749                                  
   750                                  	; eax = 16 bit stereo byte count (target buffer size)
   751                                  	
   752                                  	; 07/12/2024
   753                                  	;shr	eax, 1	; buffer size is 16 bit sample count
   754 0000051D A3[70810000]            	mov	[buffersize], eax ; buffer size in bytes
   755 00000522 891D[68810000]          	mov	[loadfromwavfile], ebx
   756                                  
   757                                  ; -------------------------------------------------------------
   758                                  
   759                                  Player_Template:
   760                                  
   761                                  	; 26/12/2024
   762 00000528 803D[35430000]00        	cmp 	byte [IsInSplash], 0
   763 0000052F 7611                    	jna	short Player_Template_@
   764                                  
   765                                  	; 24/12/2024 (setting for wave lighting points)
   766 00000531 A1[A4760000]            	mov	eax, [LFB_ADDR]
   767                                  	;add	eax, 228*640 ; wave graphics start (top) line/row
   768 00000536 05009A0100              	add	eax, 164*640 ; 256 volume levels ; 24/12/2024
   769 0000053B A3[A0760000]            	mov	[graphstart], eax
   770                                  
   771                                  	; 26/12/2024
   772 00000540 EB14                    	jmp	short PlayNow
   773                                  
   774                                  Player_Template_@:
   775                                  	; 21/12/2024
   776 00000542 E859010000              	call	clearscreen
   777 00000547 E870010000              	call	drawplayingscreen
   778                                  
   779                                  	; 14/11/2024
   780 0000054C E80A220000              	call	SetTotalTime
   781 00000551 E8D7220000              	call	UpdateFileInfo
   782                                  
   783                                  ; -------------------------------------------------------------
   784                                  
   785                                  	; 21/12/2024 (VGA/LFB modifications)
   786                                  	; (Direct access/map to the LFB is already done here)
   787                                  	; ((this program is in VESA/VBE graphics mode here))
   788                                  PlayNow:
   789                                  	; 07/12/2024
   790                                  	sys	_audio, 0200h, [buffersize], audio_buffer
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000556 BB00020000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000055B 8B0D[70810000]      <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000561 BA[00900000]        <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000566 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 0000056B CD40                <1>  int 40h
   791 0000056D 0F82FF000000            	jc	error_exit ; return to text mode and print err msg
   792                                  
   793                                  	; 01/06/2024
   794                                  	; Initialize Audio Device (bh = 3)
   795                                  	sys	_audio, 0301h, 0, audio_int_handler
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000573 BB01030000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000578 B900000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000057D BA[E2090000]        <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000582 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000587 CD40                <1>  int 40h
   796                                  	;jc	short error_exit
   797 00000589 0F82C3000000            	jc	init_err ; return to text mode and print err msg
   798                                  
   799                                  	; 30/05/2024
   800                                  	; playwav4.asm
   801                                  ;_2:	; 24/12/2024
   802                                  	;call	check4keyboardstop	; flush keyboard buffer
   803                                  	;jc	short _2		; 07/11/2023
   804                                  
   805                                  	;;;
   806                                  	; 26/12/2024
   807                                  	; 14/11/2024
   808                                  	;mov	al, 3	; 0 = max, 31 = min
   809                                  	; 15/11/2024
   810 0000058F E86E030000              	call	SetMasterVolume
   811                                  
   812                                  	; 26/12/2024
   813 00000594 803D[35430000]00        	cmp 	byte [IsInSplash], 0
   814 0000059B 770A                    	ja	short _2
   815                                  
   816                                  	; 07/12/2024
   817                                  	;call	SetPCMOutVolume
   818 0000059D E80C230000              	call	UpdateVolume
   819                                  	;;;
   820                                  	; 14/11/2024
   821 000005A2 E897230000              	call	UpdateProgressBar
   822                                  	;;;
   823                                  
   824                                  	; 26/12/2024
   825                                  _2:
   826                                  
   827                                  ; play the .wav file. Most of the good stuff is in here.
   828                                  	
   829                                  	; 05/12/2024
   830 000005A7 E86A010000              	call    PlayWav
   831                                  
   832                                  ; close the .wav file and exit.
   833                                  
   834                                  	; 25/12/2024
   835 000005AC E8D8030000              	call	closeFile
   836                                  
   837                                  	; 25/12/2024
   838                                  	;;;
   839                                  	; reset file loading and EOF parameters
   840                                  	; 18/12/2024
   841 000005B1 C705[7C810000]0000-     	mov	dword [count], 0
   841 000005B9 0000               
   842 000005BB C705[80810000]0000-     	mov	dword [LoadedDataBytes], 0
   842 000005C3 0000               
   843 000005C5 C605[F6800000]00        	mov	byte [flags], 0
   844 000005CC C605[B4800000]00        	mov	byte [stopped], 0
   845                                  	; 26/12/2024
   846 000005D3 C605[C0800000]FF        	mov	byte [pbuf_s], 0FFh
   847                                  	;;;
   848                                  
   849                                  ;	cmp	byte [IsInSplash], 0
   850                                  ;	jna	short _6
   851                                  ;	mov	byte [IsInSplash], 0
   852                                  ;	mov	esi, [argvf]
   853                                  ;	jmp	Player_ParseNextParameter
   854                                  ;
   855                                  ;	; 29/11/2024
   856                                  ;_6:
   857                                  ;	cmp	byte [command], 'Q'
   858                                  ;	je	short _7	; 25/12/2024
   859                                  ;	jmp	check_p_command
   860                                  ;
   861                                  ;_7:
   862                                  	; 07/12/2024
   863                                  	;;;
   864                                  	; Stop Playing
   865                                  	;sys	_audio, 0700h
   866                                  	; Cancel callback service (for user)
   867                                  	sys	_audio, 0900h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000005DA BB00090000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000005DF B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000005E4 CD40                <1>  int 40h
   868                                  	; Deallocate Audio Buffer (for user)
   869                                  	sys	_audio, 0A00h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000005E6 BB000A0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000005EB B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000005F0 CD40                <1>  int 40h
   870                                  	; Disable Audio Device
   871                                  	sys	_audio, 0C00h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000005F2 BB000C0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000005F7 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000005FC CD40                <1>  int 40h
   872                                  	;;;
   873                                  
   874                                  	; 27/12/2024
   875                                  	; 26/12/2024
   876 000005FE 803D[35430000]00        	cmp	byte [IsInSplash], 0
   877 00000605 7612                    	jna	short _6
   878 00000607 C605[35430000]00        	mov	byte [IsInSplash], 0
   879 0000060E 8B35[00810000]          	mov	esi, [argvf]
   880 00000614 E9E6FAFFFF              	jmp	Player_ParseNextParameter
   881                                  _6:
   882 00000619 803D[C4800000]51        	cmp	byte [command], 'Q'
   883 00000620 7405                    	je	short terminate
   884 00000622 E9AEFAFFFF              	jmp	check_p_command
   885                                  
   886                                  terminate:
   887 00000627 E8E3000000              	call	set_text_mode
   888                                  Exit:
   889                                  	sys	_exit
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88                              <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000062C B801000000          <1>  mov eax, %1
    97                              <1> 
    98 00000631 CD40                <1>  int 40h
   890                                  halt:
   891 00000633 EBFE                    	jmp	short halt
   892                                  
   893                                  ; -------------------------------------------------------------
   894                                  
   895                                  	; 30/05/2024
   896                                  pmsg_usage:
   897                                  	; 21/12/2024
   898 00000635 E8D5000000              	call	set_text_mode
   899                                  	; 01/12/2024
   900                                  	sys	_msg, msg_usage, 255, 0Fh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000063A BB[522C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000063F B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000644 BA0F000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000649 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 0000064E CD40                <1>  int 40h
   901 00000650 EBDA                    	jmp	short Exit
   902                                  
   903                                  ; -------------------------------------------------------------
   904                                  
   905                                  	; 30/05/2024
   906                                  init_err:
   907                                  	; 21/12/2024
   908 00000652 E8B8000000              	call	set_text_mode
   909                                  	; 01/12/2024
   910                                  	sys	_msg, msg_init_err, 255, 0Fh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000657 BB[E52C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000065C B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000661 BA0F000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000666 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 0000066B CD40                <1>  int 40h
   911 0000066D EBBD                    	jmp	short Exit
   912                                  
   913                                  ; -------------------------------------------------------------
   914                                  
   915                                  	; 02/12/2024
   916                                  Player_Quit@:
   917 0000066F 58                      	pop	eax ; return addr (call PlayWav@)
   918                                  	
   919                                  	; 29/11/2024
   920                                  Player_Quit:
   921 00000670 EBB5                    	jmp	 short terminate
   922                                  
   923                                  
   924                                  ; -------------------------------------------------------------
   925                                  
   926                                  	; 07/12/2024
   927                                  error_exit:
   928                                  	; 21/12/2024
   929 00000672 E898000000              	call	set_text_mode
   930                                  trdos386_error:
   931                                  	sys	_msg, trdos386_err_msg, 255, 0Eh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000677 BB[C52C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000067C B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000681 BA0E000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000686 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 0000068B CD40                <1>  int 40h
   932 0000068D EB9D                    	jmp	short Exit
   933                                  
   934                                  ; -------------------------------------------------------------
   935                                  
   936                                  	; 21/12/2024
   937                                  print_msg:
   938 0000068F B40E                    	mov	ah, 0Eh
   939 00000691 BB07000000              	mov	ebx, 7
   940                                  	;mov	bl, 7 ; char attribute & color
   941                                  p_next_chr:
   942 00000696 AC                      	lodsb
   943 00000697 08C0                    	or	al, al
   944 00000699 7404                    	jz	short p_retn ; retn
   945 0000069B CD31                    	int	31h
   946 0000069D EBF7                    	jmp	short p_next_chr
   947                                  p_retn:
   948 0000069F C3                      	retn
   949                                  
   950                                  ; -------------------------------------------------------------
   951                                  
   952                                  	; 21/12/2024
   953                                  clearscreen:
   954                                  	; fast clear
   955                                  	; 640*480, 256 colors
   956 000006A0 8B3D[A4760000]          	mov	edi, [LFB_ADDR]
   957 000006A6 B9002C0100              	mov	ecx, (640*480*1)/4 ; 22/12/2024
   958 000006AB 31C0                    	xor	eax, eax
   959 000006AD F3AB                    	rep	stosd
   960 000006AF C3                      	retn
   961                                  
   962                                  ; -------------------------------------------------------------
   963                                  
   964                                  	; 26/12/2024
   965                                  	; 21/12/2024
   966                                  drawsplashscreen:
   967 000006B0 BD[442E0000]            	mov	ebp, SplashScreen
   968                                  	;;mov	dword [nextrow], 00100000h ; 8*16
   969                                  	;mov	dword [nextrow], 000E0000h ; 8*14
   970                                  	;mov	esi, 0 ; row 0, column 0
   971 000006B5 BE00000200              	mov	esi, 00020000h ; row 2, column 0 ; top margin = 2
   972 000006BA EB0A                    	jmp	short p_d_x
   973                                  drawplayingscreen:
   974 000006BC BD[E5380000]            	mov	ebp, PlayingScreen
   975                                  	;mov	dword [nextrow], 000E0000h ; 8*14
   976                                  	;mov	esi, 0 ; row 0, column 0
   977 000006C1 BE00000700              	mov	esi, 00070000h ; row 7, column 0 ; top margin = 7
   978                                  p_d_x:
   979 000006C6 C605[B0760000]50        	mov	byte [columns], 80
   980                                  p_d_x_n:
   981 000006CD 31D2                    	xor	edx, edx
   982 000006CF 8A5500                  	mov	dl, [ebp]
   983 000006D2 20D2                    	and	dl, dl
   984 000006D4 7438                    	jz	short p_d_x_ok
   985 000006D6 C1E204                  	shl	edx, 4 ; * 16 (for 8x16 font)
   986                                  
   987 000006D9 BF[5C510000]            	mov	edi, fontbuff2 ; start of user font data
   988 000006DE 01D7                    	add	edi, edx
   989                                  	
   990                                  	;; NOTE: Following system call writes fonts at
   991                                  	;; Std VGA video memory 0A0000h, BL bit 7 selects
   992                                  	;; screen width as 640 pixels (instead of 320 pixels)
   993                                  	;; so 8Fh is sub function 0Fh (write char)
   994                                  	;; with 640 pixels screen witdh. 
   995                                  	;; (Even if VESA VBE mode -LFB- is in use, QEMU and
   996                                  	;; a real computer with NVIDIA GEFORCE FX 550 uses
   997                                  	;; A0000h, so.. even if fonts are written at A0000h-B0000h
   998                                  	;; region, the text is appeared on screen
   999                                  	;; while LFB is at C0000000h or E0000000h.)
  1000                                  
  1001                                  	;sys	_video, 018Fh, [tcolor], 8001h
  1002                                  			;; use STD VGA video memory
  1003                                  			;; (0A0000h)
  1004                                  	;sys	_video, 020Fh, [tcolor], 8001h ; 8x16 user font
  1005                                  		 ; use LFB for current VBE mode
  1006                                  		 ; for writing fonts on screen
  1007                                  	; 26/12/2024
  1008                                  	sys	_video, 020Fh, 0Fh, 8001h ; 8x16 user font
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000006E0 BB0F020000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000006E5 B90F000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000006EA BA01800000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000006EF B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 000006F4 CD40                <1>  int 40h
  1009                                  
  1010 000006F6 45                      	inc	ebp
  1011 000006F7 6683C608                	add	si, 8 ; next char pos
  1012 000006FB FE0D[B0760000]          	dec	byte [columns]
  1013 00000701 75CA                    	jnz	short p_d_x_n	; next column
  1014 00000703 6631F6                  	xor	si, si
  1015                                  	;;add	esi, 00100000h	; next row ; 8*16
  1016                                  	;add	esi, [nextrow]
  1017 00000706 81C600000E00            	add	esi, 000E0000h	; next row ; 8*14
  1018 0000070C EBB8                    	jmp	short p_d_x
  1019                                  p_d_x_ok:
  1020 0000070E C3                      	retn
  1021                                  
  1022                                  ; -------------------------------------------------------------
  1023                                  
  1024                                  	; 21/12/2024
  1025                                  set_text_mode:
  1026 0000070F 30E4                    	xor    ah, ah
  1027 00000711 B003                    	mov    al, 3                        
  1028                                   	;int   10h ; al = 03h text mode, int 10 video
  1029 00000713 CD31                    	int    31h ; TRDOS 386 - Video interrupt
  1030 00000715 C3                      	retn
  1031                                  
  1032                                  ; -------------------------------------------------------------
  1033                                  
  1034                                  	; 07/12/2024 (playwav9.s)
  1035                                  	; 26/11/2023 (playwav8.s)
  1036                                  PlayWav:
  1037                                  	; 19/11/2024
  1038 00000716 C605[B7800000]01        	mov	byte [wleds], 1
  1039                                  
  1040                                  	;;;
  1041                                  	; 09/12/2024
  1042 0000071D B834290000              	mov	eax, 10548 ; (48000*10/182)*4
  1043 00000722 803D[C2800000]00        	cmp	byte [VRA], 0
  1044 00000729 7614                    	jna	short _3 ; 48kHZ (interpolation)
  1045                                  	;;;
  1046                                  	; 01/12/2024 (32bit)
  1047                                  	;movzx	eax, word [WAVE_SampleRate]
  1048                                  	; 09/12/2024
  1049 0000072B 66A1[E0800000]          	mov	ax, [WAVE_SampleRate]
  1050 00000731 B90A000000              	mov	ecx, 10
  1051 00000736 F7E1                    	mul	ecx
  1052 00000738 B1B6                    	mov	cl, 182
  1053 0000073A F7F1                    	div	ecx
  1054                                  	; ax = samples per 1/18.2 second
  1055                                  	;mov	cl, byte [WAVE_BlockAlign]
  1056                                  	; 09/12/2024 
  1057                                  	;mov	cl, 4 ; 16 bit, stereo
  1058                                  	;mul	ecx
  1059 0000073C C1E002                  	shl	eax, 2 ; * 4
  1060                                  _3:
  1061 0000073F A3[B8800000]            	mov	[wleds_dif], eax ; buffer read differential (distance)
  1062                                  				; for wave volume leds update
  1063                                  				; (byte stream per 1/18.2 second)
  1064                                  	;;;
  1065                                  	; 24/12/2024
  1066 00000744 3D000A0000              	cmp	eax, 640*4 ; 640 samples (for 640 wave light points)
  1067 00000749 7305                    	jnb	short _4
  1068 0000074B B8000A0000              	mov	eax, 640*4	
  1069                                  _4:
  1070 00000750 A3[9C760000]            	mov	[wpoints_dif], eax
  1071                                  	;;;
  1072                                  
  1073                                  RePlayWav:
  1074                                  	; 07/12/2024
  1075 00000755 BF[00900000]            	mov	edi, audio_buffer
  1076 0000075A FF15[68810000]          	call	dword [loadfromwavfile]
  1077 00000760 0F820CFFFFFF            	jc	error_exit
  1078                                  
  1079 00000766 C605[C1800000]01        	mov	byte [half_buffer], 1 ; (DMA) Buffer 1
  1080                                  
  1081 0000076D A1[7C810000]            	mov	eax, [count]
  1082 00000772 0105[80810000]          	add	[LoadedDataBytes], eax
  1083                                  
  1084 00000778 F605[F6800000]01        	test    byte [flags], ENDOFFILE  ; end of file
  1085 0000077F 752C                    	jnz	short _5 ; yes
  1086                                  			 ; bypass filling dma half buffer 2
  1087                                  
  1088                                  	; bh = 16 : update (current, first) dma half buffer
  1089                                  	; bl = 0  : then switch to the next (second) half buffer
  1090                                  	sys	_audio, 1000h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000781 BB00100000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000786 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 0000078B CD40                <1>  int 40h
  1091                                  
  1092                                  	; 18/12/2024
  1093 0000078D C705[7C810000]0000-     	mov	dword [count], 0
  1093 00000795 0000               
  1094                                  
  1095                                  	; 07/12/2024
  1096 00000797 BF[00900000]            	mov	edi, audio_buffer
  1097 0000079C FF15[68810000]          	call	dword [loadfromwavfile]
  1098                                  	;jc	error_exit
  1099                                  	
  1100 000007A2 A1[7C810000]            	mov	eax, [count]
  1101 000007A7 0105[80810000]          	add	[LoadedDataBytes], eax
  1102                                  _5:
  1103                                  	; 07/12/2024
  1104 000007AD 668B0D[E0800000]         	mov	cx, [WAVE_SampleRate]
  1105 000007B4 B303                    	mov	bl, 3	; 16 bit, stereo
  1106 000007B6 B704                    	mov	bh, 4	; start to play
  1107                                  	sys	_audio
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88                              <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000007B8 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000007BD CD40                <1>  int 40h
  1108                                  
  1109                                  	;;;
  1110                                  	; 26/12/2024
  1111                                  SplashLoop:
  1112 000007BF 803D[35430000]00        	cmp	byte [IsInSplash], 0
  1113 000007C6 7648                    	jna	short _10
  1114                                  	;; skip 1st signal without sound data loading
  1115                                  	;nop
  1116                                  	;nop
  1117                                  	;nop
  1118                                  	;cmp	byte [SRB], 0
  1119                                  	;jna	short SplashLoop
  1120                                  	;mov	byte [SRB], 0
  1121                                  _8:
  1122 000007C8 F605[F6800000]01        	test    byte [flags], ENDOFFILE  ; end of file
  1123 000007CF 0F85CC1C0000            	jnz	ac97_stop ; yes
  1124                                  
  1125                                  	; bh = 16 : update (current, first) dma half buffer
  1126                                  	; bl = 0  : then switch to the next (second) half buffer
  1127                                  	sys	_audio, 1000h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000007D5 BB00100000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000007DA B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000007DF CD40                <1>  int 40h
  1128                                  
  1129 000007E1 803D[5B810000]00        	cmp	byte [SRB], 0
  1130 000007E8 7619                    	jna	short _9
  1131 000007EA C605[5B810000]00        	mov	byte [SRB], 0
  1132 000007F1 BF[00900000]            	mov	edi, audio_buffer
  1133 000007F6 FF15[68810000]          	call	dword [loadfromwavfile]
  1134 000007FC 7305                    	jnc	short _9
  1135                                  	; end of file
  1136                                  	;call	ac97_stop
  1137                                  	;retn
  1138 000007FE E99E1C0000              	jmp	ac97_stop
  1139                                  _9:
  1140 00000803 E8D41E0000              	call	check4keyboardstop
  1141 00000808 0F82B1000000            	jc	_exitt_
  1142 0000080E EBB8                    	jmp	short _8
  1143                                  _10:
  1144                                  	; 26/12/2024
  1145 00000810 803D[C3800000]00        	cmp	byte [p_mode], 0
  1146 00000817 7705                    	ja	short tuneLoop
  1147                                  	;;;
  1148                                  
  1149                                  ; -------------------------------------------
  1150                                  
  1151                                  	; 22/12/2024
  1152                                   	; prepare all leds as turned off
  1153 00000819 E822220000              	call	reset_wave_leds
  1154                                  
  1155                                  ; -------------------------------------------
  1156                                  
  1157                                  	; 07/12/2024 (playwav9.s)
  1158                                  	; 01/12/2024 (32bit)
  1159                                  	; 29/11/2024
  1160                                  tuneLoop:
  1161                                  	; 30/05/2024
  1162                                  	; 18/11/2023 (ich_wav4.asm)
  1163                                  	; 08/11/2023
  1164                                  	; 06/11/2023
  1165                                  tLWait:
  1166                                  	; 18/11/2024
  1167 0000081E 803D[B4800000]00        	cmp	byte [stopped], 0
  1168                                  	; 24/11/2024
  1169 00000825 7641                    	jna	short tL1
  1170                                  
  1171                                  tLWait@:	; 21/11/2024
  1172                                  	;;;
  1173                                  	; 25/12/2024
  1174                                  	; 09/12/2024
  1175 00000827 803D[B4800000]03        	cmp	byte [stopped], 3
  1176 0000082E 0F838B000000            	jnb	_exitt_
  1177                                  	;;;
  1178 00000834 E8A41C0000              	call	checkUpdateEvents
  1179 00000839 0F8280000000            	jc	_exitt_
  1180                                  	;;;
  1181                                  	; 25/12/2024
  1182                                  	; 29/11/2024
  1183 0000083F 803D[C4800000]4E        	cmp	byte [command], 'N'
  1184 00000846 7477                    	je	_exitt_
  1185 00000848 803D[C4800000]50        	cmp	byte [command], 'P'
  1186 0000084F 746E                    	je	_exitt_
  1187                                  	;;;
  1188 00000851 803D[B5800000]30        	cmp	byte [tLO], '0'
  1189 00000858 74C4                    	je	short tLWait
  1190 0000085A E86A000000              	call	tLZ
  1191 0000085F C605[B5800000]30        	mov	byte [tLO], '0'
  1192 00000866 EBB6                    	jmp	short tLWait
  1193                                  tL1:
  1194                                  	; 27/11/2024
  1195                                  	; Check AC'97 interrupt status
  1196 00000868 803D[5B810000]00        	cmp	byte [SRB], 0
  1197 0000086F 7709                    	ja	short tL3
  1198                                  tL2:
  1199 00000871 E8671C0000              	call	checkUpdateEvents
  1200 00000876 7247                    	jc	_exitt_
  1201 00000878 EBA4                    	jmp	short tLWait
  1202                                  tL3:
  1203 0000087A 8035[C1800000]01        	xor	byte [half_buffer], 1
  1204                                  	; 07/12/2024
  1205 00000881 C605[5B810000]00        	mov	byte [SRB], 0
  1206                                  
  1207                                  	; 07/12/2024
  1208 00000888 BF[00900000]            	mov	edi, audio_buffer
  1209                                  	;call	loadFromFile
  1210                                  	; 18/11/2023
  1211                                  	;call	word [loadfromwavfile]
  1212                                  	; 01/12/2024
  1213 0000088D FF15[68810000]          	call	dword [loadfromwavfile]
  1214 00000893 722A                    	jc	short _exitt_	; end of file
  1215                                  
  1216                                  	; 07/12/2024
  1217                                  	;;;;
  1218                                  	; bh = 16 : update (current, first) dma half buffer
  1219                                  	; bl = 0  : then switch to the other half buffer
  1220                                  	sys	_audio, 1000h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000895 BB00100000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000089A B820000000          <1>  mov eax, %1
    97                              <1> 
    98 0000089F CD40                <1>  int 40h
  1221                                  	;;;;
  1222                                  
  1223                                  	; 26/11/2024
  1224 000008A1 A0[C1800000]            	mov	al, [half_buffer]
  1225 000008A6 0431                    	add	al, '1'
  1226                                  	; 19/11/2024
  1227 000008A8 A2[B5800000]            	mov	[tLO], al
  1228 000008AD E819000000              	call	tL0
  1229                                  
  1230                                  	; 24/11/2024
  1231                                  	; 14/11/2024
  1232                                  	;mov	ax, [count]
  1233                                  	;add	[LoadedDataBytes], ax
  1234                                  	;adc	word [LoadedDataBytes+2], 0
  1235                                  	; 01/12/2024
  1236 000008B2 A1[7C810000]            	mov	eax, [count]
  1237 000008B7 0105[80810000]          	add	[LoadedDataBytes], eax
  1238                                  
  1239                                  	; 07/12/2024 (playwav9.s)
  1240                                  	; 27/11/2024 (playwav9.asm)
  1241 000008BD EBB2                    	jmp	short tL2
  1242                                  
  1243                                  _exitt_:
  1244                                  	; 07/12/2024
  1245                                  	; Stop Playing
  1246                                  	;mov	byte [stopped], 2
  1247                                  	;sys	_audio, 0700h
  1248 000008BF E8DD1B0000              	call	ac97_stop
  1249                                  
  1250                                  	;;;
  1251                                  	; 14/11/2024
  1252 000008C4 E875200000              	call	UpdateProgressBar
  1253                                  	;;;
  1254                                  
  1255                                  	; 18/11/2024
  1256                                  tLZ:
  1257                                  	; 30/05/2024
  1258 000008C9 B030                    	mov	al, '0'
  1259                                  
  1260                                  	;add	al, '0'
  1261                                  	;call	tL0
  1262                                  	;
  1263                                  	;retn
  1264                                  	; 06/11/2023
  1265                                  	;jmp	short tL0
  1266                                  	;retn
  1267                                  
  1268                                  	; 06/11/2023
  1269                                  tL0:
  1270                                  	; 29/05/2024 (TRDOS 386)
  1271                                  	; 08/11/2023
  1272                                  	; 05/11/2023
  1273                                  	; 17/02/2017 - Buffer switch test (temporary)
  1274                                  	; 06/11/2023
  1275                                  	; al = buffer indicator ('1', '2' or '0' -stop- )
  1276                                  
  1277                                  	; 22/12/2024 (graphics mode modification)
  1278                                  	; (640*480, 256 colors)
  1279                                  	;;;
  1280                                  	;mov	ebp, 16
  1281 000008CB BD0E000000              	mov	ebp, 14
  1282 000008D0 8B3D[A4760000]          	mov	edi, [LFB_ADDR]
  1283 000008D6 0FB6F0                  	movzx	esi, al
  1284 000008D9 C1E604                  	shl	esi, 4 ; * 16
  1285 000008DC 81C6[5C510000]          	add	esi, fontbuff2
  1286                                  tL0_1:
  1287 000008E2 BA08000000              	mov	edx, 8 ; 8 pixels (8*16 pixel font)
  1288 000008E7 8A26                    	mov	ah, [esi]
  1289                                  tL0_2:
  1290 000008E9 B00C                    	mov	al, 0Ch ; red
  1291 000008EB D0E4                    	shl	ah, 1
  1292 000008ED 7302                    	jnc	short tL0_3
  1293 000008EF B00E                    	mov	al, 0Eh ; yellow
  1294                                  tL0_3:
  1295 000008F1 AA                      	stosb
  1296 000008F2 4A                      	dec	edx
  1297 000008F3 75F4                    	jnz	short tL0_2
  1298 000008F5 4D                      	dec	ebp
  1299 000008F6 7409                    	jz	short tL0_4
  1300 000008F8 81C778020000            	add	edi, 640-8 ; next line
  1301 000008FE 46                      	inc	esi
  1302 000008FF EBE1                    	jmp	short tL0_1
  1303                                  tL0_4:
  1304                                  	;;;
  1305 00000901 C3                      	retn
  1306                                  
  1307                                  ; -------------------------------------------
  1308                                  
  1309                                  	; 26/12/2024
  1310                                  	; 07/12/2024
  1311                                  SetMasterVolume:
  1312 00000902 A0[3F270000]            	mov	al, [volume]
  1313                                  	; 26/12/2024
  1314                                  	;mov	[volume], al  ; max = 0, min = 31
  1315                                  
  1316 00000907 B41F                    	mov	ah, 31
  1317 00000909 28C4                    	sub	ah, al
  1318 0000090B 88E0                    	mov	al, ah
  1319                                  
  1320                                  	; Set Master Volume Level (BL=0 or 80h)
  1321                                  	; 	for next playing (BL>=80h)
  1322                                  	;sys	_audio, 0B80h, eax
  1323                                  	sys	_audio, 0B00h, eax
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000090D BB000B0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000912 89C1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000914 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000919 CD40                <1>  int 40h
  1324                                  	
  1325                                  setvolume_ok:
  1326                                  ac97_not_detected:
  1327 0000091B C3                      	retn
  1328                                  
  1329                                  ; -------------------------------------------
  1330                                  
  1331                                  	; 07/12/2024 (playwav9.s)
  1332                                  DetectAC97:
  1333                                  DetectICH:
  1334                                  	; 25/11/2023 (playwav8.s)
  1335                                  	; Detect (BH=1) AC'97 (BL=2) Audio Device
  1336                                          sys	_audio, 0102h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000091C BB02010000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000921 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000926 CD40                <1>  int 40h
  1337                                  	;jnc	short d_ac97_@
  1338                                  	;retn
  1339 00000928 72F1                    	jc	short ac97_not_detected
  1340                                  d_ac97_@:
  1341                                  	; 07/12/2024 (playwav9.s)
  1342                                  	; 06/06/2017
  1343                                  	sys	_audio, 0E00h ; get audio controller info
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000092A BB000E0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000092F B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000934 CD40                <1>  int 40h
  1344 00000936 0F8236FDFFFF            	jc	error_exit ; 25/11/2023
  1345                                  
  1346                                  	;cmp	ah, 2 ; ICH ? (Intel AC'97 Audio Controller)
  1347                                  	;jne	_dev_not_ready	
  1348                                  
  1349                                  	; EAX = IRQ Number in AL
  1350                                  	;	Audio Device Number in AH 
  1351                                  	; EBX = DEV/VENDOR ID
  1352                                  	;       (DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV)
  1353                                  	; ECX = BUS/DEV/FN 
  1354                                  	;       (00000000BBBBBBBBDDDDDFFF00000000)
  1355                                  	; EDX = NABMBAR/NAMBAR (for AC97)
  1356                                  	;      (Low word, DX = NAMBAR address)
  1357                                  	; EDX = Base IO Addr (DX) for SB16 & VT8233
  1358                                  
  1359 0000093C 891D[60810000]          	mov	[dev_vendor], ebx
  1360 00000942 890D[5C810000]          	mov	[bus_dev_fn], ecx
  1361                                  
  1362 00000948 668915[64810000]                mov     [NAMBAR], dx			; save audio mixer base addr
  1363                                  	;shr	edx, 16
  1364                                          ;mov    [NABMBAR], dx			; save bus master base addr
  1365 0000094F 8915[64810000]          	mov	[NAMBAR], edx
  1366                                  
  1367 00000955 A2[F7800000]            	mov	[ac97_int_ln_reg], al
  1368                                  
  1369                                  	; 07/12/2024
  1370                                  	; 01/06/2024
  1371                                  	; 25/11/2023
  1372                                  	; Get AC'97 Codec info
  1373                                  	; (Function 14, sub function 1)
  1374                                  	sys	_audio, 0E01h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000095A BB010E0000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000095F B820000000          <1>  mov eax, %1
    97                              <1> 
    98 00000964 CD40                <1>  int 40h
  1375                                  	; Save Variable Rate Audio support bit
  1376 00000966 2401                    	and	al, 1
  1377 00000968 A2[C2800000]            	mov	[VRA], al
  1378                                  
  1379                                  	;clc
  1380                                  
  1381 0000096D C3                      	retn
  1382                                  
  1383                                  ; ----------------------------------
  1384                                  	
  1385                                  	; 26/12/2024
  1386                                  	; 07/12/2024
  1387                                  	; 01/12/2024
  1388                                  	; 14/11/2024
  1389                                  	; INPUT: ds:dx = file name address
  1390                                  	; OUTPUT: [filehandle] = ; -1 = not open
  1391                                  openFile:
  1392                                  	; 26/12/2024
  1393                                  	; 01/12/2024
  1394                                  	sys	_open, edx, 0
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000096E 89D3                <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000970 B900000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000975 B805000000          <1>  mov eax, %1
    97                              <1> 
    98 0000097A CD40                <1>  int 40h
  1395                                  	; 07/12/2024
  1396                                  	;sys	_open, wav_file_name, 0
  1397 0000097C 7305                    	jnc	short _of1
  1398                                  
  1399 0000097E B8FFFFFFFF              	mov	eax, -1
  1400                                  	; cf = 1 -> not found or access error
  1401                                  _of1:
  1402 00000983 A3[F8800000]            	mov	[filehandle], eax
  1403 00000988 C3                      	retn
  1404                                  
  1405                                  ; ----------------------------------
  1406                                  
  1407                                  ; close the currently open file
  1408                                  
  1409                                  	; 01/12/2024
  1410                                  	; 14/11/2024
  1411                                  	; INPUT: [filehandle] ; -1 = not open
  1412                                  	; OUTPUT: none
  1413                                  closeFile:
  1414 00000989 833D[F8800000]FF        	cmp	dword [filehandle], -1
  1415 00000990 740D                    	jz	short _cf1
  1416                                  	; 01/12/2024
  1417                                  	sys	_close, [filehandle]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000992 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000998 B806000000          <1>  mov eax, %1
    97                              <1> 
    98 0000099D CD40                <1>  int 40h
  1418                                  	;mov 	dword [filehandle], -1
  1419                                  _cf1:
  1420 0000099F C3                      	retn
  1421                                  
  1422                                  ; ----------------------------------
  1423                                  
  1424                                  	; 05/02/2025
  1425                                  	; 01/12/2024
  1426                                  	; 14/11/2024 - Erdogan Tan
  1427                                  getWAVParameters:
  1428                                  ; reads WAV file header(s) (44 bytes) from the .wav file.
  1429                                  ; entry: none - assumes file is already open
  1430                                  ; exit: ax = sample rate (11025, 22050, 44100, 48000)
  1431                                  ;	cx = number of channels (mono=1, stereo=2)
  1432                                  ;	dx = bits per sample (8, 16)
  1433                                  ;	bx = number of bytes per sample (1 to 4)
  1434                                  
  1435                                          ;mov	dx, WAVFILEHEADERbuff
  1436                                  	;mov	bx, [filehandle]
  1437                                          ;mov	cx, 44			; 44 bytes
  1438                                  	;mov	ah, 3Fh
  1439                                          ;int	21h
  1440                                  	;jc	short gwavp_retn
  1441                                  	; 01/12/2024 (TRDOS 386)
  1442                                  	sys	_read, [filehandle], WAVFILEHEADERbuff, 44
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000009A0 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000009A6 B9[C8800000]        <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000009AB BA2C000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000009B0 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000009B5 CD40                <1>  int 40h
  1443 000009B7 7228                    	jc	short gwavp_retn
  1444                                  
  1445 000009B9 83F82C                  	cmp	eax, 44
  1446 000009BC 7223                    	jb	short gwavp_retn
  1447                                  
  1448 000009BE 813D[D0800000]5741-     	cmp	dword [RIFF_Format], 'WAVE'
  1448 000009C6 5645               
  1449 000009C8 7516                    	jne	short gwavp_stc_retn
  1450                                  
  1451 000009CA 66833D[DC800000]01      	cmp	word [WAVE_AudioFormat], 1 ; Offset 20, must be 1 (= PCM)
  1452                                  	; 05/02/2025
  1453 000009D2 750C                    	jne	short gwavp_stc_retn
  1454                                  	;je	short gwavp_retn ; 15/11/2024
  1455                                  
  1456                                  	; 05/02/2025
  1457                                  	; (Open MPT creates wav files with a new type header,
  1458                                  	;  this program can not use the new type
  1459                                  	;  because of 'data' offset is not at DATA_SubchunkID.)
  1460                                  	; ((GoldWave creates common type wav file.))
  1461 000009D4 813D[EC800000]6461-     	cmp	dword [DATA_SubchunkID], 'data'
  1461 000009DC 7461               
  1462 000009DE 7401                    	je	short gwavp_retn
  1463                                  
  1464                                  	; 15/11/2024
  1465                                  	;mov	cx, [WAVE_NumChannels]	; return num of channels in CX
  1466                                          ;mov    ax, [WAVE_SampleRate]	; return sample rate in AX
  1467                                  	;mov	dx, [WAVE_BitsPerSample] 
  1468                                  					; return bits per sample value in DX
  1469                                  	;mov	bx, [WAVE_BlockAlign]	; return bytes per sample in BX
  1470                                  ;gwavp_retn:
  1471                                          ;retn
  1472                                  
  1473                                  gwavp_stc_retn:
  1474 000009E0 F9                      	stc
  1475                                  gwavp_retn:
  1476 000009E1 C3                      	retn
  1477                                  
  1478                                  ; --------------------------------------------------------
  1479                                  ; 07/12/2024
  1480                                  ; --------------------------------------------------------
  1481                                  ; ref: playwav8.s (04/06/2024)
  1482                                  
  1483                                  audio_int_handler:
  1484                                  	; 18/08/2020 (14/10/2020, 'wavplay2.s')
  1485                                  
  1486                                  	; 07/12/2024
  1487                                  	;mov	al, [stopped]
  1488                                  	;cmp	al, 2
  1489                                  	;je	short _callback_retn
  1490                                  
  1491                                  	; 18/08/2020
  1492                                  	;mov	byte [SRB], 1
  1493                                  	; 07/12/2024
  1494 000009E2 FE05[5B810000]          	inc	byte [SRB]
  1495                                  
  1496                                  ;_callback_retn:
  1497                                  	sys	_rele ; return from callback service 
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88                              <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000009E8 B827000000          <1>  mov eax, %1
    97                              <1> 
    98 000009ED CD40                <1>  int 40h
  1498                                  	; we must not come here !
  1499                                  	sys	_exit
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88                              <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000009EF B801000000          <1>  mov eax, %1
    97                              <1> 
    98 000009F4 CD40                <1>  int 40h
  1500                                  
  1501                                  ; --------------------------------------------------------
  1502                                  ; 07/12/2024
  1503                                  ; --------------------------------------------------------
  1504                                  
  1505                                  ; /////
  1506                                  	; 14/12/2024
  1507                                  	; 07/12/2024
  1508                                  	; 01/12/2024
  1509                                  	; 30/05/2024 (ich_wav4.asm, 19/05/2024)
  1510                                  loadFromFile:
  1511                                  	; 07/11/2023
  1512                                  
  1513 000009F6 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  1514                                  					; last of the file?
  1515 000009FD 7402                    	jz	short lff_0		; no
  1516 000009FF F9                      	stc
  1517 00000A00 C3                      	retn
  1518                                  
  1519                                  lff_0:
  1520                                  	; 07/12/2024
  1521                                  	; 26/11/2023 (playwav8.s)
  1522                                  	;mov	edi, audio_buffer
  1523                                  
  1524                                  	; 01/12/2024 (TRDOS 386)
  1525                                  	; edi = audio buffer address
  1526                                  
  1527                                  	; 14/12/2024
  1528                                  	; 01/12/2024
  1529                                  	; 17/11/2024
  1530                                  	;mov	ebx, [filehandle]
  1531                                  	; 02/12/2024
  1532                                  	;mov	edx, [loadsize] 
  1533                                  
  1534                                  	; 17/11/2024
  1535 00000A01 803D[5A810000]00        	cmp	byte [fbs_shift], 0
  1536 00000A08 7677                    	jna	short lff_1 ; stereo, 16 bit
  1537                                  
  1538                                  lff_2:
  1539                                  	; 01/12/2024
  1540 00000A0A BE[00900100]            	mov	esi, temp_buffer 
  1541                                  	; 14/12/2024
  1542                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000A0F 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000A15 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000A17 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000A1D B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00000A22 CD40                <1>  int 40h
  1543 00000A24 0F8289000000            	jc	lff_4 ; error !
  1544                                  
  1545                                  	; 01/12/2024
  1546                                  	; 14/11/2024
  1547 00000A2A A3[7C810000]            	mov	[count], eax
  1548                                  
  1549                                  	; 01/12/2024
  1550 00000A2F 21C0                    	and	eax, eax
  1551                                  	;jz	short lff_3
  1552                                  	; 14/12/2024
  1553 00000A31 0F8485000000            	jz	lff_10
  1554                                  
  1555 00000A37 8A1D[5A810000]          	mov	bl, [fbs_shift]
  1556                                  
  1557                                  	; 14/12/2024
  1558 00000A3D 89FA                    	mov	edx, edi ; audio buffer start address
  1559                                  
  1560                                  	; 01/12/2024
  1561 00000A3F 89C1                    	mov	ecx, eax
  1562 00000A41 803D[EA800000]08        	cmp	byte [WAVE_BitsPerSample], 8 ; bits per sample (8 or 16)
  1563 00000A48 751E                    	jne	short lff_7 ; 16 bit samples
  1564                                  	; 8 bit samples
  1565 00000A4A FECB                    	dec	bl  ; shift count, 1 = stereo, 2 = mono
  1566 00000A4C 740E                    	jz	short lff_6 ; 8 bit, stereo
  1567                                  	; 01/12/2024 (32bit registers)
  1568                                  lff_5:
  1569                                  	; mono & 8 bit
  1570 00000A4E AC                      	lodsb
  1571 00000A4F 2C80                    	sub	al, 80h ; 08/11/2023
  1572 00000A51 C1E008                  	shl	eax, 8 ; convert 8 bit sample to 16 bit sample
  1573 00000A54 66AB                    	stosw	; left channel
  1574 00000A56 66AB                    	stosw	; right channel
  1575 00000A58 E2F4                    	loop	lff_5
  1576 00000A5A EB16                    	jmp	short lff_9
  1577                                  lff_6:
  1578                                  	; stereo & 8 bit
  1579 00000A5C AC                      	lodsb
  1580 00000A5D 2C80                    	sub	al, 80h ; 08/11/2023
  1581 00000A5F C1E008                  	shl	eax, 8 ; convert 8 bit sample to 16 bit sample
  1582 00000A62 66AB                    	stosw
  1583 00000A64 E2F6                    	loop	lff_6
  1584 00000A66 EB0A                    	jmp	short lff_9
  1585                                  lff_7:
  1586 00000A68 D1E9                    	shr	ecx, 1 ; word count
  1587                                  lff_8:
  1588 00000A6A 66AD                    	lodsw
  1589 00000A6C 66AB                    	stosw	; left channel
  1590 00000A6E 66AB                    	stosw	; right channel
  1591 00000A70 E2F8                    	loop	lff_8
  1592                                  lff_9:
  1593                                  	; 14/12/2024
  1594 00000A72 89F8                    	mov	eax, edi
  1595 00000A74 8B0D[70810000]          	mov	ecx, [buffersize] 
  1596 00000A7A 01D1                    	add	ecx, edx ; + buffer start address
  1597 00000A7C 39C8                    	cmp	eax, ecx	
  1598 00000A7E 7225                    	jb	short lff_3
  1599 00000A80 C3                      	retn
  1600                                  	
  1601                                  lff_1:  
  1602                                  	; 07/12/2024
  1603                                  	; 01/12/2024
  1604                                  	;sys 	_read, [filehandle], esi, [loadsize] ; edx
  1605                                  	; 14/12/2024
  1606                                  	sys 	_read, [filehandle], edi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000A81 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000A87 89F9                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000A89 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000A8F B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00000A94 CD40                <1>  int 40h
  1607                                  	; 07/11/2023
  1608 00000A96 721B                    	jc	short lff_4 ; error !
  1609                                  
  1610                                  	; 01/12/2024
  1611                                  	; 14/11/2024
  1612 00000A98 A3[7C810000]            	mov	[count], eax
  1613                                  
  1614                                  	; 02/12/2024
  1615 00000A9D 39D0                    	cmp	eax, edx ; cmp eax, [loadsize]	
  1616 00000A9F 7411                    	je	short endLFF
  1617                                  	; edi = buffer (start) address
  1618 00000AA1 01C7                    	add	edi, eax
  1619 00000AA3 89D1                    	mov	ecx, edx
  1620                                  lff_3:
  1621                                  	;call	padfill			; blank pad the remainder
  1622                                  	; 21/12/2024
  1623                                  padfill:
  1624                                  	; 14/12/2024
  1625                                  	; 01/12/2024 (TRDOS 386, 32bit registers)
  1626                                  	; 17/11/2024
  1627                                  	;   di = offset (to be filled with ZEROs)
  1628                                  	;   bp = buffer segment
  1629                                  	;   ax = di = number of bytes loaded
  1630                                  	;   cx = buffer size (> loaded bytes)	
  1631                                  	; 07/11/2023
  1632                                  	; 06/11/2023
  1633                                  	; 17/02/2017
  1634                                  	; 01/12/2024
  1635 00000AA5 29C1                    	sub	ecx, eax
  1636                                  	; 01/12/2024
  1637                                  	; 25/11/2024
  1638 00000AA7 31C0                    	xor	eax, eax
  1639                                  	; 14/12/2024
  1640 00000AA9 F3AA                    	rep	stosb
  1641                                  	; 21/12/2024
  1642                                  	;retn
  1643                                  	; ----------
  1644                                          ;clc				; don't exit with CY yet.
  1645 00000AAB 800D[F6800000]01                or	byte [flags], ENDOFFILE	; end of file flag
  1646                                  endLFF:
  1647 00000AB2 C3                              retn
  1648                                  lff_4:
  1649                                  	; 08/11/2023
  1650 00000AB3 B021                    	mov	al, '!'  ; error
  1651 00000AB5 E811FEFFFF              	call	tL0
  1652                                  
  1653                                  	; 01/12/2024
  1654 00000ABA 31C0                    	xor	eax, eax
  1655                                  lff_10:
  1656                                  	; 14/12/2024
  1657 00000ABC 8B0D[70810000]          	mov	ecx, [buffersize]
  1658 00000AC2 EBE1                    	jmp	short lff_3
  1659                                  
  1660                                  ; /////
  1661                                  
  1662                                  ; --------------------------------------------------------
  1663                                  ; --------------------------------------------------------
  1664                                  	
  1665                                  write_audio_dev_info:
  1666                                  	; 30/05/2024
  1667                                       	;sys_msg msgAudioCardInfo, 0Fh
  1668                                  	; 01/12/2024
  1669                                  	sys 	_msg, msgAudioCardInfo, 255, 0Fh
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000AC4 BB[292C0000]        <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000AC9 B9FF000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000ACE BA0F000000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000AD3 B823000000          <1>  mov eax, %1
    97                              <1> 
    98 00000AD8 CD40                <1>  int 40h
  1670 00000ADA C3                      	retn
  1671                                  
  1672                                  ; --------------------------------------------------------
  1673                                  
  1674                                  write_ac97_pci_dev_info:
  1675                                  	; 19/11/2024
  1676                                  	; 30/05/2024
  1677                                  	; 06/06/2017
  1678                                  	; 03/06/2017
  1679                                  	; BUS/DEV/FN
  1680                                  	;	00000000BBBBBBBBDDDDDFFF00000000
  1681                                  	; DEV/VENDOR
  1682                                  	;	DDDDDDDDDDDDDDDDVVVVVVVVVVVVVVVV
  1683                                  
  1684 00000ADB A1[60810000]            	mov	eax, [dev_vendor]
  1685 00000AE0 31DB                    	xor	ebx, ebx
  1686 00000AE2 88C3                    	mov	bl, al
  1687 00000AE4 88DA                    	mov	dl, bl
  1688 00000AE6 80E30F                  	and	bl, 0Fh
  1689 00000AE9 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1690 00000AEF A2[962D0000]            	mov	[msgVendorId+3], al
  1691 00000AF4 88D3                    	mov	bl, dl
  1692 00000AF6 C0EB04                  	shr	bl, 4
  1693 00000AF9 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1694 00000AFF A2[952D0000]            	mov	[msgVendorId+2], al
  1695 00000B04 88E3                    	mov	bl, ah
  1696 00000B06 88DA                    	mov	dl, bl
  1697 00000B08 80E30F                  	and	bl, 0Fh
  1698 00000B0B 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1699 00000B11 A2[942D0000]            	mov	[msgVendorId+1], al
  1700 00000B16 88D3                    	mov	bl, dl
  1701 00000B18 C0EB04                  	shr	bl, 4
  1702 00000B1B 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1703 00000B21 A2[932D0000]            	mov	[msgVendorId], al
  1704 00000B26 C1E810                  	shr	eax, 16
  1705 00000B29 88C3                    	mov	bl, al
  1706 00000B2B 88DA                    	mov	dl, bl
  1707 00000B2D 80E30F                  	and	bl, 0Fh
  1708 00000B30 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1709 00000B36 A2[A72D0000]            	mov	[msgDevId+3], al
  1710 00000B3B 88D3                    	mov	bl, dl
  1711 00000B3D C0EB04                  	shr	bl, 4
  1712 00000B40 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1713 00000B46 A2[A62D0000]            	mov	[msgDevId+2], al
  1714 00000B4B 88E3                    	mov	bl, ah
  1715 00000B4D 88DA                    	mov	dl, bl
  1716 00000B4F 80E30F                  	and	bl, 0Fh
  1717 00000B52 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1718 00000B58 A2[A52D0000]            	mov	[msgDevId+1], al
  1719 00000B5D 88D3                    	mov	bl, dl
  1720 00000B5F C0EB04                  	shr	bl, 4
  1721 00000B62 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1722 00000B68 A2[A42D0000]            	mov	[msgDevId], al
  1723                                  
  1724 00000B6D A1[5C810000]            	mov	eax, [bus_dev_fn]
  1725 00000B72 C1E808                  	shr	eax, 8
  1726 00000B75 88C3                    	mov	bl, al
  1727 00000B77 88DA                    	mov	dl, bl
  1728 00000B79 80E307                  	and	bl, 7 ; bit 0,1,2
  1729 00000B7C 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1730 00000B82 A2[CC2D0000]            	mov	[msgFncNo+1], al
  1731 00000B87 88D3                    	mov	bl, dl
  1732 00000B89 C0EB03                  	shr	bl, 3
  1733 00000B8C 88DA                    	mov	dl, bl
  1734 00000B8E 80E30F                  	and	bl, 0Fh
  1735 00000B91 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1736 00000B97 A2[BE2D0000]            	mov	[msgDevNo+1], al
  1737 00000B9C 88D3                    	mov	bl, dl
  1738 00000B9E C0EB04                  	shr	bl, 4
  1739 00000BA1 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1740 00000BA7 A2[BD2D0000]            	mov	[msgDevNo], al
  1741 00000BAC 88E3                    	mov	bl, ah
  1742 00000BAE 88DA                    	mov	dl, bl
  1743 00000BB0 80E30F                  	and	bl, 0Fh
  1744 00000BB3 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1745 00000BB9 A2[B22D0000]            	mov	[msgBusNo+1], al
  1746 00000BBE 88D3                    	mov	bl, dl
  1747 00000BC0 C0EB04                  	shr	bl, 4
  1748 00000BC3 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1749 00000BC9 A2[B12D0000]            	mov	[msgBusNo], al
  1750                                  
  1751                                  	;mov	ax, [ac97_NamBar]
  1752 00000BCE 66A1[64810000]          	mov	ax, [NAMBAR]
  1753 00000BD4 88C3                    	mov	bl, al
  1754 00000BD6 88DA                    	mov	dl, bl
  1755 00000BD8 80E30F                  	and	bl, 0Fh
  1756 00000BDB 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1757 00000BE1 A2[DC2D0000]            	mov	[msgNamBar+3], al
  1758 00000BE6 88D3                    	mov	bl, dl
  1759 00000BE8 C0EB04                  	shr	bl, 4
  1760 00000BEB 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1761 00000BF1 A2[DB2D0000]            	mov	[msgNamBar+2], al
  1762 00000BF6 88E3                    	mov	bl, ah
  1763 00000BF8 88DA                    	mov	dl, bl
  1764 00000BFA 80E30F                  	and	bl, 0Fh
  1765 00000BFD 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1766 00000C03 A2[DA2D0000]            	mov	[msgNamBar+1], al
  1767 00000C08 88D3                    	mov	bl, dl
  1768 00000C0A C0EB04                  	shr	bl, 4
  1769 00000C0D 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1770 00000C13 A2[D92D0000]            	mov	[msgNamBar], al
  1771                                  
  1772                                  	;mov	ax, [ac97_NabmBar]
  1773 00000C18 66A1[66810000]          	mov	ax, [NABMBAR]
  1774 00000C1E 88C3                    	mov	bl, al
  1775 00000C20 88DA                    	mov	dl, bl
  1776 00000C22 80E30F                  	and	bl, 0Fh
  1777 00000C25 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1778 00000C2B A2[EC2D0000]            	mov	[msgNabmBar+3], al
  1779 00000C30 88D3                    	mov	bl, dl
  1780 00000C32 C0EB04                  	shr	bl, 4
  1781 00000C35 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1782 00000C3B A2[EB2D0000]            	mov	[msgNabmBar+2], al
  1783 00000C40 88E3                    	mov	bl, ah
  1784 00000C42 88DA                    	mov	dl, bl
  1785 00000C44 80E30F                  	and	bl, 0Fh
  1786 00000C47 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1787 00000C4D A2[EA2D0000]            	mov	[msgNabmBar+1], al
  1788 00000C52 88D3                    	mov	bl, dl
  1789 00000C54 C0EB04                  	shr	bl, 4
  1790 00000C57 8A83[4F2D0000]          	mov	al, [hex_chars+ebx]
  1791 00000C5D A2[E92D0000]            	mov	[msgNabmBar], al
  1792                                  
  1793 00000C62 31C0                    	xor	eax, eax
  1794 00000C64 A0[F7800000]            	mov	al, [ac97_int_ln_reg]
  1795 00000C69 B10A                    	mov	cl, 10
  1796 00000C6B F6F1                    	div	cl
  1797                                  	; 23/11/2024
  1798                                  	;add	[msgIRQ], ax
  1799 00000C6D 66053030                	add	ax, 3030h
  1800 00000C71 66A3[F52D0000]          	mov	[msgIRQ], ax
  1801                                  	;and	al, al
  1802 00000C77 3C30                    	cmp	al, 30h
  1803 00000C79 750D                    	jnz	short _w_ac97imsg_
  1804 00000C7B A0[F62D0000]            	mov	al, byte [msgIRQ+1]
  1805 00000C80 B420                    	mov	ah, ' '
  1806 00000C82 66A3[F52D0000]          	mov	[msgIRQ], ax
  1807                                  _w_ac97imsg_:
  1808                                  	; 19/11/2024
  1809 00000C88 E8981D0000              	call 	clear_window
  1810 00000C8D B60D                    	mov	dh, 13
  1811 00000C8F B200                    	mov	dl, 0
  1812 00000C91 E8AA1A0000              	call	setCursorPosition
  1813                                  	;;;
  1814                                  	; 21/12/2024
  1815 00000C96 BD[602D0000]            	mov	ebp, msgAC97Info ; message
  1816                                  	; 22/12/2024
  1817                                  	;mov	cl, 07h ; color 
  1818 00000C9B E81F000000              	call	sys_gmsg
  1819                                  	;
  1820                                  	; 30/05/2024
  1821                                  write_VRA_info:
  1822                                  	; 21/12/2024
  1823 00000CA0 BD[FA2D0000]            	mov	ebp, msgVRAheader ; message
  1824                                  	;mov	cl, 07h ; color 
  1825 00000CA5 E815000000              	call	sys_gmsg
  1826                                  	;
  1827 00000CAA 803D[C2800000]00        	cmp	byte [VRA], 0
  1828 00000CB1 7607                    	jna	short _w_VRAi_no
  1829                                  _w_VRAi_yes:
  1830 00000CB3 BD[092E0000]            	mov	ebp, msgVRAyes
  1831 00000CB8 EB05                    	jmp	short _w_VRAi_yn_msg
  1832                                  _w_VRAi_no:
  1833 00000CBA BD[0F2E0000]            	mov	ebp, msgVRAno
  1834                                  _w_VRAi_yn_msg:
  1835                                  	;mov	cl, 07h ; color 
  1836                                  	;call	sys_msg
  1837                                  	;retn
  1838                                  	;jmp	short sys_gmsg
  1839                                  	;;;
  1840                                  ; --------------------------------------------------------
  1841                                  
  1842                                  	; 22/12/2024
  1843                                  	;;;
  1844                                  	; 21/12/2024
  1845                                  	; (write message in VGA/VESA-VBE mode)
  1846                                  sys_gmsg:
  1847 00000CBF 8A4500                  	mov	al, [ebp]
  1848 00000CC2 20C0                    	and	al, al
  1849 00000CC4 7458                    	jz	short sys_gmsg_ok
  1850 00000CC6 3C20                    	cmp	al, 20h
  1851 00000CC8 731E                    	jnb	short sys_gmsg_3
  1852 00000CCA 3C0D                    	cmp	al, CR ; 13
  1853 00000CCC 750C                    	jne	short sys_gmsg_2
  1854                                  	; carriege return, move cursor to column 0
  1855 00000CCE 66C705[A8760000]00-     	mov	word [screenpos], 0
  1855 00000CD6 00                 
  1856                                  sys_gmsg_1:
  1857 00000CD7 45                      	inc	ebp
  1858 00000CD8 EBE5                    	jmp	short sys_gmsg
  1859                                  sys_gmsg_2:
  1860 00000CDA 3C0A                    	cmp	al, LF ; 10
  1861 00000CDC 7540                    	jne	short sys_gmsg_ok ; 22/12/2024
  1862                                  	; line feed, move cursor to next row
  1863 00000CDE 668305[AA760000]10      	add	word [screenpos+2], 16
  1864 00000CE6 EBEF                    	jmp	short sys_gmsg_1
  1865                                  sys_gmsg_3:
  1866 00000CE8 8B35[A8760000]          	mov	esi, [screenpos]
  1867                                  		; hw = (cursor) row
  1868                                  		; si = (cursor) column
  1869 00000CEE B907000000              	mov	ecx, 07h ; gray (light)
  1870 00000CF3 E8011C0000              	call	write_character
  1871 00000CF8 83C608                  	add	esi, 8
  1872                                  	;;;
  1873 00000CFB 6681FE8002              	cmp	si, 640
  1874 00000D00 7213                    	jb	short sys_gmsg_5
  1875 00000D02 C1EE10                  	shr	esi, 16
  1876 00000D05 6683C610                	add	si, 16
  1877 00000D09 6681FEE001              	cmp	si, 480
  1878 00000D0E 7202                    	jb	short sys_gmsg_4
  1879 00000D10 31F6                    	xor	esi, esi
  1880                                  sys_gmsg_4:
  1881 00000D12 C1E610                  	shl	esi, 16
  1882                                  	;;;
  1883                                  sys_gmsg_5:
  1884 00000D15 8935[A8760000]          	mov	[screenpos], esi
  1885 00000D1B 45                      	inc	ebp
  1886 00000D1C EBA1                    	jmp	short sys_gmsg
  1887                                  sys_gmsg_ok:
  1888 00000D1E C3                      	retn
  1889                                  	;;;
  1890                                  
  1891                                  ; --------------------------------------------------------
  1892                                  
  1893                                  ; 05/02/2025 - vgaplay.s - cgaplay.s - cgaplay1.s
  1894                                  ; 02/02/2025 - playwav9.s - ac97play.s - dplaywav.s - dplayw2.s
  1895                                  ; 29/12/2024 - vgaplay3.s
  1896                                  ; 18/12/2024
  1897                                  ; 07/12/2024 - playwav9.s
  1898                                  ; 01/12/2024 - ac97play.s
  1899                                  ; 29/05/2024
  1900                                  ; 26/11/2023
  1901                                  ; 25/11/2023 - playwav6.s (32 bit registers, TRDOS 386 adaption)
  1902                                  ; 15/11/2023 - PLAYWAV5.COM, ich_wav5.asm
  1903                                  ; 14/11/2023
  1904                                  ; 13/11/2023 - Erdogan Tan - (VRA, sample rate conversion)
  1905                                  ; --------------------------------------------------------
  1906                                  
  1907                                  ;;Note:	At the end of every buffer load,
  1908                                  ;;	during buffer switch/swap, there will be discontinuity
  1909                                  ;;	between the last converted sample and the 1st sample
  1910                                  ;;	of the next buffer.
  1911                                  ;;	(like as a dot noises vaguely between normal sound samples)
  1912                                  ;;	-To avoid this defect, the 1st sample of
  1913                                  ;;	the next buffer may be read from the wav file but
  1914                                  ;;	the file pointer would need to be set to 1 sample back
  1915                                  ;;	again via seek system call. Time comsumption problem! -
  1916                                  ;;
  1917                                  ;;	Erdogan Tan - 15/11/2023
  1918                                  ;;
  1919                                  ;;	((If entire wav data would be loaded at once.. conversion
  1920                                  ;;	defect/noise would disappear.. but for DOS, to keep
  1921                                  ;;	64KB buffer limit is important also it is important
  1922                                  ;;	for running under 1MB barrier without HIMEM.SYS or DPMI.
  1923                                  ;;	I have tested this program by using 2-30MB wav files.))
  1924                                  ;;
  1925                                  ;;	Test Computer:	ASUS desktop/mainboard, M2N4-SLI, 2010.
  1926                                  ;;			AMD Athlon 64 X2 2200 MHZ CPU.
  1927                                  ;;		       	NFORCE4 (CK804) AC97 audio hardware.
  1928                                  ;;			Realtek ALC850 codec.
  1929                                  ;;		       	Retro DOS v4.2 (MSDOS 6.22) operating system.
  1930                                  
  1931                                  load_8khz_mono_8_bit:
  1932                                  	; 02/02/2025
  1933                                  	; 15/11/2023
  1934                                  	; 14/11/2023
  1935                                  	; 13/11/2023
  1936 00000D1F F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  1937                                  					; last of the file?
  1938 00000D26 7402                    	jz	short lff8m_0		; no
  1939 00000D28 F9                      	stc
  1940 00000D29 C3                      	retn
  1941                                  
  1942                                  lff8m_0:
  1943                                  	; 01/12/2024
  1944                                  	; edi = audio buffer address
  1945 00000D2A BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  1946                                          ;mov	edx, [loadsize]
  1947                                  
  1948                                  	; esi = buffer address
  1949                                  	;; edx = buffer size
  1950                                  
  1951                                  	; load file into memory
  1952                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000D2F 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000D35 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000D37 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000D3D B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00000D42 CD40                <1>  int 40h
  1953 00000D44 7305                    	jnc	short lff8m_6
  1954 00000D46 E9AF000000              	jmp	lff8m_5  ; error !
  1955                                  
  1956                                  lff8m_6:
  1957                                  	; 01/12/2024
  1958 00000D4B A3[7C810000]            	mov	[count], eax
  1959                                  	;;;
  1960                                  	; 07/12/2024
  1961                                  	;mov	edi, audio_buffer
  1962                                  	;;;
  1963 00000D50 21C0                    	and	eax, eax
  1964 00000D52 0F8499000000            	jz	lff8_eof
  1965                                  
  1966 00000D58 89C1                    	mov	ecx, eax		; byte count
  1967                                  lff8m_1:
  1968 00000D5A AC                      	lodsb
  1969 00000D5B A2[98240000]            	mov	[previous_val], al
  1970 00000D60 2C80                    	sub	al, 80h
  1971 00000D62 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  1972 00000D66 66AB                    	stosw		; original sample (left channel)
  1973 00000D68 66AB                    	stosw		; original sample (right channel)
  1974                                  	; 02/02/2025
  1975                                  	;xor	eax, eax
  1976 00000D6A 8A06                    	mov	al, [esi]
  1977 00000D6C 49                      	dec	ecx
  1978 00000D6D 7502                    	jnz	short lff8m_2
  1979 00000D6F B080                    	mov	al, 80h
  1980                                  lff8m_2:
  1981                                  	;mov	[next_val], ax
  1982 00000D71 88C7                    	mov	bh, al	; [next_val]
  1983 00000D73 8A25[98240000]          	mov	ah, [previous_val]
  1984 00000D79 00E0                    	add	al, ah	; [previous_val]
  1985 00000D7B D0D8                    	rcr	al, 1
  1986 00000D7D 88C2                    	mov	dl, al	; this is interpolated middle (3th) sample
  1987 00000D7F 00E0                    	add	al, ah	; [previous_val]
  1988 00000D81 D0D8                    	rcr	al, 1	
  1989 00000D83 88C3                    	mov	bl, al 	; this is temporary interpolation value
  1990 00000D85 00E0                    	add	al, ah	; [previous_val]
  1991 00000D87 D0D8                    	rcr	al, 1
  1992 00000D89 2C80                    	sub	al, 80h
  1993 00000D8B 66C1E008                	shl	ax, 8
  1994 00000D8F 66AB                    	stosw		; this is 1st interpolated sample (L)
  1995 00000D91 66AB                    	stosw		; this is 1st interpolated sample (R)
  1996 00000D93 88D8                    	mov	al, bl
  1997 00000D95 00D0                    	add	al, dl
  1998 00000D97 D0D8                    	rcr	al, 1
  1999 00000D99 2C80                    	sub	al, 80h
  2000 00000D9B 66C1E008                	shl	ax, 8
  2001 00000D9F 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2002 00000DA1 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2003 00000DA3 88D0                    	mov	al, dl
  2004 00000DA5 2C80                    	sub	al, 80h
  2005 00000DA7 66C1E008                	shl	ax, 8
  2006 00000DAB 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2007 00000DAD 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2008                                  	;mov	al, [next_val]
  2009 00000DAF 88F8                    	mov	al, bh
  2010 00000DB1 00D0                    	add	al, dl
  2011 00000DB3 D0D8                    	rcr	al, 1
  2012 00000DB5 88C3                    	mov	bl, al	; this is temporary interpolation value
  2013 00000DB7 00D0                    	add	al, dl
  2014 00000DB9 D0D8                    	rcr	al, 1
  2015 00000DBB 2C80                    	sub	al, 80h
  2016 00000DBD 66C1E008                	shl	ax, 8
  2017 00000DC1 66AB                    	stosw		; this is 4th interpolated sample (L)
  2018 00000DC3 66AB                    	stosw		; this is 4th interpolated sample (R)
  2019                                  	;mov	al, [next_val]
  2020 00000DC5 88F8                    	mov	al, bh
  2021 00000DC7 00D8                    	add	al, bl
  2022 00000DC9 D0D8                    	rcr	al, 1
  2023 00000DCB 2C80                    	sub	al, 80h
  2024 00000DCD 66C1E008                	shl	ax, 8
  2025 00000DD1 66AB                    	stosw		; this is 5th interpolated sample (L)
  2026 00000DD3 66AB                    	stosw		; this is 5th interpolated sample (R)
  2027                                  	; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2028 00000DD5 09C9                    	or	ecx, ecx
  2029 00000DD7 7581                    	jnz	short lff8m_1
  2030                                  
  2031                                  	; --------------
  2032                                  
  2033                                  lff8s_3:
  2034                                  lff8m_3:
  2035                                  lff8s2_3:
  2036                                  lff8m2_3:
  2037                                  lff16s_3:
  2038                                  lff16m_3:
  2039                                  lff16s2_3:
  2040                                  lff16m2_3:
  2041                                  lff24_3:
  2042                                  lff32_3:
  2043                                  lff44_3:
  2044                                  lff22_3:
  2045                                  lff11_3:
  2046                                  lff12_3: 	; 02/02/2025
  2047                                  	; 08/12/2024 (BugFix)
  2048                                  	; 31/05/2024 (BugFix)
  2049 00000DD9 8B0D[70810000]          	mov	ecx, [buffersize] ; 16 bit (48 kHZ, stereo) sample size
  2050                                  	;shl	ecx, 1	; byte count ; Bug !
  2051                                  	; 08/12/2024
  2052 00000DDF 81C1[00900000]          	add	ecx, audio_buffer
  2053 00000DE5 29F9                    	sub	ecx, edi
  2054 00000DE7 7607                    	jna	short lff8m_4
  2055                                  	;inc	ecx
  2056 00000DE9 C1E902                  	shr	ecx, 2
  2057 00000DEC 31C0                    	xor	eax, eax ; fill (remain part of) buffer with zeros
  2058 00000DEE F3AB                    	rep	stosd
  2059                                  lff8m_4:
  2060                                  	; 31/05/2024 (BugFix)
  2061                                  	; cf=1 ; Bug !
  2062                                  	; 08/12/2024
  2063                                  	;clc
  2064 00000DF0 C3                      	retn
  2065                                  
  2066                                  lff8_eof:
  2067                                  lff16_eof:
  2068                                  lff24_eof:
  2069                                  lff32_eof:
  2070                                  lff44_eof:
  2071                                  lff22_eof:
  2072                                  lff11_eof:
  2073                                  lff12_eof:	; 02/02/2025
  2074                                  	; 15/11/2023
  2075 00000DF1 C605[F6800000]01        	mov	byte [flags], ENDOFFILE
  2076 00000DF8 EBDF                    	jmp	short lff8m_3
  2077                                  
  2078                                  lff8s_5:
  2079                                  lff8m_5:
  2080                                  lff8s2_5:
  2081                                  lff8m2_5:
  2082                                  lff16s_5:
  2083                                  lff16m_5:
  2084                                  lff16s2_5:
  2085                                  lff16m2_5:
  2086                                  lff24_5:
  2087                                  lff32_5:
  2088                                  lff44_5:
  2089                                  lff22_5:
  2090                                  lff11_5:
  2091                                  lff12_5:	; 02/02/2025
  2092 00000DFA B021                    	mov	al, '!'  ; error
  2093 00000DFC E8CAFAFFFF              	call	tL0
  2094                                  	
  2095                                  	;jmp	short lff8m_3
  2096                                  	; 15/11/2023
  2097 00000E01 EBEE                    	jmp	lff8_eof
  2098                                  
  2099                                  	; --------------
  2100                                  
  2101                                  load_8khz_stereo_8_bit:
  2102                                  	; 02/02/2025
  2103                                  	; 15/11/2023
  2104                                  	; 14/11/2023
  2105                                  	; 13/11/2023
  2106 00000E03 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2107                                  					; last of the file?
  2108 00000E0A 7402                    	jz	short lff8s_0		; no
  2109 00000E0C F9                      	stc
  2110 00000E0D C3                      	retn
  2111                                  
  2112                                  lff8s_0:
  2113                                  	; 01/12/2024
  2114                                  	; edi = audio buffer address
  2115 00000E0E BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2116                                          ;mov	edx, [loadsize]
  2117                                  
  2118                                  	; esi = buffer address
  2119                                  	;; edx = buffer size
  2120                                  
  2121                                  	; load file into memory
  2122                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000E13 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000E19 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000E1B 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000E21 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00000E26 CD40                <1>  int 40h
  2123 00000E28 72D0                    	jc	short lff8s_5 ; error !
  2124                                  
  2125                                  	; 01/12/2024
  2126 00000E2A A3[7C810000]            	mov	[count], eax
  2127                                  	;;;
  2128                                  	; 07/12/2024
  2129                                  	;mov	edi, audio_buffer
  2130                                  	;;;
  2131 00000E2F D1E8                    	shr	eax, 1
  2132 00000E31 74BE                    	jz	short lff8_eof
  2133                                  
  2134 00000E33 89C1                    	mov	ecx, eax	; word count
  2135                                  lff8s_1:
  2136 00000E35 AC                      	lodsb
  2137 00000E36 A2[98240000]            	mov	[previous_val_l], al
  2138 00000E3B 2C80                    	sub	al, 80h
  2139 00000E3D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2140 00000E41 66AB                    	stosw		; original sample (L)
  2141 00000E43 AC                      	lodsb
  2142 00000E44 A2[9A240000]            	mov	[previous_val_r], al
  2143 00000E49 2C80                    	sub	al, 80h
  2144 00000E4B 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2145 00000E4F 66AB                    	stosw		; original sample (R)
  2146                                  
  2147                                  	;xor	eax, eax
  2148                                  	; 02/02/2025
  2149 00000E51 668B06                  	mov	ax, [esi]
  2150 00000E54 49                      	dec	ecx
  2151 00000E55 7504                    	jnz	short lff8s_2
  2152                                  		; convert 8 bit sample to 16 bit sample
  2153 00000E57 66B88080                	mov	ax, 8080h
  2154                                  lff8s_2:
  2155 00000E5B A2[9C240000]            	mov	[next_val_l], al
  2156 00000E60 8825[9E240000]          	mov	[next_val_r], ah
  2157 00000E66 8A25[98240000]          	mov	ah, [previous_val_l]
  2158 00000E6C 00E0                    	add	al, ah
  2159 00000E6E D0D8                    	rcr	al, 1
  2160 00000E70 88C2                    	mov	dl, al	; this is interpolated middle (3th) sample (L)
  2161 00000E72 00E0                    	add	al, ah
  2162 00000E74 D0D8                    	rcr	al, 1
  2163 00000E76 88C3                    	mov	bl, al	; this is temporary interpolation value (L)
  2164 00000E78 00E0                    	add	al, ah
  2165 00000E7A D0D8                    	rcr	al, 1
  2166 00000E7C 2C80                    	sub	al, 80h
  2167 00000E7E 66C1E008                	shl	ax, 8
  2168 00000E82 66AB                    	stosw		; this is 1st interpolated sample (L)
  2169 00000E84 A0[9E240000]            	mov	al, [next_val_r]
  2170 00000E89 8A25[9A240000]          	mov	ah, [previous_val_r]
  2171 00000E8F 00E0                    	add	al, ah
  2172 00000E91 D0D8                    	rcr	al, 1
  2173 00000E93 88C6                    	mov	dh, al	; this is interpolated middle (3th) sample (R)
  2174 00000E95 00E0                    	add	al, ah
  2175 00000E97 D0D8                    	rcr	al, 1
  2176 00000E99 88C7                    	mov	bh, al	; this is temporary interpolation value (R)
  2177 00000E9B 00E0                    	add	al, ah
  2178 00000E9D D0D8                    	rcr	al, 1
  2179 00000E9F 2C80                    	sub	al, 80h
  2180 00000EA1 66C1E008                	shl	ax, 8
  2181 00000EA5 66AB                    	stosw		; this is 1st interpolated sample (R)
  2182 00000EA7 88D8                    	mov	al, bl
  2183 00000EA9 00D0                    	add	al, dl
  2184 00000EAB D0D8                    	rcr	al, 1
  2185 00000EAD 2C80                    	sub	al, 80h
  2186 00000EAF 66C1E008                	shl	ax, 8
  2187 00000EB3 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2188 00000EB5 88F8                    	mov	al, bh
  2189 00000EB7 00F0                    	add	al, dh
  2190 00000EB9 D0D8                    	rcr	al, 1
  2191 00000EBB 2C80                    	sub	al, 80h
  2192 00000EBD 66C1E008                	shl	ax, 8
  2193 00000EC1 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2194 00000EC3 88D0                    	mov	al, dl
  2195 00000EC5 2C80                    	sub	al, 80h
  2196 00000EC7 66C1E008                	shl	ax, 8
  2197 00000ECB 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2198 00000ECD 88F0                    	mov	al, dh
  2199 00000ECF 2C80                    	sub	al, 80h
  2200 00000ED1 66C1E008                	shl	ax, 8
  2201 00000ED5 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2202 00000ED7 A0[9C240000]            	mov	al, [next_val_l]
  2203 00000EDC 00D0                    	add	al, dl
  2204 00000EDE D0D8                    	rcr	al, 1
  2205 00000EE0 88C3                    	mov	bl, al	; this is temporary interpolation value (L)
  2206 00000EE2 00D0                    	add	al, dl
  2207 00000EE4 D0D8                    	rcr	al, 1
  2208 00000EE6 2C80                    	sub	al, 80h
  2209 00000EE8 66C1E008                	shl	ax, 8
  2210 00000EEC 66AB                    	stosw		; this is 4th interpolated sample (L)
  2211 00000EEE A0[9E240000]            	mov	al, [next_val_r]
  2212 00000EF3 00F0                    	add	al, dh
  2213 00000EF5 D0D8                    	rcr	al, 1
  2214 00000EF7 88C7                    	mov	bh, al	; this is temporary interpolation value (R)
  2215 00000EF9 00F0                    	add	al, dh
  2216 00000EFB D0D8                    	rcr	al, 1
  2217 00000EFD 2C80                    	sub	al, 80h
  2218 00000EFF 66C1E008                	shl	ax, 8
  2219 00000F03 66AB                    	stosw		; this is 4th interpolated sample (R)
  2220 00000F05 A0[9C240000]            	mov	al, [next_val_l]
  2221 00000F0A 00D8                    	add	al, bl
  2222 00000F0C D0D8                    	rcr	al, 1
  2223 00000F0E 2C80                    	sub	al, 80h
  2224 00000F10 66C1E008                	shl	ax, 8
  2225 00000F14 66AB                    	stosw		; this is 5th interpolated sample (L)
  2226 00000F16 A0[9E240000]            	mov	al, [next_val_r]
  2227 00000F1B 00F8                    	add	al, bh
  2228 00000F1D D0D8                    	rcr	al, 1
  2229 00000F1F 2C80                    	sub	al, 80h
  2230 00000F21 66C1E008                	shl	ax, 8
  2231 00000F25 66AB                    	stosw		; this is 5th interpolated sample (R)
  2232                                  	; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2233 00000F27 E305                    	jecxz	lff8s_6
  2234 00000F29 E907FFFFFF              	jmp	lff8s_1
  2235                                  lff8s_6:
  2236 00000F2E E9A6FEFFFF              	jmp	lff8s_3
  2237                                  
  2238                                  load_8khz_mono_16_bit:
  2239                                  	; 02/02/2025
  2240                                  	; 13/11/2023
  2241 00000F33 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2242                                  					; last of the file?
  2243 00000F3A 7402                    	jz	short lff8m2_0		; no
  2244 00000F3C F9                      	stc
  2245 00000F3D C3                      	retn
  2246                                  
  2247                                  lff8m2_0:
  2248                                  	; 01/12/2024
  2249                                  	; edi = audio buffer address
  2250 00000F3E BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2251                                          ;mov	edx, [loadsize]
  2252                                  
  2253                                  	; esi = buffer address
  2254                                  	;; edx = buffer size
  2255                                  
  2256                                  	; load file into memory
  2257                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00000F43 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00000F49 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00000F4B 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00000F51 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00000F56 CD40                <1>  int 40h
  2258 00000F58 0F82A0000000            	jc	lff8m2_7 ; error !
  2259                                  
  2260                                  	; 01/12/2024
  2261 00000F5E A3[7C810000]            	mov	[count], eax
  2262                                  	;;;
  2263                                  	; 07/12/2024
  2264                                  	;mov	edi, audio_buffer
  2265                                  	;;;
  2266 00000F63 D1E8                    	shr	eax, 1
  2267 00000F65 7505                    	jnz	short lff8m2_8
  2268 00000F67 E985FEFFFF              	jmp	lff8_eof
  2269                                  
  2270                                  lff8m2_8:
  2271 00000F6C 89C1                    	mov	ecx, eax	; word count
  2272                                  lff8m2_1:
  2273 00000F6E 66AD                    	lodsw
  2274 00000F70 66AB                    	stosw		; original sample (left channel)
  2275 00000F72 66AB                    	stosw		; original sample (right channel)
  2276 00000F74 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2277 00000F77 66A3[98240000]          	mov	[previous_val], ax
  2278                                  	; 02/02/2025
  2279 00000F7D 668B06                  	mov	ax, [esi]
  2280 00000F80 49                      	dec	ecx
  2281 00000F81 7502                    	jnz	short lff8m2_2
  2282 00000F83 31C0                    	xor	eax, eax
  2283                                  lff8m2_2:
  2284 00000F85 80C480                  	add	ah, 80h ; convert sound level to 0-65535 format
  2285 00000F88 89C5                    	mov	ebp, eax	; [next_val]
  2286 00000F8A 660305[98240000]        	add	ax, [previous_val]
  2287 00000F91 66D1D8                  	rcr	ax, 1
  2288 00000F94 89C2                    	mov	edx, eax ; this is interpolated middle (3th) sample
  2289 00000F96 660305[98240000]        	add	ax, [previous_val]
  2290 00000F9D 66D1D8                  	rcr	ax, 1	; this is temporary interpolation value
  2291 00000FA0 89C3                    	mov	ebx, eax 		
  2292 00000FA2 660305[98240000]        	add	ax, [previous_val]
  2293 00000FA9 66D1D8                  	rcr	ax, 1
  2294 00000FAC 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2295 00000FAF 66AB                    	stosw		; this is 1st interpolated sample (L)
  2296 00000FB1 66AB                    	stosw		; this is 1st interpolated sample (R)
  2297 00000FB3 89D8                    	mov	eax, ebx
  2298 00000FB5 6601D0                  	add	ax, dx
  2299 00000FB8 66D1D8                  	rcr	ax, 1
  2300 00000FBB 80EC80                  	sub	ah, 80h
  2301 00000FBE 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2302 00000FC0 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2303 00000FC2 89D0                    	mov	eax, edx
  2304 00000FC4 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2305 00000FC7 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2306 00000FC9 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2307 00000FCB 89E8                    	mov	eax, ebp
  2308 00000FCD 6601D0                  	add	ax, dx
  2309 00000FD0 66D1D8                  	rcr	ax, 1
  2310 00000FD3 89C3                    	mov	ebx, eax ; this is temporary interpolation value
  2311 00000FD5 6601D0                  	add	ax, dx
  2312 00000FD8 66D1D8                  	rcr	ax, 1
  2313 00000FDB 80EC80                  	sub	ah, 80h
  2314 00000FDE 66AB                    	stosw		; this is 4th interpolated sample (L)
  2315 00000FE0 66AB                    	stosw		; this is 4th interpolated sample (R)
  2316 00000FE2 89E8                    	mov	eax, ebp
  2317 00000FE4 6601D8                  	add	ax, bx
  2318 00000FE7 66D1D8                  	rcr	ax, 1
  2319 00000FEA 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2320 00000FED 66AB                    	stosw		; this is 5th interpolated sample (L)
  2321 00000FEF 66AB                    	stosw		; this is 5th interpolated sample (R)
  2322                                  	; 8 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2323 00000FF1 09C9                    	or	ecx, ecx
  2324 00000FF3 0F8575FFFFFF            	jnz	lff8m2_1
  2325 00000FF9 E9DBFDFFFF              	jmp	lff8m2_3
  2326                                  
  2327                                  lff8m2_7:
  2328                                  lff8s2_7:
  2329 00000FFE E9F7FDFFFF              	jmp	lff8m2_5  ; error
  2330                                  
  2331                                  load_8khz_stereo_16_bit:
  2332                                  	; 02/02/2025
  2333                                  	; 16/11/2023
  2334                                  	; 15/11/2023
  2335                                  	; 13/11/2023
  2336 00001003 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2337                                  					; last of the file?
  2338 0000100A 7402                    	jz	short lff8s2_0		; no
  2339 0000100C F9                      	stc
  2340 0000100D C3                      	retn
  2341                                  
  2342                                  lff8s2_0:
  2343                                  	; 01/12/2024
  2344                                  	; edi = audio buffer address
  2345 0000100E BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2346                                          ;mov	edx, [loadsize]
  2347                                  
  2348                                  	; esi = buffer address
  2349                                  	;; edx = buffer size
  2350                                  
  2351                                  	; load file into memory
  2352                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001013 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001019 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000101B 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001021 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001026 CD40                <1>  int 40h
  2353 00001028 72D4                    	jc	short lff8s2_7 ; error !
  2354                                  
  2355                                  	; 01/12/2024
  2356 0000102A A3[7C810000]            	mov	[count], eax
  2357                                  	;;;
  2358                                  	; 07/12/2024
  2359                                  	;mov	edi, audio_buffer
  2360                                  	;;;
  2361 0000102F C1E802                  	shr	eax, 2
  2362 00001032 7505                    	jnz	short lff8s2_8
  2363 00001034 E9B8FDFFFF              	jmp	lff8_eof
  2364                                  
  2365                                  lff8s2_8:
  2366 00001039 89C1                    	mov	ecx, eax ; dword count
  2367                                  lff8s2_1:
  2368 0000103B 66AD                    	lodsw
  2369 0000103D 66AB                    	stosw		; original sample (L)
  2370                                  	; 15/11/2023
  2371 0000103F 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2372 00001042 66A3[98240000]          	mov	[previous_val_l], ax
  2373 00001048 66AD                    	lodsw
  2374 0000104A 66AB                    	stosw		; original sample (R)
  2375 0000104C 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2376 0000104F 66A3[9A240000]          	mov	[previous_val_r], ax
  2377                                  	; 02/02/2025
  2378 00001055 668B06                  	mov	ax, [esi]
  2379 00001058 668B5602                	mov	dx, [esi+2]
  2380                                  	; 16/11/2023
  2381 0000105C 49                      	dec	ecx
  2382 0000105D 7504                    	jnz	short lff8s2_2
  2383 0000105F 31D2                    	xor	edx, edx
  2384 00001061 31C0                    	xor	eax, eax
  2385                                  lff8s2_2:
  2386 00001063 80C480                  	add	ah, 80h	; convert sound level to 0-65535 format
  2387 00001066 66A3[9C240000]          	mov	[next_val_l], ax
  2388 0000106C 80C680                  	add	dh, 80h	; convert sound level to 0-65535 format
  2389 0000106F 668915[9E240000]        	mov	[next_val_r], dx
  2390 00001076 660305[98240000]        	add	ax, [previous_val_l]
  2391 0000107D 66D1D8                  	rcr	ax, 1
  2392 00001080 89C2                    	mov	edx, eax ; this is interpolated middle (3th) sample (L)
  2393 00001082 660305[98240000]        	add	ax, [previous_val_l]
  2394 00001089 66D1D8                  	rcr	ax, 1	
  2395 0000108C 89C3                    	mov	ebx, eax ; this is temporary interpolation value (L)
  2396 0000108E 660305[98240000]        	add	ax, [previous_val_l]
  2397 00001095 66D1D8                  	rcr	ax, 1
  2398 00001098 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2399 0000109B 66AB                    	stosw		; this is 1st interpolated sample (L)
  2400 0000109D 66A1[9E240000]          	mov	ax, [next_val_r]
  2401 000010A3 660305[9A240000]        	add	ax, [previous_val_r]
  2402 000010AA 66D1D8                  	rcr	ax, 1
  2403 000010AD 89C5                    	mov	ebp, eax ; this is interpolated middle (3th) sample (R)
  2404 000010AF 660305[9A240000]        	add	ax, [previous_val_r]
  2405 000010B6 66D1D8                  	rcr	ax, 1
  2406 000010B9 50                      	push	eax ; *	; this is temporary interpolation value (R)
  2407 000010BA 660305[9A240000]        	add	ax, [previous_val_r]
  2408 000010C1 66D1D8                  	rcr	ax, 1
  2409 000010C4 80EC80                  	sub	ah, 80h
  2410 000010C7 66AB                    	stosw		; this is 1st interpolated sample (R)
  2411 000010C9 89D8                    	mov	eax, ebx
  2412 000010CB 6601D0                  	add	ax, dx
  2413 000010CE 66D1D8                  	rcr	ax, 1
  2414 000010D1 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2415 000010D4 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2416 000010D6 58                      	pop	eax ; *
  2417 000010D7 6601E8                  	add	ax, bp
  2418 000010DA 66D1D8                  	rcr	ax, 1
  2419 000010DD 80EC80                  	sub	ah, 80h
  2420 000010E0 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2421 000010E2 89D0                    	mov	eax, edx
  2422 000010E4 80EC80                  	sub	ah, 80h
  2423 000010E7 66AB                    	stosw		; this is middle (3th) interpolated sample (L)
  2424 000010E9 89E8                    	mov	eax, ebp
  2425 000010EB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2426 000010EE 66AB                    	stosw		; this is middle (3th) interpolated sample (R)
  2427 000010F0 66A1[9C240000]          	mov	ax, [next_val_l]
  2428 000010F6 6601D0                  	add	ax, dx
  2429 000010F9 66D1D8                  	rcr	ax, 1
  2430 000010FC 89C3                    	mov	ebx, eax ; this is temporary interpolation value (L)
  2431 000010FE 6601D0                  	add	ax, dx
  2432 00001101 66D1D8                  	rcr	ax, 1
  2433 00001104 80EC80                  	sub	ah, 80h
  2434 00001107 66AB                    	stosw		; this is 4th interpolated sample (L)
  2435 00001109 66A1[9E240000]          	mov	ax, [next_val_r]
  2436 0000110F 6601E8                  	add	ax, bp
  2437 00001112 66D1D8                  	rcr	ax, 1
  2438 00001115 50                      	push	eax ; ** ; this is temporary interpolation value (R)
  2439 00001116 6601E8                  	add	ax, bp
  2440 00001119 66D1D8                  	rcr	ax, 1
  2441 0000111C 80EC80                  	sub	ah, 80h
  2442 0000111F 66AB                    	stosw		; this is 4th interpolated sample (R)
  2443 00001121 66A1[9C240000]          	mov	ax, [next_val_l]
  2444 00001127 6601D8                  	add	ax, bx
  2445 0000112A 66D1D8                  	rcr	ax, 1
  2446 0000112D 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2447 00001130 66AB                    	stosw		; this is 5th interpolated sample (L)
  2448 00001132 58                      	pop	eax ; **
  2449 00001133 660305[9E240000]        	add	ax, [next_val_r]
  2450 0000113A 66D1D8                  	rcr	ax, 1
  2451 0000113D 80EC80                  	sub	ah, 80h
  2452 00001140 66AB                    	stosw		; this is 5th interpolated sample (R)
  2453                                  	; 8 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2454 00001142 E305                    	jecxz	lff8_s2_9
  2455 00001144 E9F2FEFFFF              	jmp	lff8s2_1
  2456                                  lff8_s2_9:
  2457 00001149 E98BFCFFFF              	jmp	lff8s2_3
  2458                                  
  2459                                  ; .....................
  2460                                  
  2461                                  load_16khz_mono_8_bit:
  2462                                  	; 02/02/2025
  2463                                  	; 14/11/2023
  2464                                  	; 13/11/2023
  2465 0000114E F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2466                                  					; last of the file?
  2467 00001155 7402                    	jz	short lff16m_0		; no
  2468 00001157 F9                      	stc
  2469 00001158 C3                      	retn
  2470                                  
  2471                                  lff16m_0:
  2472                                  	; 01/12/2024
  2473                                  	; edi = audio buffer address
  2474 00001159 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2475                                          ;mov	edx, [loadsize]
  2476                                  
  2477                                  	; esi = buffer address
  2478                                  	;; edx = buffer size
  2479                                  
  2480                                  	; load file into memory
  2481                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000115E 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001164 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001166 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000116C B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001171 CD40                <1>  int 40h
  2482 00001173 7253                    	jc	short lff16m_7 ; error !
  2483                                  
  2484                                  	; 01/12/2024
  2485 00001175 A3[7C810000]            	mov	[count], eax
  2486                                  	;;;
  2487                                  	; 07/12/2024
  2488                                  	;mov	edi, audio_buffer
  2489                                  	;;;
  2490 0000117A 21C0                    	and	eax, eax
  2491 0000117C 7505                    	jnz	short lff16m_8
  2492 0000117E E96EFCFFFF              	jmp	lff16_eof
  2493                                  
  2494                                  lff16m_8:
  2495 00001183 89C1                    	mov	ecx, eax		; byte count
  2496                                  lff16m_1:
  2497 00001185 AC                      	lodsb
  2498                                  	;mov	[previous_val], al
  2499 00001186 88C3                    	mov	bl, al
  2500 00001188 2C80                    	sub	al, 80h
  2501 0000118A 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2502 0000118E 66AB                    	stosw		; original sample (left channel)
  2503 00001190 66AB                    	stosw		; original sample (right channel)
  2504                                  	;xor	eax, eax
  2505                                  	; 02/02/2025
  2506 00001192 8A06                    	mov	al, [esi]
  2507 00001194 49                      	dec	ecx
  2508 00001195 7502                    	jnz	short lff16m_2
  2509                                  	; 14/11/2023
  2510 00001197 B080                    	mov	al, 80h
  2511                                  lff16m_2:
  2512                                  	;mov	[next_val], al
  2513 00001199 88C7                    	mov	bh, al
  2514                                  	;add	al, [previous_val]
  2515 0000119B 00D8                    	add	al, bl
  2516 0000119D D0D8                    	rcr	al, 1
  2517 0000119F 88C2                    	mov	dl, al	; this is interpolated middle (temp) sample
  2518                                  	;add	al, [previous_val]
  2519 000011A1 00D8                    	add	al, bl
  2520 000011A3 D0D8                    	rcr	al, 1
  2521 000011A5 2C80                    	sub	al, 80h
  2522 000011A7 66C1E008                	shl	ax, 8
  2523 000011AB 66AB                    	stosw		; this is 1st interpolated sample (L)
  2524 000011AD 66AB                    	stosw		; this is 1st interpolated sample (R)
  2525                                  	;mov	al, [next_val]
  2526 000011AF 88F8                    	mov	al, bh
  2527 000011B1 00D0                    	add	al, dl
  2528 000011B3 D0D8                    	rcr	al, 1
  2529 000011B5 2C80                    	sub	al, 80h
  2530 000011B7 66C1E008                	shl	ax, 8
  2531 000011BB 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2532 000011BD 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2533                                  	
  2534                                  	; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2535 000011BF 09C9                    	or	ecx, ecx
  2536 000011C1 75C2                    	jnz	short lff16m_1
  2537 000011C3 E911FCFFFF              	jmp	lff16m_3
  2538                                  
  2539                                  lff16m_7:
  2540                                  lff16s_7:
  2541 000011C8 E92DFCFFFF              	jmp	lff16m_5  ; error
  2542                                  
  2543                                  load_16khz_stereo_8_bit:
  2544                                  	; 02/02/2025
  2545                                  	; 14/11/2023
  2546                                  	; 13/11/2023
  2547 000011CD F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2548                                  					; last of the file?
  2549 000011D4 7402                    	jz	short lff16s_0		; no
  2550 000011D6 F9                      	stc
  2551 000011D7 C3                      	retn
  2552                                  
  2553                                  lff16s_0:
  2554                                  	; 01/12/2024
  2555                                  	; edi = audio buffer address
  2556 000011D8 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2557                                          ;mov	edx, [loadsize]
  2558                                  
  2559                                  	; esi = buffer address
  2560                                  	;; edx = buffer size
  2561                                  
  2562                                  	; load file into memory
  2563                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000011DD 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000011E3 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000011E5 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000011EB B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000011F0 CD40                <1>  int 40h
  2564 000011F2 72D4                    	jc	short lff16s_7 ; error !
  2565                                  
  2566                                  	; 01/12/2024
  2567 000011F4 A3[7C810000]            	mov	[count], eax
  2568                                  	;;;
  2569                                  	; 07/12/2024
  2570                                  	;mov	edi, audio_buffer
  2571                                  	;;;
  2572 000011F9 D1E8                    	shr	eax, 1
  2573 000011FB 7505                    	jnz	short lff16s_8
  2574 000011FD E9EFFBFFFF              	jmp	lff16_eof
  2575                                  
  2576                                  lff16s_8:
  2577 00001202 89C1                    	mov	ecx, eax	; word count
  2578                                  lff16s_1:
  2579 00001204 AC                      	lodsb
  2580 00001205 A2[98240000]            	mov	[previous_val_l], al
  2581 0000120A 2C80                    	sub	al, 80h
  2582 0000120C 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2583 00001210 66AB                    	stosw		; original sample (L)
  2584 00001212 AC                      	lodsb
  2585 00001213 A2[9A240000]            	mov	[previous_val_r], al
  2586 00001218 2C80                    	sub	al, 80h
  2587 0000121A 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2588 0000121E 66AB                    	stosw		; original sample (R)
  2589                                  
  2590                                  	;xor	eax, eax
  2591                                  	; 02/02/2025
  2592 00001220 668B06                  	mov	ax, [esi]
  2593 00001223 49                      	dec	ecx
  2594 00001224 7504                    	jnz	short lff16s_2
  2595                                  		; convert 8 bit sample to 16 bit sample
  2596                                  	; 14/11/2023
  2597 00001226 66B88080                	mov	ax, 8080h
  2598                                  lff16s_2:
  2599                                  	;mov	[next_val_l], al
  2600                                  	;mov	[next_val_r], ah
  2601 0000122A 89C3                    	mov	ebx, eax
  2602 0000122C 0205[98240000]          	add	al, [previous_val_l]
  2603 00001232 D0D8                    	rcr	al, 1
  2604 00001234 88C2                    	mov	dl, al	; this is temporary interpolation value (L)
  2605 00001236 0205[98240000]          	add	al, [previous_val_l]
  2606 0000123C D0D8                    	rcr	al, 1
  2607 0000123E 2C80                    	sub	al, 80h
  2608 00001240 66C1E008                	shl	ax, 8
  2609 00001244 66AB                    	stosw		; this is 1st interpolated sample (L)
  2610 00001246 88F8                    	mov	al, bh	; [next_val_r]
  2611 00001248 0205[9A240000]          	add	al, [previous_val_r]
  2612 0000124E D0D8                    	rcr	al, 1
  2613 00001250 88C6                    	mov	dh, al	; this is temporary interpolation value (R)
  2614 00001252 0205[9A240000]          	add	al, [previous_val_r]
  2615 00001258 D0D8                    	rcr	al, 1
  2616 0000125A 2C80                    	sub	al, 80h
  2617 0000125C 66C1E008                	shl	ax, 8
  2618 00001260 66AB                    	stosw		; this is 1st interpolated sample (R)
  2619 00001262 88D0                    	mov	al, dl
  2620 00001264 00D8                    	add	al, bl	; [next_val_l]
  2621 00001266 D0D8                    	rcr	al, 1
  2622 00001268 2C80                    	sub	al, 80h
  2623 0000126A 66C1E008                	shl	ax, 8
  2624 0000126E 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2625 00001270 88F0                    	mov	al, dh
  2626 00001272 00F8                    	add	al, bh	; [next_val_r]
  2627 00001274 D0D8                    	rcr	al, 1
  2628 00001276 2C80                    	sub	al, 80h
  2629 00001278 66C1E008                	shl	ax, 8
  2630 0000127C 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2631                                  	
  2632                                  	; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2633 0000127E 09C9                    	or	ecx, ecx
  2634 00001280 7582                    	jnz	short lff16s_1
  2635 00001282 E952FBFFFF              	jmp	lff16s_3
  2636                                  
  2637                                  load_16khz_mono_16_bit:
  2638                                  	; 02/02/2025
  2639                                  	; 15/11/2023
  2640                                  	; 13/11/2023
  2641 00001287 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2642                                  					; last of the file?
  2643 0000128E 7402                    	jz	short lff16m2_0		; no
  2644 00001290 F9                      	stc
  2645 00001291 C3                      	retn
  2646                                  
  2647                                  lff16m2_0:
  2648                                  	; 01/12/2024
  2649                                  	; edi = audio buffer address
  2650 00001292 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2651                                          ;mov	edx, [loadsize]
  2652                                  
  2653                                  	; esi = buffer address
  2654                                  	;; edx = buffer size
  2655                                  
  2656                                  	; load file into memory
  2657                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001297 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000129D 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000129F 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000012A5 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000012AA CD40                <1>  int 40h
  2658 000012AC 7255                    	jc	short lff16m2_7 ; error !
  2659                                  
  2660                                  	; 01/12/2024
  2661 000012AE A3[7C810000]            	mov	[count], eax
  2662                                  	;;;
  2663                                  	; 07/12/2024
  2664                                  	;mov	edi, audio_buffer
  2665                                  	;;;
  2666 000012B3 D1E8                    	shr	eax, 1
  2667 000012B5 7505                    	jnz	short lff16m2_8
  2668 000012B7 E935FBFFFF              	jmp	lff16_eof
  2669                                  
  2670                                  lff16m2_8:
  2671 000012BC 89C1                    	mov	ecx, eax  ; word count
  2672                                  lff16m2_1:
  2673 000012BE 66AD                    	lodsw
  2674 000012C0 66AB                    	stosw		; original sample (left channel)
  2675 000012C2 66AB                    	stosw		; original sample (right channel)
  2676 000012C4 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2677                                  	;mov	[previous_val], ax
  2678 000012C7 89C3                    	mov	ebx, eax
  2679                                  	; 02/02/2025
  2680 000012C9 668B06                  	mov	ax, [esi]
  2681 000012CC 49                      	dec	ecx
  2682 000012CD 7502                    	jnz	short lff16m2_2
  2683 000012CF 31C0                    	xor	eax, eax
  2684                                  lff16m2_2:
  2685 000012D1 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2686 000012D4 89C5                    	mov	ebp, eax	; [next_val]
  2687                                  	;add	ax, [previous_val]
  2688 000012D6 6601D8                  	add	ax, bx
  2689 000012D9 66D1D8                  	rcr	ax, 1
  2690 000012DC 89C2                    	mov	edx, eax ; this is temporary interpolation value
  2691                                  	;add	ax, [previous_val]
  2692 000012DE 6601D8                  	add	ax, bx
  2693 000012E1 66D1D8                  	rcr	ax, 1
  2694 000012E4 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2695 000012E7 66AB                    	stosw		; this is 1st interpolated sample (L)
  2696 000012E9 66AB                    	stosw		; this is 1st interpolated sample (R)
  2697 000012EB 89E8                    	mov	eax, ebp
  2698 000012ED 6601D0                  	add	ax, dx
  2699 000012F0 66D1D8                  	rcr	ax, 1
  2700 000012F3 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2701 000012F6 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2702 000012F8 66AB                    	stosw		; this is 2nd interpolated sample (R)
  2703                                  	; 16 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2704 000012FA 09C9                    	or	ecx, ecx
  2705 000012FC 75C0                    	jnz	short lff16m2_1
  2706 000012FE E9D6FAFFFF              	jmp	lff16m2_3
  2707                                  
  2708                                  lff16m2_7:
  2709                                  lff16s2_7:
  2710 00001303 E9F2FAFFFF              	jmp	lff16m2_5  ; error
  2711                                  
  2712                                  load_16khz_stereo_16_bit:
  2713                                  	; 02/02/2025
  2714                                  	; 16/11/2023
  2715                                  	; 15/11/2023
  2716                                  	; 13/11/2023
  2717 00001308 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2718                                  					; last of the file?
  2719 0000130F 7402                    	jz	short lff16s2_0		; no
  2720 00001311 F9                      	stc
  2721 00001312 C3                      	retn
  2722                                  
  2723                                  lff16s2_0:
  2724                                  	; 01/12/2024
  2725                                  	; edi = audio buffer address
  2726 00001313 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2727                                          ;mov	edx, [loadsize]
  2728                                  
  2729                                  	; esi = buffer address
  2730                                  	;; edx = buffer size
  2731                                  
  2732                                  	; load file into memory
  2733                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001318 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000131E 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001320 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001326 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 0000132B CD40                <1>  int 40h
  2734 0000132D 72D4                    	jc	short lff16s2_7 ; error !
  2735                                  
  2736                                  	; 01/12/2024
  2737 0000132F A3[7C810000]            	mov	[count], eax
  2738                                  	;;;
  2739                                  	; 07/12/2024
  2740                                  	;mov	edi, audio_buffer
  2741                                  	;;;
  2742 00001334 C1E802                  	shr	eax, 2
  2743 00001337 7505                    	jnz	short lff16s2_8
  2744 00001339 E9B3FAFFFF              	jmp	lff16_eof
  2745                                  
  2746                                  lff16s2_8:
  2747 0000133E 89C1                    	mov	ecx, eax  ; dword count
  2748                                  lff16s2_1:
  2749 00001340 66AD                    	lodsw
  2750 00001342 66AB                    	stosw		; original sample (L)
  2751 00001344 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2752 00001347 66A3[98240000]          	mov	[previous_val_l], ax
  2753 0000134D 66AD                    	lodsw
  2754 0000134F 66AB                    	stosw		; original sample (R)
  2755 00001351 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2756 00001354 66A3[9A240000]          	mov	[previous_val_r], ax
  2757                                  	; 02/02/2025
  2758 0000135A 668B06                  	mov	ax, [esi]
  2759 0000135D 668B5602                	mov	dx, [esi+2]
  2760                                  	; 16/11/2023
  2761 00001361 49                      	dec	ecx
  2762 00001362 7504                    	jnz	short lff16s2_2
  2763 00001364 31D2                    	xor	edx, edx
  2764 00001366 31C0                    	xor	eax, eax
  2765                                  lff16s2_2:
  2766 00001368 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  2767                                  	;mov	[next_val_l], ax
  2768 0000136B 89C5                    	mov	ebp, eax
  2769 0000136D 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  2770 00001370 668915[9E240000]        	mov	[next_val_r], dx
  2771 00001377 660305[98240000]        	add	ax, [previous_val_l]
  2772 0000137E 66D1D8                  	rcr	ax, 1
  2773 00001381 89C2                    	mov	edx, eax ; this is temporary interpolation value (L)
  2774 00001383 660305[98240000]        	add	ax, [previous_val_l]
  2775 0000138A 66D1D8                  	rcr	ax, 1
  2776 0000138D 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  2777 00001390 66AB                    	stosw		; this is 1st interpolated sample (L)
  2778 00001392 66A1[9E240000]          	mov	ax, [next_val_r]
  2779 00001398 660305[9A240000]        	add	ax, [previous_val_r]
  2780 0000139F 66D1D8                  	rcr	ax, 1
  2781 000013A2 89C3                    	mov	ebx, eax ; this is temporary interpolation value (R)
  2782 000013A4 660305[9A240000]        	add	ax, [previous_val_r]
  2783 000013AB 66D1D8                  	rcr	ax, 1
  2784 000013AE 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2785 000013B1 66AB                    	stosw		; this is 1st interpolated sample (R)
  2786                                  	;mov	ax, [next_val_l]
  2787 000013B3 89E8                    	mov	eax, ebp
  2788 000013B5 6601D0                  	add	ax, dx
  2789 000013B8 66D1D8                  	rcr	ax, 1
  2790 000013BB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2791 000013BE 66AB                    	stosw		; this is 2nd interpolated sample (L)
  2792 000013C0 66A1[9E240000]          	mov	ax, [next_val_r]
  2793 000013C6 6601D8                  	add	ax, bx
  2794 000013C9 66D1D8                  	rcr	ax, 1
  2795 000013CC 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  2796 000013CF 66AB                    	stosw 		; this is 2nd interpolated sample (R)
  2797                                  	
  2798                                  	; 16 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2799 000013D1 09C9                    	or	ecx, ecx
  2800 000013D3 0F8567FFFFFF            	jnz	lff16s2_1
  2801 000013D9 E9FBF9FFFF              	jmp	lff16s2_3
  2802                                  
  2803                                  ; .....................
  2804                                  
  2805                                  load_24khz_mono_8_bit:
  2806                                  	; 02/02/2025
  2807                                  	; 15/11/2023
  2808 000013DE F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2809                                  					; last of the file?
  2810 000013E5 7402                    	jz	short lff24m_0		; no
  2811 000013E7 F9                      	stc
  2812 000013E8 C3                      	retn
  2813                                  
  2814                                  lff24m_0:
  2815                                  	; 01/12/2024
  2816                                  	; edi = audio buffer address
  2817 000013E9 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2818                                          ;mov	edx, [loadsize]
  2819                                  
  2820                                  	; esi = buffer address
  2821                                  	;; edx = buffer size
  2822                                  
  2823                                  	; load file into memory
  2824                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000013EE 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000013F4 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000013F6 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000013FC B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001401 CD40                <1>  int 40h
  2825 00001403 723B                    	jc	short lff24m_7 ; error !
  2826                                  
  2827                                  	; 01/12/2024
  2828 00001405 A3[7C810000]            	mov	[count], eax
  2829                                  	;;;
  2830                                  	; 07/12/2024
  2831                                  	;mov	edi, audio_buffer
  2832                                  	;;;
  2833 0000140A 21C0                    	and	eax, eax
  2834 0000140C 7505                    	jnz	short lff24m_8
  2835 0000140E E9DEF9FFFF              	jmp	lff24_eof
  2836                                  
  2837                                  lff24m_8:
  2838 00001413 89C1                    	mov	ecx, eax	; byte count
  2839                                  lff24m_1:
  2840 00001415 AC                      	lodsb
  2841                                  	;mov	[previous_val], al
  2842 00001416 88C3                    	mov	bl, al
  2843 00001418 2C80                    	sub	al, 80h
  2844 0000141A 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2845 0000141E 66AB                    	stosw		; original sample (left channel)
  2846 00001420 66AB                    	stosw		; original sample (right channel)
  2847                                  	;xor	eax, eax
  2848                                  	; 02/02/2025
  2849 00001422 8A06                    	mov	al, [esi]
  2850 00001424 49                      	dec	ecx
  2851 00001425 7502                    	jnz	short lff24m_2
  2852 00001427 B080                    	mov	al, 80h
  2853                                  lff24m_2:
  2854                                  	;;mov	[next_val], al
  2855                                  	;mov	bh, al
  2856                                  	;add	al, [previous_val]
  2857 00001429 00D8                    	add	al, bl
  2858 0000142B D0D8                    	rcr	al, 1
  2859 0000142D 2C80                    	sub	al, 80h
  2860 0000142F 66C1E008                	shl	ax, 8
  2861 00001433 66AB                    	stosw		; this is interpolated sample (L)
  2862 00001435 66AB                    	stosw		; this is interpolated sample (R)
  2863                                  	
  2864                                  	; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  2865 00001437 09C9                    	or	ecx, ecx
  2866 00001439 75DA                    	jnz	short lff24m_1
  2867 0000143B E999F9FFFF              	jmp	lff24_3
  2868                                  
  2869                                  lff24m_7:
  2870                                  lff24s_7:
  2871 00001440 E9B5F9FFFF              	jmp	lff24_5  ; error
  2872                                  
  2873                                  load_24khz_stereo_8_bit:
  2874                                  	; 02/02/2025
  2875                                  	; 15/11/2023
  2876 00001445 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2877                                  					; last of the file?
  2878 0000144C 7402                    	jz	short lff24s_0		; no
  2879 0000144E F9                      	stc
  2880 0000144F C3                      	retn
  2881                                  
  2882                                  lff24s_0:
  2883                                  	; 01/12/2024
  2884                                  	; edi = audio buffer address
  2885 00001450 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2886                                          ;mov	edx, [loadsize]
  2887                                  
  2888                                  	; esi = buffer address
  2889                                  	;; edx = buffer size
  2890                                  
  2891                                  	; load file into memory
  2892                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001455 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000145B 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000145D 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001463 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001468 CD40                <1>  int 40h
  2893 0000146A 72D4                    	jc	short lff24s_7 ; error !
  2894                                  
  2895                                  	; 01/12/2024
  2896 0000146C A3[7C810000]            	mov	[count], eax
  2897                                  	;;;
  2898                                  	; 07/12/2024
  2899                                  	;mov	edi, audio_buffer
  2900                                  	;;;
  2901 00001471 D1E8                    	shr	eax, 1
  2902 00001473 7505                    	jnz	short lff24s_8
  2903 00001475 E977F9FFFF              	jmp	lff24_eof
  2904                                  
  2905                                  lff24s_8:
  2906 0000147A 89C1                    	mov	ecx, eax  ; word count
  2907                                  lff24s_1:
  2908 0000147C AC                      	lodsb
  2909 0000147D A2[98240000]            	mov	[previous_val_l], al
  2910 00001482 2C80                    	sub	al, 80h
  2911 00001484 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2912 00001488 66AB                    	stosw		; original sample (L)
  2913 0000148A AC                      	lodsb
  2914 0000148B A2[9A240000]            	mov	[previous_val_r], al
  2915 00001490 2C80                    	sub	al, 80h
  2916 00001492 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  2917 00001496 66AB                    	stosw		; original sample (R)
  2918                                  
  2919                                  	;xor	eax, eax
  2920                                  	; 02/02/2025
  2921 00001498 668B06                  	mov	ax, [esi]
  2922 0000149B 49                      	dec	ecx
  2923 0000149C 7504                    	jnz	short lff24s_2
  2924                                  		; convert 8 bit sample to 16 bit sample
  2925 0000149E 66B88080                	mov	ax, 8080h
  2926                                  lff24s_2:
  2927                                  	;;mov	[next_val_l], al
  2928                                  	;;mov	[next_val_r], ah
  2929                                  	;mov	bx, ax
  2930 000014A2 88E7                    	mov	bh, ah
  2931 000014A4 0205[98240000]          	add	al, [previous_val_l]
  2932 000014AA D0D8                    	rcr	al, 1
  2933                                  	;mov	dl, al
  2934 000014AC 2C80                    	sub	al, 80h
  2935 000014AE 66C1E008                	shl	ax, 8
  2936 000014B2 66AB                    	stosw		; this is interpolated sample (L)
  2937 000014B4 88F8                    	mov	al, bh	; [next_val_r]
  2938 000014B6 0205[9A240000]          	add	al, [previous_val_r]
  2939 000014BC D0D8                    	rcr	al, 1
  2940                                  	;mov	dh, al
  2941 000014BE 2C80                    	sub	al, 80h
  2942 000014C0 66C1E008                	shl	ax, 8
  2943 000014C4 66AB                    	stosw		; this is interpolated sample (R)
  2944                                  		
  2945                                  	; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  2946 000014C6 09C9                    	or	ecx, ecx
  2947 000014C8 75B2                    	jnz	short lff24s_1
  2948 000014CA E90AF9FFFF              	jmp	lff24_3
  2949                                  
  2950                                  load_24khz_mono_16_bit:
  2951                                  	; 02/02/2025
  2952                                  	; 15/11/2023
  2953 000014CF F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  2954                                  					; last of the file?
  2955 000014D6 7402                    	jz	short lff24m2_0		; no
  2956 000014D8 F9                      	stc
  2957 000014D9 C3                      	retn
  2958                                  
  2959                                  lff24m2_0:
  2960                                  	; 01/12/2024
  2961                                  	; edi = audio buffer address
  2962 000014DA BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  2963                                          ;mov	edx, [loadsize]
  2964                                  
  2965                                  	; esi = buffer address
  2966                                  	;; edx = buffer size
  2967                                  
  2968                                  	; load file into memory
  2969                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000014DF 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000014E5 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000014E7 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000014ED B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000014F2 CD40                <1>  int 40h
  2970 000014F4 723A                    	jc	short lff24m2_7 ; error !
  2971                                  
  2972                                  	; 01/12/2024
  2973 000014F6 A3[7C810000]            	mov	[count], eax
  2974                                  	;;;
  2975                                  	; 07/12/2024
  2976                                  	;mov	edi, audio_buffer
  2977                                  	;;;
  2978 000014FB D1E8                    	shr	eax, 1
  2979 000014FD 7505                    	jnz	short lff24m2_8
  2980 000014FF E9EDF8FFFF              	jmp	lff24_eof
  2981                                  
  2982                                  lff24m2_8:
  2983 00001504 89C1                    	mov	ecx, eax  ; word count
  2984                                  lff24m2_1:
  2985 00001506 66AD                    	lodsw
  2986 00001508 66AB                    	stosw		; original sample (left channel)
  2987 0000150A 66AB                    	stosw		; original sample (right channel)
  2988 0000150C 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  2989                                  	;mov	[previous_val], ax
  2990                                  	;mov	ebx, eax
  2991                                  	; 02/02/2025
  2992 0000150F 668B1E                  	mov	bx, [esi]
  2993 00001512 49                      	dec	ecx
  2994 00001513 7502                    	jnz	short lff24m2_2
  2995                                  	;xor	eax, eax
  2996 00001515 31DB                    	xor	ebx, ebx
  2997                                  lff24m2_2:
  2998                                  	; 02/02/2025
  2999 00001517 80C780                  	add	bh, 80h ; convert sound level 0 to 65535 format
  3000                                  	;add	ah, 80h
  3001                                  	;mov	ebp, eax	; [next_val]
  3002                                  	;add	ax, [previous_val]
  3003                                  	; ax = [previous_val]
  3004                                  	; bx = [next_val]
  3005 0000151A 6601D8                  	add	ax, bx
  3006 0000151D 66D1D8                  	rcr	ax, 1
  3007 00001520 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3008 00001523 66AB                    	stosw		; this is interpolated sample (L)
  3009 00001525 66AB                    	stosw		; this is interpolated sample (R)
  3010                                  	; 24 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  3011 00001527 09C9                    	or	ecx, ecx
  3012 00001529 75DB                    	jnz	short lff24m2_1
  3013 0000152B E9A9F8FFFF              	jmp	lff24_3
  3014                                  
  3015                                  lff24m2_7:
  3016                                  lff24s2_7:
  3017 00001530 E9C5F8FFFF              	jmp	lff24_5  ; error
  3018                                  
  3019                                  load_24khz_stereo_16_bit:
  3020                                  	; 02/02/2025
  3021                                  	; 16/11/2023
  3022                                  	; 15/11/2023
  3023 00001535 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3024                                  					; last of the file?
  3025 0000153C 7402                    	jz	short lff24s2_0		; no
  3026 0000153E F9                      	stc
  3027 0000153F C3                      	retn
  3028                                  
  3029                                  lff24s2_0:
  3030                                  	; 01/12/2024
  3031                                  	; edi = audio buffer address
  3032 00001540 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3033                                          ;mov	edx, [loadsize]
  3034                                  
  3035                                  	; esi = buffer address
  3036                                  	;; edx = buffer size
  3037                                  
  3038                                  	; load file into memory
  3039                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001545 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000154B 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000154D 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001553 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001558 CD40                <1>  int 40h
  3040 0000155A 72D4                    	jc	short lff24s2_7 ; error !
  3041                                  
  3042                                  	; 01/12/2024
  3043 0000155C A3[7C810000]            	mov	[count], eax
  3044                                  	;;;
  3045                                  	; 07/12/2024
  3046                                  	;mov	edi, audio_buffer
  3047                                  	;;;
  3048 00001561 C1E802                  	shr	eax, 2
  3049 00001564 7505                    	jnz	short lff24s2_8
  3050 00001566 E986F8FFFF              	jmp	lff24_eof
  3051                                  
  3052                                  lff24s2_8:
  3053 0000156B 89C1                    	mov	ecx, eax  ; dword count
  3054                                  lff24s2_1:
  3055 0000156D 66AD                    	lodsw
  3056 0000156F 66AB                    	stosw		; original sample (L)
  3057 00001571 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  3058 00001574 66A3[98240000]          	mov	[previous_val_l], ax
  3059 0000157A 66AD                    	lodsw
  3060 0000157C 66AB                    	stosw		; original sample (R)
  3061 0000157E 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  3062                                  	;mov	[previous_val_r], ax
  3063 00001581 89C3                    	mov	ebx, eax
  3064                                  	; 02/02/2025
  3065 00001583 668B06                  	mov	ax, [esi]
  3066 00001586 668B5602                	mov	dx, [esi+2]
  3067                                  	; 16/11/2023
  3068 0000158A 49                      	dec	ecx
  3069 0000158B 7504                    	jnz	short lff24s2_2
  3070 0000158D 31D2                    	xor	edx, edx
  3071 0000158F 31C0                    	xor	eax, eax
  3072                                  lff24s2_2:
  3073 00001591 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  3074                                  	;;mov	[next_val_l], ax
  3075                                  	;mov	ebp, eax
  3076 00001594 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  3077                                  	;mov	[next_val_r], dx
  3078 00001597 660305[98240000]        	add	ax, [previous_val_l]
  3079 0000159E 66D1D8                  	rcr	ax, 1
  3080 000015A1 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  3081 000015A4 66AB                    	stosw		; this is interpolated sample (L)
  3082                                  	;mov	ax, [next_val_r]
  3083 000015A6 89D0                    	mov	eax, edx
  3084                                  	;add	ax, [previous_val_r]
  3085 000015A8 6601D8                  	add	ax, bx
  3086 000015AB 66D1D8                  	rcr	ax, 1
  3087 000015AE 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3088 000015B1 66AB                    	stosw		; this is interpolated sample (R)
  3089                                  	
  3090                                  	; 24 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  3091 000015B3 09C9                    	or	ecx, ecx
  3092 000015B5 75B6                    	jnz	short lff24s2_1
  3093 000015B7 E91DF8FFFF              	jmp	lff24_3
  3094                                  
  3095                                  ; .....................
  3096                                  
  3097                                  load_32khz_mono_8_bit:
  3098                                  	; 02/02/2025
  3099                                  	; 15/11/2023
  3100 000015BC F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3101                                  					; last of the file?
  3102 000015C3 7402                    	jz	short lff32m_0		; no
  3103 000015C5 F9                      	stc
  3104 000015C6 C3                      	retn
  3105                                  
  3106                                  lff32m_0:
  3107                                  	; 01/12/2024
  3108                                  	; edi = audio buffer address
  3109 000015C7 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3110                                          ;mov	edx, [loadsize]
  3111                                  
  3112                                  	; esi = buffer address
  3113                                  	;; edx = buffer size
  3114                                  
  3115                                  	; load file into memory
  3116                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000015CC 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000015D2 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000015D4 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000015DA B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000015DF CD40                <1>  int 40h
  3117 000015E1 7247                    	jc	short lff32m_7 ; error !
  3118                                  
  3119                                  	; 01/12/2024
  3120 000015E3 A3[7C810000]            	mov	[count], eax
  3121                                  	;;;
  3122                                  	; 07/12/2024
  3123                                  	;mov	edi, audio_buffer
  3124                                  	;;;
  3125 000015E8 21C0                    	and	eax, eax
  3126 000015EA 7505                    	jnz	short lff32m_8
  3127 000015EC E900F8FFFF              	jmp	lff32_eof
  3128                                  
  3129                                  lff32m_8:
  3130 000015F1 89C1                    	mov	ecx, eax	; byte count
  3131                                  lff32m_1:
  3132 000015F3 AC                      	lodsb
  3133                                  	;mov	[previous_val], al
  3134 000015F4 88C3                    	mov	bl, al
  3135 000015F6 2C80                    	sub	al, 80h
  3136 000015F8 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  3137 000015FC 66AB                    	stosw		; original sample (left channel)
  3138 000015FE 66AB                    	stosw		; original sample (right channel)
  3139                                  	;xor	eax, eax
  3140                                  	; 02/02/2025
  3141 00001600 8A06                    	mov	al, [esi]
  3142 00001602 49                      	dec	ecx
  3143 00001603 7502                    	jnz	short lff32m_2
  3144 00001605 B080                    	mov	al, 80h
  3145                                  lff32m_2:
  3146                                  	;;mov	[next_val], al
  3147                                  	;mov	bh, al
  3148                                  	;add	al, [previous_val]
  3149 00001607 00D8                    	add	al, bl
  3150 00001609 D0D8                    	rcr	al, 1
  3151 0000160B 2C80                    	sub	al, 80h
  3152 0000160D 66C1E008                	shl	ax, 8
  3153 00001611 66AB                    	stosw		; this is interpolated sample (L)
  3154 00001613 66AB                    	stosw		; this is interpolated sample (R)
  3155                                  	
  3156                                  	; different than 8-16-24 kHZ !
  3157                                  	; 'original-interpolated-original' trio samples
  3158 00001615 E30E                    	jecxz	lff32m_3
  3159                                  
  3160 00001617 AC                      	lodsb
  3161 00001618 2C80                    	sub	al, 80h
  3162 0000161A 66C1E008                	shl	ax, 8
  3163 0000161E 66AB                    	stosw		; original sample (left channel)
  3164 00001620 66AB                    	stosw		; original sample (right channel)
  3165                                  
  3166                                  	; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  3167 00001622 49                      	dec	ecx
  3168 00001623 75CE                    	jnz	short lff32m_1
  3169                                  lff32m_3:
  3170 00001625 E9AFF7FFFF              	jmp	lff32_3
  3171                                  
  3172                                  lff32m_7:
  3173                                  lff32s_7:
  3174 0000162A E9CBF7FFFF              	jmp	lff32_5  ; error
  3175                                  
  3176                                  load_32khz_stereo_8_bit:
  3177                                  	; 02/02/2025
  3178                                  	; 15/11/2023
  3179 0000162F F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3180                                  					; last of the file?
  3181 00001636 7402                    	jz	short lff32s_0		; no
  3182 00001638 F9                      	stc
  3183 00001639 C3                      	retn
  3184                                  
  3185                                  lff32s_0:
  3186                                  	; 01/12/2024
  3187                                  	; edi = audio buffer address
  3188 0000163A BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3189                                          ;mov	edx, [loadsize]
  3190                                  
  3191                                  	; esi = buffer address
  3192                                  	;; edx = buffer size
  3193                                  
  3194                                  	; load file into memory
  3195                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 0000163F 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001645 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001647 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 0000164D B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001652 CD40                <1>  int 40h
  3196 00001654 72D4                    	jc	short lff32s_7 ; error !
  3197                                  
  3198                                  	; 01/12/2024
  3199 00001656 A3[7C810000]            	mov	[count], eax
  3200                                  	;;;
  3201                                  	; 07/12/2024
  3202                                  	;mov	edi, audio_buffer
  3203                                  	;;;
  3204 0000165B D1E8                    	shr	eax, 1
  3205 0000165D 7505                    	jnz	short lff32s_8
  3206 0000165F E98DF7FFFF              	jmp	lff32_eof
  3207                                  
  3208                                  lff32s_8:
  3209 00001664 89C1                    	mov	ecx, eax  ; word count
  3210                                  lff32s_1:
  3211 00001666 AC                      	lodsb
  3212 00001667 A2[98240000]            	mov	[previous_val_l], al
  3213 0000166C 2C80                    	sub	al, 80h
  3214 0000166E 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  3215 00001672 66AB                    	stosw		; original sample (L)
  3216 00001674 AC                      	lodsb
  3217 00001675 A2[9A240000]            	mov	[previous_val_r], al
  3218 0000167A 2C80                    	sub	al, 80h
  3219 0000167C 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  3220 00001680 66AB                    	stosw		; original sample (R)
  3221                                  
  3222                                  	;xor	eax, eax
  3223                                  	; 02/02/2025
  3224 00001682 668B06                  	mov	ax, [esi]
  3225 00001685 49                      	dec	ecx
  3226 00001686 7504                    	jnz	short lff32s_2
  3227                                  		; convert 8 bit sample to 16 bit sample
  3228 00001688 66B88080                	mov	ax, 8080h
  3229                                  lff32s_2:
  3230                                  	;;mov	[next_val_l], al
  3231                                  	;;mov	[next_val_r], ah
  3232                                  	;mov	bx, ax
  3233 0000168C 88E7                    	mov	bh, ah
  3234 0000168E 0205[98240000]          	add	al, [previous_val_l]
  3235 00001694 D0D8                    	rcr	al, 1
  3236                                  	;mov	dl, al
  3237 00001696 2C80                    	sub	al, 80h
  3238 00001698 66C1E008                	shl	ax, 8
  3239 0000169C 66AB                    	stosw		; this is interpolated sample (L)
  3240 0000169E 88F8                    	mov	al, bh	; [next_val_r]
  3241 000016A0 0205[9A240000]          	add	al, [previous_val_r]
  3242 000016A6 D0D8                    	rcr	al, 1
  3243                                  	;mov	dh, al
  3244 000016A8 2C80                    	sub	al, 80h
  3245 000016AA 66C1E008                	shl	ax, 8
  3246 000016AE 66AB                    	stosw		; this is interpolated sample (R)
  3247                                  
  3248                                  	; different than 8-16-24 kHZ !
  3249                                  	; 'original-interpolated-original' trio samples
  3250 000016B0 E315                    	jecxz	lff32s_3
  3251                                  
  3252 000016B2 AC                      	lodsb
  3253 000016B3 2C80                    	sub	al, 80h
  3254 000016B5 66C1E008                	shl	ax, 8
  3255 000016B9 66AB                    	stosw		; original sample (left channel)
  3256                                  
  3257 000016BB AC                      	lodsb
  3258 000016BC 2C80                    	sub	al, 80h
  3259 000016BE 66C1E008                	shl	ax, 8
  3260 000016C2 66AB                    	stosw		; original sample (right channel)
  3261                                  		
  3262                                  	; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  3263 000016C4 49                      	dec	ecx
  3264 000016C5 759F                    	jnz	short lff32s_1
  3265                                  lff32s_3:
  3266 000016C7 E90DF7FFFF              	jmp	lff32_3
  3267                                  
  3268                                  load_32khz_mono_16_bit:
  3269                                  	; 02/02/2025
  3270                                  	; 15/11/2023
  3271 000016CC F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3272                                  					; last of the file?
  3273 000016D3 7402                    	jz	short lff32m2_0		; no
  3274 000016D5 F9                      	stc
  3275 000016D6 C3                      	retn
  3276                                  
  3277                                  lff32m2_0:
  3278                                  	; 01/12/2024
  3279                                  	; edi = audio buffer address
  3280 000016D7 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3281                                          ;mov	edx, [loadsize]
  3282                                  
  3283                                  	; esi = buffer address
  3284                                  	;; edx = buffer size
  3285                                  
  3286                                  	; load file into memory
  3287                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000016DC 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000016E2 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000016E4 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000016EA B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000016EF CD40                <1>  int 40h
  3288 000016F1 7241                    	jc	short lff32m2_7 ; error !
  3289                                  
  3290                                  	; 01/12/2024
  3291 000016F3 A3[7C810000]            	mov	[count], eax
  3292                                  	;;;
  3293                                  	; 07/12/2024
  3294                                  	;mov	edi, audio_buffer
  3295                                  	;;;
  3296 000016F8 D1E8                    	shr	eax, 1
  3297 000016FA 7505                    	jnz	short lff32m2_8
  3298 000016FC E9F0F6FFFF              	jmp	lff32_eof
  3299                                  
  3300                                  lff32m2_8:
  3301 00001701 89C1                    	mov	ecx, eax  ; word count
  3302                                  lff32m2_1:
  3303 00001703 66AD                    	lodsw
  3304 00001705 66AB                    	stosw		; original sample (left channel)
  3305 00001707 66AB                    	stosw		; original sample (right channel)
  3306 00001709 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  3307                                  	;mov	[previous_val], ax
  3308                                  	;mov	ebx, eax
  3309                                  	;xor	eax, eax
  3310                                  	; 02/02/2025
  3311                                  	;mov	ax, [esi]
  3312 0000170C 668B1E                  	mov	bx, [esi]
  3313 0000170F 49                      	dec	ecx
  3314 00001710 7502                    	jnz	short lff32m2_2
  3315 00001712 31DB                    	xor	ebx, ebx
  3316                                  lff32m2_2:
  3317                                  	; 02/02/2025
  3318 00001714 80C780                  	add	bh, 80h ; convert sound level 0 to 65535 format
  3319                                  	;add	ah, 80h
  3320                                  	;mov	ebp, eax ; [next_val]
  3321                                  	;add	ax, [previous_val]
  3322                                  	; ax = [previous_val]
  3323                                  	; bx = [next_val]
  3324 00001717 6601D8                  	add	ax, bx
  3325 0000171A 66D1D8                  	rcr	ax, 1
  3326 0000171D 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3327 00001720 66AB                    	stosw		; this is interpolated sample (L)
  3328 00001722 66AB                    	stosw		; this is interpolated sample (R)
  3329                                  
  3330                                  	; different than 8-16-24 kHZ !
  3331                                  	; 'original-interpolated-original' trio samples 
  3332 00001724 E309                    	jecxz	lff32m2_3
  3333                                  
  3334 00001726 66AD                    	lodsw
  3335 00001728 66AB                    	stosw		; original sample (left channel)
  3336 0000172A 66AB                    	stosw		; original sample (right channel)
  3337                                  
  3338                                  	; 32 kHZ mono to 48 kHZ stereo conversion of the sample is OK
  3339 0000172C 49                      	dec	ecx
  3340 0000172D 75D4                    	jnz	short lff32m2_1
  3341                                  lff32m2_3:
  3342 0000172F E9A5F6FFFF              	jmp	lff32_3
  3343                                  
  3344                                  lff32m2_7:
  3345                                  lff32s2_7:
  3346 00001734 E9C1F6FFFF              	jmp	lff32_5  ; error
  3347                                  
  3348                                  load_32khz_stereo_16_bit:
  3349                                  	; 02/02/2025
  3350                                  	; 16/11/2023
  3351                                  	; 15/11/2023
  3352 00001739 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3353                                  					; last of the file?
  3354 00001740 7402                    	jz	short lff32s2_0		; no
  3355 00001742 F9                      	stc
  3356 00001743 C3                      	retn
  3357                                  
  3358                                  lff32s2_0:
  3359                                  	; 01/12/2024
  3360                                  	; edi = audio buffer address
  3361 00001744 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3362                                          ;mov	edx, [loadsize]
  3363                                  
  3364                                  	; esi = buffer address
  3365                                  	;; edx = buffer size
  3366                                  
  3367                                  	; load file into memory
  3368                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001749 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000174F 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001751 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001757 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 0000175C CD40                <1>  int 40h
  3369 0000175E 72D4                    	jc	short lff32s2_7 ; error !
  3370                                  
  3371                                  	; 01/12/2024
  3372 00001760 A3[7C810000]            	mov	[count], eax
  3373                                  	;;;
  3374                                  	; 07/12/2024
  3375                                  	;mov	edi, audio_buffer
  3376                                  	;;;
  3377 00001765 C1E802                  	shr	eax, 2
  3378 00001768 7505                    	jnz	short lff32s2_8
  3379 0000176A E982F6FFFF              	jmp	lff32_eof
  3380                                  
  3381                                  lff32s2_8:
  3382 0000176F 89C1                    	mov	ecx, eax ; dword count
  3383                                  lff32s2_1:
  3384 00001771 66AD                    	lodsw
  3385 00001773 66AB                    	stosw		; original sample (L)
  3386 00001775 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format 
  3387 00001778 66A3[98240000]          	mov	[previous_val_l], ax
  3388 0000177E 66AD                    	lodsw
  3389 00001780 66AB                    	stosw		; original sample (R)
  3390 00001782 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format 
  3391                                  	;mov	[previous_val_r], ax
  3392 00001785 89C3                    	mov	ebx, eax
  3393                                  	; 02/02/2025
  3394 00001787 668B06                  	mov	ax, [esi]
  3395 0000178A 668B5602                	mov	dx, [esi+2]
  3396                                  	; 16/11/2023
  3397 0000178E 49                      	dec	ecx
  3398 0000178F 7504                    	jnz	short lff32s2_2
  3399 00001791 31D2                    	xor	edx, edx
  3400 00001793 31C0                    	xor	eax, eax
  3401                                  lff32s2_2:
  3402 00001795 80C480                  	add	ah, 80h	; convert sound level 0 to 65535 format
  3403                                  	;;mov	[next_val_l], ax
  3404                                  	;mov	ebp, eax
  3405 00001798 80C680                  	add	dh, 80h	; convert sound level 0 to 65535 format
  3406                                  	;mov	[next_val_r], dx
  3407 0000179B 660305[98240000]        	add	ax, [previous_val_l]
  3408 000017A2 66D1D8                  	rcr	ax, 1
  3409 000017A5 80EC80                  	sub	ah, 80h ; -32768 to +32767 format again
  3410 000017A8 66AB                    	stosw		; this is interpolated sample (L)
  3411                                  	;mov	ax, [next_val_r]
  3412 000017AA 89D0                    	mov	eax, edx
  3413                                  	;add	ax, [previous_val_r]
  3414 000017AC 6601D8                  	add	ax, bx
  3415 000017AF 66D1D8                  	rcr	ax, 1
  3416 000017B2 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  3417 000017B5 66AB                    	stosw		; this is interpolated sample (R)
  3418                                  
  3419                                  	; different than 8-16-24 kHZ !
  3420                                  	; 'original-interpolated-original' trio samples
  3421 000017B7 E30B                    	jecxz	lff32s2_3
  3422                                  
  3423 000017B9 66AD                    	lodsw
  3424 000017BB 66AB                    	stosw	; original sample (L)
  3425 000017BD 66AD                    	lodsw
  3426 000017BF 66AB                    	stosw	; original sample (R)
  3427                                  	
  3428                                  	; 32 kHZ stereo to 48 kHZ stereo conversion of the sample is OK
  3429 000017C1 49                      	dec	ecx
  3430 000017C2 75AD                    	jnz	short lff32s2_1
  3431                                  lff32s2_3:
  3432 000017C4 E910F6FFFF              	jmp	lff32_3
  3433                                  
  3434                                  ; .....................
  3435                                  
  3436                                  load_22khz_mono_8_bit:
  3437                                  	; 02/02/2025
  3438                                  	; 16/11/2023
  3439 000017C9 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3440                                  					; last of the file?
  3441 000017D0 7402                    	jz	short lff22m_0		; no
  3442 000017D2 F9                      	stc
  3443 000017D3 C3                      	retn
  3444                                  
  3445                                  lff22m_0:
  3446                                  	; 01/12/2024
  3447                                  	; edi = audio buffer address
  3448 000017D4 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3449                                          ;mov	edx, [loadsize]
  3450                                  
  3451                                  	; esi = buffer address
  3452                                  	;; edx = buffer size
  3453                                  
  3454                                  	; load file into memory
  3455                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000017D9 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000017DF 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000017E1 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000017E7 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000017EC CD40                <1>  int 40h
  3456 000017EE 725D                    	jc	short lff22m_7 ; error !
  3457                                  
  3458                                  	; 01/12/2024
  3459 000017F0 A3[7C810000]            	mov	[count], eax
  3460                                  	;;;
  3461                                  	; 07/12/2024
  3462                                  	;mov	edi, audio_buffer
  3463                                  	;;;
  3464 000017F5 21C0                    	and	eax, eax
  3465 000017F7 7505                    	jnz	short lff22m_8
  3466 000017F9 E9F3F5FFFF              	jmp	lff22_eof
  3467                                  
  3468                                  lff22m_8:
  3469 000017FE 89C1                    	mov	ecx, eax	; byte count
  3470                                  lff22m_9:
  3471 00001800 BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3472 00001805 C605[A0240000]03        	mov	byte [faz], 3  ; 3 steps/phases
  3473                                  lff22m_1:
  3474                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3475 0000180C AC                      	lodsb
  3476                                  	; 02/02/2025
  3477 0000180D 8A16                    	mov	dl, [esi]
  3478 0000180F 49                      	dec	ecx
  3479 00001810 7502                    	jnz	short lff22m_2_1
  3480 00001812 B280                    	mov	dl, 80h
  3481                                  lff22m_2_1:	
  3482                                  	; al = [previous_val]
  3483                                  	; dl = [next_val]
  3484 00001814 E835070000              	call	interpolating_3_8bit_mono ; 1 of 17
  3485 00001819 E32D                    	jecxz	lff22m_3
  3486                                  lff22m_2_2:
  3487 0000181B AC                      	lodsb
  3488                                  	; 02/02/2025
  3489 0000181C 8A16                    	mov	dl, [esi]
  3490 0000181E 49                      	dec	ecx
  3491 0000181F 7502                    	jnz	short lff22m_2_3
  3492 00001821 B280                    	mov	dl, 80h
  3493                                  lff22m_2_3:
  3494 00001823 E8B0070000               	call	interpolating_2_8bit_mono ; 2 of 17 .. 6 of 17
  3495 00001828 E31E                    	jecxz	lff22m_3
  3496 0000182A 4D                      	dec	ebp
  3497 0000182B 75EE                    	jnz	short lff22m_2_2
  3498                                  
  3499 0000182D A0[A0240000]            	mov	al, [faz]
  3500 00001832 FEC8                    	dec	al
  3501 00001834 74CA                    	jz	short lff22m_9
  3502 00001836 FE0D[A0240000]          	dec	byte [faz]
  3503 0000183C BD04000000              	mov	ebp, 4
  3504 00001841 FEC8                    	dec	al
  3505 00001843 75C7                    	jnz	short lff22m_1 ; 3:2:2:2:2 ; 7-11 of 17
  3506 00001845 45                      	inc	ebp ; 5
  3507 00001846 EBC4                    	jmp	short lff22m_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3508                                  
  3509                                  lff22m_3:
  3510                                  lff22s_3:
  3511 00001848 E98CF5FFFF              	jmp	lff22_3	; padfill
  3512                                  		; (put zeros in the remain words of the buffer)
  3513                                  lff22m_7:
  3514                                  lff22s_7:
  3515 0000184D E9A8F5FFFF              	jmp	lff22_5  ; error
  3516                                  
  3517                                  load_22khz_stereo_8_bit:
  3518                                  	; 02/02/2025
  3519                                  	; 16/11/2023
  3520 00001852 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3521                                  					; last of the file?
  3522 00001859 7402                    	jz	short lff22s_0		; no
  3523 0000185B F9                      	stc
  3524 0000185C C3                      	retn
  3525                                  
  3526                                  lff22s_0:
  3527                                  	; 01/12/2024
  3528                                  	; edi = audio buffer address
  3529 0000185D BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3530                                          ;mov	edx, [loadsize]
  3531                                  
  3532                                  	; esi = buffer address
  3533                                  	;; edx = buffer size
  3534                                  
  3535                                  	; load file into memory
  3536                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001862 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001868 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000186A 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001870 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001875 CD40                <1>  int 40h
  3537 00001877 72D4                    	jc	short lff22s_7 ; error !
  3538                                  
  3539                                  	; 01/12/2024
  3540 00001879 A3[7C810000]            	mov	[count], eax
  3541                                  	;;;
  3542                                  	; 07/12/2024
  3543                                  	;mov	edi, audio_buffer
  3544                                  	;;;
  3545 0000187E D1E8                    	shr	eax, 1
  3546 00001880 7505                    	jnz	short lff22s_8
  3547 00001882 E96AF5FFFF              	jmp	lff22_eof
  3548                                  
  3549                                  lff22s_8:
  3550 00001887 89C1                    	mov	ecx, eax	; word count
  3551                                  lff22s_9:
  3552 00001889 BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3553 0000188E C605[A0240000]03        	mov	byte [faz], 3  ; 3 steps/phase
  3554                                  lff22s_1:
  3555                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3556 00001895 66AD                    	lodsw
  3557                                  	; 02/02/2025
  3558 00001897 668B16                  	mov	dx, [esi]
  3559 0000189A 49                      	dec	ecx
  3560 0000189B 7504                    	jnz	short lff22s_2_1
  3561 0000189D 66BA8080                	mov	dx, 8080h
  3562                                  lff22s_2_1:	
  3563                                  	; al = [previous_val_l]
  3564                                  	; ah = [previous_val_r]
  3565                                  	; dl = [next_val_l]
  3566                                  	; dh = [next_val_r]
  3567 000018A1 E8DB060000              	call	interpolating_3_8bit_stereo ; 1 of 17
  3568 000018A6 E3A0                    	jecxz	lff22s_3
  3569                                  lff22s_2_2:
  3570 000018A8 66AD                    	lodsw
  3571                                  	; 02/02/2025
  3572 000018AA 668B16                  	mov	dx, [esi]
  3573 000018AD 49                      	dec	ecx
  3574 000018AE 7504                    	jnz	short lff22s_2_3
  3575 000018B0 66BA8080                	mov	dx, 8080h
  3576                                  lff22s_2_3:
  3577 000018B4 E83C070000               	call	interpolating_2_8bit_stereo ; 2 of 17 .. 6 of 17
  3578 000018B9 E38D                    	jecxz	lff22s_3
  3579 000018BB 4D                      	dec	ebp
  3580 000018BC 75EA                    	jnz	short lff22s_2_2
  3581                                  
  3582 000018BE A0[A0240000]            	mov	al, [faz]
  3583 000018C3 FEC8                    	dec	al
  3584 000018C5 74C2                    	jz	short lff22s_9
  3585 000018C7 FE0D[A0240000]          	dec	byte [faz]
  3586 000018CD BD04000000              	mov	ebp, 4
  3587 000018D2 FEC8                    	dec	al
  3588 000018D4 75BF                    	jnz	short lff22s_1 ; 3:2:2:2:2 ; 7-11 of 17
  3589 000018D6 45                      	inc	ebp ; 5
  3590 000018D7 EBBC                    	jmp	short lff22s_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3591                                  
  3592                                  load_22khz_mono_16_bit:
  3593                                  	; 02/02/2025
  3594                                  	; 16/11/2023
  3595 000018D9 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3596                                  					; last of the file?
  3597 000018E0 7402                    	jz	short lff22m2_0		; no
  3598 000018E2 F9                      	stc
  3599 000018E3 C3                      	retn
  3600                                  
  3601                                  lff22m2_0:
  3602                                  	; 01/12/2024
  3603                                  	; edi = audio buffer address
  3604 000018E4 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3605                                          ;mov	edx, [loadsize]
  3606                                  
  3607                                  	; esi = buffer address
  3608                                  	;; edx = buffer size
  3609                                  
  3610                                  	; load file into memory
  3611                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000018E9 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 000018EF 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 000018F1 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000018F7 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 000018FC CD40                <1>  int 40h
  3612 000018FE 7261                    	jc	short lff22m2_7 ; error !
  3613                                  
  3614                                  	; 01/12/2024
  3615 00001900 A3[7C810000]            	mov	[count], eax
  3616                                  	;;;
  3617                                  	; 07/12/2024
  3618                                  	;mov	edi, audio_buffer
  3619                                  	;;;
  3620 00001905 D1E8                    	shr	eax, 1
  3621 00001907 7505                    	jnz	short lff22m2_8
  3622 00001909 E9E3F4FFFF              	jmp	lff22_eof
  3623                                  
  3624                                  lff22m2_8:
  3625 0000190E 89C1                    	mov	ecx, eax	; word count
  3626                                  lff22m2_9:
  3627 00001910 BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3628 00001915 C605[A0240000]03        	mov	byte [faz], 3  ; 3 steps/phases
  3629                                  lff22m2_1:
  3630                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3631 0000191C 66AD                    	lodsw
  3632                                  	; 02/02/2025
  3633 0000191E 668B16                  	mov	dx, [esi]
  3634 00001921 49                      	dec	ecx
  3635 00001922 7502                    	jnz	short lff22m2_2_1
  3636 00001924 31D2                    	xor	edx, edx
  3637                                  lff22m2_2_1:	
  3638                                  	; ax = [previous_val]
  3639                                  	; dx = [next_val]
  3640 00001926 E8FB060000              	call	interpolating_3_16bit_mono ; 1 of 17
  3641 0000192B E32F                    	jecxz	lff22m2_3
  3642                                  lff22m2_2_2:
  3643 0000192D 66AD                    	lodsw
  3644                                  	; 02/02/2025
  3645 0000192F 668B16                  	mov	dx, [esi]
  3646 00001932 49                      	dec	ecx
  3647 00001933 7502                    	jnz	short lff22m2_2_3
  3648 00001935 31D2                    	xor	edx, edx
  3649                                  lff22m2_2_3:
  3650 00001937 E87D070000               	call	interpolating_2_16bit_mono ; 2 of 17 .. 6 of 17
  3651 0000193C E31E                    	jecxz	lff22m2_3
  3652 0000193E 4D                      	dec	ebp
  3653 0000193F 75EC                    	jnz	short lff22m2_2_2
  3654                                  
  3655 00001941 A0[A0240000]            	mov	al, [faz]
  3656 00001946 FEC8                    	dec	al
  3657 00001948 74C6                    	jz	short lff22m2_9
  3658 0000194A FE0D[A0240000]          	dec	byte [faz]
  3659 00001950 BD04000000              	mov	ebp, 4
  3660 00001955 FEC8                    	dec	al
  3661 00001957 75C3                    	jnz	short lff22m2_1 ; 3:2:2:2:2 ; 7-11 of 17
  3662 00001959 45                      	inc	ebp ; 5
  3663 0000195A EBC0                    	jmp	short lff22m2_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3664                                  
  3665                                  lff22m2_3:
  3666                                  lff22s2_3:
  3667 0000195C E978F4FFFF              	jmp	lff22_3	; padfill
  3668                                  		; (put zeros in the remain words of the buffer)
  3669                                  lff22m2_7:
  3670                                  lff22s2_7:
  3671 00001961 E994F4FFFF              	jmp	lff22_5  ; error
  3672                                  
  3673                                  load_22khz_stereo_16_bit:
  3674                                  	; 16/11/2023
  3675 00001966 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3676                                  					; last of the file?
  3677 0000196D 7402                    	jz	short lff22s2_0		; no
  3678 0000196F F9                      	stc
  3679 00001970 C3                      	retn
  3680                                  
  3681                                  lff22s2_0:
  3682                                  	; 01/12/2024
  3683                                  	; edi = audio buffer address
  3684 00001971 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3685                                          ;mov	edx, [loadsize]
  3686                                  
  3687                                  	; esi = buffer address
  3688                                  	;; edx = buffer size
  3689                                  
  3690                                  	; load file into memory
  3691                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001976 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000197C 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000197E 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001984 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001989 CD40                <1>  int 40h
  3692 0000198B 72D4                    	jc	short lff22s2_7 ; error !
  3693                                  
  3694                                  	; 01/12/2024
  3695 0000198D A3[7C810000]            	mov	[count], eax
  3696                                  	;;;
  3697                                  	; 07/12/2024
  3698                                  	;mov	edi, audio_buffer
  3699                                  	;;;
  3700 00001992 C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  3701 00001995 7505                    	jnz	short lff22s2_8
  3702 00001997 E955F4FFFF              	jmp	lff22_eof
  3703                                  
  3704                                  lff22s2_8:
  3705 0000199C 89C1                    	mov	ecx, eax	; dword count
  3706                                  lff22s2_9:
  3707 0000199E BD05000000              	mov	ebp, 5 ; interpolation (one step) loop count
  3708 000019A3 C605[A0240000]03        	mov	byte [faz], 3  ; 3 steps/phase
  3709                                  lff22s2_1:
  3710                                  	; 3:2:2:2:2:2::3:2:2:2:2::3:2:2:2:2:2  ; 37/17
  3711 000019AA 66AD                    	lodsw
  3712 000019AC 89C3                    	mov	ebx, eax
  3713 000019AE 66AD                    	lodsw
  3714 000019B0 8B16                    	mov	edx, [esi]
  3715 000019B2 668915[9C240000]        	mov	[next_val_l], dx
  3716                                  	; 26/11/2023
  3717 000019B9 C1EA10                  	shr	edx, 16
  3718 000019BC 49                      	dec	ecx
  3719 000019BD 7509                    	jnz	short lff22s2_2_1
  3720 000019BF 31D2                    	xor	edx, edx ; 0
  3721 000019C1 668915[9C240000]        	mov	[next_val_l], dx
  3722                                  lff22s2_2_1:
  3723                                  	; bx = [previous_val_l]
  3724                                  	; ax = [previous_val_r]
  3725                                  	; [next_val_l]
  3726                                  	; dx = [next_val_r]
  3727 000019C8 E889060000              	call	interpolating_3_16bit_stereo ; 1 of 17
  3728 000019CD E38D                    	jecxz	lff22s2_3
  3729                                  lff22s2_2_2:
  3730 000019CF 66AD                    	lodsw
  3731 000019D1 89C3                    	mov	ebx, eax
  3732 000019D3 66AD                    	lodsw
  3733 000019D5 8B16                    	mov	edx, [esi]
  3734 000019D7 668915[9C240000]        	mov	[next_val_l], dx
  3735                                  	; 26/11/2023
  3736 000019DE C1EA10                  	shr	edx, 16
  3737 000019E1 49                      	dec	ecx
  3738 000019E2 7509                    	jnz	short lff22s2_2_3
  3739 000019E4 31D2                    	xor	edx, edx ; 0
  3740 000019E6 668915[9C240000]        	mov	[next_val_l], dx
  3741                                  lff22s2_2_3:
  3742 000019ED E8DF060000               	call	interpolating_2_16bit_stereo ; 2 of 17 .. 6 of 17
  3743 000019F2 E31E                    	jecxz	lff22s2_2_4
  3744                                  
  3745 000019F4 4D                      	dec	ebp
  3746 000019F5 75D8                    	jnz	short lff22s2_2_2
  3747                                  
  3748 000019F7 A0[A0240000]            	mov	al, [faz]
  3749 000019FC FEC8                    	dec	al
  3750 000019FE 749E                    	jz	short lff22s2_9
  3751 00001A00 FE0D[A0240000]          	dec	byte [faz]
  3752 00001A06 BD04000000              	mov	ebp, 4
  3753 00001A0B FEC8                    	dec	al
  3754 00001A0D 759B                    	jnz	short lff22s2_1 ; 3:2:2:2:2 ; 7-11 of 17
  3755 00001A0F 45                      	inc	ebp ; 5
  3756 00001A10 EB98                    	jmp	short lff22s2_1 ; 3:2:2:2:2:2 ; 12-17 of 17
  3757                                  
  3758                                  lff22s2_2_4:
  3759                                  	; 26/11/2023
  3760 00001A12 E9C2F3FFFF              	jmp	lff22_3	; padfill
  3761                                  
  3762                                  ; .....................
  3763                                  
  3764                                  load_11khz_mono_8_bit:
  3765                                  	; 02/02/2025
  3766                                  	; 18/11/2023
  3767 00001A17 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3768                                  					; last of the file?
  3769 00001A1E 7402                    	jz	short lff11m_0		; no
  3770 00001A20 F9                      	stc
  3771 00001A21 C3                      	retn
  3772                                  
  3773                                  lff11m_0:
  3774                                  	; 01/12/2024
  3775                                  	; edi = audio buffer address
  3776 00001A22 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3777                                          ;mov	edx, [loadsize]
  3778                                  
  3779                                  	; esi = buffer address
  3780                                  	;; edx = buffer size
  3781                                  
  3782                                  	; load file into memory
  3783                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001A27 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001A2D 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001A2F 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001A35 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001A3A CD40                <1>  int 40h
  3784 00001A3C 7247                    	jc	short lff11m_7 ; error !
  3785                                  
  3786                                  	; 01/12/2024
  3787 00001A3E A3[7C810000]            	mov	[count], eax
  3788                                  	;;;
  3789                                  	; 07/12/2024
  3790                                  	;mov	edi, audio_buffer
  3791                                  	;;;
  3792 00001A43 21C0                    	and	eax, eax
  3793 00001A45 7505                    	jnz	short lff11m_8
  3794 00001A47 E9A5F3FFFF              	jmp	lff11_eof
  3795                                  
  3796                                  lff11m_8:
  3797 00001A4C 89C1                    	mov	ecx, eax		; byte count
  3798                                  lff11m_9:
  3799 00001A4E BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3800                                  lff11m_1:
  3801                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3802 00001A53 AC                      	lodsb
  3803                                  	; 02/02/2025
  3804 00001A54 8A16                    	mov	dl, [esi]
  3805 00001A56 49                      	dec	ecx
  3806 00001A57 7502                    	jnz	short lff11m_2_1
  3807 00001A59 B280                    	mov	dl, 80h
  3808                                  lff11m_2_1:	
  3809                                  	; al = [previous_val]
  3810                                  	; dl = [next_val]
  3811 00001A5B E8A0060000              	call	interpolating_5_8bit_mono
  3812 00001A60 E328                    	jecxz	lff11m_3
  3813                                  lff11m_2_2:
  3814 00001A62 AC                      	lodsb
  3815                                  	; 02/02/2025
  3816 00001A63 8A16                    	mov	dl, [esi]
  3817 00001A65 49                      	dec	ecx
  3818 00001A66 7502                    	jnz	short lff11m_2_3
  3819 00001A68 B280                    	mov	dl, 80h
  3820                                  lff11m_2_3:
  3821 00001A6A E89D070000               	call	interpolating_4_8bit_mono
  3822 00001A6F E319                    	jecxz	lff11m_3
  3823                                  
  3824 00001A71 4D                      	dec	ebp
  3825 00001A72 74DA                    	jz	short lff11m_9
  3826                                  
  3827 00001A74 AC                      	lodsb
  3828                                  	; 02/02/2025
  3829 00001A75 8A16                    	mov	dl, [esi]
  3830 00001A77 49                      	dec	ecx
  3831 00001A78 7502                    	jnz	short lff11m_2_4
  3832 00001A7A B280                    	mov	dl, 80h
  3833                                  lff11m_2_4:
  3834 00001A7C E88B070000              	call	interpolating_4_8bit_mono
  3835 00001A81 E307                    	jecxz	lff11m_3
  3836 00001A83 EBCE                    	jmp	short lff11m_1
  3837                                  
  3838                                  lff11m_7:
  3839                                  lff11s_7:
  3840 00001A85 E970F3FFFF              	jmp	lff11_5  ; error
  3841                                  
  3842                                  lff11m_3:
  3843                                  lff11s_3:
  3844 00001A8A E94AF3FFFF              	jmp	lff11_3	; padfill
  3845                                  		; (put zeros in the remain words of the buffer)
  3846                                  
  3847                                  load_11khz_stereo_8_bit:
  3848                                  	; 02/02/2025
  3849                                  	; 18/11/2023
  3850 00001A8F F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3851                                  					; last of the file?
  3852 00001A96 7402                    	jz	short lff11s_0		; no
  3853 00001A98 F9                      	stc
  3854 00001A99 C3                      	retn
  3855                                  
  3856                                  lff11s_0:
  3857                                  	; 01/12/2024
  3858                                  	; edi = audio buffer address
  3859 00001A9A BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3860                                          ;mov	edx, [loadsize]
  3861                                  
  3862                                  	; esi = buffer address
  3863                                  	;; edx = buffer size
  3864                                  
  3865                                  	; load file into memory
  3866                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001A9F 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001AA5 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001AA7 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001AAD B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001AB2 CD40                <1>  int 40h
  3867 00001AB4 72CF                    	jc	short lff11s_7 ; error !
  3868                                  
  3869                                  	; 01/12/2024
  3870 00001AB6 A3[7C810000]            	mov	[count], eax
  3871                                  	;;;
  3872                                  	; 07/12/2024
  3873                                  	;mov	edi, audio_buffer
  3874                                  	;;;
  3875 00001ABB D1E8                    	shr	eax, 1
  3876 00001ABD 7505                    	jnz	short lff11s_8
  3877 00001ABF E92DF3FFFF              	jmp	lff11_eof
  3878                                  
  3879                                  lff11s_8:
  3880 00001AC4 89C1                    	mov	ecx, eax	; word count
  3881                                  lff11s_9:
  3882 00001AC6 BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3883                                  lff11s_1:
  3884                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3885 00001ACB 66AD                    	lodsw
  3886                                  	; 02/02/2025
  3887 00001ACD 668B16                  	mov	dx, [esi]
  3888 00001AD0 49                      	dec	ecx
  3889 00001AD1 7504                    	jnz	short lff11s_2_1
  3890 00001AD3 66BA8080                	mov	dx, 8080h
  3891                                  lff11s_2_1:	
  3892                                  	; al = [previous_val_l]
  3893                                  	; ah = [previous_val_r]
  3894                                  	; dl = [next_val_l]
  3895                                  	; dh = [next_val_r]
  3896 00001AD7 E883060000              	call	interpolating_5_8bit_stereo
  3897 00001ADC E3AC                    	jecxz	lff11s_3
  3898                                  lff11s_2_2:
  3899 00001ADE 66AD                    	lodsw
  3900                                  	; 02/02/2025
  3901 00001AE0 668B16                  	mov	dx, [esi]
  3902 00001AE3 49                      	dec	ecx
  3903 00001AE4 7504                    	jnz	short lff11s_2_3
  3904 00001AE6 66BA8080                	mov	dx, 8080h
  3905                                  lff11s_2_3:
  3906 00001AEA E85C070000               	call	interpolating_4_8bit_stereo
  3907 00001AEF E399                    	jecxz	lff11s_3
  3908                                  	
  3909 00001AF1 4D                      	dec	ebp
  3910 00001AF2 74D2                    	jz	short lff11s_9
  3911                                  
  3912 00001AF4 66AD                    	lodsw
  3913                                  	; 02/02/2025
  3914 00001AF6 668B16                  	mov	dx, [esi]
  3915 00001AF9 49                      	dec	ecx
  3916 00001AFA 7504                    	jnz	short lff11s_2_4
  3917 00001AFC 66BA8080                	mov	dx, 8080h
  3918                                  lff11s_2_4:
  3919 00001B00 E846070000              	call	interpolating_4_8bit_stereo
  3920 00001B05 E383                    	jecxz	lff11s_3
  3921 00001B07 EBC2                    	jmp	short lff11s_1
  3922                                  
  3923                                  load_11khz_mono_16_bit:
  3924                                  	; 02/02/2025
  3925                                  	; 18/11/2023
  3926 00001B09 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  3927                                  					; last of the file?
  3928 00001B10 7402                    	jz	short lff11m2_0		; no
  3929 00001B12 F9                      	stc
  3930 00001B13 C3                      	retn
  3931                                  
  3932                                  lff11m2_0:
  3933                                  	; 01/12/2024
  3934                                  	; edi = audio buffer address
  3935 00001B14 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  3936                                          ;mov	edx, [loadsize]
  3937                                  
  3938                                  	; esi = buffer address
  3939                                  	;; edx = buffer size
  3940                                  
  3941                                  	; load file into memory
  3942                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001B19 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001B1F 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001B21 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001B27 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001B2C CD40                <1>  int 40h
  3943 00001B2E 724D                    	jc	short lff11m2_7 ; error !
  3944                                  
  3945                                  	; 01/12/2024
  3946 00001B30 A3[7C810000]            	mov	[count], eax
  3947                                  	;;;
  3948                                  	; 07/12/2024
  3949                                  	;mov	edi, audio_buffer
  3950                                  	;;;
  3951 00001B35 D1E8                    	shr	eax, 1
  3952 00001B37 7505                    	jnz	short lff11m2_8
  3953 00001B39 E9B3F2FFFF              	jmp	lff11_eof
  3954                                  
  3955                                  lff11m2_8:
  3956 00001B3E 89C1                    	mov	ecx, eax	; word count
  3957                                  lff11m2_9:
  3958 00001B40 BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  3959                                  lff11m2_1:
  3960                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  3961 00001B45 66AD                    	lodsw
  3962                                  	; 02/02/2025
  3963 00001B47 668B16                  	mov	dx, [esi]
  3964 00001B4A 49                      	dec	ecx
  3965 00001B4B 7502                    	jnz	short lff11m2_2_1
  3966 00001B4D 31D2                    	xor	edx, edx
  3967                                  lff11m2_2_1:	
  3968                                  	; ax = [previous_val]
  3969                                  	; dx = [next_val]
  3970 00001B4F E864070000              	call	interpolating_5_16bit_mono
  3971 00001B54 E362                    	jecxz	lff11m2_3
  3972                                  lff11m2_2_2:
  3973 00001B56 66AD                    	lodsw
  3974                                  	; 02/02/2025
  3975 00001B58 668B16                  	mov	dx, [esi]
  3976 00001B5B 49                      	dec	ecx
  3977 00001B5C 7502                    	jnz	short lff11m2_2_3
  3978 00001B5E 31D2                    	xor	edx, edx
  3979                                  lff11m2_2_3:
  3980 00001B60 E87D080000               	call	interpolating_4_16bit_mono
  3981 00001B65 E351                    	jecxz	lff11m2_3
  3982                                  
  3983 00001B67 4D                      	dec	ebp
  3984 00001B68 74D6                    	jz	short lff11m2_9
  3985                                  
  3986 00001B6A 66AD                    	lodsw
  3987                                  	; 02/02/2025
  3988 00001B6C 668B16                  	mov	dx, [esi]
  3989 00001B6F 49                      	dec	ecx
  3990 00001B70 7502                    	jnz	short lff11m2_2_4
  3991 00001B72 31D2                    	xor	edx, edx
  3992                                  lff11m2_2_4:
  3993 00001B74 E869080000               	call	interpolating_4_16bit_mono
  3994 00001B79 E33D                    	jecxz	lff11m2_3
  3995 00001B7B EBC8                    	jmp	short lff11m2_1
  3996                                  
  3997                                  lff11m2_7:
  3998                                  lff11s2_7:
  3999 00001B7D E978F2FFFF              	jmp	lff11_5  ; error
  4000                                  
  4001                                  load_11khz_stereo_16_bit:
  4002                                  	; 17/01/2025
  4003                                  	; 18/11/2023
  4004 00001B82 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4005                                  					; last of the file?
  4006 00001B89 7402                    	jz	short lff11s2_0		; no
  4007 00001B8B F9                      	stc
  4008 00001B8C C3                      	retn
  4009                                  
  4010                                  lff11s2_0:
  4011                                  	; 01/12/2024
  4012                                  	; edi = audio buffer address
  4013 00001B8D BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4014                                          ;mov	edx, [loadsize]
  4015                                  
  4016                                  	; esi = buffer address
  4017                                  	;; edx = buffer size
  4018                                  
  4019                                  	; load file into memory
  4020                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001B92 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001B98 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001B9A 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001BA0 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001BA5 CD40                <1>  int 40h
  4021 00001BA7 72D4                    	jc	short lff11s2_7 ; error !
  4022                                  
  4023                                  	; 01/12/2024
  4024 00001BA9 A3[7C810000]            	mov	[count], eax
  4025                                  	;;;
  4026                                  	; 07/12/2024
  4027                                  	;mov	edi, audio_buffer
  4028                                  	;;;
  4029 00001BAE C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  4030 00001BB1 750A                    	jnz	short lff11s2_8
  4031 00001BB3 E939F2FFFF              	jmp	lff11_eof
  4032                                  
  4033                                  lff11m2_3:
  4034                                  lff11s2_3:
  4035 00001BB8 E91CF2FFFF              	jmp	lff11_3	; padfill
  4036                                  		; (put zeros in the remain words of the buffer)
  4037                                  
  4038                                  lff11s2_8:
  4039 00001BBD 89C1                    	mov	ecx, eax	; dword count
  4040                                  lff11s2_9:
  4041 00001BBF BD06000000              	mov	ebp, 6 ; interpolation (one step) loop count
  4042                                  lff11s2_1:
  4043                                  	; 5:4:4::5:4:4::5:4:4::5:4:4::5:4:4::5:4  ; 74/17
  4044 00001BC4 66AD                    	lodsw
  4045 00001BC6 89C3                    	mov	ebx, eax
  4046 00001BC8 66AD                    	lodsw
  4047 00001BCA 8B16                    	mov	edx, [esi]
  4048                                  	; 17/01/2025
  4049                                  	;mov	[next_val_l], edx
  4050                                  	; 26/11/2023
  4051                                  	;shr	edx, 16
  4052                                  	;mov	[next_val_r], dx
  4053 00001BCC 49                      	dec	ecx
  4054 00001BCD 7502                    	jnz	short lff11s2_2_1
  4055 00001BCF 31D2                    	xor	edx, edx ; 0
  4056                                  	;mov	[next_val_l], dx
  4057                                  	;mov	[next_val_r], dx
  4058                                  lff11s2_2_1:
  4059                                  	; bx = [previous_val_l]
  4060                                  	; ax = [previous_val_r]
  4061                                  	; [next_val_l]
  4062                                  	; dx = [next_val_r]
  4063                                  	;;;
  4064                                  	; 17/01/2025 (BugFix)
  4065 00001BD1 8915[9C240000]          	mov	[next_val_l], edx
  4066                                  	;;;
  4067 00001BD7 E837070000              	call	interpolating_5_16bit_stereo
  4068 00001BDC E3DA                    	jecxz	lff11s2_3
  4069                                  lff11s2_2_2:
  4070 00001BDE 66AD                    	lodsw
  4071 00001BE0 89C3                    	mov	ebx, eax
  4072 00001BE2 66AD                    	lodsw
  4073 00001BE4 8B16                    	mov	edx, [esi]
  4074                                  	; 17/01/2025
  4075                                  	;mov	[next_val_l], dx
  4076                                  	; 26/11/2023
  4077                                  	;shr	edx, 16
  4078                                  	;mov	[next_val_r], dx
  4079 00001BE6 49                      	dec	ecx
  4080 00001BE7 7502                    	jnz	short lff11s2_2_3
  4081 00001BE9 31D2                    	xor	edx, edx ; 0
  4082                                  	;mov	[next_val_l], dx
  4083                                  	;mov	[next_val_r], dx
  4084                                  lff11s2_2_3:
  4085                                  	;;;
  4086                                  	; 17/01/2025 (BugFix)
  4087 00001BEB 8915[9C240000]          	mov	[next_val_l], edx
  4088                                  	;;;
  4089 00001BF1 E825080000              	call	interpolating_4_16bit_stereo
  4090 00001BF6 E3C0                    	jecxz	lff11s2_3
  4091                                  	
  4092 00001BF8 4D                      	dec	ebp
  4093 00001BF9 74C4                    	jz	short lff11s2_9
  4094                                  
  4095 00001BFB 66AD                    	lodsw
  4096 00001BFD 89C3                    	mov	ebx, eax
  4097 00001BFF 66AD                    	lodsw
  4098 00001C01 8B16                    	mov	edx, [esi]
  4099                                  	; 17/01/2025
  4100                                  	;mov	[next_val_l], dx
  4101                                  	; 26/11/2023
  4102                                  	;shr	edx, 16
  4103                                  	;mov	[next_val_r], dx
  4104 00001C03 49                      	dec	ecx
  4105 00001C04 7502                    	jnz	short lff11s2_2_4
  4106 00001C06 31D2                    	xor	edx, edx ; 0
  4107                                  	;mov	[next_val_l], dx
  4108                                  	;mov	[next_val_r], dx
  4109                                  lff11s2_2_4:
  4110                                  	;;;
  4111                                  	; 17/01/2025 (BugFix)
  4112 00001C08 8915[9C240000]          	mov	[next_val_l], edx
  4113                                  	;;;
  4114 00001C0E E808080000               	call	interpolating_4_16bit_stereo
  4115 00001C13 E3A3                    	jecxz	lff11s2_3
  4116 00001C15 EBAD                    	jmp	short lff11s2_1
  4117                                  
  4118                                  ; .....................
  4119                                  
  4120                                  load_44khz_mono_8_bit:
  4121                                  	; 02/02/2025
  4122                                  	; 18/11/2023
  4123 00001C17 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4124                                  					; last of the file?
  4125 00001C1E 7402                    	jz	short lff44m_0		; no
  4126 00001C20 F9                      	stc
  4127 00001C21 C3                      	retn
  4128                                  
  4129                                  lff44m_0:
  4130                                  	; 01/12/2024
  4131                                  	; edi = audio buffer address
  4132 00001C22 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4133                                          ;mov	edx, [loadsize]
  4134                                  
  4135                                  	; esi = buffer address
  4136                                  	;; edx = buffer size
  4137                                  
  4138                                  	; load file into memory
  4139                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001C27 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001C2D 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001C2F 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001C35 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001C3A CD40                <1>  int 40h
  4140 00001C3C 7250                    	jc	short lff44m_7 ; error !
  4141                                  
  4142                                  	; 01/12/2024
  4143 00001C3E A3[7C810000]            	mov	[count], eax
  4144                                  	;;;
  4145                                  	; 07/12/2024
  4146                                  	;mov	edi, audio_buffer
  4147                                  	;;;
  4148 00001C43 21C0                    	and	eax, eax
  4149 00001C45 7505                    	jnz	short lff44m_8
  4150 00001C47 E9A5F1FFFF              	jmp	lff44_eof
  4151                                  
  4152                                  lff44m_8:
  4153 00001C4C 89C1                    	mov	ecx, eax	; byte count
  4154                                  lff44m_9:
  4155 00001C4E BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4156 00001C53 C605[A0240000]02        	mov	byte [faz], 2  ; 2 steps/phases
  4157                                  lff44m_1:
  4158                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4159                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4160 00001C5A AC                      	lodsb
  4161                                  	; 02/02/2025
  4162 00001C5B 8A16                    	mov	dl, [esi]
  4163 00001C5D 49                      	dec	ecx
  4164 00001C5E 7502                    	jnz	short lff44m_2_1
  4165 00001C60 B280                    	mov	dl, 80h
  4166                                  lff44m_2_1:	
  4167                                  	; al = [previous_val]
  4168                                  	; dl = [next_val]
  4169 00001C62 E871030000              	call	interpolating_2_8bit_mono
  4170 00001C67 E320                    	jecxz	lff44m_3
  4171                                  lff44m_2_2:
  4172 00001C69 AC                      	lodsb
  4173 00001C6A 2C80                    	sub	al, 80h
  4174 00001C6C 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4175 00001C70 66AB                    	stosw		; (L)
  4176 00001C72 66AB                    	stosw		; (R)
  4177                                  
  4178 00001C74 49                      	dec	ecx
  4179 00001C75 7412                    	jz	short lff44m_3
  4180 00001C77 4D                      	dec	ebp
  4181 00001C78 75EF                    	jnz	short lff44m_2_2
  4182                                  	
  4183 00001C7A FE0D[A0240000]          	dec	byte [faz]
  4184 00001C80 74CC                    	jz	short lff44m_9
  4185 00001C82 BD0B000000              	mov	ebp, 11
  4186 00001C87 EBD1                    	jmp	short lff44m_1
  4187                                  
  4188                                  lff44m_3:
  4189                                  lff44s_3:
  4190 00001C89 E94BF1FFFF              	jmp	lff44_3	; padfill
  4191                                  		; (put zeros in the remain words of the buffer)
  4192                                  lff44m_7:
  4193                                  lff44s_7:
  4194 00001C8E E967F1FFFF              	jmp	lff44_5  ; error
  4195                                  
  4196                                  load_44khz_stereo_8_bit:
  4197                                  	; 02/02/2025
  4198                                  	; 16/11/2023
  4199 00001C93 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4200                                  					; last of the file?
  4201 00001C9A 7402                    	jz	short lff44s_0		; no
  4202 00001C9C F9                      	stc
  4203 00001C9D C3                      	retn
  4204                                  
  4205                                  lff44s_0:
  4206                                  	; 01/12/2024
  4207                                  	; edi = audio buffer address
  4208 00001C9E BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4209                                          ;mov	edx, [loadsize]
  4210                                  
  4211                                  	; esi = buffer address
  4212                                  	;; edx = buffer size
  4213                                  
  4214                                  	; load file into memory
  4215                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001CA3 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001CA9 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001CAB 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001CB1 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001CB6 CD40                <1>  int 40h
  4216 00001CB8 72D4                    	jc	short lff44s_7 ; error !
  4217                                  
  4218                                  	; 01/12/2024
  4219 00001CBA A3[7C810000]            	mov	[count], eax
  4220                                  	;;;
  4221                                  	; 07/12/2024
  4222                                  	;mov	edi, audio_buffer
  4223                                  	;;;
  4224 00001CBF D1E8                    	shr	eax, 1
  4225 00001CC1 7505                    	jnz	short lff44s_8
  4226 00001CC3 E929F1FFFF              	jmp	lff44_eof
  4227                                  
  4228                                  lff44s_8:
  4229 00001CC8 89C1                    	mov	ecx, eax	; word count
  4230                                  lff44s_9:
  4231 00001CCA BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4232 00001CCF C605[A0240000]02        	mov	byte [faz], 2  ; 2 steps/phase
  4233                                  lff44s_1:
  4234                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4235                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4236 00001CD6 66AD                    	lodsw
  4237                                  	; 02/02/2025
  4238 00001CD8 668B16                  	mov	dx, [esi]
  4239 00001CDB 49                      	dec	ecx
  4240 00001CDC 7504                    	jnz	short lff44s_2_1
  4241 00001CDE 66BA8080                	mov	dx, 8080h
  4242                                  lff44s_2_1:	
  4243                                  	; al = [previous_val_l]
  4244                                  	; ah = [previous_val_r]
  4245                                  	; dl = [next_val_l]
  4246                                  	; dh = [next_val_r]
  4247 00001CE2 E80E030000              	call	interpolating_2_8bit_stereo
  4248 00001CE7 E3A0                    	jecxz	lff44s_3
  4249                                  lff44s_2_2:
  4250 00001CE9 AC                      	lodsb
  4251 00001CEA 2C80                    	sub	al, 80h
  4252 00001CEC 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4253 00001CF0 66AB                    	stosw		; (L)
  4254 00001CF2 AC                      	lodsb
  4255 00001CF3 2C80                    	sub	al, 80h
  4256 00001CF5 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4257 00001CF9 66AB                    	stosw		; (R)
  4258                                  
  4259 00001CFB 49                      	dec	ecx
  4260 00001CFC 748B                    	jz	short lff44s_3
  4261 00001CFE 4D                      	dec	ebp
  4262 00001CFF 75E8                    	jnz	short lff44s_2_2
  4263                                  	
  4264 00001D01 FE0D[A0240000]          	dec	byte [faz]
  4265 00001D07 74C1                    	jz	short lff44s_9
  4266 00001D09 BD0B000000              	mov	ebp, 11
  4267 00001D0E EBC6                    	jmp	short lff44s_1
  4268                                  
  4269                                  load_44khz_mono_16_bit:
  4270                                  	; 02/02/2025
  4271                                  	; 18/11/2023
  4272 00001D10 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4273                                  					; last of the file?
  4274 00001D17 7402                    	jz	short lff44m2_0		; no
  4275 00001D19 F9                      	stc
  4276 00001D1A C3                      	retn
  4277                                  
  4278                                  lff44m2_0:
  4279                                  	; 01/12/2024
  4280                                  	; edi = audio buffer address
  4281 00001D1B BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4282                                          ;mov	edx, [loadsize]
  4283                                  
  4284                                  	; esi = buffer address
  4285                                  	;; edx = buffer size
  4286                                  
  4287                                  	; load file into memory
  4288                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001D20 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001D26 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001D28 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001D2E B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001D33 CD40                <1>  int 40h
  4289 00001D35 724D                    	jc	short lff44m2_7 ; error !
  4290                                  
  4291                                  	; 01/12/2024
  4292 00001D37 A3[7C810000]            	mov	[count], eax
  4293                                  	;;;
  4294                                  	; 07/12/2024
  4295                                  	;mov	edi, audio_buffer
  4296                                  	;;;
  4297 00001D3C D1E8                    	shr	eax, 1
  4298 00001D3E 7505                    	jnz	short lff44m2_8
  4299 00001D40 E9ACF0FFFF              	jmp	lff44_eof
  4300                                  
  4301                                  lff44m2_8:
  4302 00001D45 89C1                    	mov	ecx, eax	; word count
  4303                                  lff44m2_9:
  4304 00001D47 BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4305 00001D4C C605[A0240000]02        	mov	byte [faz], 2  ; 2 steps/phases
  4306                                  lff44m2_1:
  4307                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4308                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4309 00001D53 66AD                    	lodsw
  4310                                  	; 02/02/2025
  4311 00001D55 668B16                  	mov	dx, [esi]
  4312 00001D58 49                      	dec	ecx
  4313 00001D59 7502                    	jnz	short lff44m2_2_1
  4314 00001D5B 31D2                    	xor	edx, edx
  4315                                  lff44m2_2_1:	
  4316                                  	; ax = [previous_val]
  4317                                  	; dx = [next_val]
  4318 00001D5D E857030000              	call	interpolating_2_16bit_mono
  4319 00001D62 E31B                    	jecxz	lff44m2_3
  4320                                  lff44m2_2_2:
  4321 00001D64 66AD                    	lodsw
  4322 00001D66 66AB                    	stosw		; (L)eft Channel
  4323 00001D68 66AB                    	stosw		; (R)ight Channel
  4324                                  
  4325 00001D6A 49                      	dec	ecx
  4326 00001D6B 7412                    	jz	short lff44m2_3
  4327 00001D6D 4D                      	dec	ebp
  4328 00001D6E 75F4                    	jnz	short lff44m2_2_2
  4329                                  	
  4330 00001D70 FE0D[A0240000]          	dec	byte [faz]
  4331 00001D76 74CF                    	jz	short lff44m2_9
  4332 00001D78 BD0B000000              	mov	ebp, 11
  4333 00001D7D EBD4                    	jmp	short lff44m2_1
  4334                                  
  4335                                  lff44m2_3:
  4336                                  lff44s2_3:
  4337 00001D7F E955F0FFFF              	jmp	lff44_3	; padfill
  4338                                  		; (put zeros in the remain words of the buffer)
  4339                                  lff44m2_7:
  4340                                  lff44s2_7:
  4341 00001D84 E971F0FFFF              	jmp	lff44_5  ; error
  4342                                  
  4343                                  load_44khz_stereo_16_bit:
  4344                                  	; 18/11/2023
  4345 00001D89 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4346                                  					; last of the file?
  4347 00001D90 7402                    	jz	short lff44s2_0		; no
  4348 00001D92 F9                      	stc
  4349 00001D93 C3                      	retn
  4350                                  
  4351                                  lff44s2_0:
  4352                                  	; 01/12/2024
  4353                                  	; edi = audio buffer address
  4354 00001D94 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4355                                          ;mov	edx, [loadsize]
  4356                                  
  4357                                  	; esi = buffer address
  4358                                  	;; edx = buffer size
  4359                                  
  4360                                  	; load file into memory
  4361                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001D99 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001D9F 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001DA1 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001DA7 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001DAC CD40                <1>  int 40h
  4362 00001DAE 72D4                    	jc	short lff44s2_7 ; error !
  4363                                  
  4364                                  	; 01/12/2024
  4365 00001DB0 A3[7C810000]            	mov	[count], eax
  4366                                  	;;;
  4367                                  	; 07/12/2024
  4368                                  	;mov	edi, audio_buffer
  4369                                  	;;;
  4370 00001DB5 C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  4371 00001DB8 7505                    	jnz	short lff44s2_8
  4372 00001DBA E932F0FFFF              	jmp	lff44_eof
  4373                                  
  4374                                  lff44s2_8:
  4375 00001DBF 89C1                    	mov	ecx, eax	; dword count
  4376                                  lff44s2_9:
  4377 00001DC1 BD0A000000              	mov	ebp, 10 ; interpolation (one step) loop count
  4378 00001DC6 C605[A0240000]02        	mov	byte [faz], 2  ; 2 steps/phase
  4379                                  lff44s2_1:
  4380                                  	; 2:1:1:1:1:1:1:1:1:1:1::	; 25/23
  4381                                  	; 2:1:1:1:1:1:1:1:1:1:1:1
  4382 00001DCD 66AD                    	lodsw
  4383 00001DCF 89C3                    	mov	ebx, eax
  4384 00001DD1 66AD                    	lodsw
  4385                                  	;mov	dx, [esi]
  4386                                  	;mov	[next_val_l], dx
  4387                                  	;mov	dx, [esi+2]
  4388                                  	; 26/11/2023
  4389 00001DD3 8B16                    	mov	edx, [esi]
  4390 00001DD5 668915[9C240000]        	mov	[next_val_l], dx
  4391 00001DDC C1EA10                  	shr	edx, 16
  4392 00001DDF 49                      	dec	ecx
  4393 00001DE0 7509                    	jnz	short lff44s2_2_1
  4394 00001DE2 31D2                    	xor	edx, edx ; 0
  4395 00001DE4 668915[9C240000]        	mov	[next_val_l], dx
  4396                                  lff44s2_2_1:
  4397                                  	; bx = [previous_val_l]
  4398                                  	; ax = [previous_val_r]
  4399                                  	; [next_val_l]
  4400                                  	; dx = [next_val_r]
  4401 00001DEB E8E1020000              	call	interpolating_2_16bit_stereo
  4402 00001DF0 E38D                    	jecxz	lff44s2_3
  4403                                  lff44s2_2_2:
  4404                                  	;movsw		; (L)eft Channel
  4405                                  	;movsw		; (R)ight Channel
  4406 00001DF2 A5                      	movsd
  4407                                  
  4408 00001DF3 49                      	dec	ecx
  4409 00001DF4 7489                    	jz	short lff44s2_3	
  4410 00001DF6 4D                      	dec	ebp
  4411 00001DF7 75F9                    	jnz	short lff44s2_2_2
  4412                                  	
  4413 00001DF9 FE0D[A0240000]          	dec	byte [faz]
  4414 00001DFF 74C0                    	jz	short lff44s2_9 
  4415 00001E01 BD0B000000              	mov	ebp, 11
  4416 00001E06 EBC5                    	jmp	short lff44s2_1
  4417                                  
  4418                                  ; .....................
  4419                                  
  4420                                  	; 02/02/2025
  4421                                  load_12khz_mono_8_bit:
  4422 00001E08 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4423                                  					; last of the file?
  4424 00001E0F 7402                    	jz	short lff12m_0		; no
  4425 00001E11 F9                      	stc
  4426 00001E12 C3                      	retn
  4427                                  
  4428                                  lff12m_0:
  4429                                  	; edi = audio buffer address
  4430 00001E13 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4431                                  
  4432                                  	; load file into memory
  4433                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001E18 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001E1E 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001E20 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001E26 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001E2B CD40                <1>  int 40h
  4434 00001E2D 7256                    	jc	short lff12m_7 ; error !
  4435                                  
  4436 00001E2F A3[7C810000]            	mov	[count], eax
  4437                                  
  4438 00001E34 21C0                    	and	eax, eax
  4439 00001E36 7505                    	jnz	short lff12m_8
  4440 00001E38 E9B4EFFFFF              	jmp	lff12_eof
  4441                                  
  4442                                  lff12m_8:
  4443 00001E3D 89C1                    	mov	ecx, eax		; byte count
  4444                                  lff12m_1:
  4445                                  	; original-interpolated-interpolated-interpolated
  4446 00001E3F AC                      	lodsb
  4447                                  	; 02/02/2025
  4448 00001E40 8A16                    	mov	dl, [esi]
  4449 00001E42 49                      	dec	ecx
  4450 00001E43 7502                    	jnz	short lff12m_2
  4451 00001E45 B280                    	mov	dl, 80h
  4452                                  lff12m_2:	
  4453                                  	; al = [previous_val]
  4454                                  	; dl = [next_val]
  4455 00001E47 E8C0030000               	call	interpolating_4_8bit_mono
  4456 00001E4C E353                    	jecxz	lff12m_3
  4457 00001E4E EBEF                    	jmp	short lff12m_1
  4458                                  
  4459                                  	; 02/02/2025
  4460                                  load_12khz_stereo_8_bit:
  4461 00001E50 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4462                                  					; last of the file?
  4463 00001E57 7402                    	jz	short lff12s_0		; no
  4464 00001E59 F9                      	stc
  4465 00001E5A C3                      	retn
  4466                                  
  4467                                  lff12s_0:
  4468                                  	; edi = audio buffer address
  4469 00001E5B BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4470                                  
  4471                                  	; load file into memory
  4472                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001E60 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001E66 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001E68 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001E6E B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001E73 CD40                <1>  int 40h
  4473 00001E75 720E                    	jc	short lff12s_7 ; error !
  4474                                  
  4475 00001E77 A3[7C810000]            	mov	[count], eax
  4476                                  
  4477 00001E7C D1E8                    	shr	eax, 1
  4478 00001E7E 750A                    	jnz	short lff12s_8
  4479 00001E80 E96CEFFFFF              	jmp	lff12_eof
  4480                                  
  4481                                  lff12m_7:
  4482                                  lff12s_7:
  4483 00001E85 E970EFFFFF              	jmp	lff12_5  ; error
  4484                                  
  4485                                  lff12s_8:
  4486 00001E8A 89C1                    	mov	ecx, eax	; word count
  4487                                  lff12s_1:
  4488                                  	; original-interpolated-interpolated-interpolated
  4489 00001E8C 66AD                    	lodsw
  4490                                  	; 02/02/2025
  4491 00001E8E 668B16                  	mov	dx, [esi]
  4492 00001E91 49                      	dec	ecx
  4493 00001E92 7504                    	jnz	short lff12s_2
  4494 00001E94 66BA8080                	mov	dx, 8080h
  4495                                  lff12s_2:	
  4496                                  	; al = [previous_val_l]
  4497                                  	; ah = [previous_val_r]
  4498                                  	; dl = [next_val_l]
  4499                                  	; dh = [next_val_r]
  4500 00001E98 E8AE030000              	call	interpolating_4_8bit_stereo
  4501 00001E9D E302                    	jecxz	lff12s_3
  4502 00001E9F EBEB                    	jmp	short lff12s_1
  4503                                  
  4504                                  lff12m_3:
  4505                                  lff12s_3:
  4506 00001EA1 E933EFFFFF              	jmp	lff12_3	; padfill
  4507                                  		; (put zeros in the remain words of the buffer)
  4508                                  
  4509                                  	; 02/02/2025
  4510                                  load_12khz_mono_16_bit:
  4511 00001EA6 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4512                                  					; last of the file?
  4513 00001EAD 7402                    	jz	short lff12m2_0		; no
  4514 00001EAF F9                      	stc
  4515 00001EB0 C3                      	retn
  4516                                  
  4517                                  lff12m2_0:
  4518                                  	; edi = audio buffer address
  4519 00001EB1 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4520                                  
  4521                                  	; load file into memory
  4522                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001EB6 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001EBC 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001EBE 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001EC4 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001EC9 CD40                <1>  int 40h
  4523 00001ECB 7223                    	jc	short lff12m2_7 ; error !
  4524                                  
  4525 00001ECD A3[7C810000]            	mov	[count], eax
  4526                                  
  4527 00001ED2 D1E8                    	shr	eax, 1
  4528 00001ED4 7505                    	jnz	short lff12m2_8
  4529 00001ED6 E916EFFFFF              	jmp	lff12_eof
  4530                                  
  4531                                  lff12m2_8:
  4532 00001EDB 89C1                    	mov	ecx, eax	; word count
  4533                                  lff12m2_1:
  4534                                  	; original-interpolated-interpolated-interpolated
  4535 00001EDD 66AD                    	lodsw
  4536                                  	; 02/02/2025
  4537 00001EDF 668B16                  	mov	dx, [esi]
  4538 00001EE2 49                      	dec	ecx
  4539 00001EE3 7502                    	jnz	short lff12m2_2
  4540 00001EE5 31D2                    	xor	edx, edx
  4541                                  lff12m2_2:	
  4542                                  	; ax = [previous_val]
  4543                                  	; dx = [next_val]
  4544 00001EE7 E8F6040000               	call	interpolating_4_16bit_mono
  4545 00001EEC E3B3                    	jecxz	lff12m_3
  4546 00001EEE EBED                    	jmp	short lff12m2_1
  4547                                  
  4548                                  lff12m2_7:
  4549                                  lff12s2_7:
  4550 00001EF0 E905EFFFFF              	jmp	lff12_5  ; error
  4551                                  
  4552                                  	; 02/02/2025
  4553                                  load_12khz_stereo_16_bit:
  4554 00001EF5 F605[F6800000]01                test    byte [flags], ENDOFFILE	; have we already read the
  4555                                  					; last of the file?
  4556 00001EFC 7402                    	jz	short lff12s2_0		; no
  4557 00001EFE F9                      	stc
  4558 00001EFF C3                      	retn
  4559                                  
  4560                                  lff12s2_0:
  4561                                  	; edi = audio buffer address
  4562 00001F00 BE[00900100]            	mov	esi, temp_buffer ; temporary buffer for wav data
  4563                                  
  4564                                  	; load file into memory
  4565                                  	sys 	_read, [filehandle], esi, [loadsize]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00001F05 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 00001F0B 89F1                <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00001F0D 8B15[6C810000]      <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00001F13 B803000000          <1>  mov eax, %1
    97                              <1> 
    98 00001F18 CD40                <1>  int 40h
  4566 00001F1A 72D4                    	jc	short lff12s2_7 ; error !
  4567                                  
  4568 00001F1C A3[7C810000]            	mov	[count], eax
  4569                                  
  4570 00001F21 C1E802                  	shr	eax, 2	; dword (left chan word + right chan word)
  4571 00001F24 750A                    	jnz	short lff12s2_8
  4572 00001F26 E9C6EEFFFF              	jmp	lff12_eof
  4573                                  
  4574                                  lff12m2_3:
  4575                                  lff12s2_3:
  4576 00001F2B E9A9EEFFFF              	jmp	lff12_3	; padfill
  4577                                  		; (put zeros in the remain words of the buffer)
  4578                                  
  4579                                  lff12s2_8:
  4580 00001F30 89C1                    	mov	ecx, eax	; dword count
  4581                                  lff12s2_1:
  4582                                  	; original-interpolated-interpolated-interpolated
  4583 00001F32 66AD                    	lodsw
  4584 00001F34 89C3                    	mov	ebx, eax
  4585 00001F36 66AD                    	lodsw
  4586 00001F38 8B16                    	mov	edx, [esi]
  4587 00001F3A 49                      	dec	ecx
  4588 00001F3B 7502                    	jnz	short lff12s2_2
  4589 00001F3D 31D2                    	xor	edx, edx ; 0
  4590                                  lff12s2_2:
  4591                                  	;mov	[next_val_l], dx
  4592                                  	;shr	edx, 16
  4593                                  	;mov	[next_val_r], dx
  4594                                  	; 02/02/2025
  4595 00001F3F 8915[9C240000]          	mov	[next_val_l], edx
  4596                                  
  4597                                  	; bx = [previous_val_l]
  4598                                  	; ax = [previous_val_r]
  4599                                  	; [next_val_l]
  4600                                  	; [next_val_r]
  4601 00001F45 E8D1040000              	call	interpolating_4_16bit_stereo
  4602 00001F4A E3DF                    	jecxz	lff12s2_3
  4603 00001F4C EBE4                    	jmp	short lff12s2_1
  4604                                  
  4605                                  ; .....................
  4606                                  
  4607                                  interpolating_3_8bit_mono:
  4608                                  	; 02/02/2025
  4609                                  	; 16/11/2023
  4610                                  	; al = [previous_val]
  4611                                  	; dl = [next_val]
  4612                                  	; original-interpolated-interpolated
  4613 00001F4E 88C3                    	mov	bl, al
  4614 00001F50 2C80                    	sub	al, 80h
  4615 00001F52 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4616 00001F56 66AB                    	stosw		; original sample (L)
  4617 00001F58 66AB                    	stosw		; original sample (R)
  4618 00001F5A 88D8                    	mov	al, bl
  4619 00001F5C 00D0                    	add	al, dl
  4620 00001F5E D0D8                    	rcr	al, 1
  4621 00001F60 88C7                    	mov	bh, al	; interpolated middle (temporary)
  4622 00001F62 00D8                    	add	al, bl
  4623 00001F64 D0D8                    	rcr	al, 1
  4624 00001F66 2C80                    	sub	al, 80h
  4625 00001F68 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4626 00001F6C 66AB                    	stosw		; interpolated sample 1 (L)
  4627 00001F6E 66AB                    	stosw		; interpolated sample 1 (R)
  4628 00001F70 88F8                    	mov	al, bh
  4629 00001F72 00D0                    	add	al, dl	; [next_val]
  4630 00001F74 D0D8                    	rcr	al, 1
  4631                                  	; 02/02/2025
  4632 00001F76 2C80                    	sub	al, 80h
  4633 00001F78 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4634 00001F7C 66AB                    	stosw		; interpolated sample 2 (L)
  4635 00001F7E 66AB                    	stosw		; interpolated sample 2 (R)
  4636 00001F80 C3                      	retn
  4637                                  
  4638                                  interpolating_3_8bit_stereo:
  4639                                  	; 02/02/2025
  4640                                  	; 16/11/2023
  4641                                  	; al = [previous_val_l]
  4642                                  	; ah = [previous_val_r]
  4643                                  	; dl = [next_val_l]
  4644                                  	; dh = [next_val_r]	
  4645                                  	; original-interpolated-interpolated
  4646 00001F81 89C3                    	mov	ebx, eax
  4647 00001F83 2C80                    	sub	al, 80h
  4648 00001F85 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4649 00001F89 66AB                    	stosw		; original sample (L)
  4650 00001F8B 88F8                    	mov	al, bh
  4651 00001F8D 2C80                    	sub	al, 80h
  4652 00001F8F 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4653 00001F93 66AB                    	stosw		; original sample (R)
  4654 00001F95 88D8                    	mov	al, bl
  4655 00001F97 00D0                    	add	al, dl	; [next_val_l]
  4656 00001F99 D0D8                    	rcr	al, 1
  4657 00001F9B 50                      	push	eax ; *	; al = interpolated middle (L) (temporary)
  4658 00001F9C 00D8                    	add	al, bl	; [previous_val_l]
  4659 00001F9E D0D8                    	rcr	al, 1
  4660 00001FA0 2C80                    	sub	al, 80h
  4661 00001FA2 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4662 00001FA6 66AB                    	stosw		; interpolated sample 1 (L)
  4663 00001FA8 88F8                    	mov	al, bh
  4664 00001FAA 00F0                    	add	al, dh	; [next_val_r]
  4665 00001FAC D0D8                    	rcr	al, 1
  4666 00001FAE 50                      	push	eax ; ** ; al = interpolated middle (R) (temporary)
  4667 00001FAF 00F8                    	add	al, bh	; [previous_val_r]
  4668 00001FB1 D0D8                    	rcr	al, 1
  4669 00001FB3 2C80                    	sub	al, 80h
  4670 00001FB5 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4671 00001FB9 66AB                    	stosw		; interpolated sample 1 (R)
  4672 00001FBB 5B                      	pop	ebx ; **
  4673 00001FBC 58                      	pop	eax ; *
  4674 00001FBD 00D0                    	add	al, dl	; [next_val_l]
  4675 00001FBF D0D8                    	rcr	al, 1
  4676                                  	; 02/02/2025
  4677 00001FC1 2C80                    	sub	al, 80h
  4678 00001FC3 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4679 00001FC7 66AB                    	stosw		; interpolated sample 2 (L)
  4680 00001FC9 88D8                    	mov	al, bl
  4681 00001FCB 00F0                    	add	al, dh	; [next_val_r]
  4682 00001FCD D0D8                    	rcr	al, 1
  4683                                  	; 02/02/2025
  4684 00001FCF 2C80                    	sub	al, 80h
  4685 00001FD1 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4686 00001FD5 66AB                    	stosw		; interpolated sample 2 (R)
  4687 00001FD7 C3                      	retn
  4688                                  
  4689                                  interpolating_2_8bit_mono:
  4690                                  	; 16/11/2023
  4691                                  	; al = [previous_val]
  4692                                  	; dl = [next_val]
  4693                                  	; original-interpolated
  4694 00001FD8 88C3                    	mov	bl, al
  4695 00001FDA 2C80                    	sub	al, 80h
  4696 00001FDC 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4697 00001FE0 66AB                    	stosw		; original sample (L)
  4698 00001FE2 66AB                    	stosw		; original sample (R)
  4699 00001FE4 88D8                    	mov	al, bl
  4700 00001FE6 00D0                    	add	al, dl
  4701 00001FE8 D0D8                    	rcr	al, 1
  4702 00001FEA 2C80                    	sub	al, 80h
  4703 00001FEC 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4704 00001FF0 66AB                    	stosw		; interpolated sample (L)
  4705 00001FF2 66AB                    	stosw		; interpolated sample (R)
  4706 00001FF4 C3                      	retn
  4707                                  
  4708                                  interpolating_2_8bit_stereo:
  4709                                  	; 16/11/2023
  4710                                  	; al = [previous_val_l]
  4711                                  	; ah = [previous_val_r]
  4712                                  	; dl = [next_val_l]
  4713                                  	; dh = [next_val_r]
  4714                                  	; original-interpolated
  4715 00001FF5 89C3                    	mov	ebx, eax
  4716 00001FF7 2C80                    	sub	al, 80h
  4717 00001FF9 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4718 00001FFD 66AB                    	stosw		; original sample (L)
  4719 00001FFF 88F8                    	mov	al, bh
  4720 00002001 2C80                    	sub	al, 80h
  4721 00002003 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4722 00002007 66AB                    	stosw		; original sample (R)
  4723 00002009 88D8                    	mov	al, bl	; [previous_val_l]
  4724 0000200B 00D0                    	add	al, dl	; [next_val_l]
  4725 0000200D D0D8                    	rcr	al, 1
  4726 0000200F 2C80                    	sub	al, 80h
  4727 00002011 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4728 00002015 66AB                    	stosw		; interpolated sample (L)
  4729 00002017 88F8                    	mov	al, bh
  4730 00002019 00F0                    	add	al, dh	; [next_val_r]
  4731 0000201B D0D8                    	rcr	al, 1
  4732 0000201D 2C80                    	sub	al, 80h
  4733 0000201F 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4734 00002023 66AB                    	stosw		; interpolated sample (R)
  4735 00002025 C3                      	retn
  4736                                  
  4737                                  interpolating_3_16bit_mono:
  4738                                  	; 16/11/2023
  4739                                  	; ax = [previous_val]
  4740                                  	; dx = [next_val]
  4741                                  	; original-interpolated-interpolated
  4742                                  
  4743 00002026 66AB                    	stosw		; original sample (L)
  4744 00002028 66AB                    	stosw		; original sample (R)
  4745 0000202A 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4746 0000202D 50                      	push	eax ; *	; [previous_val]
  4747 0000202E 80C680                  	add	dh, 80h
  4748 00002031 6601D0                  	add	ax, dx
  4749 00002034 66D1D8                  	rcr	ax, 1
  4750 00002037 5B                      	pop	ebx ; *
  4751 00002038 93                      	xchg	ebx, eax ; bx  = interpolated middle (temporary)
  4752 00002039 6601D8                  	add	ax, bx	; [previous_val] + interpolated middle
  4753 0000203C 66D1D8                  	rcr	ax, 1
  4754 0000203F 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4755 00002042 66AB                    	stosw 		; interpolated sample 1 (L)
  4756 00002044 66AB                    	stosw		; interpolated sample 1 (R)
  4757 00002046 89D8                    	mov	eax, ebx
  4758 00002048 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  4759 0000204B 66D1D8                  	rcr	ax, 1
  4760 0000204E 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4761 00002051 66AB                    	stosw		; interpolated sample 2 (L)
  4762 00002053 66AB                    	stosw		; interpolated sample 2 (R)
  4763 00002055 C3                      	retn
  4764                                  
  4765                                  interpolating_3_16bit_stereo:
  4766                                  	; 16/11/2023
  4767                                  	; bx = [previous_val_l]
  4768                                  	; ax = [previous_val_r]
  4769                                  	; [next_val_l]
  4770                                  	; dx = [next_val_r]
  4771                                  	; original-interpolated-interpolated
  4772                                  
  4773 00002056 93                      	xchg	eax, ebx
  4774 00002057 66AB                    	stosw		; original sample (L)
  4775 00002059 93                      	xchg	eax, ebx
  4776 0000205A 66AB                    	stosw		; original sample (R)
  4777 0000205C 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4778 0000205F 50                      	push	eax ; *	; [previous_val_r]
  4779 00002060 80C780                  	add	bh, 80h
  4780 00002063 8005[9D240000]80        	add	byte [next_val_l+1], 80h
  4781 0000206A 66A1[9C240000]          	mov	ax, [next_val_l]
  4782 00002070 6601D8                  	add	ax, bx	; [previous_val_l]
  4783 00002073 66D1D8                  	rcr	ax, 1
  4784 00002076 93                      	xchg	eax, ebx ; ax = [previous_val_l]
  4785 00002077 6601D8                  	add	ax, bx	; bx = interpolated middle (L)
  4786 0000207A 66D1D8                  	rcr	ax, 1
  4787 0000207D 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4788 00002080 66AB                    	stosw 		; interpolated sample 1 (L)
  4789 00002082 58                      	pop	eax  ; *
  4790 00002083 80C680                  	add	dh, 80h ; convert sound level 0 to 65535 format
  4791 00002086 52                      	push	edx  ; * ; [next_val_r]
  4792 00002087 92                      	xchg	eax, edx
  4793 00002088 6601D0                  	add	ax, dx	; [next_val_r] + [previous_val_r]
  4794 0000208B 66D1D8                  	rcr	ax, 1	; / 2
  4795 0000208E 50                      	push	eax ; ** ; interpolated middle (R)
  4796 0000208F 6601D0                  	add	ax, dx	; + [previous_val_r]
  4797 00002092 66D1D8                  	rcr	ax, 1
  4798 00002095 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4799 00002098 66AB                    	stosw 		; interpolated sample 1 (R)
  4800 0000209A 66A1[9C240000]          	mov	ax, [next_val_l]
  4801 000020A0 6601D8                  	add	ax, bx	; + interpolated middle (L)
  4802 000020A3 66D1D8                  	rcr	ax, 1
  4803 000020A6 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4804 000020A9 66AB                    	stosw 		; interpolated sample 2 (L)
  4805 000020AB 58                      	pop	eax ; **
  4806 000020AC 5A                      	pop	edx ; *
  4807 000020AD 6601D0                  	add	ax, dx	; interpolated middle + [next_val_r]
  4808 000020B0 66D1D8                  	rcr	ax, 1	; / 2
  4809 000020B3 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4810 000020B6 66AB                    	stosw 		; interpolated sample 2 (L)
  4811 000020B8 C3                      	retn
  4812                                  
  4813                                  interpolating_2_16bit_mono:
  4814                                  	; 16/11/2023
  4815                                  	; ax = [previous_val]
  4816                                  	; dx = [next_val]
  4817                                  	; original-interpolated
  4818                                  
  4819 000020B9 66AB                    	stosw		; original sample (L)
  4820 000020BB 66AB                    	stosw		; original sample (R)
  4821 000020BD 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4822 000020C0 80C680                  	add	dh, 80h
  4823 000020C3 6601D0                  	add	ax, dx
  4824 000020C6 66D1D8                  	rcr	ax, 1
  4825 000020C9 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4826 000020CC 66AB                    	stosw		; interpolated sample (L)
  4827 000020CE 66AB                    	stosw		; interpolated sample (R)
  4828 000020D0 C3                      	retn
  4829                                  
  4830                                  interpolating_2_16bit_stereo:
  4831                                  	; 17/01/2025
  4832                                  	; 16/11/2023
  4833                                  	; bx = [previous_val_l]
  4834                                  	; ax = [previous_val_r]
  4835                                  	; [next_val_l]
  4836                                  	; dx = [next_val_r]
  4837                                  	; original-interpolated
  4838                                  
  4839 000020D1 93                      	xchg	eax, ebx
  4840 000020D2 66AB                    	stosw		; original sample (L)
  4841 000020D4 93                      	xchg	eax, ebx
  4842 000020D5 66AB                    	stosw		; original sample (R)
  4843 000020D7 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  4844 000020DA 80C680                  	add	dh, 80h
  4845 000020DD 6601D0                  	add	ax, dx	; [previous_val_r] + [next_val_r]
  4846 000020E0 66D1D8                  	rcr	ax, 1	; / 2
  4847                                  	; 17/01/2025
  4848 000020E3 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4849                                  	;push	eax ; *	; interpolated sample (R)
  4850                                  	; 17/01/2025
  4851 000020E6 C1E010                  	shl	eax, 16
  4852 000020E9 66A1[9C240000]          	mov	ax, [next_val_l]
  4853 000020EF 80C480                  	add	ah, 80h
  4854 000020F2 80C780                  	add	bh, 80h
  4855 000020F5 6601D8                  	add	ax, bx	; [next_val_l] + [previous_val_l]
  4856 000020F8 66D1D8                  	rcr	ax, 1	; / 2
  4857 000020FB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  4858                                  	; 17/01/2025
  4859                                  	;stosw 		; interpolated sample (L)
  4860                                  	;pop	eax ; *
  4861                                  	;sub	ah, 80h	; -32768 to +32767 format again
  4862                                  	;stosw 		; interpolated sample (R)
  4863                                  	; 17/01/2025
  4864 000020FE AB                      	stosd
  4865 000020FF C3                      	retn
  4866                                  
  4867                                  interpolating_5_8bit_mono:
  4868                                  	; 17/11/2023
  4869                                  	; al = [previous_val]
  4870                                  	; dl = [next_val]
  4871                                  	; original-interpltd-interpltd-interpltd-interpltd
  4872 00002100 88C3                    	mov	bl, al
  4873 00002102 2C80                    	sub	al, 80h
  4874 00002104 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4875 00002108 66AB                    	stosw		; original sample (L)
  4876 0000210A 66AB                    	stosw		; original sample (R)
  4877 0000210C 88D8                    	mov	al, bl
  4878 0000210E 00D0                    	add	al, dl
  4879 00002110 D0D8                    	rcr	al, 1
  4880 00002112 88C7                    	mov	bh, al	; interpolated middle (temporary)
  4881 00002114 00D8                    	add	al, bl  ; [previous_val]
  4882 00002116 D0D8                    	rcr	al, 1
  4883 00002118 88C6                    	mov	dh, al	; interpolated 1st quarter (temporary)
  4884 0000211A 00D8                    	add	al, bl
  4885 0000211C D0D8                    	rcr	al, 1
  4886 0000211E 2C80                    	sub	al, 80h
  4887 00002120 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4888 00002124 66AB                    	stosw		; interpolated sample 1 (L)
  4889 00002126 66AB                    	stosw		; interpolated sample 1 (R)
  4890 00002128 88F8                    	mov	al, bh
  4891 0000212A 00F0                    	add	al, dh
  4892 0000212C D0D8                    	rcr	al, 1
  4893 0000212E 2C80                    	sub	al, 80h
  4894 00002130 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4895 00002134 66AB                    	stosw		; interpolated sample 2 (L)
  4896 00002136 66AB                    	stosw		; interpolated sample 2 (R)
  4897 00002138 88F8                    	mov	al, bh
  4898 0000213A 00D0                    	add	al, dl	; [next_val]
  4899 0000213C D0D8                    	rcr	al, 1
  4900 0000213E 88C6                    	mov	dh, al	; interpolated 3rd quarter (temporary)
  4901 00002140 00F8                    	add	al, bh
  4902 00002142 D0D8                    	rcr	al, 1
  4903 00002144 2C80                    	sub	al, 80h
  4904 00002146 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4905 0000214A 66AB                    	stosw		; interpolated sample 3 (L)
  4906 0000214C 66AB                    	stosw		; interpolated sample 3 (R)
  4907 0000214E 88F0                    	mov	al, dh
  4908 00002150 00D0                    	add	al, dl
  4909 00002152 D0D8                    	rcr	al, 1
  4910 00002154 2C80                    	sub	al, 80h
  4911 00002156 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4912 0000215A 66AB                    	stosw		; interpolated sample 4 (L)
  4913 0000215C 66AB                    	stosw		; interpolated sample 4 (R)
  4914 0000215E C3                      	retn
  4915                                  
  4916                                  interpolating_5_8bit_stereo:
  4917                                  	; 17/11/2023
  4918                                  	; al = [previous_val_l]
  4919                                  	; ah = [previous_val_r]
  4920                                  	; dl = [next_val_l]
  4921                                  	; dh = [next_val_r]
  4922                                  	; original-interpltd-interpltd-interpltd-interpltd
  4923 0000215F 89C3                    	mov	ebx, eax
  4924 00002161 2C80                    	sub	al, 80h
  4925 00002163 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4926 00002167 66AB                    	stosw		; original sample (L)
  4927 00002169 88F8                    	mov	al, bh
  4928 0000216B 2C80                    	sub	al, 80h
  4929 0000216D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4930 00002171 66AB                    	stosw		; original sample (R)
  4931 00002173 52                      	push	edx ; *
  4932 00002174 88D8                    	mov	al, bl
  4933 00002176 00D0                    	add	al, dl	; [next_val_l]
  4934 00002178 D0D8                    	rcr	al, 1
  4935 0000217A 50                      	push	eax ; ** ; al = interpolated middle (L) (temporary)
  4936 0000217B 00D8                    	add	al, bl	; [previous_val_l]
  4937 0000217D D0D8                    	rcr	al, 1
  4938 0000217F 86D8                    	xchg	al, bl
  4939 00002181 00D8                    	add	al, bl	; bl = interpolated 1st quarter (L) (temp)
  4940 00002183 D0D8                    	rcr	al, 1
  4941 00002185 2C80                    	sub	al, 80h
  4942 00002187 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4943 0000218B 66AB                    	stosw		; interpolated sample 1 (L)
  4944 0000218D 88F8                    	mov	al, bh
  4945 0000218F 00F0                    	add	al, dh	; [next_val_r]
  4946 00002191 D0D8                    	rcr	al, 1
  4947 00002193 50                      	push	eax ; *** ; al = interpolated middle (R) (temporary)
  4948 00002194 00F8                    	add	al, bh	; [previous_val_r]
  4949 00002196 D0D8                    	rcr	al, 1
  4950 00002198 86F8                    	xchg	al, bh
  4951 0000219A 00F8                    	add	al, bh	; bh = interpolated 1st quarter (R) (temp)
  4952 0000219C D0D8                    	rcr	al, 1
  4953 0000219E 2C80                    	sub	al, 80h
  4954 000021A0 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4955 000021A4 66AB                    	stosw		; interpolated sample 1 (R)
  4956 000021A6 5A                      	pop	edx ; ***
  4957 000021A7 58                      	pop	eax ; ** ; al = interpolated middle (L) (temporary)
  4958 000021A8 86D8                    	xchg	al, bl	; al = interpolated 1st quarter (L) (temp)
  4959 000021AA 00D8                    	add	al, bl	; bl = interpolated middle (L) (temporary)
  4960 000021AC D0D8                    	rcr	al, 1
  4961 000021AE 2C80                    	sub	al, 80h
  4962 000021B0 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4963 000021B4 66AB                    	stosw		; interpolated sample 2 (L)	
  4964 000021B6 88D0                    	mov	al, dl 	; interpolated middle (R) (temporary)
  4965 000021B8 86F8                    	xchg	al, bh	; al = interpolated 1st quarter (R) (temp)
  4966 000021BA 00F8                    	add	al, bh	; bh = interpolated middle (R) (temporary)
  4967 000021BC D0D8                    	rcr	al, 1
  4968 000021BE 2C80                    	sub	al, 80h
  4969 000021C0 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4970 000021C4 66AB                    	stosw		; interpolated sample 2 (R)
  4971 000021C6 5A                      	pop	edx ; *
  4972 000021C7 88D8                    	mov	al, bl	; interpolated middle (L) (temporary)
  4973 000021C9 00D0                    	add	al, dl	; [next_val_l]
  4974 000021CB D0D8                    	rcr	al, 1
  4975 000021CD 86D8                    	xchg	al, bl	; al = interpolated middle (R) (temporary)
  4976 000021CF 00D8                    	add	al, bl	; bl = interpolated 3rd quarter (L) (temp)
  4977 000021D1 D0D8                    	rcr	al, 1
  4978 000021D3 2C80                    	sub	al, 80h
  4979 000021D5 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4980 000021D9 66AB                    	stosw		; interpolated sample 3 (L)
  4981 000021DB 88F8                    	mov	al, bh	
  4982 000021DD 00F0                    	add	al, dh	; interpolated middle (R) + [next_val_r]
  4983 000021DF D0D8                    	rcr	al, 1
  4984 000021E1 86F8                    	xchg	al, bh	; al = interpolated middle (R)
  4985 000021E3 00F8                    	add	al, bh	; bh = interpolated 3rd quarter (R) (temp)
  4986 000021E5 D0D8                    	rcr	al, 1
  4987 000021E7 2C80                    	sub	al, 80h
  4988 000021E9 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4989 000021ED 66AB                    	stosw		; interpolated sample 3 (R)
  4990 000021EF 88D8                    	mov	al, bl
  4991 000021F1 00D0                    	add	al, dl	; [next_val_l]
  4992 000021F3 D0D8                    	rcr	al, 1
  4993 000021F5 2C80                    	sub	al, 80h
  4994 000021F7 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  4995 000021FB 66AB                    	stosw		; interpolated sample 4 (L)
  4996 000021FD 88F8                    	mov	al, bh
  4997 000021FF 00F0                    	add	al, dh	; [next_val_r]
  4998 00002201 D0D8                    	rcr	al, 1
  4999 00002203 2C80                    	sub	al, 80h
  5000 00002205 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5001 00002209 66AB                    	stosw		; interpolated sample 4 (R)
  5002 0000220B C3                      	retn
  5003                                  
  5004                                  interpolating_4_8bit_mono:
  5005                                  	; 17/11/2023
  5006                                  	; al = [previous_val]
  5007                                  	; dl = [next_val]
  5008                                  	; original-interpolated-interpolated-interpolated
  5009 0000220C 88C3                    	mov	bl, al
  5010 0000220E 2C80                    	sub	al, 80h
  5011 00002210 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5012 00002214 66AB                    	stosw		; original sample (L)
  5013 00002216 66AB                    	stosw		; original sample (R)
  5014 00002218 88D8                    	mov	al, bl
  5015 0000221A 00D0                    	add	al, dl
  5016 0000221C D0D8                    	rcr	al, 1
  5017 0000221E 86D8                    	xchg	al, bl  ; al = [previous_val]
  5018 00002220 00D8                    	add	al, bl	; bl = interpolated middle (sample 2)
  5019 00002222 D0D8                    	rcr	al, 1
  5020 00002224 2C80                    	sub	al, 80h
  5021 00002226 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5022 0000222A 66AB                    	stosw		; interpolated sample 1 (L)
  5023 0000222C 66AB                    	stosw		; interpolated sample 1 (R)
  5024 0000222E 88D8                    	mov	al, bl	; interpolated middle (sample 2)
  5025 00002230 2C80                    	sub	al, 80h
  5026 00002232 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5027 00002236 66AB                    	stosw		; interpolated sample 2 (L)
  5028 00002238 66AB                    	stosw		; interpolated sample 2 (R)
  5029 0000223A 88D8                    	mov	al, bl
  5030 0000223C 00D0                    	add	al, dl	; [next_val]
  5031 0000223E D0D8                    	rcr	al, 1
  5032 00002240 2C80                    	sub	al, 80h
  5033 00002242 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5034 00002246 66AB                    	stosw		; interpolated sample 3 (L)
  5035 00002248 66AB                    	stosw		; interpolated sample 3 (R)
  5036 0000224A C3                      	retn
  5037                                  
  5038                                  interpolating_4_8bit_stereo:
  5039                                  	; 17/11/2023
  5040                                  	; al = [previous_val_l]
  5041                                  	; ah = [previous_val_r]
  5042                                  	; dl = [next_val_l]
  5043                                  	; dh = [next_val_r]
  5044                                  	; original-interpolated-interpolated-interpolated
  5045 0000224B 89C3                    	mov	ebx, eax
  5046 0000224D 2C80                    	sub	al, 80h
  5047 0000224F 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5048 00002253 66AB                    	stosw		; original sample (L)
  5049 00002255 88F8                    	mov	al, bh
  5050 00002257 2C80                    	sub	al, 80h
  5051 00002259 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5052 0000225D 66AB                    	stosw		; original sample (R)
  5053 0000225F 88D8                    	mov	al, bl
  5054 00002261 00D0                    	add	al, dl	; [next_val_l]
  5055 00002263 D0D8                    	rcr	al, 1
  5056 00002265 86D8                    	xchg	al, bl	; al = [previous_val_l]
  5057 00002267 00D8                    	add	al, bl	; bl = interpolated middle (L) (sample 2)
  5058 00002269 D0D8                    	rcr	al, 1
  5059 0000226B 2C80                    	sub	al, 80h
  5060 0000226D 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5061 00002271 66AB                    	stosw		; interpolated sample 1 (L)
  5062 00002273 88F8                    	mov	al, bh
  5063 00002275 00F0                    	add	al, dh	; [next_val_r]
  5064 00002277 D0D8                    	rcr	al, 1
  5065 00002279 86F8                    	xchg	al, bh	; al = [previous_val_h]
  5066 0000227B 00F8                    	add	al, bh	; bh = interpolated middle (R) (sample 2)
  5067 0000227D D0D8                    	rcr	al, 1
  5068 0000227F 2C80                    	sub	al, 80h
  5069 00002281 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5070 00002285 66AB                    	stosw		; interpolated sample 1 (R)
  5071 00002287 88D8                    	mov	al, bl	; interpolated middle (L) (sample 2)
  5072 00002289 2C80                    	sub	al, 80h
  5073 0000228B 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5074 0000228F 66AB                    	stosw		; interpolated sample 2 (L)
  5075 00002291 88F8                    	mov	al, bh	; interpolated middle (L) (sample 2)
  5076 00002293 2C80                    	sub	al, 80h
  5077 00002295 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5078 00002299 66AB                    	stosw		; interpolated sample 2 (L)
  5079 0000229B 88D8                    	mov	al, bl
  5080 0000229D 00D0                    	add	al, dl	; [next_val_l]
  5081 0000229F D0D8                    	rcr	al, 1
  5082 000022A1 2C80                    	sub	al, 80h
  5083 000022A3 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5084 000022A7 66AB                    	stosw		; interpolated sample 3 (L)
  5085 000022A9 88F8                    	mov	al, bh
  5086 000022AB 00F0                    	add	al, dh	; [next_val_r]
  5087 000022AD D0D8                    	rcr	al, 1
  5088 000022AF 2C80                    	sub	al, 80h
  5089 000022B1 66C1E008                	shl	ax, 8	; convert 8 bit sample to 16 bit sample
  5090 000022B5 66AB                    	stosw		; interpolated sample 3 (R)
  5091 000022B7 C3                      	retn
  5092                                  
  5093                                  interpolating_5_16bit_mono:
  5094                                  	; 18/11/2023
  5095                                  	; ax = [previous_val]
  5096                                  	; dx = [next_val]
  5097                                  	; original-interpltd-interpltd-interpltd-interpltd
  5098 000022B8 66AB                    	stosw		; original sample (L)
  5099 000022BA 66AB                    	stosw		; original sample (R)
  5100 000022BC 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5101 000022BF 89C3                    	mov	ebx, eax ; [previous_val]
  5102 000022C1 80C680                  	add	dh, 80h
  5103 000022C4 6601D0                  	add	ax, dx
  5104 000022C7 66D1D8                  	rcr	ax, 1
  5105 000022CA 50                      	push	eax ; *	; interpolated middle (temporary)
  5106 000022CB 6601D8                  	add	ax, bx	; interpolated middle + [previous_val]
  5107 000022CE 66D1D8                  	rcr	ax, 1
  5108 000022D1 50                      	push	eax ; **	; interpolated 1st quarter (temporary)
  5109 000022D2 6601D8                  	add	ax, bx	; 1st quarter + [previous_val]
  5110 000022D5 66D1D8                  	rcr	ax, 1	
  5111 000022D8 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5112 000022DB 66AB                    	stosw 		; interpolated sample 1 (L)
  5113 000022DD 66AB                    	stosw		; interpolated sample 1 (R)
  5114 000022DF 58                      	pop	eax ; **
  5115 000022E0 5B                      	pop	ebx ; *
  5116 000022E1 6601D8                  	add	ax, bx	; 1st quarter + middle
  5117 000022E4 66D1D8                  	rcr	ax, 1	; / 2
  5118 000022E7 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again	
  5119 000022EA 66AB                    	stosw		; interpolated sample 2 (L)
  5120 000022EC 66AB                    	stosw		; interpolated sample 2 (R)
  5121 000022EE 89D8                    	mov	eax, ebx
  5122 000022F0 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  5123 000022F3 66D1D8                  	rcr	ax, 1
  5124 000022F6 50                      	push	eax ; *	; interpolated 3rd quarter (temporary)
  5125 000022F7 6601D8                  	add	ax, bx	; + interpolated middle
  5126 000022FA 66D1D8                  	rcr	ax, 1
  5127 000022FD 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5128 00002300 66AB                    	stosw		; interpolated sample 3 (L)
  5129 00002302 66AB                    	stosw		; interpolated sample 3 (R)
  5130 00002304 58                      	pop	eax ; *
  5131 00002305 6601D0                  	add	ax, dx	; 3rd quarter + [next_val]
  5132 00002308 66D1D8                  	rcr	ax, 1	; / 2
  5133 0000230B 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5134 0000230E 66AB                    	stosw		; interpolated sample 4 (L)
  5135 00002310 66AB                    	stosw		; interpolated sample 4 (R)
  5136 00002312 C3                      	retn
  5137                                  
  5138                                  interpolating_5_16bit_stereo:
  5139                                  	; 18/11/2023
  5140                                  	; bx = [previous_val_l]
  5141                                  	; ax = [previous_val_r]
  5142                                  	; [next_val_l]
  5143                                  	; [next_val_r]
  5144                                  	; original-interpltd-interpltd-interpltd-interpltd
  5145 00002313 51                      	push	ecx ; !
  5146 00002314 93                      	xchg	eax, ebx
  5147 00002315 66AB                    	stosw		; original sample (L)
  5148 00002317 93                      	xchg	eax, ebx
  5149 00002318 66AB                    	stosw		; original sample (R)
  5150 0000231A 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5151 0000231D 50                      	push	eax ; *	; [previous_val_r]
  5152 0000231E 80C780                  	add	bh, 80h
  5153 00002321 8005[9D240000]80        	add	byte [next_val_l+1], 80h
  5154 00002328 66A1[9C240000]          	mov	ax, [next_val_l]
  5155 0000232E 6601D8                  	add	ax, bx	; [previous_val_l]
  5156 00002331 66D1D8                  	rcr	ax, 1
  5157 00002334 89C1                    	mov	ecx, eax ; interpolated middle (L)
  5158 00002336 6601D8                  	add	ax, bx
  5159 00002339 66D1D8                  	rcr	ax, 1
  5160 0000233C 89C2                    	mov	edx, eax ; interpolated 1st quarter (L)
  5161 0000233E 6601D8                  	add	ax, bx	; [previous_val_l]
  5162 00002341 66D1D8                  	rcr	ax, 1
  5163 00002344 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5164 00002347 66AB                    	stosw 		; interpolated sample 1 (L)
  5165 00002349 89C8                    	mov	eax, ecx
  5166 0000234B 6601D0                  	add	ax, dx	; middle (L) + 1st quarter (L)
  5167 0000234E 66D1D8                  	rcr	ax, 1	; / 2
  5168 00002351 89C3                    	mov	ebx, eax  ; interpolated sample 2 (L)
  5169 00002353 5A                      	pop	edx ; *	; [previous_val_r]
  5170 00002354 89D0                    	mov	eax, edx
  5171 00002356 8005[9F240000]80        	add	byte [next_val_r+1], 80h
  5172 0000235D 660305[9E240000]        	add	ax, [next_val_r]
  5173 00002364 66D1D8                  	rcr	ax, 1
  5174 00002367 50                      	push	eax ; *	; interpolated middle (R)
  5175 00002368 6601D0                  	add	ax, dx
  5176 0000236B 66D1D8                  	rcr	ax, 1
  5177 0000236E 50                      	push	eax ; ** ; interpolated 1st quarter (R)
  5178 0000236F 6601D0                  	add	ax, dx	; [previous_val_r]
  5179 00002372 66D1D8                  	rcr	ax, 1
  5180 00002375 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5181 00002378 66AB                    	stosw 		; interpolated sample 1 (R)
  5182 0000237A 89D8                    	mov	eax, ebx
  5183 0000237C 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5184 0000237F 66AB                    	stosw 		; interpolated sample 2 (L)
  5185 00002381 58                      	pop	eax ; **
  5186 00002382 5A                      	pop	edx ; *
  5187 00002383 6601D0                  	add	ax, dx	; 1st quarter (R) + middle (R)
  5188 00002386 66D1D8                  	rcr	ax, 1	; / 2
  5189 00002389 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5190 0000238C 66AB                    	stosw 		; interpolated sample 2 (R)
  5191 0000238E 89C8                    	mov	eax, ecx
  5192 00002390 660305[9C240000]        	add	ax, [next_val_l]
  5193 00002397 66D1D8                  	rcr	ax, 1
  5194 0000239A 50                      	push	eax ; * ; interpolated 3rd quarter (L)
  5195 0000239B 6601C8                  	add	ax, cx	; interpolated middle (L)
  5196 0000239E 66D1D8                  	rcr	ax, 1
  5197 000023A1 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5198 000023A4 66AB                    	stosw 		; interpolated sample 3 (L)
  5199 000023A6 89D0                    	mov	eax, edx
  5200 000023A8 660305[9E240000]        	add	ax, [next_val_r]
  5201 000023AF 66D1D8                  	rcr	ax, 1
  5202 000023B2 50                      	push	eax ; ** ; interpolated 3rd quarter (R)
  5203 000023B3 6601D0                  	add	ax, dx	; interpolated middle (R)
  5204 000023B6 66D1D8                  	rcr	ax, 1
  5205 000023B9 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5206 000023BC 66AB                    	stosw 		; interpolated sample 3 (R)
  5207 000023BE 5B                      	pop	ebx ; **
  5208 000023BF 58                      	pop	eax ; *
  5209 000023C0 660305[9C240000]        	add	ax, [next_val_l]
  5210 000023C7 66D1D8                  	rcr	ax, 1
  5211 000023CA 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5212 000023CD 66AB                    	stosw 		; interpolated sample 4 (L)
  5213 000023CF 89D8                    	mov	eax, ebx	
  5214 000023D1 660305[9E240000]        	add	ax, [next_val_r]
  5215 000023D8 66D1D8                  	rcr	ax, 1
  5216 000023DB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5217 000023DE 66AB                    	stosw 		; interpolated sample 4 (R)
  5218 000023E0 59                      	pop	ecx ; !
  5219 000023E1 C3                      	retn
  5220                                  
  5221                                  interpolating_4_16bit_mono:
  5222                                  	; 18/11/2023
  5223                                  	; ax = [previous_val]
  5224                                  	; dx = [next_val]
  5225                                  	; 02/02/2025
  5226                                  	; original-interpolated-interpolated-interpolated
  5227                                  
  5228 000023E2 66AB                    	stosw		; original sample (L)
  5229 000023E4 66AB                    	stosw		; original sample (R)
  5230 000023E6 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5231 000023E9 89C3                    	mov	ebx, eax ; [previous_val]
  5232 000023EB 80C680                  	add	dh, 80h
  5233 000023EE 6601D0                  	add	ax, dx	; [previous_val] + [next_val]
  5234 000023F1 66D1D8                  	rcr	ax, 1
  5235 000023F4 93                      	xchg	eax, ebx
  5236 000023F5 6601D8                  	add	ax, bx	; [previous_val] + interpolated middle
  5237 000023F8 66D1D8                  	rcr	ax, 1
  5238 000023FB 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5239 000023FE 66AB                    	stosw 		; interpolated sample 1 (L)
  5240 00002400 66AB                    	stosw		; interpolated sample 1 (R)
  5241 00002402 89D8                    	mov	eax, ebx ; interpolated middle
  5242 00002404 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5243 00002407 66AB                    	stosw 		; interpolated sample 2 (L)
  5244 00002409 66AB                    	stosw		; interpolated sample 2 (R)
  5245 0000240B 89D8                    	mov	eax, ebx
  5246 0000240D 6601D0                  	add	ax, dx	; interpolated middle + [next_val]
  5247 00002410 66D1D8                  	rcr	ax, 1
  5248 00002413 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5249 00002416 66AB                    	stosw		; interpolated sample 3 (L)
  5250 00002418 66AB                    	stosw		; interpolated sample 3 (R)
  5251 0000241A C3                      	retn
  5252                                  
  5253                                  interpolating_4_16bit_stereo:
  5254                                  	; 18/11/2023
  5255                                  	; bx = [previous_val_l]
  5256                                  	; ax = [previous_val_r]
  5257                                  	; [next_val_l]
  5258                                  	; [next_val_r]
  5259                                  	; original-interpolated-interpolated-interpolated
  5260 0000241B 93                      	xchg	eax, ebx
  5261 0000241C 66AB                    	stosw		; original sample (L)
  5262 0000241E 93                      	xchg	eax, ebx
  5263 0000241F 66AB                    	stosw		; original sample (R)
  5264 00002421 80C480                  	add	ah, 80h ; convert sound level 0 to 65535 format
  5265 00002424 89C2                    	mov	edx, eax ; [previous_val_r]
  5266 00002426 80C780                  	add	bh, 80h
  5267 00002429 8005[9D240000]80        	add	byte [next_val_l+1], 80h
  5268 00002430 66A1[9C240000]          	mov	ax, [next_val_l]
  5269 00002436 6601D8                  	add	ax, bx	; [previous_val_l]
  5270 00002439 66D1D8                  	rcr	ax, 1
  5271 0000243C 93                      	xchg	eax, ebx
  5272 0000243D 6601D8                  	add	ax, bx	; bx = interpolated middle (L)
  5273 00002440 66D1D8                  	rcr	ax, 1
  5274 00002443 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5275 00002446 66AB                    	stosw 		; interpolated sample 1 (L)
  5276 00002448 8005[9F240000]80        	add	byte [next_val_r+1], 80h
  5277 0000244F 89D0                    	mov	eax, edx ; [previous_val_r]
  5278 00002451 660305[9E240000]        	add	ax, [next_val_r]
  5279 00002458 66D1D8                  	rcr	ax, 1
  5280 0000245B 92                      	xchg	eax, edx
  5281 0000245C 6601D0                  	add	ax, dx	; dx = interpolated middle (R)
  5282 0000245F 66D1D8                  	rcr	ax, 1
  5283 00002462 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5284 00002465 66AB                    	stosw 		; interpolated sample 1 (R)
  5285 00002467 89D8                    	mov	eax, ebx
  5286 00002469 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5287 0000246C 66AB                    	stosw 		; interpolated sample 2 (L)
  5288 0000246E 89D0                    	mov	eax, edx
  5289 00002470 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5290 00002473 66AB                    	stosw 		; interpolated sample 2 (R)
  5291 00002475 89D8                    	mov	eax, ebx
  5292 00002477 660305[9C240000]        	add	ax, [next_val_l]
  5293 0000247E 66D1D8                  	rcr	ax, 1
  5294 00002481 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5295 00002484 66AB                    	stosw 		; interpolated sample 3 (L)
  5296 00002486 89D0                    	mov	eax, edx
  5297 00002488 660305[9E240000]        	add	ax, [next_val_r]
  5298 0000248F 66D1D8                  	rcr	ax, 1
  5299 00002492 80EC80                  	sub	ah, 80h	; -32768 to +32767 format again
  5300 00002495 66AB                    	stosw 		; interpolated sample 3 (R)
  5301 00002497 C3                      	retn
  5302                                  
  5303                                  ; 13/11/2023
  5304                                  previous_val:
  5305 00002498 0000                    previous_val_l: dw 0
  5306 0000249A 0000                    previous_val_r: dw 0
  5307                                  next_val:
  5308 0000249C 0000                    next_val_l: dw 0
  5309 0000249E 0000                    next_val_r: dw 0
  5310                                  
  5311                                  ; 16/11/2023
  5312 000024A0 00                      faz:	db 0
  5313                                  
  5314                                  ; --------------------------------------------------------
  5315                                  ; --------------------------------------------------------
  5316                                  
  5317                                  ; 07/12/2024
  5318                                  ; Ref: TRDOS 386 v2.0.9, trdosk8.s (18/09/2024)
  5319                                  ;		'sysaudio' system call (23/08/2024)
  5320                                  ; 18/11/2024
  5321                                  ; Ref: TRDOS 386 v2.0.9, audio.s, Erdogan Tan, 06/06/2024
  5322                                  
  5323                                  ac97_stop: 
  5324                                  	; 18/11/2024
  5325 000024A1 C605[B4800000]02        	mov	byte [stopped], 2
  5326                                  	; 07/12/2024
  5327                                  	sys	_audio, 0700h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000024A8 BB00070000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000024AD B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000024B2 CD40                <1>  int 40h
  5328 000024B4 C3                      	retn
  5329                                  
  5330                                  ac97_pause:
  5331                                  	; 18/11/2024
  5332 000024B5 C605[B4800000]01        	mov	byte [stopped], 1 ; paused
  5333                                  	; 07/12/2024
  5334                                  	sys	_audio, 0500h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000024BC BB00050000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000024C1 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000024C6 CD40                <1>  int 40h
  5335 000024C8 C3                      	retn
  5336                                  
  5337                                  ac97_play: ; continue to play (after pause)
  5338                                  	; 18/11/2024
  5339 000024C9 C605[B4800000]00        	mov	byte [stopped], 0
  5340                                  	; 07/12/2024	
  5341                                  	sys	_audio, 0600h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000024D0 BB00060000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 000024D5 B820000000          <1>  mov eax, %1
    97                              <1> 
    98 000024DA CD40                <1>  int 40h
  5342 000024DC C3                      	retn
  5343                                  	
  5344                                  ; --------------------------------------------------------
  5345                                  ; 14/11/2024 - Erdogan Tan
  5346                                  ; --------------------------------------------------------
  5347                                  
  5348                                  	; 07/12/2024
  5349                                  	; 01/12/2024 (32bit registers)
  5350                                  	; 29/11/2024
  5351                                  checkUpdateEvents:
  5352 000024DD E8FA010000              	call	check4keyboardstop
  5353 000024E2 7279                    	jc	short c4ue_ok
  5354                                  
  5355                                  	; 18/11/2024
  5356 000024E4 50                      	push	eax ; *
  5357 000024E5 09C0                    	or	eax, eax
  5358 000024E7 0F8406010000            	jz	c4ue_cpt
  5359                                  
  5360                                  	; 18/11/2024
  5361 000024ED 3C20                    	cmp	al, 20h ; SPACE (spacebar) ; pause/play
  5362 000024EF 7543                    	jne	short c4ue_chk_s
  5363 000024F1 803D[B4800000]00        	cmp	byte [stopped], 0
  5364 000024F8 7714                    	ja	short c4ue_chk_ps
  5365                                  	; pause
  5366 000024FA E8B6FFFFFF              	call	ac97_pause
  5367                                  	; 21/11/2024
  5368 000024FF A0[B5800000]            	mov	al, [tLO]
  5369 00002504 A2[B6800000]            	mov	byte [tLP], al
  5370 00002509 E9E5000000              	jmp	c4ue_cpt
  5371                                  c4ue_chk_ps:
  5372 0000250E 803D[B4800000]01        	cmp	byte [stopped], 1
  5373 00002515 770A                    	ja	short c4ue_replay
  5374                                  	; continue to play (after a pause)
  5375 00002517 E8ADFFFFFF              	call	ac97_play 
  5376 0000251C E9D2000000              	jmp	c4ue_cpt
  5377                                  c4ue_replay:
  5378                                  	; 19/11/2024
  5379 00002521 58                      	pop	eax ; *
  5380 00002522 58                      	pop	eax ; return address
  5381                                  	; 07/02/2024
  5382                                  	;mov	al, [volume]
  5383                                  	;call	SetmasterVolume
  5384 00002523 C605[B4800000]00        	mov	byte [stopped], 0
  5385 0000252A E8C7040000              	call	move_to_beginning
  5386                                  	;jmp	PlayWav
  5387                                  	; 07/12/2024
  5388 0000252F E921E2FFFF              	jmp	RePlayWav
  5389                                  
  5390                                  c4ue_chk_s:
  5391 00002534 3C53                    	cmp	al, 'S'	; stop
  5392 00002536 7526                    	jne	short c4ue_chk_fb
  5393 00002538 803D[B4800000]00        	cmp	byte [stopped], 0
  5394 0000253F 0F87AE000000            	ja	c4ue_cpt ; Already stopped/paused
  5395 00002545 E857FFFFFF              	call	ac97_stop
  5396                                  	; 19/11/2024
  5397 0000254A C605[B5800000]00        	mov	byte [tLO], 0
  5398                                  	; 21/11/2024
  5399 00002551 C605[B6800000]30        	mov	byte [tLP], '0'
  5400 00002558 E996000000              	jmp	c4ue_cpt
  5401                                  
  5402                                  	; 01/12/2024
  5403                                  	; 18/11/2024
  5404                                  c4ue_ok:
  5405 0000255D C3                      	retn
  5406                                  
  5407                                  c4ue_chk_fb:
  5408                                  	; 17/11/2024
  5409 0000255E 3C46                    	cmp	al, 'F'
  5410 00002560 750A                    	jne	short c4ue_chk_b
  5411 00002562 E867040000              	call 	Player_ProcessKey_Forwards
  5412 00002567 E987000000              	jmp	c4ue_cpt
  5413                                  
  5414                                  c4ue_chk_b:
  5415 0000256C 3C42                    	cmp	al, 'B'
  5416                                  	;;jne	short c4ue_cpt
  5417                                  	; 19/11/2024
  5418                                  	;jne	short c4ue_chk_h
  5419                                  	; 25/12/2024
  5420                                  	; 29/11/2024
  5421 0000256E 7507                    	jne	short c4ue_chk_n
  5422 00002570 E855040000              	call 	Player_ProcessKey_Backwards
  5423 00002575 EB7C                    	jmp	short c4ue_cpt
  5424                                  
  5425                                  	;;;
  5426                                  	; 25/12/2024
  5427                                  	; 29/11/2024
  5428                                  c4ue_chk_n:
  5429 00002577 3C4E                    	cmp	al, 'N'
  5430 00002579 7404                    	je	short c4ue_nps
  5431                                  c4ue_chk_p:
  5432 0000257B 3C50                    	cmp	al, 'P'
  5433 0000257D 7509                    	jne	short c4ue_chk_h
  5434                                  c4ue_nps:
  5435 0000257F C605[B4800000]03        	mov	byte [stopped], 3
  5436 00002586 EB6B                    	jmp	short c4ue_cpt
  5437                                  	;;;
  5438                                  
  5439                                  c4ue_chk_h:
  5440                                  	; 19/11/2024
  5441 00002588 3C48                    	cmp	al, 'H'
  5442 0000258A 7515                    	jne	short c4ue_chk_cr
  5443 0000258C C605[B7800000]00        	mov	byte [wleds], 0
  5444 00002593 E843E5FFFF              	call 	write_ac97_pci_dev_info
  5445                                  	;;;
  5446                                  	;24/12/2024 (wave lighting points option)
  5447 00002598 C605[C3800000]01        	mov	byte [p_mode], 1
  5448                                  	;;;
  5449                                  	;mov	dh, 24
  5450                                  	;mov	dl, 79
  5451                                  	;call	setCursorPosition
  5452                                  	; 21/12/2024
  5453 0000259F EB52                    	jmp	short c4ue_cpt
  5454                                  c4ue_chk_cr:
  5455                                  	;;;
  5456                                  	; 24/12/2024 (wave lighting points option)
  5457 000025A1 8A25[B7800000]          	mov	ah, [wleds]
  5458 000025A7 3C47                    	cmp	al, 'G'
  5459 000025A9 7432                    	je	short c4ue_g
  5460                                  ;	;;;
  5461                                  ;	; 26/12/2024
  5462                                  ;	cmp	al, 'T'
  5463                                  ;	jne	short c4ue_chk_cr_@
  5464                                  ;	inc	byte [tcolor]
  5465                                  ;	and 	byte [tcolor], 0Fh
  5466                                  ;	jnz	short c4ue_cpt
  5467                                  ;	inc	byte [tcolor]
  5468                                  ;	jmp	short c4ue_cpt
  5469                                  ;c4ue_chk_cr_@:
  5470                                  ;	;;;
  5471                                  	; 19/11/2024
  5472 000025AB 3C0D                    	cmp	al, 0Dh ; ENTER/CR key
  5473 000025AD 7544                    	jne	short c4ue_cpt
  5474                                  	;inc	byte [wleds]
  5475                                  	;jnz	short c4ue_cpt
  5476                                  	;inc	byte [wleds]
  5477                                  	;;;
  5478                                  	; 24/12/2024
  5479                                  	; 22/12/2024 (faster method)
  5480                                  	; (UpdateWaveLeds procedure turns off previously
  5481                                  	;  lighting wave leds only)
  5482                                  	;call	reset_wave_leds ; prepare all leds as turned off
  5483                                  	;;;
  5484                                  	; 23/11/2024
  5485 000025AF 31DB                    	xor	ebx, ebx
  5486                                  	; 24/12/2024 (wave lighting points option)
  5487 000025B1 881D[C3800000]          	mov	[p_mode], bl ; 0
  5488                                  	;
  5489                                  	;mov	bl, [wleds]
  5490 000025B7 88E3                    	mov	bl, ah ; 24/12/2024
  5491 000025B9 FEC3                    	inc	bl
  5492 000025BB 80E30F                  	and	bl, 0Fh
  5493 000025BE 7501                    	jnz	short c4ue_sc
  5494 000025C0 43                      	inc	ebx
  5495                                  c4ue_sc:
  5496 000025C1 881D[B7800000]          	mov	[wleds], bl
  5497 000025C7 D0EB                    	shr	bl, 1
  5498 000025C9 8A83[51430000]          	mov	al, [ebx+colors]
  5499                                  	; 24/12/2024
  5500 000025CF A2[59430000]            	mov	[ccolor], al
  5501 000025D4 7211                    	jc	short c4ue_g_@
  5502                                  	; 24/12/2024
  5503 000025D6 E865040000              	call	reset_wave_leds ; prepare all leds as turned off
  5504 000025DB EB16                    	jmp	short c4ue_cpt
  5505                                  	; 24/12/2024
  5506                                  c4ue_g:
  5507 000025DD 08E4                    	or	ah, ah	; byte [wleds]
  5508 000025DF 7506                    	jnz	short c4ue_g_@
  5509 000025E1 FE05[B7800000]          	inc	byte [wleds]	; force wave lighting ('G' key)
  5510                                  c4ue_g_@:
  5511                                  	; 24/12/2024 (wave lighting points option)
  5512 000025E7 C605[C3800000]01        	mov	byte [p_mode], 1
  5513 000025EE E832040000              	call	clear_window
  5514                                  	;;;
  5515                                  c4ue_cpt:
  5516                                  	; 24/12/2024
  5517                                  	; 18/11/2024
  5518 000025F3 59                      	pop	ecx ; *
  5519                                  	;;;
  5520                                  	; 24/12/2024 (skip wave lighting if data is not loaded yet)
  5521 000025F4 803D[5B810000]00        	cmp	byte [SRB], 0
  5522 000025FB 7751                    	ja	short c4ue_vb_ok
  5523                                  	;;;
  5524                                  	; 01/12/2024 (TRDOS 386)
  5525                                  	sys	_time, 4 ; get timer ticks (18.2 ticks/second),
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 000025FD BB04000000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00002602 B80D000000          <1>  mov eax, %1
    97                              <1> 
    98 00002607 CD40                <1>  int 40h
  5526                                  	; 24/12/2024
  5527                                  	; 18/11/2024
  5528                                  	;pop	ecx ; *
  5529                                  	; 01/12/2024
  5530 00002609 3B05[84810000]          	cmp	eax, [timerticks]
  5531                                  	;je	short c4ue_ok
  5532                                  	; 18/11/2024
  5533 0000260F 7407                    	je	short c4ue_skip_utt
  5534                                  c4ue_utt:	
  5535                                  	; 01/12/2024
  5536 00002611 A3[84810000]            	mov	[timerticks], eax
  5537 00002616 EB04                    	jmp	short c4ue_cpt_@
  5538                                  c4ue_skip_utt:
  5539                                  	; 18/11/2024
  5540 00002618 21C9                    	and	ecx, ecx
  5541 0000261A 7432                    	jz	short c4ue_vb_ok
  5542                                  c4ue_cpt_@:
  5543                                  	; 18/11/2024
  5544 0000261C 803D[B4800000]00        	cmp	byte [stopped], 0
  5545 00002623 7729                    	ja	short c4ue_vb_ok
  5546                                  	
  5547 00002625 E8E3010000              	call	CalcProgressTime
  5548                                  
  5549                                  	;cmp	ax, [ProgressTime]
  5550                                  	; 01/12/2024
  5551 0000262A 3B05[78810000]          	cmp	eax, [ProgressTime]
  5552                                  	;je	short c4ue_vb_ok
  5553                                  			; same second, no need to update
  5554                                  	; 23/11/2024
  5555 00002630 7405                    	je	short c4ue_uvb
  5556                                  
  5557                                  	;call	UpdateProgressTime
  5558                                  	;call	UpdateProgressBar@
  5559 00002632 E807030000              	call	UpdateProgressBar
  5560                                  
  5561                                  	; 23/11/2024
  5562                                  c4ue_uvb:
  5563 00002637 803D[B7800000]00        	cmp	byte [wleds], 0
  5564 0000263E 760E                    	jna	short c4ue_vb_ok
  5565                                  
  5566                                  	; 24/12/2024 (wave points mode)
  5567 00002640 803D[C3800000]00        	cmp	byte [p_mode], 0
  5568 00002647 7706                    	ja	short c4ue_uwp
  5569                                  
  5570 00002649 E83C040000              	call	UpdateWaveLeds
  5571                                  
  5572                                  c4ue_vb_ok:
  5573 0000264E C3                      	retn
  5574                                  
  5575                                  	; 22/12/2024
  5576                                  c4ue_uwp:
  5577                                  	;call	UpdateWavePoints
  5578                                  	;retn
  5579                                  
  5580                                  ; --------------------------------------------------------
  5581                                  ; 24/12/2024 - Erdogan Tan
  5582                                  ; --------------------------------------------------------
  5583                                  
  5584                                  	; 26/12/2024
  5585                                  	; 24/12/2024
  5586                                  UpdateWavePoints:
  5587 0000264F BE[B4760000]            	mov	esi, prev_points
  5588 00002654 833E00                  	cmp	dword [esi], 0
  5589 00002657 740B                    	jz	short lights_off_ok
  5590 00002659 B980020000              	mov	ecx, 640
  5591                                  light_off:
  5592 0000265E AD                      	lodsd
  5593                                  	; eax = wave point (lighting point) address
  5594 0000265F C60000                  	mov	byte [eax], 0 ; black point (light off)
  5595 00002662 E2FA                    	loop	light_off	
  5596                                  lights_off_ok:
  5597 00002664 8A15[C1800000]          	mov	dl, [half_buffer]
  5598 0000266A 3815[C0800000]          	cmp	[pbuf_s], dl
  5599 00002670 7520                    	jne	short lights_on_2
  5600 00002672 8B1D[9C760000]          	mov	ebx, [wpoints_dif]
  5601 00002678 8B35[BC800000]          	mov	esi, [pbuf_o]
  5602 0000267E 8B0D[70810000]          	mov	ecx, [buffersize] ; bytes
  5603 00002684 29D9                    	sub	ecx, ebx ; sub ecx, [wpoints_dif]
  5604 00002686 01DE                    	add	esi, ebx
  5605 00002688 7204                    	jc	short lights_on_1
  5606 0000268A 39CE                    	cmp	esi, ecx
  5607 0000268C 760C                    	jna	short lights_on_3
  5608                                  lights_on_1:
  5609 0000268E 89CE                    	mov	esi, ecx
  5610 00002690 EB08                    	jmp	short lights_on_3
  5611                                  
  5612                                  lights_on_2:
  5613 00002692 8815[C0800000]          	mov	[pbuf_s], dl
  5614 00002698 31F6                    	xor	esi, esi ; 0
  5615                                  lights_on_3:
  5616 0000269A 8935[BC800000]          	mov	[pbuf_o], esi
  5617                                  	;
  5618 000026A0 81C6[00900000]          	add	esi, audio_buffer
  5619 000026A6 B980020000              	mov	ecx, 640
  5620 000026AB 89CD                    	mov	ebp, ecx
  5621                                  	; 26/12/2024
  5622 000026AD BF[B4760000]            	mov	edi, prev_points
  5623 000026B2 8B1D[A0760000]          	mov	ebx, [graphstart] ; start (top) line
  5624                                  lights_on_4:
  5625 000026B8 31C0                    	xor	eax, eax ; 0
  5626 000026BA 66AD                    	lodsw	; left
  5627 000026BC 80C480                  	add	ah, 80h
  5628 000026BF 89C2                    	mov	edx, eax
  5629 000026C1 66AD                    	lodsw	; right
  5630                                  	;add	ax, dx
  5631 000026C3 80C480                  	add	ah, 80h
  5632                                  	;shr	eax, 9	; 128 volume levels
  5633 000026C6 01D0                    	add	eax, edx
  5634                                  	;shr	eax, 10	; (L+R/2) & 128 volume levels
  5635 000026C8 C1E809                  	shr	eax, 9	; (L+R/2) & 256 volume levels
  5636 000026CB F7E5                    	mul	ebp	; * 640 (row)
  5637 000026CD 01D8                    	add	eax, ebx ; + column
  5638 000026CF 8A15[59430000]          	mov	dl, [ccolor]
  5639 000026D5 8810                    	mov	[eax], dl ; pixel (light on) color
  5640 000026D7 AB                      	stosd		; save light on addr in prev_points
  5641 000026D8 43                      	inc	ebx
  5642 000026D9 E2DD                    	loop	lights_on_4
  5643 000026DB C3                      	retn
  5644                                  
  5645                                  ; --------------------------------------------------------
  5646                                  ; 19/05/2024 - (playwav4.asm) ich_wav4.asm
  5647                                  ; --------------------------------------------------------
  5648                                  
  5649                                  	; 25/12/2024
  5650                                  	; 07/12/2024
  5651                                  	; 01/12/2024 (TRDOS 386)
  5652                                  	; 29/11/2024
  5653                                  check4keyboardstop:
  5654                                  	; 19/05/2024
  5655                                  	; 08/11/2023
  5656                                  	; 04/11/2023
  5657 000026DC B401                    	mov	ah, 1
  5658                                  	;int	16h
  5659                                  	; 01/12/2024 (TRDOS 386 keyboard interrupt)
  5660 000026DE CD32                    	int	32h
  5661                                  	;clc
  5662 000026E0 7433                    	jz	short _cksr
  5663                                  
  5664 000026E2 30E4                    	xor	ah, ah
  5665                                  	;int	16h
  5666                                  	; 01/12/2024 (TRDOS 386 keyboard interrupt)
  5667 000026E4 CD32                    	int	32h
  5668                                  
  5669                                  	; 25/12/2024
  5670                                  	; 29/11/2024
  5671                                  	;mov	[command], al
  5672                                  
  5673                                  	;;;
  5674                                  	; 19/05/2024 (change PCM out volume)
  5675 000026E6 3C2B                    	cmp	al, '+'
  5676 000026E8 750D                    	jne	short p_1
  5677                                  	
  5678 000026EA A0[3F270000]            	mov	al, [volume]
  5679 000026EF 3C00                    	cmp	al, 0
  5680 000026F1 7624                    	jna	short p_3
  5681 000026F3 FEC8                    	dec	al
  5682 000026F5 EB0F                    	jmp	short p_2
  5683                                  p_1:
  5684 000026F7 3C2D                    	cmp	al, '-'
  5685 000026F9 751D                    	jne	short p_4
  5686                                  
  5687 000026FB A0[3F270000]            	mov	al, [volume]
  5688 00002700 3C1F                    	cmp	al, 31
  5689 00002702 7313                    	jnb	short p_3
  5690 00002704 FEC0                    	inc	al
  5691                                  p_2:
  5692 00002706 A2[3F270000]            	mov	[volume], al
  5693                                  	; 14/11/2024
  5694                                  	;call	SetPCMOutVolume
  5695                                  	; 15/11/2024 (QEMU)
  5696                                  	; 07/12/2024
  5697 0000270B E8F2E1FFFF              	call	SetMasterVolume
  5698                                  	;call	UpdateVolume
  5699                                  	;;clc
  5700                                  	;retn
  5701 00002710 E999010000              	jmp	UpdateVolume
  5702                                  	;mov	ah, al
  5703                                  	;mov    dx, [NAMBAR]
  5704                                    	;;add   dx, CODEC_MASTER_VOL_REG
  5705                                  	;add	dx, CODEC_PCM_OUT_REG
  5706                                  	;out    dx, ax
  5707                                  	;
  5708                                  	;call   delay1_4ms
  5709                                          ;call   delay1_4ms
  5710                                          ;call   delay1_4ms
  5711                                          ;call   delay1_4ms
  5712                                  _cksr:		; 19/05/2024
  5713                                  	; 18/12/2024
  5714 00002715 31C0                    	xor	eax, eax
  5715                                  	;clc
  5716                                  p_3:
  5717 00002717 C3                      	retn
  5718                                  p_4:
  5719                                  	; 17/11/2024
  5720 00002718 80FC01                  	cmp	ah, 01h  ; ESC
  5721 0000271B 7419                        	je	short p_q
  5722                                  	;cmp	ax, 2E03h ; 21/12/2024 
  5723 0000271D 3C03                    	cmp	al, 03h  ; CTRL+C
  5724 0000271F 7415                    	je	short p_q
  5725                                  
  5726                                  	; 18/11/2024
  5727 00002721 3C20                    	cmp	al, 20h
  5728 00002723 7419                    	je	short p_r
  5729                                  
  5730                                  	; 19/11/2024
  5731 00002725 3C0D                    	cmp	al, 0Dh ; CR/ENTER
  5732 00002727 7415                    	je	short p_r
  5733                                  
  5734 00002729 24DF                    	and	al, 0DFh
  5735                                  
  5736                                  	; 25/12/2024
  5737                                  	; 29/11/2024
  5738 0000272B A2[C4800000]            	mov	[command], al
  5739                                  
  5740                                  	;cmp	al, 'B'
  5741                                  	;je	short p_r
  5742                                  	;cmp	al, 'F'
  5743                                  	;je	short p_r
  5744                                  
  5745                                  	; 29/11/2024
  5746                                  	;cmp	al, 'N'
  5747                                  	;je	short p_r
  5748                                  	;cmp	al, 'P'
  5749                                  	;je	short p_r
  5750                                  
  5751 00002730 3C51                    	cmp	al, 'Q'
  5752                                  	;je	short p_q
  5753 00002732 7409                    	je	short p_quit ; 29/11/2024
  5754                                  
  5755 00002734 F8                      	clc
  5756 00002735 C3                      	retn
  5757                                  
  5758                                  	;;;
  5759                                  ;_cskr:	
  5760                                  p_q:
  5761                                  	; 27/12/2024
  5762 00002736 C605[C4800000]51        	mov	byte [command], 'Q'
  5763                                  p_quit:
  5764 0000273D F9                      	stc
  5765                                  p_r:
  5766 0000273E C3                      	retn
  5767                                  
  5768                                  ; 29/05/2024
  5769                                  ; 19/05/2024
  5770                                  volume: 
  5771                                  	;db	02h
  5772                                  ; 26/12/2024
  5773 0000273F 03                      	db	03h
  5774                                  
  5775                                  ; --------------------------------------------------------
  5776                                  
  5777                                  	; 22/12/2024
  5778                                  	; 21/12/2024
  5779                                  	; simulate cursor position in VGA (VESA VBE) mode
  5780                                  	; ! for 640*480, 256 colors (1 byte/pixel) !
  5781                                  setCursorPosition:
  5782                                  	; dh = Row
  5783                                  	; dl = Column
  5784                                  	
  5785 00002740 31C0                    	xor	eax, eax
  5786 00002742 B00E                    	mov	al, 14	; row height is 14 pixels (8*14)
  5787 00002744 F6E6                    	mul	dh
  5788 00002746 6683C007                	add	ax, 7	; top margin
  5789 0000274A C1E010                  	shl	eax, 16
  5790 0000274D 88D0                    	mov	al, dl	; * 8 ; character width = 8 pixels
  5791 0000274F 66C1E003                	shl	ax, 3
  5792                                  			; hw = row, ax = column
  5793 00002753 A3[A8760000]            	mov	[screenpos], eax
  5794                                  	; 22/12/2024
  5795 00002758 31C0                    	xor	eax, eax
  5796 0000275A C3                      	retn
  5797                                  	
  5798                                  ; --------------------------------------------------------
  5799                                  ; 14/11/2024
  5800                                  ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017)
  5801                                  
  5802                                  ;; NAME:	SetTotalTime
  5803                                  ;; DESCRIPTION: Calculates the total time in seconds in file
  5804                                  ;; INPUT:	DATA_SubchunkSize, WAVE_SampleRate, WAVE_BlockAlign
  5805                                  ;; OUTPUT:	CurrentTotalTime=Total time in seconds in file,
  5806                                  ;; 		Output on the screen of the total time in seconds
  5807                                  
  5808                                  	; 01/12/2024 (32 bit registers)
  5809                                  SetTotalTime:
  5810                                  	;; Calculate total seconds in file
  5811                                  	;mov	ax, [DATA_SubchunkSize]
  5812                                  	;mov	dx, [DATA_SubchunkSize + 2]
  5813                                  	;mov	bx, [WAVE_SampleRate]
  5814                                  	;div	bx
  5815                                  	;xor	dx, dx
  5816                                  	; 01/12/2024
  5817 0000275B A1[F0800000]            	mov	eax, [DATA_SubchunkSize]
  5818 00002760 0FB71D[E0800000]        	movzx	ebx, word [WAVE_SampleRate]
  5819 00002767 31D2                    	xor	edx, edx
  5820 00002769 F7F3                    	div	ebx
  5821                                  
  5822                                  	;mov	bx, [WAVE_BlockAlign]
  5823                                  	;div	bx
  5824                                  	; 01/12/2024
  5825 0000276B 668B1D[E8800000]        	mov	bx, [WAVE_BlockAlign]
  5826 00002772 31D2                    	xor	edx, edx
  5827 00002774 F7F3                    	div	ebx
  5828                                  
  5829                                  	;mov	[TotalTime], ax
  5830 00002776 A3[74810000]            	mov	[TotalTime], eax
  5831                                  
  5832 0000277B B33C                    	mov	bl, 60
  5833 0000277D F6F3                    	div	bl
  5834                                  
  5835                                  	;; al = minutes, ah = seconds
  5836 0000277F 50                      	push	eax ; **
  5837 00002780 50                      	push	eax ; *
  5838                                  
  5839                                  	;mov	dh, 24
  5840                                  	; 21/12/2024 (640*480)
  5841 00002781 B620                    	mov	dh, 32
  5842 00002783 B22A                    	mov	dl, 42
  5843 00002785 E8B6FFFFFF              	call	setCursorPosition
  5844                                  
  5845 0000278A 58                      	pop	eax ; *
  5846 0000278B 30E4                    	xor	ah, ah
  5847 0000278D BD02000000              	mov	ebp, 2
  5848 00002792 E812000000              	call	PrintNumber
  5849                                  	
  5850                                  	;mov	dh, 24
  5851                                  	; 21/12/2024 (640*480)
  5852 00002797 B620                    	mov	dh, 32
  5853 00002799 B22D                    	mov	dl, 45
  5854 0000279B E8A0FFFFFF              	call	setCursorPosition
  5855                                  
  5856 000027A0 58                      	pop	eax ; **
  5857 000027A1 88E0                    	mov	al, ah
  5858 000027A3 30E4                    	xor	ah, ah
  5859                                  	; 21/12/2024
  5860 000027A5 66BD0200                	mov	bp, 2
  5861                                  	;jmp	short PrintNumber
  5862                                  
  5863                                  ; --------------------------------------------------------
  5864                                  
  5865                                  	; 21/12/2024 (write numbers in VESA VBE graphics mode)
  5866                                  	; 01/12/2024 (32bit registers)
  5867                                  PrintNumber:
  5868                                  	; eax = binary number
  5869                                  	; ebp = digits
  5870 000027A9 8B35[A8760000]          	mov	esi, [screenpos]
  5871                                  		; hw = row, si = column
  5872 000027AF BB0A000000              	mov	ebx, 10
  5873 000027B4 31C9                    	xor	ecx, ecx
  5874                                  printNumber_CutNumber:
  5875 000027B6 41                      	inc	ecx
  5876 000027B7 31D2                    	xor	edx, edx
  5877 000027B9 F7F3                    	div	ebx
  5878 000027BB 52                      	push	edx
  5879 000027BC 39E9                    	cmp	ecx, ebp
  5880 000027BE 7402                    	je	short printNumber_printloop
  5881 000027C0 EBF4                    	jmp	printNumber_CutNumber
  5882                                  
  5883                                  printNumber_printloop:
  5884 000027C2 58                      	pop	eax
  5885                                  	; 21/12/2024
  5886                                  	; ebp = count of digits
  5887                                  	; eax <= 9
  5888                                  
  5889 000027C3 0430                    	add	al, '0'
  5890                                  	
  5891                                  	; esi = pixel position (hw = row, si = column)
  5892                                  	; eax = al = character
  5893                                  	;call	write_character
  5894                                  	; 22/12/2024
  5895 000027C5 E82A010000              	call	write_character_white
  5896                                  
  5897 000027CA 4D                      	dec	ebp
  5898 000027CB 7405                     	jz	short printNumber_ok
  5899 000027CD 83C608                  	add	esi, 8	; next column
  5900 000027D0 EBF0                    	jmp	short printNumber_printloop
  5901                                  printNumber_ok:
  5902 000027D2 C3                      	retn
  5903                                  
  5904                                  ; --------------------------------------------------------
  5905                                  
  5906                                  	; 14/11/2024 - Erdogan Tan
  5907                                  SetProgressTime:
  5908                                  	;; Calculate playing/progress seconds in file
  5909 000027D3 E835000000              	call	CalcProgressTime
  5910                                  
  5911                                  	; 01/12/2024 (32bit registers)
  5912                                  UpdateProgressTime:
  5913                                  	; eax = (new) progress time 
  5914                                  
  5915 000027D8 A3[78810000]            	mov	[ProgressTime], eax
  5916                                  
  5917 000027DD B33C                    	mov	bl, 60
  5918 000027DF F6F3                    	div	bl
  5919                                  
  5920                                  	;; al = minutes, ah = seconds
  5921 000027E1 50                      	push	eax ; **
  5922 000027E2 50                      	push	eax ; *
  5923                                  
  5924                                  	;mov	dh, 24
  5925                                  	; 21/12/2024 (640*480)
  5926 000027E3 B620                    	mov	dh, 32
  5927 000027E5 B221                    	mov	dl, 33
  5928 000027E7 E854FFFFFF              	call	setCursorPosition
  5929                                  
  5930 000027EC 58                      	pop	eax ; *
  5931 000027ED 30E4                    	xor	ah, ah
  5932 000027EF BD02000000              	mov	ebp, 2
  5933 000027F4 E8B0FFFFFF              	call	PrintNumber
  5934                                  	
  5935                                  	;mov	dh, 24
  5936                                  	; 21/12/2024 (640*480)
  5937 000027F9 B620                    	mov	dh, 32
  5938 000027FB B224                    	mov	dl, 36
  5939 000027FD E83EFFFFFF              	call	setCursorPosition
  5940                                  
  5941 00002802 58                      	pop	eax ; **
  5942 00002803 88E0                    	mov	al, ah
  5943 00002805 30E4                    	xor	ah, ah
  5944                                  	; 21/12/2024
  5945 00002807 66BD0200                	mov	bp, 2
  5946 0000280B EB9C                    	jmp	short PrintNumber
  5947                                  
  5948                                  ; --------------------------------------------------------
  5949                                  
  5950                                  	; 01/12/2024 (32bit registers)
  5951                                  	; 17/11/2024
  5952                                  	; 14/11/2024
  5953                                  CalcProgressTime:
  5954                                  	;mov	ax, [LoadedDataBytes]
  5955                                  	;mov	dx, [LoadedDataBytes+2]
  5956                                  	;mov	bx, ax
  5957                                  	;or	bx, dx
  5958                                  	;jz	short cpt_ok
  5959                                  	; 01/12/2024
  5960 0000280D A1[80810000]            	mov	eax, [LoadedDataBytes]
  5961 00002812 09C0                    	or	eax, eax
  5962 00002814 7416                    	jz	short cpt_ok
  5963                                  
  5964                                  	;mov	bx, [WAVE_SampleRate]
  5965                                  	;div	bx
  5966                                  	;xor	dx, dx
  5967                                  	;mov	bx, [WAVE_BlockAlign]
  5968                                  	;div	bx
  5969                                  	; 01/12/2024
  5970 00002816 0FB71D[E0800000]        	movzx	ebx, word [WAVE_SampleRate]
  5971 0000281D 31D2                    	xor	edx, edx
  5972 0000281F F7F3                    	div	ebx
  5973 00002821 31D2                    	xor	edx, edx
  5974 00002823 668B1D[E8800000]        	mov	bx, [WAVE_BlockAlign]
  5975 0000282A F7F3                    	div	ebx
  5976                                  cpt_ok:
  5977                                  	; eax = (new) progress time
  5978 0000282C C3                      	retn
  5979                                  
  5980                                  ; --------------------------------------------------------
  5981                                  ; 14/11/2024
  5982                                  ; (Ref: player.asm, out_cs.asm, Matan Alfasi, 2017)
  5983                                  
  5984                                  ;; DESCRIPTION: Update file information on template
  5985                                  ;; PARAMS:	WAVE parameters and other variables
  5986                                  ;; REGS:	AX(RW)
  5987                                  ;; VARS:	CurrentFileName, WAVE_SampleRate, 
  5988                                  ;; RETURNS:	On-screen file info is updated.
  5989                                  
  5990                                  	; 01/12/2024 (32bit registers)
  5991                                  UpdateFileInfo:
  5992                                  	;; Print File Name
  5993                                  	;mov	dh, 9
  5994                                  	; 21/12/2024 (640*480 graphics display)
  5995 0000282D B608                    	mov	dh, 8
  5996 0000282F B217                    	mov	dl, 23
  5997 00002831 E80AFFFFFF              	call	setCursorPosition
  5998                                  	
  5999 00002836 BE[08810000]            	mov	esi, wav_file_name
  6000                                  	
  6001                                  	;;;
  6002                                  	; 14/11/2024
  6003                                  	; skip directory separators
  6004                                  	; (note: asciiz string, max. 79 bytes except zero tail)
  6005 0000283B 89F3                    	mov	ebx, esi
  6006                                  chk4_nxt_sep:
  6007 0000283D AC                      	lodsb
  6008 0000283E 3C2F                    	cmp	al, '/'	; 14/12/2024
  6009 00002840 7406                    	je	short chg_fpos
  6010 00002842 20C0                    	and	al, al
  6011 00002844 7406                    	jz	short chg_fpos_ok
  6012 00002846 EBF5                    	jmp	short chk4_nxt_sep
  6013                                  chg_fpos:
  6014 00002848 89F3                    	mov	ebx, esi
  6015 0000284A EBF1                    	jmp	short chk4_nxt_sep
  6016                                  chg_fpos_ok:
  6017 0000284C 89DE                    	mov	esi, ebx ; file name (without its path/directory)
  6018                                  	;;;
  6019                                  _fnl_chk:
  6020                                  	; 26/12/2024 (file name length limit -display-)
  6021                                  	;mov	ebx, 12
  6022 0000284E BB11000000              	mov	ebx, 17 ; ????????.wav?????
  6023 00002853 56                      	push	esi
  6024                                  _fnl_chk_loop:
  6025 00002854 AC                      	lodsb
  6026 00002855 20C0                    	and	al, al
  6027 00002857 7406                    	jz	short _fnl_ok
  6028 00002859 4B                       	dec	ebx
  6029 0000285A 75F8                    	jnz	short _fnl_chk_loop
  6030 0000285C C60600                  	mov	byte [esi], 0
  6031                                  _fnl_ok:
  6032 0000285F 5E                      	pop	esi
  6033                                  	;;;
  6034                                  
  6035 00002860 E870000000              	call	PrintString
  6036                                  	
  6037                                  	;; Print Frequency
  6038                                  	;mov	dh, 10
  6039                                  	; 21/12/2024 (640*480 graphics display)
  6040 00002865 B609                    	mov	dh, 9
  6041 00002867 B217                    	mov	dl, 23
  6042 00002869 E8D2FEFFFF              	call	setCursorPosition
  6043                                  	;movzx	eax, word [WAVE_SampleRate]
  6044                                  	; 22/12/2024
  6045                                  	; eax = 0
  6046 0000286E 66A1[E0800000]          	mov	ax, [WAVE_SampleRate]
  6047 00002874 BD05000000              	mov	ebp, 5
  6048 00002879 E82BFFFFFF              	call	PrintNumber
  6049                                  
  6050                                  	;; Print BitRate
  6051                                  	;mov	dh, 9
  6052                                  	; 21/12/2024 (640*480 graphics display)
  6053 0000287E B608                    	mov	dh, 8
  6054 00002880 B239                    	mov	dl, 57
  6055 00002882 E8B9FEFFFF              	call	setCursorPosition
  6056 00002887 66A1[EA800000]          	mov	ax, [WAVE_BitsPerSample]
  6057 0000288D 66BD0200                	mov	bp, 2
  6058 00002891 E813FFFFFF              	call	PrintNumber
  6059                                  
  6060                                  	;; Print Channel Number
  6061                                  	;mov	dh, 10
  6062                                  	; 21/12/2024 (640*480 graphics display)
  6063 00002896 B609                    	mov	dh, 9
  6064 00002898 B239                    	mov	dl, 57
  6065 0000289A E8A1FEFFFF              	call	setCursorPosition
  6066 0000289F 66A1[DE800000]          	mov	ax, [WAVE_NumChannels]
  6067 000028A5 66BD0100                	mov	bp, 1
  6068 000028A9 E8FBFEFFFF              	call	PrintNumber
  6069                                  
  6070                                  	;call	UpdateVolume
  6071                                  	;retn
  6072                                  
  6073                                  ; --------------------------------------------------------
  6074                                  
  6075                                  	; 14/11/2024
  6076                                  UpdateVolume:
  6077                                  	;; Print Volume
  6078                                  	;mov	dh, 24
  6079                                  	; 21/12/2024 (640*480)
  6080 000028AE B620                    	mov	dh, 32
  6081 000028B0 B24B                    	mov	dl, 75
  6082 000028B2 E889FEFFFF              	call	setCursorPosition
  6083                                  	; 22/12/2024
  6084                                  	; eax = 0
  6085                                  
  6086 000028B7 A0[3F270000]            	mov	al, [volume]
  6087                                  
  6088 000028BC B364                    	mov	bl, 100
  6089 000028BE F6E3                    	mul	bl
  6090                                  
  6091 000028C0 B31F                    	mov	bl, 31
  6092 000028C2 F6F3                    	div	bl
  6093                                  
  6094                                  	;neg	ax
  6095                                  	;add	ax, 100	
  6096                                  	; 01/12/2024
  6097 000028C4 B464                    	mov	ah, 100
  6098 000028C6 28C4                    	sub	ah, al
  6099 000028C8 0FB6C4                  	movzx	eax, ah
  6100                                  	;xor	ah, ah
  6101                                  	;mov	bp, 3
  6102 000028CB BD03000000              	mov	ebp, 3
  6103                                  	;call	PrintNumber
  6104                                  	;retn
  6105 000028D0 E9D4FEFFFF              	jmp	PrintNumber	
  6106                                  
  6107                                  ; --------------------------------------------------------
  6108                                  
  6109                                  	; 21/12/2024
  6110                                  	; write text in VESA VBE graphics mode
  6111                                  PrintString:
  6112                                  	; esi = string address
  6113                                  printstr_loop:
  6114 000028D5 31C0                    	xor	eax, eax
  6115 000028D7 AC                      	lodsb
  6116 000028D8 08C0                    	or	al, al
  6117 000028DA 7417                    	jz	short printstr_ok
  6118                                  
  6119 000028DC 56                      	push	esi
  6120                                  
  6121 000028DD 8B35[A8760000]          	mov	esi, [screenpos]
  6122                                  
  6123                                  	; esi = pixel position (hw = row, si = column)
  6124                                  	; eax = al = character
  6125                                  	;call	write_character
  6126                                  	; 22/12/2024
  6127 000028E3 E80C000000              	call	write_character_white
  6128                                  
  6129 000028E8 668305[A8760000]08      	add	word [screenpos], 8 ; update column (only, not row)
  6130                                  
  6131 000028F0 5E                      	pop	esi
  6132 000028F1 EBE2                    	jmp	short printstr_loop
  6133                                  
  6134                                  printstr_ok:
  6135 000028F3 C3                      	retn
  6136                                  
  6137                                  ; --------------------------------------------------------
  6138                                  
  6139                                  	; 21/12/2024
  6140                                  	; write character (at cursor position)
  6141                                  	; in graphics mode (640*480, 256 colors)
  6142                                  	; 22/12/2024
  6143                                  write_character_white:
  6144 000028F4 B90F000000              	mov	ecx, 0Fh
  6145                                  	; 26/12/2024
  6146                                  	;movzx	ecx, byte [tcolor]
  6147                                  write_character:
  6148                                  	; esi = pixel position (hw = row, si = column)
  6149                                  	; eax = al = character
  6150                                  	; cl = color
  6151 000028F9 890D[AC760000]          	mov	[wcolor], ecx ; 22/12/2024
  6152                                  
  6153                                  	; 22/12/2024
  6154 000028FF 50                      	push	eax
  6155                                  	; clear previous character pixels
  6156 00002900 BF[41430000]            	mov	edi, fillblock
  6157                                  	sys	_video, 020Fh, 0, 8001h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00002905 BB0F020000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000290A B900000000          <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 0000290F BA01800000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00002914 B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 00002919 CD40                <1>  int 40h
  6158 0000291B 58                      	pop	eax
  6159                                  
  6160 0000291C C1E004                  	shl	eax, 4 ; 8*16 pixel user font
  6161 0000291F BF[5C510000]            	mov	edi, fontbuff2 ; start of user font data
  6162 00002924 01C7                    	add	edi, eax
  6163                                  
  6164                                  	; 21/12/2024
  6165                                  	; NOTE:
  6166                                  	; TRDOS 386 does not use 8*14 pixel fonts in sysvideo
  6167                                  	; system calls -in graphics mode-
  6168                                  	; because 8*16 pixel operations are faster
  6169                                  	;			than 8*14 pixel operations.
  6170                                  	; ((so, 8*14 fonts can be converted to 8*16 fonts by
  6171                                  	; adding 2 empty lines))
  6172                                  	; (8*14 characters can be written via pixel operations)
  6173                                    	
  6174                                  	; 21/12/2024 (TRDOS 386 v2.0.9, trdosk6.s, 27/09/2024)
  6175                                  	;;;;;;;;;;;;;;;;; ; sysvideo system call
  6176                                  	;sysvideo:
  6177                                  	;   function in BH
  6178                                  	;	02h: Super VGA, LINEAR FRAME BUFFER data transfers
  6179                                  	;   sub function in BL
  6180                                  	;	0Fh: WRITE CHARACTER (FONT)
  6181                                  	;          CL = char's color (8 bit, 256 colors)
  6182                                  	;	If DH bit 7 = 1
  6183                                  	;	   USER FONT (from user buffer)
  6184                                  	;	         DL = 1 -> 8x16 pixel font
  6185                                   	;	   EDI = user's font buffer address
  6186                                  	;		(NOTE: byte order is as row0,row1,row2..)
  6187                                  	;	   ESI = start position (row, column)
  6188                                  	;		(HW = row, SI = column)
  6189                                  	;;;;;;;;;;;;;;;;;
  6190                                  
  6191                                  	sys	_video, 020Fh, [wcolor], 8001h
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00002926 BB0F020000          <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90 0000292B 8B0D[AC760000]      <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92 00002931 BA01800000          <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00002936 B81F000000          <1>  mov eax, %1
    97                              <1> 
    98 0000293B CD40                <1>  int 40h
  6192                                  
  6193 0000293D C3                      	retn
  6194                                  
  6195                                  ; --------------------------------------------------------
  6196                                  
  6197                                  	; 22/12/2024
  6198                                  	; 21/12/2024
  6199                                  	; (write chars in VESA VBE graphics mode)
  6200                                  	; 14/11/2024
  6201                                  	; (Ref: player.asm, Matan Alfasi, 2017)
  6202                                  	; (Modification: Erdogan Tan, 14/11/2024)
  6203                                  
  6204                                  	;PROGRESSBAR_ROW equ 23
  6205                                  	; 21/12/2024 (640*480)
  6206                                  	PROGRESSBAR_ROW equ 31
  6207                                  
  6208                                  UpdateProgressBar:
  6209 0000293E E890FEFFFF              	call	SetProgressTime	; 14/11/2024
  6210                                  
  6211                                  	; 01/12/2024 (32bit registers)
  6212 00002943 A1[78810000]            	mov	eax, [ProgressTime]
  6213                                  UpdateProgressBar@:
  6214 00002948 BA50000000              	mov	edx, 80
  6215 0000294D F7E2                    	mul	edx
  6216 0000294F 8B1D[74810000]          	mov	ebx, [TotalTime]
  6217 00002955 F7F3                    	div	ebx
  6218                                  
  6219                                  	; 22/12/2024
  6220                                  	; check progress bar indicator position if it is same 
  6221 00002957 3A05[B1760000]          	cmp	al, [pbprev]
  6222 0000295D 7430                    	je	short UpdateProgressBar_ok
  6223 0000295F A2[B1760000]            	mov	[pbprev], al
  6224                                  
  6225                                  UpdateProgressBar@@:
  6226                                  	;; Push for the 'Clean' part
  6227 00002964 50                      	push	eax ; **
  6228 00002965 50                      	push	eax ; *
  6229                                  
  6230                                  	;; Set cursor position
  6231 00002966 B61F                    	mov	dh, PROGRESSBAR_ROW
  6232 00002968 B200                    	mov	dl, 0
  6233 0000296A E8D1FDFFFF              	call	setCursorPosition
  6234                                  
  6235 0000296F 58                      	pop	eax ; *
  6236 00002970 09C0                    	or	eax, eax
  6237 00002972 742D                    	jz	short UpdateProgressBar_Clean
  6238                                  
  6239                                  UpdateProgressBar_DrawProgress:
  6240                                  	; 22/12/2024
  6241                                  	; 21/12/2024
  6242                                  	; (write progress bar chars in graphics mode)
  6243                                  	;;;;
  6244 00002974 89C5                    	mov	ebp, eax
  6245 00002976 50                      	push	eax ; ***
  6246 00002977 8B35[A8760000]          	mov	esi, [screenpos]
  6247                                  UpdateProgressBar_DrawProgress_@:
  6248 0000297D B8DF000000              	mov	eax, 223
  6249                                  	
  6250                                  	; esi = pixel position (hw = row, si = column)
  6251                                  	; eax = al = character
  6252                                  	;call	write_character
  6253                                  	; 22/12/2024
  6254 00002982 E86DFFFFFF              	call	write_character_white
  6255                                  
  6256 00002987 4D                      	dec	ebp
  6257 00002988 7406                    	jz	short UpdateProgressBar_DrawCursor
  6258                                  
  6259 0000298A 83C608                  	add	esi, 8 ; next column
  6260 0000298D EBEE                    	jmp	short UpdateProgressBar_DrawProgress_@
  6261                                  	;;;
  6262                                  
  6263                                  UpdateProgressBar_ok:
  6264 0000298F C3                      	retn
  6265                                  
  6266                                  UpdateProgressBar_DrawCursor:
  6267                                  	; 22/12/2024
  6268 00002990 5A                      	pop	edx ; ***
  6269 00002991 B61F                    	mov	dh, PROGRESSBAR_ROW
  6270 00002993 E8A8FDFFFF              	call	setCursorPosition
  6271                                  
  6272                                  	; 21/12/2024
  6273                                  	; (write progress bar character in graphics mode)
  6274                                  	;;;;
  6275                                  	;;;mov	eax, 223
  6276                                  	;;;shl	eax, 4 ; 8*16 pixel user font
  6277                                  	;;mov	eax, 223*16
  6278                                  	;;mov	edi, fontbuff2 ; start of user font data
  6279                                  	;;add	edi, eax
  6280                                  	;mov	edi, fontbuff2+(223*16)
  6281                                  	;
  6282                                  	;sys	_video, 020Fh, 0Ch, 8001h
  6283                                  	; 22/12/2024
  6284                                  	;mov	eax, 223
  6285                                  	; eax = 0
  6286 00002998 B0DF                    	mov	al, 223
  6287 0000299A B10C                    	mov	cl, 0Ch ; red
  6288 0000299C E858FFFFFF              	call	write_character
  6289                                  	;;;;
  6290                                  
  6291                                  UpdateProgressBar_Clean:
  6292                                  	;pop	eax  ; **
  6293                                  	; 22/12/2024
  6294 000029A1 5A                      	pop	edx  ; **
  6295                                  	; 21/12/2024
  6296 000029A2 BD50000000              	mov	ebp, 80
  6297                                  	;sub	bp, ax
  6298 000029A7 6629D5                  	sub	bp, dx ; 22/12/2024
  6299 000029AA 74E3                    	jz	short UpdateProgressBar_ok
  6300                                  
  6301 000029AC B61F                    	mov	dh, PROGRESSBAR_ROW
  6302                                  	;mov	dl, al ; 22/12/2024
  6303 000029AE E88DFDFFFF              	call	setCursorPosition
  6304                                  
  6305                                  	; 21/12/2024
  6306                                  	; (write progress bar chars in graphics mode)
  6307                                  	;;;;
  6308 000029B3 8B35[A8760000]          	mov	esi, [screenpos]
  6309                                  UpdateProgressBar_Clean_@:
  6310                                  	;;;mov	eax, 223
  6311                                  	;;;shl	eax, 4 ; 8*16 pixel user font
  6312                                  	;;mov	eax, 223*16
  6313                                  	;mov	edi, fontbuff2 ; start of user font data
  6314                                  	;add	edi, eax
  6315                                  	;mov	edi, fontbuff2+(223*16)
  6316                                  	;
  6317                                  	;sys	_video, 020Fh, 08h, 8001h
  6318                                  	; 22/12/2024
  6319                                  	;mov	eax, 223
  6320                                  	; eax = 0
  6321 000029B9 B0DF                    	mov	al, 223
  6322 000029BB B108                    	mov	cl, 08h ; gray (dark)
  6323 000029BD E837FFFFFF              	call	write_character
  6324                                  	;;;;
  6325                                  
  6326 000029C2 4D                      	dec	ebp
  6327 000029C3 74CA                    	jz	short UpdateProgressBar_ok
  6328                                  
  6329 000029C5 83C608                  	add	esi, 8 ; next column
  6330 000029C8 EBEF                    	jmp	short UpdateProgressBar_Clean_@
  6331                                  	;;;;
  6332                                  
  6333                                  ; --------------------------------------------------------
  6334                                  ; 17/11/2024
  6335                                  
  6336                                  Player_ProcessKey_Backwards:
  6337                                  	;; In order to go backwards 5 seconds:
  6338                                  	;; Update file pointer to the beginning, skip headers
  6339 000029CA B142                    	mov	cl, 'B'
  6340 000029CC EB02                    	jmp	short Player_ProcessKey_B_or_F
  6341                                  
  6342                                  Player_ProcessKey_Forwards:
  6343                                  	;; In order to fast-forward 5 seconds, set the file pointer
  6344                                  	;; to CUR_SEEK + 5 * Freq
  6345                                  
  6346 000029CE B146                    	mov	cl, 'F'
  6347                                  	;jmp	short Player_ProcessKey_B_or_F
  6348                                  
  6349                                  	; 01/12/2024 (32bit regsisters)
  6350                                  Player_ProcessKey_B_or_F:
  6351                                  	; 17/11/2024
  6352                                  	; 04/11/2024
  6353                                  	; (Ref: player.asm, Matan Alfasi, 2017)
  6354                                    
  6355                                  	; 04/11/2024
  6356 000029D0 B805000000              	mov	eax, 5
  6357 000029D5 0FB71D[E8800000]        	movzx	ebx, word [WAVE_BlockAlign]
  6358 000029DC F7E3                    	mul	ebx
  6359 000029DE 668B1D[E0800000]        	mov	bx, [WAVE_SampleRate]
  6360 000029E5 F7E3                    	mul	ebx
  6361                                  	; eax = transfer byte count for 5 seconds
  6362                                  	
  6363                                  	; 17/11/2024
  6364 000029E7 80F942                  	cmp	cl, 'B'
  6365                                  	;mov	bx, [LoadedDataBytes]
  6366                                  	;mov	cx, [LoadedDataBytes+2]
  6367                                  	; 01/12/2024
  6368 000029EA 8B0D[80810000]          	mov	ecx, [LoadedDataBytes]
  6369 000029F0 7508                    	jne	short move_forward ; cl = 'F'
  6370                                  move_backward:
  6371                                  	;sub	bx, ax
  6372                                  	;sbb	cx, dx
  6373 000029F2 29C1                    	sub	ecx, eax
  6374 000029F4 7316                    	jnc	short move_file_pointer
  6375                                  move_to_beginning:
  6376                                  	;xor	cx, cx ; 0
  6377                                  	;xor	bx, bx ; 0
  6378 000029F6 31C9                    	xor	ecx, ecx
  6379 000029F8 EB12                    	jmp	short move_file_pointer
  6380                                  move_forward: 
  6381                                  	;add	bx, ax
  6382                                  	;adc	cx, dx
  6383 000029FA 01C1                    	add	ecx, eax
  6384 000029FC 7208                    	jc	short move_to_end
  6385                                  	;cmp	cx, [DATA_SubchunkSize+2]
  6386                                  	;ja	short move_to_end
  6387                                  	;jb	short move_file_pointer
  6388                                  	;cmp	bx, [DATA_SubchunkSize]
  6389                                  	;jna	short move_file_pointer
  6390 000029FE 3B0D[F0800000]          	cmp	ecx, [DATA_SubchunkSize]
  6391 00002A04 7606                    	jna	short move_file_pointer
  6392                                  move_to_end:
  6393                                  	;mov	bx, [DATA_SubchunkSize]
  6394                                  	;mov	cx, [DATA_SubchunkSize+2]
  6395 00002A06 8B0D[F0800000]          	mov	ecx, [DATA_SubchunkSize]
  6396                                  move_file_pointer:
  6397                                  	;mov	dx, bx    
  6398                                  	;mov	[LoadedDataBytes], dx
  6399                                  	;mov	[LoadedDataBytes+2], cx
  6400 00002A0C 890D[80810000]          	mov	[LoadedDataBytes], ecx
  6401                                  	;add	dx, 44 ; + header
  6402                                  	;adc	cx, 0
  6403 00002A12 83C12C                  	add	ecx, 44 
  6404                                  
  6405                                  	; seek
  6406                                  	;mov	bx, [filehandle]
  6407                                  	;mov	ax, 4200h
  6408                                  	;int	21h
  6409                                  	; 01/12/2024
  6410 00002A15 31D2                    	xor	edx, edx ; offset from beginning of the file
  6411                                  	; ecx = offset	
  6412                                  	; ebx = file handle
  6413                                  	; edx = 0
  6414                                  	sys	_seek, [filehandle]
    83                              <1> 
    84                              <1> 
    85                              <1> 
    86                              <1> 
    87                              <1>  %if %0 >= 2
    88 00002A17 8B1D[F8800000]      <1>  mov ebx, %2
    89                              <1>  %if %0 >= 3
    90                              <1>  mov ecx, %3
    91                              <1>  %if %0 = 4
    92                              <1>  mov edx, %4
    93                              <1>  %endif
    94                              <1>  %endif
    95                              <1>  %endif
    96 00002A1D B813000000          <1>  mov eax, %1
    97                              <1> 
    98 00002A22 CD40                <1>  int 40h
  6415 00002A24 C3                      	retn
  6416                                  
  6417                                  ; --------------------------------------------------------
  6418                                  
  6419                                  	; 25/12/2024
  6420                                  	; 22/12/2024 (VESA VBE mode graphics) 
  6421                                  	; (640*480, 256 colors)
  6422                                  clear_window:
  6423 00002A25 8B3D[A4760000]          	mov	edi, [LFB_ADDR]
  6424                                  	;add	edi, (13*80*8*14)
  6425                                  	; 25/12/2024
  6426 00002A2B 81C7009A0100            	add	edi, 164*640
  6427 00002A31 29C0                    	sub	eax, eax
  6428                                  	;mov	ecx, (16*640*14)/4 ; 16 rows
  6429 00002A33 B900A00000              	mov	ecx, 64*640 ; 256 volume level points
  6430 00002A38 F3AB                    	rep	stosd
  6431                                  	; 24/12/2024
  6432 00002A3A A3[B4760000]            	mov	[prev_points], eax ; 0
  6433                                  	;
  6434 00002A3F C3                      	retn
  6435                                  
  6436                                  ; --------------------------------------------------------
  6437                                  
  6438                                  	; 22/12/2024
  6439                                  	; 21/12/2024
  6440                                  	; (simulate wave leds in graphics mode)
  6441                                  	; (640*480, 256 colors)
  6442                                  reset_wave_leds:
  6443                                  	; 22/12/2024
  6444 00002A40 C705[5C750000]0000-     	mov	dword [prev_leds], 0
  6444 00002A48 0000               
  6445                                  	;
  6446 00002A4A BD00050000              	mov	ebp, 16*80 ; 80 columns with 16 levels
  6447 00002A4F BE[5C610000]            	mov	esi, wleds_addr
  6448                                  next_led:
  6449 00002A54 AD                      	lodsd
  6450 00002A55 89C7                    	mov	edi, eax
  6451 00002A57 BA0E000000              	mov	edx, 14 ; 14 lines (8*14 pixel font)
  6452 00002A5C BB[3C610000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6453                                  led_line:
  6454 00002A61 8A23                    	mov	ah, [ebx]
  6455 00002A63 B908000000              	mov	ecx, 8 ; 8 pixels (8*16 pixel font)
  6456                                  next_pixel:
  6457 00002A68 D0E4                    	shl	ah, 1
  6458 00002A6A 7308                    	jnc	short skip_this
  6459 00002A6C B008                    	mov	al, 8 ; gray
  6460 00002A6E AA                      	stosb
  6461 00002A6F 49                      	dec	ecx
  6462 00002A70 75F6                    	jnz	short next_pixel
  6463 00002A72 EB06                    	jmp	short next_line
  6464                                  skip_this:
  6465 00002A74 B000                    	mov	al, 0 ; black
  6466 00002A76 AA                      	stosb
  6467 00002A77 49                      	dec	ecx
  6468 00002A78 75EE                    	jnz	short next_pixel
  6469                                  next_line:
  6470 00002A7A 4A                      	dec	edx
  6471 00002A7B 7504                    	jnz	short next_line_@
  6472 00002A7D 4D                      	dec	ebp
  6473 00002A7E 75D4                    	jnz	short next_led
  6474                                  	;clc	; 25/12/2024
  6475 00002A80 C3                      	retn
  6476                                  next_line_@:
  6477                                  	; 22/12/2024
  6478 00002A81 81C778020000            	add	edi, 640-8 ; next line
  6479 00002A87 43                      	inc	ebx
  6480 00002A88 EBD7                    	jmp	short led_line	
  6481                                  
  6482                                  ; --------------------------------------------------------
  6483                                  
  6484                                  	; 22/12/2024 (graphics mode)
  6485                                  	; 09/12/2024
  6486                                  	; 19/11/2024
  6487                                  UpdateWaveLeds:
  6488                                  	; 23/11/2024
  6489                                  	;call	reset_wave_leds
  6490                                  	; 22/12/2024 (faster method, 80 against 80*16)
  6491                                  	; turn off previously lighting wave leds at first
  6492                                  	;;;
  6493 00002A8A BE[5C750000]            	mov	esi, prev_leds
  6494 00002A8F 833E00                  	cmp	dword [esi], 0
  6495 00002A92 7433                    	jz	short UpdateWaveLeds_ok
  6496 00002A94 B950000000              	mov	ecx, 80
  6497                                  turn_off_led:
  6498 00002A99 AD                      	lodsd
  6499 00002A9A 89C7                    	mov	edi, eax
  6500                                  	; edi = wave led address
  6501 00002A9C BD0E000000              	mov	ebp, 14
  6502 00002AA1 BB[3C610000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6503 00002AA6 31D2                    	xor	edx, edx
  6504 00002AA8 B008                    	mov	al, 8 ; gray (dark)
  6505                                  toffl_next_line:
  6506                                  	;;mov	edx, 8 ; 8 pixels (8*14 pixel font)
  6507                                  	;mov	dl, 8
  6508 00002AAA 88C2                    	mov	dl, al ; 8
  6509 00002AAC 8A23                    	mov	ah, [ebx]
  6510                                  toffl_next_pixel:
  6511 00002AAE D0E4                    	shl	ah, 1
  6512 00002AB0 7310                    	jnc	short toffl_skip_this
  6513 00002AB2 AA                      	stosb
  6514                                  toffl_next_pixel_@:
  6515 00002AB3 4A                      	dec	edx
  6516 00002AB4 75F8                    	jnz	short toffl_next_pixel
  6517 00002AB6 4D                      	dec	ebp
  6518 00002AB7 740C                    	jz	short toffl_next_led
  6519 00002AB9 81C778020000            	add	edi, 640-8 ; next line
  6520 00002ABF 43                      	inc	ebx
  6521 00002AC0 EBE8                    	jmp	short toffl_next_line
  6522                                  toffl_skip_this:
  6523 00002AC2 47                      	inc	edi
  6524 00002AC3 EBEE                    	jmp	short toffl_next_pixel_@
  6525                                  toffl_next_led:
  6526 00002AC5 E2D2                    	loop	turn_off_led
  6527                                  UpdateWaveLeds_ok:
  6528                                  	;;;
  6529                                  	; 09/12/2024
  6530                                  	;jmp	short turn_on_leds
  6531                                  
  6532                                  ; --------------------------------------------------------
  6533                                  
  6534                                  	; 21/12/2024 (VESA VBE Mode, 640*480, 256 colors)
  6535                                  	; 09/12/2024
  6536                                  	; 01/12/2024 (TRDOS 386, 32bit registers, flat memory)
  6537                                  	; 23/11/2024 (Retro DOS, 16bit registers, segmented)
  6538                                  	; 21/11/2024, 22/11/2024
  6539                                  	; 19/11/2024
  6540                                  turn_on_leds:
  6541                                  	; 09/12/2024
  6542                                  	; 07/12/2024
  6543 00002AC7 8A15[C1800000]          	mov	dl, [half_buffer]
  6544                                  tol_@:
  6545                                  	; 07/12/2024
  6546 00002ACD 3815[C0800000]          	cmp	[pbuf_s], dl
  6547 00002AD3 7520                    	jne	short tol_ns_buf
  6548 00002AD5 8B1D[B8800000]          	mov	ebx, [wleds_dif]
  6549 00002ADB 8B35[BC800000]          	mov	esi, [pbuf_o]
  6550 00002AE1 8B0D[70810000]          	mov	ecx, [buffersize] ; bytes
  6551 00002AE7 29D9                    	sub	ecx, ebx ; sub ecx, [wleds_dif]
  6552 00002AE9 01DE                    	add	esi, ebx
  6553 00002AEB 7204                    	jc	short tol_o_@
  6554 00002AED 39CE                    	cmp	esi, ecx
  6555 00002AEF 760C                    	jna	short tol_s_buf
  6556                                  tol_o_@:
  6557 00002AF1 89CE                    	mov	esi, ecx
  6558 00002AF3 EB08                    	jmp	short tol_s_buf
  6559                                  
  6560                                  tol_ns_buf:
  6561 00002AF5 8815[C0800000]          	mov	[pbuf_s], dl
  6562 00002AFB 31F6                    	xor	esi, esi ; 0
  6563                                  tol_s_buf:
  6564 00002AFD 8935[BC800000]          	mov	[pbuf_o], esi
  6565                                  
  6566                                  tol_buf_@:
  6567                                  	; 07/12/2024
  6568 00002B03 81C6[00900000]          	add	esi, audio_buffer
  6569 00002B09 B950000000              	mov	ecx, 80
  6570                                  	;xor	eax, eax ; 0
  6571 00002B0E BB[5C610000]            	mov	ebx, wleds_addr
  6572                                  	; 22/12/2024
  6573 00002B13 BF[5C750000]            	mov	edi, prev_leds
  6574                                  tol_fill_c:
  6575 00002B18 31C0                    	xor	eax, eax ; 0 ; 22/12/2024
  6576 00002B1A 66AD                    	lodsw	; left
  6577 00002B1C 80C480                  	add	ah, 80h	; 24/12/2024
  6578 00002B1F 89C2                    	mov	edx, eax
  6579 00002B21 66AD                    	lodsw	; right
  6580                                  	;add	ax, dx
  6581 00002B23 80C480                  	add	ah, 80h
  6582                                  	;; 21/12/2024 (16 volume levels)
  6583                                  	;shr	eax, 12
  6584                                  	; 24/12/2024
  6585 00002B26 01D0                    	add	eax, edx
  6586 00002B28 C1E80D                  	shr	eax, 13	; (L+R/2) & 16 volume levels
  6587                                  
  6588 00002B2B 53                      	push	ebx ; *
  6589                                  	; 01/12/2024
  6590 00002B2C C1E002                  	shl	eax, 2
  6591 00002B2F 01C3                    	add	ebx, eax
  6592                                  	; 01/12/2024 (32bit address)
  6593                                  	;mov	edi, [ebx]
  6594                                  	; 22/12/2024
  6595 00002B31 8B03                    	mov	eax, [ebx]
  6596 00002B33 AB                      	stosd
  6597 00002B34 57                      	push	edi ; **
  6598 00002B35 89C7                    	mov	edi, eax
  6599                                  	;;;
  6600                                  	; 21/12/2024
  6601                                  	; (simulate wave leds in graphics mode)
  6602                                  	; (640*480, 256 colors)
  6603                                  turn_on_led:
  6604                                  	; edi = wave led address
  6605 00002B37 BD0E000000              	mov	ebp, 14
  6606 00002B3C BB[3C610000]            	mov	ebx, fontbuff2+(254*16) ; char = 254
  6607 00002B41 A0[59430000]            	mov	al, [ccolor]
  6608                                  tol_next_line:
  6609 00002B46 BA08000000              	mov	edx, 8 ; 8 pixels (8*14 pixel font)
  6610 00002B4B 8A23                    	mov	ah, [ebx]
  6611                                  tol_next_pixel:
  6612 00002B4D D0E4                    	shl	ah, 1
  6613 00002B4F 7310                    	jnc	short tol_skip_this
  6614 00002B51 AA                      	stosb
  6615                                  tol_next_pixel_@:
  6616 00002B52 4A                      	dec	edx
  6617 00002B53 75F8                    	jnz	short tol_next_pixel
  6618 00002B55 4D                      	dec	ebp
  6619 00002B56 740C                    	jz	short tol_next_led
  6620                                  	; 22/12/2024
  6621 00002B58 81C778020000            	add	edi, 640-8 ; next line
  6622 00002B5E 43                      	inc	ebx
  6623 00002B5F EBE5                    	jmp	short tol_next_line
  6624                                  tol_skip_this:
  6625 00002B61 47                      	inc	edi
  6626 00002B62 EBEE                    	jmp	short tol_next_pixel_@
  6627                                  tol_next_led:
  6628                                  	; 22/12/2024
  6629 00002B64 5F                      	pop	edi ; **
  6630                                  	;;;
  6631 00002B65 5B                      	pop	ebx ; *
  6632 00002B66 83C340                  	add	ebx, 16*4
  6633 00002B69 E2AD                    	loop	tol_fill_c
  6634                                  
  6635 00002B6B C3                      	retn
  6636                                  
  6637                                  ; -------------------------------------------------------------
  6638                                  
  6639                                  ; -------------------------------------------------------------
  6640                                  ; ac97.inc (11/11/2023)
  6641                                  ; -------------------------------------------------------------
  6642                                  
  6643                                  ; special characters
  6644                                  LF      EQU 10
  6645                                  CR      EQU 13
  6646                                  
  6647                                  ; PCI stuff
  6648                                  
  6649                                  ; Intel ICH2 equates. It is assumed that ICH0 and plain ole ICH are compatible.
  6650                                  
  6651                                  INTEL_VID       equ     8086h           ; Intel's PCI vendor ID
  6652                                  ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004)
  6653                                  SIS_VID		equ	1039h
  6654                                  NVIDIA_VID	equ	10DEh	 ; Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source c.
  6655                                  AMD_VID		equ	1022h
  6656                                  
  6657                                  ICH_DID         equ     2415h           ; ICH device ID
  6658                                  ICH0_DID        equ     2425h           ; ICH0
  6659                                  ICH2_DID        equ     2445h           ; ICH2 I think there are more ICHes.
  6660                                                                          ; they all should be compatible.
  6661                                  
  6662                                  ; 17/02/2017 (Erdogan Tan, ref: ALSA Device IDs, ALSA project)
  6663                                  ICH3_DID	equ     2485h           ; ICH3
  6664                                  ICH4_DID        equ     24C5h           ; ICH4
  6665                                  ICH5_DID	equ     24D5h           ; ICH5
  6666                                  ICH6_DID	equ     266Eh           ; ICH6
  6667                                  ESB6300_DID	equ     25A6h           ; 6300ESB
  6668                                  ESB631X_DID	equ     2698h           ; 631XESB
  6669                                  ICH7_DID	equ	27DEh		; ICH7
  6670                                  ; 03/11/2023 - Erdogan Tan (Ref: MenuetOS AC97 WAV Player source code, 2004)
  6671                                  MX82440_DID	equ	7195h
  6672                                  SI7012_DID	equ	7012h
  6673                                  NFORCE_DID	equ	01B1h
  6674                                  NFORCE2_DID	equ	006Ah
  6675                                  AMD8111_DID	equ	746Dh
  6676                                  AMD768_DID	equ	7445h
  6677                                  ; 03/11/2023 - Erdogan Tan - Ref: MPXPLAY/SBEMU/KOLIBRIOS AC97 source code
  6678                                  CK804_DID	equ	0059h
  6679                                  MCP04_DID	equ	003Ah
  6680                                  CK8_DID		equ	008Ah
  6681                                  NFORCE3_DID	equ	00DAh
  6682                                  CK8S_DID	equ	00EAh
  6683                                  
  6684                                  ; -------------------------------------------------------------
  6685                                  
  6686                                  ; 22/12/2024
  6687                                  align 4
  6688                                  
  6689                                  ; 13/11/2024
  6690                                  ; ('<<' to 'shl' conversion for FASM)
  6691                                  ;
  6692                                  ; 29/05/2024 (TRDOS 386)
  6693                                  ; 17/02/2017
  6694                                  ; Valid ICH device IDs
  6695                                  
  6696                                  valid_ids:
  6697                                  	;dd (ICH_DID shl 16) + INTEL_VID	; 8086h:2415h
  6698 00002B6C 86801524                	dd (ICH_DID << 16) + INTEL_VID		; 8086h:2415h
  6699 00002B70 86802524                	dd (ICH0_DID << 16) + INTEL_VID		; 8086h:2425h
  6700 00002B74 86804524                	dd (ICH2_DID << 16) + INTEL_VID		; 8086h:2445h
  6701 00002B78 86808524                	dd (ICH3_DID << 16) + INTEL_VID		; 8086h:2485h
  6702 00002B7C 8680C524                	dd (ICH4_DID << 16) + INTEL_VID		; 8086h:24C5h
  6703 00002B80 8680D524                	dd (ICH5_DID << 16) + INTEL_VID		; 8086h:24D5h
  6704 00002B84 86806E26                	dd (ICH6_DID << 16) + INTEL_VID		; 8086h:266Eh
  6705 00002B88 8680A625                	dd (ESB6300_DID << 16) + INTEL_VID	; 8086h:25A6h
  6706 00002B8C 86809826                	dd (ESB631X_DID << 16) + INTEL_VID	; 8086h:2698h
  6707 00002B90 8680DE27                	dd (ICH7_DID << 16) + INTEL_VID		; 8086h:27DEh
  6708                                  	; 03/11/2023 - Erdogan Tan
  6709 00002B94 86809571                	dd (MX82440_DID << 16) + INTEL_VID	; 8086h:7195h
  6710 00002B98 39101270                	dd (SI7012_DID << 16)  + SIS_VID	; 1039h:7012h
  6711 00002B9C DE10B101                	dd (NFORCE_DID << 16)  + NVIDIA_VID	; 10DEh:01B1h
  6712 00002BA0 DE106A00                	dd (NFORCE2_DID << 16) + NVIDIA_VID	; 10DEh:006Ah
  6713 00002BA4 22106D74                	dd (AMD8111_DID << 16) + AMD_VID	; 1022h:746Dh
  6714 00002BA8 22104574                	dd (AMD768_DID << 16)  + AMD_VID	; 1022h:7445h
  6715 00002BAC DE105900                	dd (CK804_DID << 16) + NVIDIA_VID	; 10DEh:0059h
  6716 00002BB0 DE103A00                	dd (MCP04_DID << 16) + NVIDIA_VID	; 10DEh:003Ah
  6717 00002BB4 DE108A00                	dd (CK8_DID << 16) + NVIDIA_VID		; 1022h:008Ah
  6718 00002BB8 DE10DA00                	dd (NFORCE3_DID << 16) + NVIDIA_VID	; 10DEh:00DAh
  6719 00002BBC DE10EA00                	dd (CK8S_DID << 16) + NVIDIA_VID	; 10DEh:00EAh
  6720                                  
  6721                                  valid_id_count equ (($ - valid_ids)>>2)	; 05/11/2023
  6722                                  ; 13/11/2024
  6723                                  ;valid_id_count = ($ - valid_ids) shr 2	; 05/11/2023
  6724                                  
  6725 00002BC0 00000000                	dd 0
  6726                                  
  6727                                  Credits:
  6728 00002BC4 564741205741562050-     	db 'VGA WAV Player for TRDOS 386 by Erdogan Tan. '
  6728 00002BCD 6C6179657220666F72-
  6728 00002BD6 205452444F53203338-
  6728 00002BDF 36206279204572646F-
  6728 00002BE8 67616E2054616E2E20 
  6729                                  	;;db 'December 2024.', 10,13,0
  6730                                  	;db 'January 2025.', 10,13,0
  6731 00002BF1 466562727561727920-     	db 'February 2025.', 10,13,0
  6731 00002BFA 323032352E0A0D00   
  6732 00002C02 32372F31322F323032-     	db '27/12/2024', 10,13,0
  6732 00002C0B 340A0D00           
  6733 00002C0F 31382F30312F323032-     	db '18/01/2025', 10,13,0
  6733 00002C18 350A0D00           
  6734 00002C1C 30352F30322F323032-     	db '05/02/2025', 10,13
  6734 00002C25 350A0D             
  6735                                  ; 15/11/2024
  6736                                  reset:
  6737 00002C28 00                      	db 0
  6738                                  
  6739                                  msgAudioCardInfo:
  6740 00002C29 666F7220496E74656C-     	db 'for Intel AC97 (ICH) Audio Controller.', 10,13,0
  6740 00002C32 204143393720284943-
  6740 00002C3B 482920417564696F20-
  6740 00002C44 436F6E74726F6C6C65-
  6740 00002C4D 722E0A0D00         
  6741                                  
  6742                                  	; 25/12/2024
  6743                                  msg_usage:
  6744 00002C52 75736167653A205647-     	db 'usage: VGAPLAY <FileName1> <FileName2> <...>',10,13,0
  6744 00002C5B 41504C4159203C4669-
  6744 00002C64 6C654E616D65313E20-
  6744 00002C6D 3C46696C654E616D65-
  6744 00002C76 323E203C2E2E2E3E0A-
  6744 00002C7F 0D00               
  6745                                  
  6746                                  noDevMsg:
  6747 00002C81 4572726F723A20556E-     	db 'Error: Unable to find AC97 audio device!'
  6747 00002C8A 61626C6520746F2066-
  6747 00002C93 696E64204143393720-
  6747 00002C9C 617564696F20646576-
  6747 00002CA5 69636521           
  6748 00002CA9 0A0D00                  	db 10,13,0
  6749                                  
  6750                                  noFileErrMsg:
  6751 00002CAC 4572726F723A206669-     	db 'Error: file not found.',10,13,0
  6751 00002CB5 6C65206E6F7420666F-
  6751 00002CBE 756E642E0A0D00     
  6752                                  
  6753                                  ; 07/12/2024
  6754                                  trdos386_err_msg:
  6755 00002CC5 5452444F5320333836-     	db 'TRDOS 386 System call error !',10,13,0
  6755 00002CCE 2053797374656D2063-
  6755 00002CD7 616C6C206572726F72-
  6755 00002CE0 20210A0D00         
  6756                                  
  6757                                  ; 29/05/2024
  6758                                  ; 11/11/2023
  6759                                  msg_init_err:
  6760 00002CE5 0D0A                    	db CR, LF
  6761 00002CE7 4143393720436F6E74-     	db 'AC97 Controller/Codec initialization error !'
  6761 00002CF0 726F6C6C65722F436F-
  6761 00002CF9 64656320696E697469-
  6761 00002D02 616C697A6174696F6E-
  6761 00002D0B 206572726F722021   
  6762 00002D13 0D0A00                  	db CR, LF, 0 ; 07/12/2024
  6763                                  
  6764                                  ; 25/11/2023
  6765                                  msg_no_vra:
  6766 00002D16 0A0D                    	db 10,13
  6767 00002D18 4E6F20565241207375-     	db 'No VRA support ! Only 48 kHZ sample rate supported !'
  6767 00002D21 70706F72742021204F-
  6767 00002D2A 6E6C79203438206B48-
  6767 00002D33 5A2073616D706C6520-
  6767 00002D3C 726174652073757070-
  6767 00002D45 6F727465642021     
  6768 00002D4C 0A0D00                  	db 10,13,0
  6769                                  
  6770                                  ; 19/11/2024
  6771                                  ; 03/06/2017
  6772                                  hex_chars:
  6773 00002D4F 303132333435363738-     	db '0123456789ABCDEF', 0
  6773 00002D58 3941424344454600   
  6774                                  msgAC97Info:
  6775 00002D60 0D0A                    	db 0Dh, 0Ah
  6776 00002D62 204143393720417564-     	db ' AC97 Audio Controller & Codec Info', 0Dh, 0Ah 
  6776 00002D6B 696F20436F6E74726F-
  6776 00002D74 6C6C6572202620436F-
  6776 00002D7D 64656320496E666F0D-
  6776 00002D86 0A                 
  6777 00002D87 2056656E646F722049-     	db ' Vendor ID: '
  6777 00002D90 443A20             
  6778                                  msgVendorId:
  6779 00002D93 303030306820446576-     	db '0000h Device ID: '
  6779 00002D9C 6963652049443A20   
  6780                                  msgDevId:
  6781 00002DA4 30303030680D0A          	db '0000h', 0Dh, 0Ah
  6782 00002DAB 204275733A20            	db ' Bus: '
  6783                                  msgBusNo:
  6784 00002DB1 303068204465766963-     	db '00h Device: '
  6784 00002DBA 653A20             
  6785                                  msgDevNo:
  6786 00002DBD 3030682046756E6374-     	db '00h Function: '
  6786 00002DC6 696F6E3A20         
  6787                                  msgFncNo:
  6788 00002DCB 303068                  	db '00h'
  6789 00002DCE 0D0A                    	db 0Dh, 0Ah
  6790 00002DD0 204E414D4241523A20      	db ' NAMBAR: '
  6791                                  msgNamBar:
  6792 00002DD9 30303030682020          	db '0000h  '
  6793 00002DE0 4E41424D4241523A20      	db 'NABMBAR: '
  6794                                  msgNabmBar:
  6795 00002DE9 303030306820204952-     	db '0000h  IRQ: '
  6795 00002DF2 513A20             
  6796                                  msgIRQ:
  6797 00002DF5 3030                    	dw 3030h
  6798 00002DF7 0D0A00                  	db 0Dh, 0Ah, 0
  6799                                  ; 25/11/2023
  6800                                  msgVRAheader:
  6801 00002DFA 205652412073757070-     	db ' VRA support: '
  6801 00002E03 6F72743A20         
  6802 00002E08 00                      	db 0	
  6803                                  msgVRAyes:
  6804 00002E09 5945530D0A00            	db 'YES', 0Dh, 0Ah, 0
  6805                                  msgVRAno:
  6806 00002E0F 4E4F200D0A              	db 'NO ', 0Dh, 0Ah
  6807 00002E14 2028496E746572706F-     	db ' (Interpolated sample rate playing method)'
  6807 00002E1D 6C617465642073616D-
  6807 00002E26 706C65207261746520-
  6807 00002E2F 706C6179696E67206D-
  6807 00002E38 6574686F6429       
  6808 00002E3E 0D0A00                  	db 0Dh, 0Ah, 0
  6809                                  
  6810 00002E41 90<rep 3h>              align 4
  6811                                  
  6812                                  ; -------------------------------------------------------------
  6813                                  
  6814                                  	; 21/12/2024
  6815                                  SplashScreen:
  6816 00002E44 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6816 00002E4D 202020202020202020-
  6816 00002E56 202020202020202020-
  6816 00002E5F 202020202020202020-
  6816 00002E68 202020202020202020-
  6816 00002E71 202020202020202020-
  6816 00002E7A 202020202020202020-
  6816 00002E83 202020202020202020-
  6816 00002E8C 2020202020DDDBDE   
  6817 00002E94 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6817 00002E9D 202020202020202020-
  6817 00002EA6 202020202020202020-
  6817 00002EAF 202020202020202020-
  6817 00002EB8 202020202020202020-
  6817 00002EC1 202020202020202020-
  6817 00002ECA 202020202020202020-
  6817 00002ED3 202020202020202020-
  6817 00002EDC 2020202020DDDBDE   
  6818 00002EE4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6818 00002EED 202020202020202020-
  6818 00002EF6 202020202020202020-
  6818 00002EFF 202020202020202020-
  6818 00002F08 202020202020202020-
  6818 00002F11 202020202020202020-
  6818 00002F1A 202020202020202020-
  6818 00002F23 202020202020202020-
  6818 00002F2C 2020202020DDDBDE   
  6819 00002F34 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6819 00002F3D 202020202020202020-
  6819 00002F46 202020202020202020-
  6819 00002F4F 202020202020202020-
  6819 00002F58 202020202020202020-
  6819 00002F61 202020202020202020-
  6819 00002F6A 202020202020202020-
  6819 00002F73 202020202020202020-
  6819 00002F7C 2020202020DDDBDE   
  6820 00002F84 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6820 00002F8D 202020202020202020-
  6820 00002F96 202020202020202020-
  6820 00002F9F 202020202020202020-
  6820 00002FA8 202020202020202020-
  6820 00002FB1 202020202020202020-
  6820 00002FBA 202020202020202020-
  6820 00002FC3 202020202020202020-
  6820 00002FCC 2020202020DDDBDE   
  6821 00002FD4 DDDBDE202020202020-     	db  221, 219, 222, "                     _______   ______        _______.                     ", 221, 219, 222
  6821 00002FDD 202020202020202020-
  6821 00002FE6 2020202020205F5F5F-
  6821 00002FEF 5F5F5F5F2020205F5F-
  6821 00002FF8 5F5F5F5F2020202020-
  6821 00003001 2020205F5F5F5F5F5F-
  6821 0000300A 5F2E20202020202020-
  6821 00003013 202020202020202020-
  6821 0000301C 2020202020DDDBDE   
  6822 00003024 DDDBDE202020202020-     	db  221, 219, 222, "                    |       \ /  __  \      /       |                     ", 221, 219, 222
  6822 0000302D 202020202020202020-
  6822 00003036 20202020207C202020-
  6822 0000303F 202020205C202F2020-
  6822 00003048 5F5F20205C20202020-
  6822 00003051 20202F202020202020-
  6822 0000305A 207C20202020202020-
  6822 00003063 202020202020202020-
  6822 0000306C 2020202020DDDBDE   
  6823 00003074 DDDBDE202020202020-     	db  221, 219, 222, "                    |  .--.  |  |  |  |    |   (----`                     ", 221, 219, 222
  6823 0000307D 202020202020202020-
  6823 00003086 20202020207C20202E-
  6823 0000308F 2D2D2E20207C20207C-
  6823 00003098 20207C20207C202020-
  6823 000030A1 207C202020282D2D2D-
  6823 000030AA 2D6020202020202020-
  6823 000030B3 202020202020202020-
  6823 000030BC 2020202020DDDBDE   
  6824 000030C4 DDDBDE202020202020-     	db  221, 219, 222, "                    |  |  |  |  |  |  |     \   \                         ", 221, 219, 222
  6824 000030CD 202020202020202020-
  6824 000030D6 20202020207C20207C-
  6824 000030DF 20207C20207C20207C-
  6824 000030E8 20207C20207C202020-
  6824 000030F1 20205C2020205C2020-
  6824 000030FA 202020202020202020-
  6824 00003103 202020202020202020-
  6824 0000310C 2020202020DDDBDE   
  6825 00003114 DDDBDE202020202020-     	db  221, 219, 222, "                    |  '--'  |  `--'  | .----)   |                        ", 221, 219, 222
  6825 0000311D 202020202020202020-
  6825 00003126 20202020207C202027-
  6825 0000312F 2D2D2720207C202060-
  6825 00003138 2D2D2720207C202E2D-
  6825 00003141 2D2D2D292020207C20-
  6825 0000314A 202020202020202020-
  6825 00003153 202020202020202020-
  6825 0000315C 2020202020DDDBDE   
  6826 00003164 DDDBDE202020202020-     	db  221, 219, 222, "                    |_______/ \______/  |_______/                         ", 221, 219, 222
  6826 0000316D 202020202020202020-
  6826 00003176 20202020207C5F5F5F-
  6826 0000317F 5F5F5F5F2F205C5F5F-
  6826 00003188 5F5F5F5F2F20207C5F-
  6826 00003191 5F5F5F5F5F5F2F2020-
  6826 0000319A 202020202020202020-
  6826 000031A3 202020202020202020-
  6826 000031AC 2020202020DDDBDE   
  6827 000031B4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6827 000031BD 202020202020202020-
  6827 000031C6 202020202020202020-
  6827 000031CF 202020202020202020-
  6827 000031D8 202020202020202020-
  6827 000031E1 202020202020202020-
  6827 000031EA 202020202020202020-
  6827 000031F3 202020202020202020-
  6827 000031FC 2020202020DDDBDE   
  6828 00003204 DDDBDE20202020202E-     	db  221, 219, 222, "     .______    __          ___   ____    ____  _______ .______           ", 221, 219, 222
  6828 0000320D 5F5F5F5F5F5F202020-
  6828 00003216 205F5F202020202020-
  6828 0000321F 202020205F5F5F2020-
  6828 00003228 205F5F5F5F20202020-
  6828 00003231 5F5F5F5F20205F5F5F-
  6828 0000323A 5F5F5F5F202E5F5F5F-
  6828 00003243 5F5F5F202020202020-
  6828 0000324C 2020202020DDDBDE   
  6829 00003254 DDDBDE20202020207C-     	db  221, 219, 222, "     |   _  \  |  |        /   \  \   \  /   / |   ____||   _  \          ", 221, 219, 222
  6829 0000325D 2020205F20205C2020-
  6829 00003266 7C20207C2020202020-
  6829 0000326F 2020202F2020205C20-
  6829 00003278 205C2020205C20202F-
  6829 00003281 2020202F207C202020-
  6829 0000328A 5F5F5F5F7C7C202020-
  6829 00003293 5F20205C2020202020-
  6829 0000329C 2020202020DDDBDE   
  6830 000032A4 DDDBDE20202020207C-     	db  221, 219, 222, "     |  |_)  | |  |       /  ^  \  \   \/   /  |  |__   |  |_)  |         ", 221, 219, 222
  6830 000032AD 20207C5F2920207C20-
  6830 000032B6 7C20207C2020202020-
  6830 000032BF 20202F20205E20205C-
  6830 000032C8 20205C2020205C2F20-
  6830 000032D1 20202F20207C20207C-
  6830 000032DA 5F5F2020207C20207C-
  6830 000032E3 5F2920207C20202020-
  6830 000032EC 2020202020DDDBDE   
  6831 000032F4 DDDBDE20202020207C-     	db  221, 219, 222, "     |   ___/  |  |      /  /_\  \  \_    _/   |   __|  |      /          ", 221, 219, 222
  6831 000032FD 2020205F5F5F2F2020-
  6831 00003306 7C20207C2020202020-
  6831 0000330F 202F20202F5F5C2020-
  6831 00003318 5C20205C5F20202020-
  6831 00003321 5F2F2020207C202020-
  6831 0000332A 5F5F7C20207C202020-
  6831 00003333 2020202F2020202020-
  6831 0000333C 2020202020DDDBDE   
  6832 00003344 DDDBDE20202020207C-     	db  221, 219, 222, "     |  |      |  `----./  _____  \   |  |     |  |____ |  |\  \----.     ", 221, 219, 222
  6832 0000334D 20207C202020202020-
  6832 00003356 7C2020602D2D2D2D2E-
  6832 0000335F 2F20205F5F5F5F5F20-
  6832 00003368 205C2020207C20207C-
  6832 00003371 20202020207C20207C-
  6832 0000337A 5F5F5F5F207C20207C-
  6832 00003383 5C20205C2D2D2D2D2E-
  6832 0000338C 2020202020DDDBDE   
  6833 00003394 DDDBDE20202020207C-     	db  221, 219, 222, "     | _|      |_______/__/     \__\  |__|     |_______|| _| `._____|     ", 221, 219, 222
  6833 0000339D 205F7C202020202020-
  6833 000033A6 7C5F5F5F5F5F5F5F2F-
  6833 000033AF 5F5F2F20202020205C-
  6833 000033B8 5F5F5C20207C5F5F7C-
  6833 000033C1 20202020207C5F5F5F-
  6833 000033CA 5F5F5F5F7C7C205F7C-
  6833 000033D3 20602E5F5F5F5F5F7C-
  6833 000033DC 2020202020DDDBDE   
  6834 000033E4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6834 000033ED 202020202020202020-
  6834 000033F6 202020202020202020-
  6834 000033FF 202020202020202020-
  6834 00003408 202020202020202020-
  6834 00003411 202020202020202020-
  6834 0000341A 202020202020202020-
  6834 00003423 202020202020202020-
  6834 0000342C 2020202020DDDBDE   
  6835 00003434 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6835 0000343D 202020202020202020-
  6835 00003446 202020202020202020-
  6835 0000344F 202020202020202020-
  6835 00003458 202020202020202020-
  6835 00003461 202020202020202020-
  6835 0000346A 202020202020202020-
  6835 00003473 202020202020202020-
  6835 0000347C 2020202020DDDBDE   
  6836 00003484 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6836 0000348D 202020202020202020-
  6836 00003496 202020202020202020-
  6836 0000349F 202020202020202020-
  6836 000034A8 202020202020202020-
  6836 000034B1 202020202020202020-
  6836 000034BA 202020202020202020-
  6836 000034C3 202020202020202020-
  6836 000034CC 2020202020DDDBDE   
  6837 000034D4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6837 000034DD 202020202020202020-
  6837 000034E6 202020202020202020-
  6837 000034EF 202020202020202020-
  6837 000034F8 202020202020202020-
  6837 00003501 202020202020202020-
  6837 0000350A 202020202020202020-
  6837 00003513 202020202020202020-
  6837 0000351C 2020202020DDDBDE   
  6838 00003524 DDDBDE202020202020-     	db  221, 219, 222, "                                WELCOME TO                                ", 221, 219, 222
  6838 0000352D 202020202020202020-
  6838 00003536 202020202020202020-
  6838 0000353F 202020202020202057-
  6838 00003548 454C434F4D4520544F-
  6838 00003551 202020202020202020-
  6838 0000355A 202020202020202020-
  6838 00003563 202020202020202020-
  6838 0000356C 2020202020DDDBDE   
  6839 00003574 DDDBDE202020202020-     	db  221, 219, 222, "                                DOS PLAYER                                ", 221, 219, 222
  6839 0000357D 202020202020202020-
  6839 00003586 202020202020202020-
  6839 0000358F 202020202020202044-
  6839 00003598 4F5320504C41594552-
  6839 000035A1 202020202020202020-
  6839 000035AA 202020202020202020-
  6839 000035B3 202020202020202020-
  6839 000035BC 2020202020DDDBDE   
  6840 000035C4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6840 000035CD 202020202020202020-
  6840 000035D6 202020202020202020-
  6840 000035DF 202020202020202020-
  6840 000035E8 202020202020202020-
  6840 000035F1 202020202020202020-
  6840 000035FA 202020202020202020-
  6840 00003603 202020202020202020-
  6840 0000360C 2020202020DDDBDE   
  6841 00003614 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6841 0000361D 202020202020202020-
  6841 00003626 202020202020202020-
  6841 0000362F 202020202020202020-
  6841 00003638 202020202020202020-
  6841 00003641 202020202020202020-
  6841 0000364A 202020202020202020-
  6841 00003653 202020202020202020-
  6841 0000365C 2020202020DDDBDE   
  6842 00003664 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6842 0000366D 202020202020202020-
  6842 00003676 202020202020202020-
  6842 0000367F 202020202020202020-
  6842 00003688 202020202020202020-
  6842 00003691 202020202020202020-
  6842 0000369A 202020202020202020-
  6842 000036A3 202020202020202020-
  6842 000036AC 2020202020DDDBDE   
  6843 000036B4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6843 000036BD 202020202020202020-
  6843 000036C6 202020202020202020-
  6843 000036CF 202020202020202020-
  6843 000036D8 202020202020202020-
  6843 000036E1 202020202020202020-
  6843 000036EA 202020202020202020-
  6843 000036F3 202020202020202020-
  6843 000036FC 2020202020DDDBDE   
  6844 00003704 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6844 0000370D 202020202020202020-
  6844 00003716 202020202020202020-
  6844 0000371F 202020202020202020-
  6844 00003728 202020202020202020-
  6844 00003731 202020202020202020-
  6844 0000373A 202020202020202020-
  6844 00003743 202020202020202020-
  6844 0000374C 2020202020DDDBDE   
  6845 00003754 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6845 0000375D 202020202020202020-
  6845 00003766 202020202020202020-
  6845 0000376F 202020202020202020-
  6845 00003778 202020202020202020-
  6845 00003781 202020202020202020-
  6845 0000378A 202020202020202020-
  6845 00003793 202020202020202020-
  6845 0000379C 2020202020DDDBDE   
  6846 000037A4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6846 000037AD 202020202020202020-
  6846 000037B6 202020202020202020-
  6846 000037BF 202020202020202020-
  6846 000037C8 202020202020202020-
  6846 000037D1 202020202020202020-
  6846 000037DA 202020202020202020-
  6846 000037E3 202020202020202020-
  6846 000037EC 2020202020DDDBDE   
  6847 000037F4 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6847 000037FD 202020202020202020-
  6847 00003806 202020202020202020-
  6847 0000380F 202020202020202020-
  6847 00003818 202020202020202020-
  6847 00003821 202020202020202020-
  6847 0000382A 202020202020202020-
  6847 00003833 202020202020202020-
  6847 0000383C 2020202020DDDBDE   
  6848 00003844 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6848 0000384D 202020202020202020-
  6848 00003856 202020202020202020-
  6848 0000385F 202020202020202020-
  6848 00003868 202020202020202020-
  6848 00003871 202020202020202020-
  6848 0000387A 202020202020202020-
  6848 00003883 202020202020202020-
  6848 0000388C 2020202020DDDBDE   
  6849 00003894 DDDBDE202020202020-     	db  221, 219, 222, "                                                                          ", 221, 219, 222
  6849 0000389D 202020202020202020-
  6849 000038A6 202020202020202020-
  6849 000038AF 202020202020202020-
  6849 000038B8 202020202020202020-
  6849 000038C1 202020202020202020-
  6849 000038CA 202020202020202020-
  6849 000038D3 202020202020202020-
  6849 000038DC 2020202020DDDBDE   
  6850 000038E4 00                      	db 0
  6851                                  
  6852                                  ; -------------------------------------------------------------
  6853                                  
  6854                                  	; 25/12/2024
  6855                                  PlayingScreen:
  6856 000038E5 DBDBDBDBDBDBDBDBDB-     	db  34 dup(219), " DOS Player ", 34 dup(219)
  6856 000038EE DBDBDBDBDBDBDBDBDB-
  6856 000038F7 DBDBDBDBDBDBDBDBDB-
  6856 00003900 DBDBDBDBDBDBDB2044-
  6856 00003909 4F5320506C61796572-
  6856 00003912 20DBDBDBDBDBDBDBDB-
  6856 0000391B DBDBDBDBDBDBDBDBDB-
  6856 00003924 DBDBDBDBDBDBDBDBDB-
  6856 0000392D DBDBDBDBDBDBDBDB   
  6857 00003935 C9CDCDCDCDCDCDCDCD-     	db  201, 78 dup(205), 187
  6857 0000393E CDCDCDCDCDCDCDCDCD-
  6857 00003947 CDCDCDCDCDCDCDCDCD-
  6857 00003950 CDCDCDCDCDCDCDCDCD-
  6857 00003959 CDCDCDCDCDCDCDCDCD-
  6857 00003962 CDCDCDCDCDCDCDCDCD-
  6857 0000396B CDCDCDCDCDCDCDCDCD-
  6857 00003974 CDCDCDCDCDCDCDCDCD-
  6857 0000397D CDCDCDCDCDCDCDBB   
  6858 00003985 BA2020202020202020-     	db  186, 33 dup(32), " User Guide ", 33 dup(32), 186
  6858 0000398E 202020202020202020-
  6858 00003997 202020202020202020-
  6858 000039A0 202020202020202055-
  6858 000039A9 736572204775696465-
  6858 000039B2 202020202020202020-
  6858 000039BB 202020202020202020-
  6858 000039C4 202020202020202020-
  6858 000039CD 20202020202020BA   
  6859 000039D5 BA2020202020203C53-     	db  186, 6  dup(32), "<Space>         Play/Pause    ", 4 dup(32), "<N>/<P>         Next/Previous", 9 dup(32), 186
  6859 000039DE 706163653E20202020-
  6859 000039E7 2020202020506C6179-
  6859 000039F0 2F5061757365202020-
  6859 000039F9 20202020203C4E3E2F-
  6859 00003A02 3C503E202020202020-
  6859 00003A0B 2020204E6578742F50-
  6859 00003A14 726576696F75732020-
  6859 00003A1D 20202020202020BA   
  6860 00003A25 BA2020202020203C53-     	db  186, 6  dup(32), "<S>             Stop          ", 4 dup(32), "<Enter>/<G>     Wave Lighting", 9 dup(32), 186
  6860 00003A2E 3E2020202020202020-
  6860 00003A37 202020202053746F70-
  6860 00003A40 202020202020202020-
  6860 00003A49 20202020203C456E74-
  6860 00003A52 65723E2F3C473E2020-
  6860 00003A5B 20202057617665204C-
  6860 00003A64 69676874696E672020-
  6860 00003A6D 20202020202020BA   
  6861 00003A75 BA2020202020203C46-     	db  186, 6  dup(32), "<F>             Forwards      ", 4 dup(32), "<+>/<->         Inc/Dec Volume", 8 dup(32), 186
  6861 00003A7E 3E2020202020202020-
  6861 00003A87 2020202020466F7277-
  6861 00003A90 617264732020202020-
  6861 00003A99 20202020203C2B3E2F-
  6861 00003AA2 3C2D3E202020202020-
  6861 00003AAB 202020496E632F4465-
  6861 00003AB4 6320566F6C756D6520-
  6861 00003ABD 20202020202020BA   
  6862 00003AC5 BA2020202020203C42-     	db  186, 6  dup(32), "<B>             Backwards     ", 4 dup(32), "<Q>             Quit Program ", 9 dup(32), 186
  6862 00003ACE 3E2020202020202020-
  6862 00003AD7 20202020204261636B-
  6862 00003AE0 776172647320202020-
  6862 00003AE9 20202020203C513E20-
  6862 00003AF2 202020202020202020-
  6862 00003AFB 202020517569742050-
  6862 00003B04 726F6772616D202020-
  6862 00003B0D 20202020202020BA   
  6863 00003B15 CCCDCDCDCDCDCDCDCD-     	db  204, 78 dup(205), 185
  6863 00003B1E CDCDCDCDCDCDCDCDCD-
  6863 00003B27 CDCDCDCDCDCDCDCDCD-
  6863 00003B30 CDCDCDCDCDCDCDCDCD-
  6863 00003B39 CDCDCDCDCDCDCDCDCD-
  6863 00003B42 CDCDCDCDCDCDCDCDCD-
  6863 00003B4B CDCDCDCDCDCDCDCDCD-
  6863 00003B54 CDCDCDCDCDCDCDCDCD-
  6863 00003B5D CDCDCDCDCDCDCDB9   
  6864 00003B65 BA2020202020204669-     	db  186, 6  dup(32), "File Name :                   ", 4 dup(32), "Bit-Rate  :     0  Bits      ", 9 dup(32), 186
  6864 00003B6E 6C65204E616D65203A-
  6864 00003B77 202020202020202020-
  6864 00003B80 202020202020202020-
  6864 00003B89 20202020204269742D-
  6864 00003B92 5261746520203A2020-
  6864 00003B9B 202020302020426974-
  6864 00003BA4 732020202020202020-
  6864 00003BAD 20202020202020BA   
  6865 00003BB5 BA2020202020204672-     	db  186, 6  dup(32), "Frequency :     0     Hz      ", 4 dup(32), "#-Channels:     0            ", 9 dup(32), 186
  6865 00003BBE 657175656E6379203A-
  6865 00003BC7 202020202030202020-
  6865 00003BD0 2020487A2020202020-
  6865 00003BD9 2020202020232D4368-
  6865 00003BE2 616E6E656C733A2020-
  6865 00003BEB 202020302020202020-
  6865 00003BF4 202020202020202020-
  6865 00003BFD 20202020202020BA   
  6866 00003C05 C8CDCDCDCDCDCDCDCD-     	db  200, 78 dup(205), 188
  6866 00003C0E CDCDCDCDCDCDCDCDCD-
  6866 00003C17 CDCDCDCDCDCDCDCDCD-
  6866 00003C20 CDCDCDCDCDCDCDCDCD-
  6866 00003C29 CDCDCDCDCDCDCDCDCD-
  6866 00003C32 CDCDCDCDCDCDCDCDCD-
  6866 00003C3B CDCDCDCDCDCDCDCDCD-
  6866 00003C44 CDCDCDCDCDCDCDCDCD-
  6866 00003C4D CDCDCDCDCDCDCDBC   
  6867 00003C55 202020202020202020-     	db  80 dup(32)
  6867 00003C5E 202020202020202020-
  6867 00003C67 202020202020202020-
  6867 00003C70 202020202020202020-
  6867 00003C79 202020202020202020-
  6867 00003C82 202020202020202020-
  6867 00003C8B 202020202020202020-
  6867 00003C94 202020202020202020-
  6867 00003C9D 2020202020202020   
  6868                                  improper_samplerate_txt:
  6869                                  read_error_txt:
  6870 00003CA5 202020202020202020-     	db  80 dup(32)
  6870 00003CAE 202020202020202020-
  6870 00003CB7 202020202020202020-
  6870 00003CC0 202020202020202020-
  6870 00003CC9 202020202020202020-
  6870 00003CD2 202020202020202020-
  6870 00003CDB 202020202020202020-
  6870 00003CE4 202020202020202020-
  6870 00003CED 2020202020202020   
  6871 00003CF5 202020202020202020-     	db  80 dup(32)
  6871 00003CFE 202020202020202020-
  6871 00003D07 202020202020202020-
  6871 00003D10 202020202020202020-
  6871 00003D19 202020202020202020-
  6871 00003D22 202020202020202020-
  6871 00003D2B 202020202020202020-
  6871 00003D34 202020202020202020-
  6871 00003D3D 2020202020202020   
  6872 00003D45 202020202020202020-     	db  80 dup(32)
  6872 00003D4E 202020202020202020-
  6872 00003D57 202020202020202020-
  6872 00003D60 202020202020202020-
  6872 00003D69 202020202020202020-
  6872 00003D72 202020202020202020-
  6872 00003D7B 202020202020202020-
  6872 00003D84 202020202020202020-
  6872 00003D8D 2020202020202020   
  6873 00003D95 202020202020202020-     	db  80 dup(32)
  6873 00003D9E 202020202020202020-
  6873 00003DA7 202020202020202020-
  6873 00003DB0 202020202020202020-
  6873 00003DB9 202020202020202020-
  6873 00003DC2 202020202020202020-
  6873 00003DCB 202020202020202020-
  6873 00003DD4 202020202020202020-
  6873 00003DDD 2020202020202020   
  6874 00003DE5 202020202020202020-     	db  80 dup(32)
  6874 00003DEE 202020202020202020-
  6874 00003DF7 202020202020202020-
  6874 00003E00 202020202020202020-
  6874 00003E09 202020202020202020-
  6874 00003E12 202020202020202020-
  6874 00003E1B 202020202020202020-
  6874 00003E24 202020202020202020-
  6874 00003E2D 2020202020202020   
  6875 00003E35 202020202020202020-     	db  80 dup(32)
  6875 00003E3E 202020202020202020-
  6875 00003E47 202020202020202020-
  6875 00003E50 202020202020202020-
  6875 00003E59 202020202020202020-
  6875 00003E62 202020202020202020-
  6875 00003E6B 202020202020202020-
  6875 00003E74 202020202020202020-
  6875 00003E7D 2020202020202020   
  6876 00003E85 202020202020202020-     	db  80 dup(32)
  6876 00003E8E 202020202020202020-
  6876 00003E97 202020202020202020-
  6876 00003EA0 202020202020202020-
  6876 00003EA9 202020202020202020-
  6876 00003EB2 202020202020202020-
  6876 00003EBB 202020202020202020-
  6876 00003EC4 202020202020202020-
  6876 00003ECD 2020202020202020   
  6877 00003ED5 202020202020202020-     	db  80 dup(32)
  6877 00003EDE 202020202020202020-
  6877 00003EE7 202020202020202020-
  6877 00003EF0 202020202020202020-
  6877 00003EF9 202020202020202020-
  6877 00003F02 202020202020202020-
  6877 00003F0B 202020202020202020-
  6877 00003F14 202020202020202020-
  6877 00003F1D 2020202020202020   
  6878 00003F25 202020202020202020-     	db  80 dup(32)
  6878 00003F2E 202020202020202020-
  6878 00003F37 202020202020202020-
  6878 00003F40 202020202020202020-
  6878 00003F49 202020202020202020-
  6878 00003F52 202020202020202020-
  6878 00003F5B 202020202020202020-
  6878 00003F64 202020202020202020-
  6878 00003F6D 2020202020202020   
  6879 00003F75 202020202020202020-     	db  80 dup(32)
  6879 00003F7E 202020202020202020-
  6879 00003F87 202020202020202020-
  6879 00003F90 202020202020202020-
  6879 00003F99 202020202020202020-
  6879 00003FA2 202020202020202020-
  6879 00003FAB 202020202020202020-
  6879 00003FB4 202020202020202020-
  6879 00003FBD 2020202020202020   
  6880 00003FC5 202020202020202020-     	db  80 dup(32)
  6880 00003FCE 202020202020202020-
  6880 00003FD7 202020202020202020-
  6880 00003FE0 202020202020202020-
  6880 00003FE9 202020202020202020-
  6880 00003FF2 202020202020202020-
  6880 00003FFB 202020202020202020-
  6880 00004004 202020202020202020-
  6880 0000400D 2020202020202020   
  6881 00004015 202020202020202020-     	db  80 dup(32)
  6881 0000401E 202020202020202020-
  6881 00004027 202020202020202020-
  6881 00004030 202020202020202020-
  6881 00004039 202020202020202020-
  6881 00004042 202020202020202020-
  6881 0000404B 202020202020202020-
  6881 00004054 202020202020202020-
  6881 0000405D 2020202020202020   
  6882 00004065 202020202020202020-     	db  80 dup(32)
  6882 0000406E 202020202020202020-
  6882 00004077 202020202020202020-
  6882 00004080 202020202020202020-
  6882 00004089 202020202020202020-
  6882 00004092 202020202020202020-
  6882 0000409B 202020202020202020-
  6882 000040A4 202020202020202020-
  6882 000040AD 2020202020202020   
  6883 000040B5 202020202020202020-     	db  80 dup(32)
  6883 000040BE 202020202020202020-
  6883 000040C7 202020202020202020-
  6883 000040D0 202020202020202020-
  6883 000040D9 202020202020202020-
  6883 000040E2 202020202020202020-
  6883 000040EB 202020202020202020-
  6883 000040F4 202020202020202020-
  6883 000040FD 2020202020202020   
  6884 00004105 202020202020202020-     	db  80 dup(32)
  6884 0000410E 202020202020202020-
  6884 00004117 202020202020202020-
  6884 00004120 202020202020202020-
  6884 00004129 202020202020202020-
  6884 00004132 202020202020202020-
  6884 0000413B 202020202020202020-
  6884 00004144 202020202020202020-
  6884 0000414D 2020202020202020   
  6885 00004155 202020202020202020-     	db  80 dup(32)
  6885 0000415E 202020202020202020-
  6885 00004167 202020202020202020-
  6885 00004170 202020202020202020-
  6885 00004179 202020202020202020-
  6885 00004182 202020202020202020-
  6885 0000418B 202020202020202020-
  6885 00004194 202020202020202020-
  6885 0000419D 2020202020202020   
  6886 000041A5 202020202020202020-     	db  80 dup(32)
  6886 000041AE 202020202020202020-
  6886 000041B7 202020202020202020-
  6886 000041C0 202020202020202020-
  6886 000041C9 202020202020202020-
  6886 000041D2 202020202020202020-
  6886 000041DB 202020202020202020-
  6886 000041E4 202020202020202020-
  6886 000041ED 2020202020202020   
  6887 000041F5 202020202020202020-     	db  80 dup(32)
  6887 000041FE 202020202020202020-
  6887 00004207 202020202020202020-
  6887 00004210 202020202020202020-
  6887 00004219 202020202020202020-
  6887 00004222 202020202020202020-
  6887 0000422B 202020202020202020-
  6887 00004234 202020202020202020-
  6887 0000423D 2020202020202020   
  6888 00004245 CDCDCDCDCDCDCDCDCD-     	db  80 dup(205)
  6888 0000424E CDCDCDCDCDCDCDCDCD-
  6888 00004257 CDCDCDCDCDCDCDCDCD-
  6888 00004260 CDCDCDCDCDCDCDCDCD-
  6888 00004269 CDCDCDCDCDCDCDCDCD-
  6888 00004272 CDCDCDCDCDCDCDCDCD-
  6888 0000427B CDCDCDCDCDCDCDCDCD-
  6888 00004284 CDCDCDCDCDCDCDCDCD-
  6888 0000428D CDCDCDCDCDCDCDCD   
  6889 00004295 202020202020202020-     	db  80 dup(32)
  6889 0000429E 202020202020202020-
  6889 000042A7 202020202020202020-
  6889 000042B0 202020202020202020-
  6889 000042B9 202020202020202020-
  6889 000042C2 202020202020202020-
  6889 000042CB 202020202020202020-
  6889 000042D4 202020202020202020-
  6889 000042DD 2020202020202020   
  6890 000042E5 202020202020202020-     	db  33 dup(32), "00:00 ", 174, 175, " 00:00", 24 dup(32), "VOL 000%"
  6890 000042EE 202020202020202020-
  6890 000042F7 202020202020202020-
  6890 00004300 20202020202030303A-
  6890 00004309 303020AEAF2030303A-
  6890 00004312 303020202020202020-
  6890 0000431B 202020202020202020-
  6890 00004324 202020202020202056-
  6890 0000432D 4F4C2030303025     
  6891 00004334 00                      	db 0
  6892                                  
  6893                                  ; 25/12/2024
  6894                                  ; 28/11/2024
  6895                                  IsInSplash:
  6896 00004335 01                      	db 1
  6897                                  
  6898                                  SplashFileName:
  6899 00004336 53504C4153482E5741-     	db "SPLASH.WAV", 0
  6899 0000433F 5600               
  6900                                  
  6901                                  ; -------------------------------------------------------------
  6902                                  
  6903                                  	; 22/12/2024
  6904                                  fillblock:
  6905 00004341 FF<rep Eh>              	times 14 db 0FFh
  6906 0000434F 0000                    	dw 0
  6907                                  
  6908                                  ; -------------------------------------------------------------
  6909                                  
  6910                                  ; 23/11/2024
  6911                                  colors:
  6912 00004351 0F0B0A0C0E090D0F        	db 0Fh, 0Bh, 0Ah, 0Ch, 0Eh, 09h, 0Dh, 0Fh
  6913                                  	; white, cyan, green, red, yellow, blue, magenta
  6914 00004359 0B                      ccolor:	db 0Bh	; cyan
  6915                                  
  6916                                  EOF: 
  6917                                  
  6918                                  ; -------------------------------------------------------------
  6919                                  
  6920                                  bss:
  6921                                  
  6922                                  ABSOLUTE bss
  6923                                  
  6924 0000435A ????                    alignb 4
  6925                                  
  6926                                  ; 21/12/2024
  6927                                  fontbuff1:
  6928 0000435C <res E00h>              	resb 256*14 ; 8x14 font data (from system)
  6929                                  fontbuff2:
  6930 0000515C <res 1000h>             	resb 256*16 ; 8x16 font data (modif. from 8x14)
  6931                                  
  6932                                  ; 11/12/2024
  6933                                  wleds_addr:
  6934 0000615C <res 1400h>             	resd 80*16 ; 32 bit addrs, 80 leds, 16 volume levels
  6935                                  ; 22/12/2024
  6936                                  prev_leds:
  6937 0000755C <res 140h>              	resd 80	; previous lighting leds
  6938                                  
  6939                                  ; 24/12/2024
  6940                                  wpoints_dif:	; wave lighting points factor (differential) 
  6941 0000769C ????????                	resd 1	; required bytes for 1/18 second wave lighting
  6942                                  graphstart:
  6943 000076A0 ????????                	resd 1	; start (top) line/row for wave lighting points 	 
  6944                                  
  6945                                  LFB_ADDR:
  6946 000076A4 ????????                	resd 1
  6947                                  ;nextrow:
  6948                                  	;resd 1
  6949                                  screenpos: ; hw = (cursor) row, lw = (cursor) column
  6950 000076A8 ????????                	resd 1
  6951 000076AC ????????                wcolor:	resd 1
  6952                                  ; 26/12/2024
  6953                                  ;tcolor: resb 1 ; text color
  6954                                  columns:
  6955 000076B0 ??                      	resb 1
  6956 000076B1 ??                      pbprev:	resb 1 ; previous progress bar indicator position
  6957                                  
  6958 000076B2 ????                    alignb 4
  6959                                  
  6960                                  bss_start:
  6961                                  
  6962                                  ; 24/12/2024
  6963                                  prev_points:
  6964 000076B4 <res A00h>              	resd 640 ; previous wave points (which are lighting)	
  6965                                  
  6966                                  ; 18/11/2024
  6967                                  stopped:
  6968 000080B4 ??                      	resb 1
  6969 000080B5 ??                      tLO:	resb 1
  6970                                  ; 21/11/2024
  6971 000080B6 ??                      tLP:	resb 1
  6972                                  ; 19/11/2024
  6973 000080B7 ??                      wleds:	resb 1
  6974                                  wleds_dif:
  6975 000080B8 ????????                	resd 1
  6976 000080BC ????????                pbuf_o:	resd 1
  6977                                  ; 07/12/2024
  6978 000080C0 ??                      pbuf_s:	resb 1
  6979                                  
  6980                                  ; 07/12/2024
  6981                                  ; 24/11/2024
  6982                                  half_buffer:
  6983 000080C1 ??                      	resb 1	; dma half buffer 1 or 2 (0 or 1)
  6984                                  
  6985                                  ; 30/05/2024
  6986 000080C2 ??                      VRA:	resb 1	; Variable Rate Audio Support Status
  6987                                  
  6988                                  ; 24/12/2024
  6989 000080C3 ??                      p_mode: resb 1	; point mode (as alternative to LED mode)
  6990                                  
  6991                                  ; 25/12/2024
  6992                                  ; 29/11/2024
  6993                                  command:
  6994 000080C4 ??                      	resb 1
  6995                                  filecount:
  6996 000080C5 ??                      	resb 1
  6997                                  
  6998                                  ; 30/11/2024
  6999 000080C6 ????                    alignb 4
  7000                                  
  7001                                  ;;;;;;;;;;;;;;
  7002                                  ; 14/11/2024
  7003                                  ; (Ref: player.asm, Matan Alfasi, 2017)  
  7004                                  WAVFILEHEADERbuff:
  7005                                  RIFF_ChunkID:
  7006 000080C8 ????????                	resd 1	; Must be equal to "RIFF" - big-endian
  7007                                  		; 0x52494646
  7008                                  RIFF_ChunkSize:
  7009 000080CC ????????                	resd 1	; Represents total file size, not 
  7010                                          	; including the first 2 fields 
  7011                                  		; (Total_File_Size - 8), little-endian
  7012                                  RIFF_Format:
  7013 000080D0 ????????                	resd 1	; Must be equal to "WAVE" - big-endian
  7014                                  		; 0x57415645
  7015                                  
  7016                                  ;; WAVE header parameters ("Sub-chunk")
  7017                                  WAVE_SubchunkID:
  7018 000080D4 ????????                	resd 1	; Must be equal to "fmt " - big-endian
  7019                                  		; 0x666d7420
  7020                                  WAVE_SubchunkSize:
  7021 000080D8 ????????                	resd 1	; Represents total chunk size
  7022                                  WAVE_AudioFormat:
  7023 000080DC ????                    	resw 1	; PCM (Raw) - is 1, other - is a form 
  7024                                  		; of compression, not supported.
  7025                                  WAVE_NumChannels:
  7026 000080DE ????                    	resw 1	; Number of channels, Mono-1, Stereo-2
  7027                                  WAVE_SampleRate:
  7028 000080E0 ????????                	resd 1	; Frequency rate, in Hz (8000, 44100 ...)
  7029                                  WAVE_ByteRate:
  7030 000080E4 ????????                	resd 1	; SampleRate * NumChannels * BytesPerSample
  7031                                  WAVE_BlockAlign:
  7032 000080E8 ????                    	resw 1	; NumChannels * BytesPerSample
  7033                                  		; Number of bytes for one sample.
  7034                                  WAVE_BitsPerSample:
  7035 000080EA ????                    	resw 1	; 8 = 8 bits, 16 = 16 bits, etc.
  7036                                  
  7037                                  ;; DATA header parameters
  7038                                  DATA_SubchunkID:
  7039 000080EC ????????                	resd 1	; Must be equal to "data" - big-endian
  7040                                          	; 0x64617461
  7041                                  DATA_SubchunkSize:
  7042 000080F0 ????????                	resd 1	; NumSamples * NumChannels * BytesPerSample
  7043                                          	; Number of bytes in the data.
  7044                                  ;;;;;;;;;;;;;;
  7045                                  
  7046                                  ; 15/11/2024
  7047                                  cursortype:
  7048 000080F4 ????                    	resw 1
  7049 000080F6 ??                      flags:	resb 1
  7050                                  ; 06/11/2023
  7051                                  ac97_int_ln_reg:
  7052 000080F7 ??                      	resb 1
  7053                                  filehandle:
  7054 000080F8 ????????                	resd 1
  7055                                  
  7056                                  ; 25/12/2024
  7057                                  ; 30/11/2024
  7058                                  ;argc:	resb 1	; argument count
  7059 000080FC ????????                argv:	resd 1	; current argument (wav file) ptr
  7060 00008100 ????????                argvf:	resd 1	; 1st argument (wav file) ptr
  7061 00008104 ????????                argvl:	resd 1	; last argument (wav file) ptr
  7062                                  
  7063                                  ; 30/05/2024
  7064                                  wav_file_name:
  7065 00008108 <res 50h>               	resb 80	; wave file, path name (<= 80 bytes)
  7066 00008158 ????                    	resw 1	; 30/11/2024
  7067                                  
  7068                                  ; 08/11/2023
  7069                                  ; 07/11/2023
  7070                                  fbs_shift:
  7071 0000815A ??                      	resb 1
  7072                                  ; 07/12/2024
  7073 0000815B ??                      SRB:	resb 1
  7074                                  
  7075                                  ; 12/11/2016 - Erdogan Tan
  7076                                  bus_dev_fn:
  7077 0000815C ????????                	resd 1
  7078                                  dev_vendor:
  7079 00008160 ????????                	resd 1
  7080                                  
  7081                                  ; 17/02/2017
  7082                                  ; NAMBAR:  Native Audio Mixer Base Address Register
  7083                                  ;    (ICH, Audio D31:F5, PCI Config Space) Address offset: 10h-13h
  7084                                  ; NABMBAR: Native Audio Bus Mastering Base Address register
  7085                                  ;    (ICH, Audio D31:F5, PCI Config Space) Address offset: 14h-17h
  7086 00008164 ????                    NAMBAR:	resw 1	; BAR for mixer
  7087                                  NABMBAR:
  7088 00008166 ????                    	resw 1	; BAR for bus master regs
  7089                                  
  7090                                  ; 15/11/2024
  7091                                  loadfromwavfile:
  7092 00008168 ????????                	resd 1	; 'loadfromfile' or load+conversion proc address
  7093                                  loadsize:
  7094 0000816C ????????                	resd 1	; (.wav file) read count (bytes) per one time
  7095                                  buffersize:
  7096 00008170 ????????                	resd 1	; 16 bit samples (not bytes)
  7097                                  		
  7098                                  ; 14/11/2024
  7099                                  TotalTime:
  7100 00008174 ????????                	resd 1	; Total (WAV File) Playing Time in seconds
  7101                                  ProgressTime:
  7102 00008178 ????????                	resd 1
  7103 0000817C ????????                count:	resd 1	; byte count of one (wav file) read
  7104                                  LoadedDataBytes:
  7105 00008180 ????????                	resd 1	; total read/load count
  7106                                  
  7107                                  timerticks:
  7108 00008184 ????????                	resd 1	; (to eliminate excessive lookup of events in tuneloop)
  7109                                  		; (in order to get the emulator/qemu to run correctly)
  7110                                  ; 14/11/2024	
  7111                                  bss_end:
  7112                                  
  7113                                  ; 02/12/2024
  7114 00008188 <res E78h>              alignb 4096
  7115                                  
  7116                                  ; 07/12/2024
  7117                                  ; 26/11/2023
  7118                                  audio_buffer:
  7119 00009000 <res 10000h>            	resb 65536  ; DMA Buffer Size / 2	
  7120                                  
  7121                                  ; 01/12/2024
  7122                                  ; 26/11/2023
  7123                                  temp_buffer:
  7124 00019000 <res 10000h>            	resb 65536  ;  rb BUFFERSIZE
