     1                                  ; ****************************************************************************
     2                                  ; sinus9.s - TRDOS 386 (TRDOS v2.0.3) Test Program - 'sysvideo' pixel tests
     3                                  ; ----------------------------------------------------------------------------
     4                                  ;
     5                                  ; 02/03/2021
     6                                  ;
     7                                  ; ****************************************************************************
     8                                  ; nasm sinus9.s -l sinus9.txt -o SINUS9.PRG -Z error.txt
     9                                  ; (modified from 'sinus8.s', 02/03/2021)
    10                                  
    11                                  ; Draw sinus wave/curve by using 'sysvideo' bx=0305h
    12                                  
    13                                  ; 14/07/2020
    14                                  ; 31/12/2017
    15                                  ; TRDOS 386 (v2.0) system calls
    16                                  _ver 	equ 0
    17                                  _exit 	equ 1
    18                                  _fork 	equ 2
    19                                  _read 	equ 3
    20                                  _write	equ 4
    21                                  _open	equ 5
    22                                  _close 	equ 6
    23                                  _wait 	equ 7
    24                                  _create	equ 8
    25                                  _rename	equ 9
    26                                  _delete	equ 10
    27                                  _exec	equ 11
    28                                  _chdir	equ 12
    29                                  _time 	equ 13
    30                                  _mkdir 	equ 14
    31                                  _chmod	equ 15
    32                                  _rmdir	equ 16
    33                                  _break	equ 17
    34                                  _drive	equ 18
    35                                  _seek	equ 19
    36                                  _tell 	equ 20
    37                                  _memory	equ 21
    38                                  _prompt	equ 22
    39                                  _path	equ 23
    40                                  _env	equ 24
    41                                  _stime	equ 25
    42                                  _quit	equ 26	
    43                                  _intr	equ 27
    44                                  _dir	equ 28
    45                                  _emt 	equ 29
    46                                  _ldrvt 	equ 30
    47                                  _video 	equ 31
    48                                  _audio	equ 32
    49                                  _timer	equ 33
    50                                  _sleep	equ 34
    51                                  _msg    equ 35
    52                                  _geterr	equ 36
    53                                  _fpstat	equ 37
    54                                  _pri	equ 38
    55                                  _rele	equ 39
    56                                  _fff	equ 40
    57                                  _fnf	equ 41
    58                                  _alloc	equ 42
    59                                  _dalloc equ 43
    60                                  _calbac equ 44
    61                                  _dma	equ 45	
    62                                  
    63                                  %macro sys 1-4
    64                                      ; 29/04/2016 - TRDOS 386 (TRDOS v2.0)	
    65                                      ; 03/09/2015	
    66                                      ; 13/04/2015
    67                                      ; Retro UNIX 386 v1 system call.		
    68                                      %if %0 >= 2   
    69                                          mov ebx, %2
    70                                          %if %0 >= 3    
    71                                              mov ecx, %3
    72                                              %if %0 = 4
    73                                                 mov edx, %4   
    74                                              %endif
    75                                          %endif
    76                                      %endif
    77                                      mov eax, %1
    78                                      ;int 30h
    79                                      int 40h ; TRDOS 386 (TRDOS v2.0)		   
    80                                  %endmacro
    81                                  
    82                                  ; Retro UNIX 386 v1 system call format:
    83                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
    84                                  
    85                                  [BITS 32] ; We need 32-bit intructions for protected mode
    86                                  
    87                                  [ORG 0] 
    88                                  
    89                                  START_CODE:
    90                                  	; clear bss
    91 00000000 BF[6C0A0000]            	mov	edi, bss_start
    92 00000005 B900100000              	mov	ecx, (bss_end - bss_start)/4
    93                                  	;xor	eax, eax
    94 0000000A F3AB                    	rep	stosd
    95                                  
    96                                  	; program message
    97 0000000C BE[9E010000]            	mov	esi, program_msg
    98 00000011 E8BF000000              	call	print_msg
    99                                  
   100 00000016 30E4                    	xor	ah, ah
   101                                  	;int	16h	; KEYBOARD - READ CHAR FROM BUFFER, WAIT IF EMPTY
   102                                  			; Return: AH = scan code, AL = character
   103 00000018 CD32                    	int	32h	; TRDOS 386 Keyboard interrupt 
   104                                  
   105                                  	; Get VESA VBE video bios number 
   106                                  	;	(vbe2 or vbe3, emulator or not)  
   107                                  	;mov	ebx, 0906h
   108                                  	;sys	_video
   109                                  
   110                                  	; get [truecolor] status (24bpp or 32bpp for VBE3 vbios)
   111 0000001A BB09090000              	mov	ebx, 0909h
   112                                  	sys	_video
   112                              <1> 
   112                              <1> 
   112                              <1> 
   112                              <1> 
   112                              <1>  %if %0 >= 2
   112                              <1>  mov ebx, %2
   112                              <1>  %if %0 >= 3
   112                              <1>  mov ecx, %3
   112                              <1>  %if %0 = 4
   112                              <1>  mov edx, %4
   112                              <1>  %endif
   112                              <1>  %endif
   112                              <1>  %endif
   112 0000001F B81F000000          <1>  mov eax, %1
   112                              <1> 
   112 00000024 CD40                <1>  int 40h
   113                                  
   114 00000026 B918010000              	mov	ecx, 118h ; VESA VBE video mode	(1024x768, 24bpp)
   115                                  	
   116                                  	;cmp	ah, 3
   117                                  	;je	short set_vmode
   118                                  	;cmp	ah, 2
   119                                  	;;jne	terminate ; invalid !?
   120                                  	;jne	short set_vmode
   121                                  	;and	al, al
   122                                  	;jz	short set_vmode ; invalid !? (AL must be >= C0h.)
   123                                  	
   124 0000002B 3C20                    	cmp	al, 32
   125 0000002D 7402                    	je	short set_vmode
   126                                  	
   127                                  	; VBE2 bios or default truecolor bpp is 24 bpp	
   128                                  	; so, we are using video mode 144h 
   129                                  	; (TRDOS 386 running in emulator or very old hardware!)
   130                                  	
   131                                  	; BOCHS/QEMU/VBOX emulator 
   132 0000002F B144                    	mov	cl, 44h ; Bochs/Plex86 video mode 144h
   133                                  			; (1024*768, 32bpp) 		
   134                                  
   135                                  	; Set Video Mode to 118h ; 1024*768, 32 bit true colors
   136                                  	;
   137                                  	; NOTE: NVIDIA GEFORCE FX 550 VIDEO BIOS uses 32bpp 
   138                                  	;       instead of 24bpp for same VBE video mode numbers. 
   139                                  	;       So, 118h is 1024*768, 24bpp for BOCHS/QEMU emulator
   140                                  	;	but, it is 1024*768, 32 bpp for real computer 
   141                                  	;	with NVIDIA graphics card and video bios. 
   142                                  	; (Also it is -it must be- 32bpp for other new hardware.)	  	
   143                                  
   144                                  	;sys	_video, 08FFh, 118h
   145                                  set_vmode:
   146                                  	; ecx = VESA VBE video mode
   147                                  	sys	_video, 08FFh
   147                              <1> 
   147                              <1> 
   147                              <1> 
   147                              <1> 
   147                              <1>  %if %0 >= 2
   147 00000031 BBFF080000          <1>  mov ebx, %2
   147                              <1>  %if %0 >= 3
   147                              <1>  mov ecx, %3
   147                              <1>  %if %0 = 4
   147                              <1>  mov edx, %4
   147                              <1>  %endif
   147                              <1>  %endif
   147                              <1>  %endif
   147 00000036 B81F000000          <1>  mov eax, %1
   147                              <1> 
   147 0000003B CD40                <1>  int 40h
   148 0000003D 09C0                    	or	eax, eax
   149                                  	;jz	short terminate
   150                                  	;mov	[LFB_ADDR], edx ; pointer to LFB info table/structure
   151 0000003F 750E                    	jnz	short set_vesa_mode_118h_ok
   152                                  
   153                                  terminate:
   154 00000041 E851010000              	call	set_text_mode
   155                                  	sys	_exit
   155                              <1> 
   155                              <1> 
   155                              <1> 
   155                              <1> 
   155                              <1>  %if %0 >= 2
   155                              <1>  mov ebx, %2
   155                              <1>  %if %0 >= 3
   155                              <1>  mov ecx, %3
   155                              <1>  %if %0 = 4
   155                              <1>  mov edx, %4
   155                              <1>  %endif
   155                              <1>  %endif
   155                              <1>  %endif
   155 00000046 B801000000          <1>  mov eax, %1
   155                              <1> 
   155 0000004B CD40                <1>  int 40h
   156                                  halt:
   157 0000004D EBFE                    	jmp	short halt
   158                                  
   159                                  set_vesa_mode_118h_ok:
   160 0000004F C705[640A0000]0000-     	mov	dword [color], 0FF0000h ; initial pixel color
   160 00000057 FF00               
   161                                  _0:
   162 00000059 E888000000              	call	drawsinewave
   163                                  waitforkey:
   164                                  	;mov	ah, 1
   165                                  	;int	32h
   166                                  	;jz	short getkey
   167                                  	;inc	word [counter]
   168                                  	;nop
   169                                  	;nop
   170                                  	;nop
   171                                  	;jmp	short waitforkey
   172                                  getkey:
   173 0000005E 30E4                    	xor	ah, ah
   174 00000060 CD32                    	int	32h
   175                                  
   176 00000062 663D032E                	cmp	ax, 2E03h
   177 00000066 74D9                    	je	short terminate
   178 00000068 3C1B                    	cmp	al, 1Bh ; ESC key
   179 0000006A 74D5                    	je	short terminate	
   180                                  
   181 0000006C 3C2B                    	cmp	al, '+'
   182 0000006E 7509                    	jne	short _1
   183                                  	
   184 00000070 8305[640A0000]20        	add	dword [color], 20h
   185 00000077 EBE0                    	jmp	short _0
   186                                  _1:
   187 00000079 3C2D                    	cmp	al, '-'
   188 0000007B 7509                    	jne	short _2
   189                                  
   190 0000007D 832D[640A0000]20        	sub	dword [color], 20h
   191 00000084 EBD3                    	jmp	short _0
   192                                  _2:
   193 00000086 3C20                    	cmp	al, 20h  ; space
   194 00000088 750C                    	jne	short _3
   195 0000008A 8105[640A0000]2020-     	add	dword [color], 2020h 	
   195 00000092 0000               
   196 00000094 EBC3                    	jmp	short _0
   197                                  _3:
   198 00000096 80FC4B                  	cmp	ah, 4Bh
   199 00000099 7507                    	jne	short _5
   200                                  	; left arrow
   201                                  _4:
   202 0000009B E8E5000000              	call	beep
   203 000000A0 EBBC                    	jmp	waitforkey
   204                                  _5:
   205 000000A2 80FC4D                  	cmp	ah, 4Dh
   206 000000A5 7502                    	jne	short _6
   207                                  
   208                                  	; right arrow
   209 000000A7 EBF2                    	jmp	short _4
   210                                  _6:
   211 000000A9 80FC50                  	cmp	ah, 50h
   212 000000AC 7502                    	jne	short _7
   213                                  	; down arrow
   214 000000AE EBEB                    	jmp	short _4
   215                                  _7:
   216 000000B0 80FC48                  	cmp	ah, 48h
   217 000000B3 7502                    	jne	short _8
   218                                  	; up arrow
   219 000000B5 EBE4                    	jmp	short _4
   220                                  _8:	
   221 000000B7 663D0D1C                	cmp	ax, 1C0Dh
   222 000000BB 7511                    	jne	short _9
   223 000000BD E8C3000000              	call	beep
   224 000000C2 8105[640A0000]1010-     	add	dword [color], 1010h
   224 000000CA 0000               
   225 000000CC EB8B                    	jmp	short _0
   226                                  _9:	
   227 000000CE E8B2000000              	call	beep
   228 000000D3 EB89                    	jmp	waitforkey
   229                                  
   230                                  print_msg:
   231 000000D5 B40E                    	mov	ah, 0Eh
   232 000000D7 BB07000000              	mov	ebx, 7
   233                                  	;mov	bl, 7 ; char attribute & color
   234                                  p_next_chr:
   235 000000DC AC                      	lodsb
   236 000000DD 08C0                    	or	al, al
   237 000000DF 7404                    	jz	short p_retn ; retn	
   238 000000E1 CD31                    	int	31h
   239 000000E3 EBF7                    	jmp	short p_next_chr
   240                                  p_retn:
   241 000000E5 C3                      	retn
   242                                  
   243                                  drawsinewave:
   244                                  	; INPUT:
   245                                  	;	sinustable
   246                                  	;
   247                                  	; Modified registers: esi, edi, eax, ecx, ebx, edx
   248                                  
   249                                  	; fill _fx table by using sine wave table
   250                                  	; x = 0 to 1023
   251                                  	; y = +256 to -256
   252                                  	; +256 --> 511 -> screen row position = (512-511)+127 = 128
   253                                  	; -256 --> 0 -> screen row position = (512-0)+127 = 639
   254                                  
   255 000000E6 BE[64020000]            	mov	esi, sinustable
   256 000000EB BF[6C0A0000]            	mov	edi, _fx
   257 000000F0 31C0                    	xor	eax, eax
   258 000000F2 29DB                    	sub	ebx, ebx ; 0 ; x 
   259 000000F4 31ED                    	xor	ebp, ebp ; pixel count
   260 000000F6 66AD                    	lodsw
   261 000000F8 EB45                    	jmp	short _dsw_5
   262                                  _dsw_0:
   263 000000FA 66AD                    	lodsw	; ax = 512-y value
   264                                  	;
   265 000000FC 6639C8                  	cmp	ax, cx ; [prevy]
   266 000000FF 743E                    	je	short _dsw_5
   267 00000101 7218                    	jb	short _dsw_3
   268                                  _dsw_1:
   269 00000103 6641                    	inc	cx ; previous 512-y
   270 00000105 6639C8                  	cmp	ax, cx
   271 00000108 7635                    	jna	short _dsw_5
   272                                  	; ebx = x
   273                                  	; eax = 512 - y
   274 0000010A E81A000000              	call	_dsw_4
   275 0000010F EBF2                    	jmp	short _dsw_1
   276                                  _dsw_2:
   277 00000111 50                      	push	eax
   278 00000112 E858000000              	call	getpixeloffset
   279 00000117 AB                      	stosd
   280 00000118 58                      	pop	eax
   281 00000119 45                      	inc	ebp ; increase pixel count
   282 0000011A C3                      	retn
   283                                  _dsw_3:
   284 0000011B 6649                    	dec	cx ; previous 512-y
   285 0000011D 6639C8                  	cmp	ax, cx
   286 00000120 731D                    	jnb	short _dsw_5
   287                                  	; ebx = x
   288                                  	; eax = 512 - y
   289 00000122 E802000000              	call	_dsw_4
   290 00000127 EBF2                    	jmp	short _dsw_3
   291                                  _dsw_4:
   292 00000129 53                      	push	ebx
   293 0000012A 8B1D[680A0000]          	mov	ebx, [prevx]
   294 00000130 91                      	xchg	eax, ecx ; [prevy]
   295 00000131 E8DBFFFFFF              	call	_dsw_2
   296 00000136 91                      	xchg	ecx, eax
   297 00000137 5B                      	pop	ebx
   298 00000138 FF05[680A0000]          	inc	dword [prevx]
   299 0000013E C3                      	retn
   300                                  _dsw_5:
   301 0000013F 891D[680A0000]          	mov	[prevx], ebx ; previous x value 
   302 00000145 89C1                    	mov	ecx, eax ; previous 512-y value
   303 00000147 E8C5FFFFFF              	call	_dsw_2
   304 0000014C 43                      	inc	ebx
   305 0000014D 81FB00040000            	cmp	ebx, 1024
   306 00000153 72A5                    	jb	short _dsw_0
   307                                  
   308 00000155 BE[6C0A0000]            	mov	esi, _fx
   309                                  	;mov	edx, ebp
   310                                  	;
   311                                  	; edx = pixel count
   312                                  	; esi = user's single color pixel buffer address
   313                                  	sys	_video, 0305h, [color], ebp
   313                              <1> 
   313                              <1> 
   313                              <1> 
   313                              <1> 
   313                              <1>  %if %0 >= 2
   313 0000015A BB05030000          <1>  mov ebx, %2
   313                              <1>  %if %0 >= 3
   313 0000015F 8B0D[640A0000]      <1>  mov ecx, %3
   313                              <1>  %if %0 = 4
   313 00000165 89EA                <1>  mov edx, %4
   313                              <1>  %endif
   313                              <1>  %endif
   313                              <1>  %endif
   313 00000167 B81F000000          <1>  mov eax, %1
   313                              <1> 
   313 0000016C CD40                <1>  int 40h
   314                                  
   315 0000016E C3                      	retn
   316                                  	
   317                                  getpixeloffset:
   318                                  	; 32 bit true color pixel offset
   319                                  	; ebx = x position
   320                                  	; eax = 512 - y position
   321 0000016F BA7F020000              	mov	edx, 512+127 ; 639
   322 00000174 29C2                    	sub	edx, eax ; convert row position from 512-y
   323                                  	; row = (512-y)+127
   324 00000176 B800100000              	mov	eax, 1024*4 ; screen width
   325 0000017B F7E2                    	mul	edx
   326 0000017D 53                      	push	ebx
   327 0000017E C1E302                  	shl	ebx, 2
   328 00000181 01D8                     	add	eax, ebx ; add x to y*1024
   329 00000183 5B                      	pop	ebx	
   330                                  	; eax = pixel offset on display page
   331 00000184 C3                      	retn
   332                                  beep:
   333                                  	; call beep function (16/64 second, 886Hz)
   334                                  	sys	_audio, 16, 1331
   334                              <1> 
   334                              <1> 
   334                              <1> 
   334                              <1> 
   334                              <1>  %if %0 >= 2
   334 00000185 BB10000000          <1>  mov ebx, %2
   334                              <1>  %if %0 >= 3
   334 0000018A B933050000          <1>  mov ecx, %3
   334                              <1>  %if %0 = 4
   334                              <1>  mov edx, %4
   334                              <1>  %endif
   334                              <1>  %endif
   334                              <1>  %endif
   334 0000018F B820000000          <1>  mov eax, %1
   334                              <1> 
   334 00000194 CD40                <1>  int 40h
   335 00000196 C3                      	retn
   336                                  
   337                                  set_text_mode:
   338 00000197 30E4                    	xor    ah, ah
   339 00000199 B003                    	mov    al, 3                        
   340                                   	;int   10h ; al = 03h text mode, int 10 video
   341 0000019B CD31                    	int    31h ; TRDOS 386 - Video interrupt
   342 0000019D C3                      	retn
   343                                  		
   344                                  program_msg:
   345 0000019E 5452444F5320333836-     	db "TRDOS 386 v2.0.3 - ('sysvideo') Test Program - Draw Sine Wave"
   345 000001A7 2076322E302E33202D-
   345 000001B0 202827737973766964-
   345 000001B9 656F27292054657374-
   345 000001C2 2050726F6772616D20-
   345 000001CB 2D2044726177205369-
   345 000001D4 6E652057617665     
   346 000001DB 0D0A                    	db 0Dh, 0Ah
   347 000001DD 6279204572646F6761-     	db "by Erdogan Tan - 02/03/2021"
   347 000001E6 6E2054616E202D2030-
   347 000001EF 322F30332F32303231 
   348                                  	;db 0Dh, 0Ah, 0
   349 000001F8 0D0A0D0A                	db 0Dh, 0Ah, 0Dh, 0Ah
   350                                  
   351 000001FC 557365205350414345-     	db "Use SPACE,ENTER,'+','-' keys to change COLOR .."		
   351 00000205 2C454E5445522C272B-
   351 0000020E 272C272D27206B6579-
   351 00000217 7320746F206368616E-
   351 00000220 676520434F4C4F5220-
   351 00000229 2E2E               
   352 0000022B 0D0A                    	db 0Dh, 0Ah
   353 0000022D 507265737320455343-     	db "Press ESC to exit .."
   353 00000236 20746F206578697420-
   353 0000023F 2E2E               
   354 00000241 0D0A                    	db 0Dh, 0Ah
   355 00000243 0D0A                    	db 0Dh, 0Ah
   356 00000245 507265737320616E79-     	db "Press any key to continue .."
   356 0000024E 206B657920746F2063-
   356 00000257 6F6E74696E7565202E-
   356 00000260 2E                 
   357                                  nextline:
   358 00000261 0D0A00                  	db 0Dh, 0Ah, 0
   359                                  
   360                                  sinustable: ; sine wave table (x=0 to 1023, y= +256 to -256)
   361                                  	; 19/02/2021
   362                                  	; https://daycounter.com/Calculators/Sine-Generator-Calculator2.phtml
   363                                  	; 1024x512 (x= 0 to 1023, y = 0 to 511)
   364 00000264 000101010301040106-     	dw 256,257,259,260,262,263,265,266,268,270,271,273,274,276,277,279,281,282,284,285,287,288,290,291,293,295,296,298,299,301,302,304
   364 0000026D 01070109010A010C01-
   364 00000276 0E010F011101120114-
   364 0000027F 011501170119011A01-
   364 00000288 1C011D011F01200122-
   364 00000291 012301250127012801-
   364 0000029A 2A012B012D012E0130-
   364 000002A3 01                 
   365 000002A4 310133013401360137-     	dw 305,307,308,310,311,313,315,316,318,319,321,322,324,325,327,328,330,331,333,334,336,337,339,340,342,343,345,346,347,349,350,352
   365 000002AD 0139013B013C013E01-
   365 000002B6 3F0141014201440145-
   365 000002BF 01470148014A014B01-
   365 000002C8 4D014E015001510153-
   365 000002D1 015401560157015901-
   365 000002DA 5A015B015D015E0160-
   365 000002E3 01                 
   366 000002E4 610163016401660167-     	dw 353,355,356,358,359,360,362,363,365,366,368,369,370,372,373,375,376,377,379,380,381,383,384,386,387,388,390,391,392,394,395,396
   366 000002ED 0168016A016B016D01-
   366 000002F6 6E0170017101720174-
   366 000002FF 017501770178017901-
   366 00000308 7B017C017D017F0180-
   366 00000311 018201830184018601-
   366 0000031A 870188018A018B018C-
   366 00000323 01                 
   367 00000324 8D018F019001910193-     	dw 397,399,400,401,403,404,405,406,408,409,410,411,413,414,415,416,418,419,420,421,422,424,425,426,427,428,429,431,432,433,434,435
   367 0000032D 019401950196019801-
   367 00000336 99019A019B019D019E-
   367 0000033F 019F01A001A201A301-
   367 00000348 A401A501A601A801A9-
   367 00000351 01AA01AB01AC01AD01-
   367 0000035A AF01B001B101B201B3-
   367 00000363 01                 
   368 00000364 B401B501B601B701B9-     	dw 436,437,438,439,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,463,464,465,466,467
   368 0000036D 01BA01BB01BC01BD01-
   368 00000376 BE01BF01C001C101C2-
   368 0000037F 01C301C401C501C601-
   368 00000388 C701C801C901CA01CB-
   368 00000391 01CC01CD01CE01CF01-
   368 0000039A CF01D001D101D201D3-
   368 000003A3 01                 
   369 000003A4 D401D501D601D701D7-     	dw 468,469,470,471,471,472,473,474,475,475,476,477,478,479,479,480,481,482,482,483,484,484,485,486,486,487,488,488,489,490,490,491
   369 000003AD 01D801D901DA01DB01-
   369 000003B6 DB01DC01DD01DE01DF-
   369 000003BF 01DF01E001E101E201-
   369 000003C8 E201E301E401E401E5-
   369 000003D1 01E601E601E701E801-
   369 000003DA E801E901EA01EA01EB-
   369 000003E3 01                 
   370 000003E4 EC01EC01ED01ED01EE-     	dw 492,492,493,493,494,494,495,496,496,497,497,498,498,499,499,500,500,500,501,501,502,502,503,503,503,504,504,504,505,505,505,506
   370 000003ED 01EE01EF01F001F001-
   370 000003F6 F101F101F201F201F3-
   370 000003FF 01F301F401F401F401-
   370 00000408 F501F501F601F601F7-
   370 00000411 01F701F701F801F801-
   370 0000041A F801F901F901F901FA-
   370 00000423 01                 
   371 00000424 FA01FA01FB01FB01FB-     	dw 506,506,507,507,507,508,508,508,508,508,509,509,509,509,509,510,510,510,510,510,510,510,511,511,511,511,511,511,511,511,511,511
   371 0000042D 01FC01FC01FC01FC01-
   371 00000436 FC01FD01FD01FD01FD-
   371 0000043F 01FD01FE01FE01FE01-
   371 00000448 FE01FE01FE01FE01FF-
   371 00000451 01FF01FF01FF01FF01-
   371 0000045A FF01FF01FF01FF01FF-
   371 00000463 01                 
   372 00000464 FF01FF01FF01FF01FF-     	dw 511,511,511,511,511,511,511,511,511,511,511,510,510,510,510,510,510,510,509,509,509,509,509,508,508,508,508,508,507,507,507,506
   372 0000046D 01FF01FF01FF01FF01-
   372 00000476 FF01FF01FE01FE01FE-
   372 0000047F 01FE01FE01FE01FE01-
   372 00000488 FD01FD01FD01FD01FD-
   372 00000491 01FC01FC01FC01FC01-
   372 0000049A FC01FB01FB01FB01FA-
   372 000004A3 01                 
   373 000004A4 FA01FA01F901F901F9-     	dw 506,506,505,505,505,504,504,504,503,503,503,502,502,501,501,500,500,500,499,499,498,498,497,497,496,496,495,494,494,493,493,492
   373 000004AD 01F801F801F801F701-
   373 000004B6 F701F701F601F601F5-
   373 000004BF 01F501F401F401F401-
   373 000004C8 F301F301F201F201F1-
   373 000004D1 01F101F001F001EF01-
   373 000004DA EE01EE01ED01ED01EC-
   373 000004E3 01                 
   374 000004E4 EC01EB01EA01EA01E9-     	dw 492,491,490,490,489,488,488,487,486,486,485,484,484,483,482,482,481,480,479,479,478,477,476,475,475,474,473,472,471,471,470,469
   374 000004ED 01E801E801E701E601-
   374 000004F6 E601E501E401E401E3-
   374 000004FF 01E201E201E101E001-
   374 00000508 DF01DF01DE01DD01DC-
   374 00000511 01DB01DB01DA01D901-
   374 0000051A D801D701D701D601D5-
   374 00000523 01                 
   375 00000524 D401D301D201D101D0-     	dw 468,467,466,465,464,463,463,462,461,460,459,458,457,456,455,454,453,452,451,450,449,448,447,446,445,444,443,442,441,439,438,437
   375 0000052D 01CF01CF01CE01CD01-
   375 00000536 CC01CB01CA01C901C8-
   375 0000053F 01C701C601C501C401-
   375 00000548 C301C201C101C001BF-
   375 00000551 01BE01BD01BC01BB01-
   375 0000055A BA01B901B701B601B5-
   375 00000563 01                 
   376 00000564 B401B301B201B101B0-     	dw 436,435,434,433,432,431,429,428,427,426,425,424,422,421,420,419,418,416,415,414,413,411,410,409,408,406,405,404,403,401,400,399
   376 0000056D 01AF01AD01AC01AB01-
   376 00000576 AA01A901A801A601A5-
   376 0000057F 01A401A301A201A001-
   376 00000588 9F019E019D019B019A-
   376 00000591 019901980196019501-
   376 0000059A 94019301910190018F-
   376 000005A3 01                 
   377 000005A4 8D018C018B018A0188-     	dw 397,396,395,394,392,391,390,388,387,386,384,383,381,380,379,377,376,375,373,372,370,369,368,366,365,363,362,360,359,358,356,355
   377 000005AD 018701860184018301-
   377 000005B6 820180017F017D017C-
   377 000005BF 017B01790178017701-
   377 000005C8 750174017201710170-
   377 000005D1 016E016D016B016A01-
   377 000005DA 680167016601640163-
   377 000005E3 01                 
   378 000005E4 610160015E015D015B-     	dw 353,352,350,349,347,346,345,343,342,340,339,337,336,334,333,331,330,328,327,325,324,322,321,319,318,316,315,313,311,310,308,307
   378 000005ED 015A01590157015601-
   378 000005F6 54015301510150014E-
   378 000005FF 014D014B014A014801-
   378 00000608 470145014401420141-
   378 00000611 013F013E013C013B01-
   378 0000061A 390137013601340133-
   378 00000623 01                 
   379 00000624 310130012E012D012B-     	dw 305,304,302,301,299,298,296,295,293,291,290,288,287,285,284,282,281,279,277,276,274,273,271,270,268,266,265,263,262,260,259,257
   379 0000062D 012A01280127012501-
   379 00000636 2301220120011F011D-
   379 0000063F 011C011A0119011701-
   379 00000648 15011401120111010F-
   379 00000651 010E010C010A010901-
   379 0000065A 070106010401030101-
   379 00000663 01                 
   380 00000664 0001FE00FC00FB00F9-     	dw 256,254,252,251,249,248,246,245,243,241,240,238,237,235,234,232,230,229,227,226,224,223,221,220,218,216,215,213,212,210,209,207
   380 0000066D 00F800F600F500F300-
   380 00000676 F100F000EE00ED00EB-
   380 0000067F 00EA00E800E600E500-
   380 00000688 E300E200E000DF00DD-
   380 00000691 00DC00DA00D800D700-
   380 0000069A D500D400D200D100CF-
   380 000006A3 00                 
   381 000006A4 CE00CC00CB00C900C8-     	dw 206,204,203,201,200,198,196,195,193,192,190,189,187,186,184,183,181,180,178,177,175,174,172,171,169,168,166,165,164,162,161,159
   381 000006AD 00C600C400C300C100-
   381 000006B6 C000BE00BD00BB00BA-
   381 000006BF 00B800B700B500B400-
   381 000006C8 B200B100AF00AE00AC-
   381 000006D1 00AB00A900A800A600-
   381 000006DA A500A400A200A1009F-
   381 000006E3 00                 
   382 000006E4 9E009C009B00990098-     	dw 158,156,155,153,152,151,149,148,146,145,143,142,141,139,138,136,135,134,132,131,130,128,127,125,124,123,121,120,119,117,116,115
   382 000006ED 009700950094009200-
   382 000006F6 91008F008E008D008B-
   382 000006FF 008A00880087008600-
   382 00000708 84008300820080007F-
   382 00000711 007D007C007B007900-
   382 0000071A 780077007500740073-
   382 00000723 00                 
   383 00000724 720070006F006E006C-     	dw 114,112,111,110,108,107,106,105,103,102,101,100,98,97,96,95,93,92,91,90,89,87,86,85,84,83,82,80,79,78,77,76
   383 0000072D 006B006A0069006700-
   383 00000736 660065006400620061-
   383 0000073F 0060005F005D005C00-
   383 00000748 5B005A005900570056-
   383 00000751 005500540053005200-
   383 0000075A 50004F004E004D004C-
   383 00000763 00                 
   384 00000764 4B004A004900480046-     	dw 75,74,73,72,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,48,47,46,45,44
   384 0000076D 004500440043004200-
   384 00000776 410040003F003E003D-
   384 0000077F 003C003B003A003900-
   384 00000788 380037003600350034-
   384 00000791 003300320031003000-
   384 0000079A 30002F002E002D002C-
   384 000007A3 00                 
   385 000007A4 2B002A002900280028-     	dw 43,42,41,40,40,39,38,37,36,36,35,34,33,32,32,31,30,29,29,28,27,27,26,25,25,24,23,23,22,21,21,20
   385 000007AD 002700260025002400-
   385 000007B6 240023002200210020-
   385 000007BF 0020001F001E001D00-
   385 000007C8 1D001C001B001B001A-
   385 000007D1 001900190018001700-
   385 000007DA 170016001500150014-
   385 000007E3 00                 
   386 000007E4 130013001200120011-     	dw 19,19,18,18,17,17,16,15,15,14,14,13,13,12,12,11,11,11,10,10,9,9,8,8,8,7,7,7,6,6,6,5
   386 000007ED 00110010000F000F00-
   386 000007F6 0E000E000D000D000C-
   386 000007FF 000C000B000B000B00-
   386 00000808 0A000A000900090008-
   386 00000811 000800080007000700-
   386 0000081A 070006000600060005-
   386 00000823 00                 
   387 00000824 050005000400040004-     	dw 5,5,4,4,4,3,3,3,3,3,2,2,2,2,2,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
   387 0000082D 000300030003000300-
   387 00000836 030002000200020002-
   387 0000083F 000200010001000100-
   387 00000848 010001000100010000-
   387 00000851 000000000000000000-
   387 0000085A 000000000000000000-
   387 00000863 00                 
   388 00000864 000000000000000000-     	dw 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,5
   388 0000086D 000000000000000000-
   388 00000876 000000000100010001-
   388 0000087F 000100010001000100-
   388 00000888 020002000200020002-
   388 00000891 000300030003000300-
   388 0000089A 030004000400040005-
   388 000008A3 00                 
   389 000008A4 050005000600060006-     	dw 5,5,6,6,6,7,7,7,8,8,8,9,9,10,10,11,11,11,12,12,13,13,14,14,15,15,16,17,17,18,18,19
   389 000008AD 000700070007000800-
   389 000008B6 08000800090009000A-
   389 000008BF 000A000B000B000B00-
   389 000008C8 0C000C000D000D000E-
   389 000008D1 000E000F000F001000-
   389 000008DA 110011001200120013-
   389 000008E3 00                 
   390 000008E4 130014001500150016-     	dw 19,20,21,21,22,23,23,24,25,25,26,27,27,28,29,29,30,31,32,32,33,34,35,36,36,37,38,39,40,40,41,42
   390 000008ED 001700170018001900-
   390 000008F6 19001A001B001B001C-
   390 000008FF 001D001D001E001F00-
   390 00000908 200020002100220023-
   390 00000911 002400240025002600-
   390 0000091A 27002800280029002A-
   390 00000923 00                 
   391 00000924 2B002C002D002E002F-     	dw 43,44,45,46,47,48,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74
   391 0000092D 003000300031003200-
   391 00000936 330034003500360037-
   391 0000093F 00380039003A003B00-
   391 00000948 3C003D003E003F0040-
   391 00000951 004100420043004400-
   391 0000095A 45004600480049004A-
   391 00000963 00                 
   392 00000964 4B004C004D004E004F-     	dw 75,76,77,78,79,80,82,83,84,85,86,87,89,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,108,110,111,112
   392 0000096D 005000520053005400-
   392 00000976 55005600570059005A-
   392 0000097F 005B005C005D005F00-
   392 00000988 600061006200640065-
   392 00000991 006600670069006A00-
   392 0000099A 6B006C006E006F0070-
   392 000009A3 00                 
   393 000009A4 720073007400750077-     	dw 114,115,116,117,119,120,121,123,124,125,127,128,130,131,132,134,135,136,138,139,141,142,143,145,146,148,149,151,152,153,155,156
   393 000009AD 00780079007B007C00-
   393 000009B6 7D007F008000820083-
   393 000009BF 008400860087008800-
   393 000009C8 8A008B008D008E008F-
   393 000009D1 009100920094009500-
   393 000009DA 9700980099009B009C-
   393 000009E3 00                 
   394 000009E4 9E009F00A100A200A4-     	dw 158,159,161,162,164,165,166,168,169,171,172,174,175,177,178,180,181,183,184,186,187,189,190,192,193,195,196,198,200,201,203,204
   394 000009ED 00A500A600A800A900-
   394 000009F6 AB00AC00AE00AF00B1-
   394 000009FF 00B200B400B500B700-
   394 00000A08 B800BA00BB00BD00BE-
   394 00000A11 00C000C100C300C400-
   394 00000A1A C600C800C900CB00CC-
   394 00000A23 00                 
   395 00000A24 CE00CF00D100D200D4-     	dw 206,207,209,210,212,213,215,216,218,220,221,223,224,226,227,229,230,232,234,235,237,238,240,241,243,245,246,248,249,251,252,254
   395 00000A2D 00D500D700D800DA00-
   395 00000A36 DC00DD00DF00E000E2-
   395 00000A3F 00E300E500E600E800-
   395 00000A48 EA00EB00ED00EE00F0-
   395 00000A51 00F100F300F500F600-
   395 00000A5A F800F900FB00FC00FE-
   395 00000A63 00                 
   396                                  
   397                                  bss:
   398                                  
   399                                  ABSOLUTE bss
   400                                  
   401                                  alignb 4
   402                                  
   403 00000A64 <res 00000004>          color:	resd 1
   404 00000A68 <res 00000004>          prevx:	resd 1
   405                                  ;prevy:	resd 1
   406                                  
   407                                  bss_start:
   408 00000A6C <res 00001000>          _fx:	resd 1024 ; for every X values from 0 to 1023
   409 00001A6C <res 00003000>          	resd 4096-1024 ; used for repetitive x values for continuity
   410                                  bss_end:
