     1                                  ; ****************************************************************************
     2                                  ; sncomni.s (TRDOS 386, TRDOS v2.0 - sample binary file, 'sncomni.prg')
     3                                  ; ----------------------------------------------------------------------------
     4                                  ; SNCOMNI.PRG ! TEST program !  TRDOS 386 VGA Functionality test !
     5                                  ;
     6                                  ; 02/09/2016
     7                                  ;
     8                                  ; [ Last Modification: 11/02/2017 ]
     9                                  ;
    10                                  ; Derived from source code of 'OMNISCENT.ASM' by Dirk Kppers
    11                                  ;          SNC_OMNI.COM	 (MSDOS) intro file, 1997
    12                                  ;
    13                                  ; Assembler: NASM 2.11
    14                                  
    15                                  ; (Original TASM -msdos- code has been modifed for TRDOS 386 system calls and
    16                                  ; other protected mode (TRDOS 386) interrupts.)
    17                                  ; ****************************************************************************
    18                                  
    19                                  ;		   ----====> Omniscent <====----
    20                                  ;
    21                                  ;   Omniscent was done by Pinker of SANCTION for the Mekka '97. The song
    22                                  ;   was written by Nyphton. It place XXX out of XXX.
    23                                  ;
    24                                  ;   Special thanks in alphabetical order :
    25                                  ;
    26                                  ;       Andreas Mautsch     (beta testing)
    27                                  ;       Axel Scheel Meyer   (MACM sources, nice IRC chat's)
    28                                  ;       Christian Cohnen    (for his help on perspective texture mapping and
    29                                  ;	   		designing world and script)
    30                                  ;       Daniel Weinand	    (song)
    31                                  ;       Funk                (for give me the idea trying a 4K Descent)
    32                                  ;       Stephanie Schepers  (moral and food support ;-) )
    33                                  ;
    34                                  ;       and all other SANCTION dudes for supporting this product !
    35                                  
    36                                  ; 16/10/2016
    37                                  ; 29/04/2016
    38                                  ; TRDOS 386 system calls (temporary list!)
    39                                  _ver 	equ 0
    40                                  _exit 	equ 1
    41                                  _fork 	equ 2
    42                                  _read 	equ 3
    43                                  _write	equ 4
    44                                  _open	equ 5
    45                                  _close 	equ 6
    46                                  _wait 	equ 7
    47                                  _creat 	equ 8
    48                                  _link 	equ 9
    49                                  _unlink	equ 10
    50                                  _exec	equ 11
    51                                  _chdir	equ 12
    52                                  _time 	equ 13
    53                                  _mkdir 	equ 14
    54                                  _chmod	equ 15
    55                                  _chown	equ 16
    56                                  _break	equ 17
    57                                  _stat	equ 18
    58                                  _seek	equ 19
    59                                  _tell 	equ 20
    60                                  _mount	equ 21
    61                                  _umount	equ 22
    62                                  _setuid	equ 23
    63                                  _getuid	equ 24
    64                                  _stime	equ 25
    65                                  _quit	equ 26	
    66                                  _intr	equ 27
    67                                  _fstat	equ 28
    68                                  _emt 	equ 29
    69                                  _mdate 	equ 30
    70                                  _video 	equ 31
    71                                  _audio	equ 32
    72                                  _timer	equ 33
    73                                  _sleep	equ 34
    74                                  _msg    equ 35
    75                                  _geterr	equ 36
    76                                  _rsvd1	equ 37
    77                                  _pri	equ 38
    78                                  _rele	equ 39
    79                                  _fff	equ 40
    80                                  _fnf	equ 41
    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                                  ; TRDOS 386 (and Retro UNIX 386 v1) system call format:
   102                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
   103                                  
   104                                  ; SNCOMNI.ASM
   105                                  ; ͻ
   106                                  ; 	This file is generated by The Interactive Disassembler (IDA)	    
   107                                  ; 	Copyright (c) 2010 by Hex-Rays SA, <support@hex-rays.com>	    
   108                                  ; 			 Licensed to: Freeware version			    
   109                                  ; ͼ
   110                                  ;
   111                                  ; Input	MD5   :	933E2716A5E585459024215F4468CDBC
   112                                  
   113                                  ; File Name   :	C:\dosprogs\MEMDUMP.COM ; SNC_OMNI.COM UNPACKED!
   114                                  ; Format      :	MS-DOS COM-file
   115                                  ; Base Address:	0h Range: 100h-60100h Loaded length: 60000h
   116                                  
   117                                  ; NASM version: Erdogan Tan, 14/08/2016 (Modified from MEMDUMP.ASM)
   118                                  ; (SNC_OMNI.COM -> unpacking by using DosBox Debug -> MEMDUMP.COM ->
   119                                  ; disassembling by using IDA Pro Free -> MEMDUMP.ASM -> converting to
   120                                  ; NASM syntax (manual) -> test with DosBox -> correcting different code by
   121                                  ; matching MEMDUMP.LST and SNCOMNI.LST files -> this file !!!)
   122                                  
   123                                  ;==============================================================================
   124                                  ;		   constants
   125                                  ;==============================================================================
   126                                  
   127                                  GMPort		equ 0331h
   128                                  CMD_NOTEON      equ 090h
   129                                  CMD_NOTEOFF     equ 080h
   130                                  CMD_CHANGEPARAM equ 0B0h
   131                                  CMD_CHANGEPRG   equ 0C0h
   132                                  MOD_ALLNOTESOFF equ 07Bh
   133                                  MAXFACES	equ 400
   134                                  MAXPOINTS	equ 400
   135                                  SONGSPEED   	equ 29
   136                                  XMAX		equ 320
   137                                  YMIN		equ 21
   138                                  YMAX		equ 179
   139                                  SUBRANGE	equ 16
   140                                  %define ASPECT_RATIO 1.2
   141                                  CENTERX		equ 160
   142                                  CENTERY		equ 100
   143                                  
   144                                  ;==============================================================================
   145                                  ;		   structures
   146                                  ;==============================================================================
   147                                  
   148                                  struc channel
   149 00000000 <res 00000002>           .del:	resw 1
   150 00000002 <res 00000001>           .trk:	resb 1
   151 00000003 <res 00000001>           .ln:	resb 1
   152 00000004 <res 00000002>           .adr:	resw 1
   153                                  endstruc
   154                                  
   155                                  struc matrix
   156 00000000 <res 00000024>          	resd 9
   157                                   .size:
   158                                  endstruc
   159                                  
   160                                  struc vector
   161 00000000 <res 00000004>           .x:	resd 1
   162 00000004 <res 00000004>           .y:	resd 1
   163 00000008 <res 00000004>           .z:	resd 1
   164                                   .size:
   165                                  endstruc
   166                                  
   167                                  struc point
   168 00000000 <res 00000002>           .x:	resw 1
   169 00000002 <res 00000002>           .y:	resw 1
   170 00000004 <res 00000002>           .z:	resw 1
   171 00000006 <res 00000002>           .s:	resw 1
   172                                   .size:
   173                                  endstruc
   174                                  
   175                                  struc face
   176 00000000 <res 0000000A>          	resw 5
   177                                   .size: 	
   178                                  endstruc
   179                                  
   180                                  ;struc object
   181                                  ; .panz: resw 1
   182                                  ; .fanz: resw 1
   183                                  ; .p:	resb point.size*MAXPOINTS
   184                                  ; .f:	resb face.size*MAXFACES
   185                                  ; .size:
   186                                  ;endstruc
   187                                  
   188                                  struc edges
   189 00000000 <res 00000004>           .x:	resd 1
   190 00000004 <res 00000004>           .u:	resd 1
   191 00000008 <res 00000004>           .v:	resd 1
   192 0000000C <res 00000004>           .w:	resd 1
   193 00000010 <res 00000004>           .s:	resd 1
   194                                   .size:	
   195                                  endstruc
   196                                  
   197                                  struc edge
   198 00000000 <res 0000000C>           .p:	resb vector.size
   199 0000000C <res 00000004>           .py:	resd 1
   200 00000010 <res 00000014>           .e:	resb edges.size
   201                                   .size:
   202                                  endstruc
   203                                  
   204                                  struc poly
   205 00000000 <res 000000B4>          	resb edge.size*5
   206                                   .size:	
   207                                  endstruc
   208                                  
   209                                  ;==============================================================================
   210                                  ;		      %macros
   211                                  ;==============================================================================
   212                                  ;***********************************************
   213                                  ;* descript. : start timer interrupt 70/s      *
   214                                  ;* parameter : none			       *
   215                                  ;* sideeffect: all		 	       *
   216                                  ;* back      : none			       *
   217                                  ;***********************************************
   218                                  %macro		startTimer 0
   219                                                  ;mov     ax,03508h
   220                                                  ;int     21h
   221                                                  ;mov     [word ptr Old08Irqseg],es
   222                                                  ;mov     [word ptr Old08Irqofs],bx
   223                                                  ;mov     ax,02508h
   224                                                  ;mov     dx,offset irqHandler08
   225                                                  ;int     21h
   226                                  		
   227                                  		;mov	bx, 3409 ; 1193180/3409 = 350 ticks per second (*!)
   228                                  		;call	setTimer
   229                                  
   230                                  		; start timer event
   231                                  		mov	ebx, 8400h ; Current Timer setup, Callback method 	
   232                                  		mov	ecx, 1	 ; 1 tick 
   233                                  		mov	edx, timer_callback ; timer callback service addr
   234                                  		mov	eax, 33	; 'systimer'
   235                                  		int	40h	; TRDOS 386 system call
   236                                  		jc	loc_err_exit
   237                                  
   238                                  		mov	[timer_event_number], al 
   239                                  
   240                                  %endmacro
   241                                  
   242                                  ;***********************************************
   243                                  ;* descript. : stop timer interrupt            *
   244                                  ;* parameter : none			       *
   245                                  ;* sideeffect: all		 	       *
   246                                  ;* back      : none			       *
   247                                  ;***********************************************
   248                                  %macro		stopTimer 0
   249                                                  ;push    ds
   250                                                  ;xor     bx,bx                  ; set timer to default
   251                                                  ;call    setTimer		; 18.2 ticks per second
   252                                                  ;mov     ax,02508h              ; restore old IRQ-vector
   253                                                  ;lds     dx,[Old08Irqptr]
   254                                                  ;int     21h
   255                                                  ;pop     ds
   256                                  
   257                                  		;xor	bx, bx	; set timer to default (18.2 Hz) value
   258                                  		;call	setTimer
   259                                  
   260                                  		; Stop timer event
   261                                  		movzx	ebx, byte [timer_event_number]
   262                                  		;and	bl, bl
   263                                  		;jz	short r_t_m ; 0 = error (no timer event)
   264                                   		; bh = 0 -> stop timer event
   265                                  		mov	eax, 33	; 'systimer'
   266                                  		int	40h	; TRDOS 386 system call
   267                                  ;r_t_m:
   268                                  %endmacro
   269                                  
   270                                  ;***********************************************
   271                                  ;* descript. : start keyboard handler          *
   272                                  ;* parameter : none			       *
   273                                  ;* sideeffect: all		 	       *
   274                                  ;* back      : none			       *
   275                                  ;***********************************************
   276                                  %macro		startKBDHandler 0
   277                                                  ;mov     ax,03509h
   278                                                  ;int     21h
   279                                                  ;mov     [word ptr Old09Irqseg],es
   280                                                  ;mov     [word ptr Old09Irqofs],bx
   281                                                  ;mov     ax,02509h
   282                                                  ;mov     dx,offset irqHandler09
   283                                                  ;int     21h
   284                                  
   285                                  		; TRDOS 386 already have a CRTL+BRK
   286                                  		; preview feature to call 'sysexit'
   287                                  		; /// nothing to do here ! ///
   288                                  		; 10/12/2016 - Erdogan Tan
   289                                  		nop
   290                                  %endmacro
   291                                  
   292                                  ;***********************************************
   293                                  ;* descript. : stop keyboard handler           *
   294                                  ;* parameter : none			       *
   295                                  ;* sideeffect: all		               *
   296                                  ;* back      : none		               *
   297                                  ;***********************************************
   298                                  %macro		stopKBDHandler 0
   299                                                  ;push    ds
   300                                                  ;mov     ax,02509h             ; restore old IRQ-vector
   301                                                  ;lds     dx,[Old09Irqptr]      ;
   302                                                  ;int     21h
   303                                                  ;pop     ds
   304                                  
   305                                  		; TRDOS 386 already have a CRTL+BRK
   306                                  		; preview feature to call 'sysexit'
   307                                  		; /// nothing to do here ! ///
   308                                  		; 10/12/2016 - Erdogan Tan
   309                                  		nop
   310                                  %endmacro
   311                                  
   312                                  ;***********************************************
   313                                  ;* descript. : zero null-initialized data      *
   314                                  ;* parameter : none			       *
   315                                  ;* sideeffect: all		               *
   316                                  ;* back      : none		               *
   317                                  ;***********************************************
   318                                  %macro		nullData 0
   319                                  		;mov	di, nullstart
   320                                                  mov	edi, nullstart
   321                                  		;mov	cx, nullend-nullstart
   322                                                  ;mov	ecx, nullend-nullstart ; ??
   323                                  		xor	eax, eax
   324                                                  ;rep	stosb
   325                                  		mov	ecx, (bss_end-nullstart)+3 ; 06/02/2017
   326                                  		shr	cx, 2
   327                                  		rep	stosd
   328                                  %endmacro
   329                                  
   330                                  ;***********************************************
   331                                  ;* descript. : set textmode		       *
   332                                  ;* parameter : none		               *
   333                                  ;* sideeffect: all		               *
   334                                  ;* back      : none		               *
   335                                  ;***********************************************
   336                                  %macro		set80x25 0
   337                                  		mov	ax, 3
   338                                  		;int	10h	; - VIDEO - SET	VIDEO MODE
   339                                  				; AL = mode
   340                                  		int	31h	; TRDOS 386 Video interrupt 
   341                                  %endmacro
   342                                  
   343                                  ;***********************************************
   344                                  ;* descript. : set gfx-mode 320x200            *
   345                                  ;* parameter : none		               *
   346                                  ;* sideeffect: all		               *
   347                                  ;* back      : none		               *
   348                                  ;***********************************************
   349                                  %macro		set320x200 0
   350                                  		mov	ax, 13h
   351                                  		;int	10h		; - VIDEO - SET	VIDEO MODE
   352                                  					; AL = mode
   353                                  		int	31h ; TRDOS 386 - Video interrupt
   354                                  %endmacro
   355                                  
   356                                  ;***********************************************
   357                                  ;* descript. : calculate a smooth colorrange   *
   358                                  ;* parameter : none             	       *
   359                                  ;* sideeffect: all              	       *
   360                                  ;* back	     : none                	       *
   361                                  ;***********************************************
   362                                  %macro		makePalette 0
   363                                  		;mov	bx, 3
   364                                  		mov	ebx, 3
   365                                  mPcolor:
   366                                  		;mov	si, colors
   367                                  		mov	esi, colors
   368                                  		mov	edi, palette
   369                                  		xor	dh, dh
   370                                  		lodsb
   371                                  		;movzx	cx, al
   372                                  		movzx	ecx, al ; ??
   373                                  mPouter:
   374                                  		push	ecx
   375                                  		mov	cl, [esi]
   376                                  		mov	ah, [ebx+esi]
   377                                  		sub	ax, dx
   378                                  		push	edx
   379                                  		cwd
   380                                  		idiv	cx
   381                                  		pop	edx
   382                                  mPinner:
   383                                  		add	dx, ax
   384                                  		mov	[edi+ebx-1], dh
   385                                  		add	di, 3
   386                                  		loop	mPinner
   387                                  		add	si, 4
   388                                  		pop	ecx
   389                                  		loop	mPouter
   390                                  		dec	bx
   391                                  		jnz	short mPcolor
   392                                  %endmacro
   393                                  
   394                                  ;***********************************************
   395                                  ;* descript. : reset the GM-Port and switch to *
   396                                  ;*             UART mode.		       *
   397                                  ;* parameter : none			       *
   398                                  ;* sideeffect: dx,al		               *
   399                                  ;* back      : none		               *
   400                                  ;***********************************************
   401                                  %macro		resetGM 0
   402                                  		mov	dx, GMPort
   403                                  		mov	al, 0FFh
   404                                  		;out	dx, al
   405                                  	
   406                                  		mov	ah, 1 ; out (byte)
   407                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   408                                  		; cl = 0
   409                                  		dec	ah ; 0
   410                                  		;sub	cl, cl
   411                                  resGMbusy1:
   412                                  		dec	cl
   413                                  		jz	short rGMerror	;{ timeout }
   414                                  		;in	al, dx		;{ read acknowledge }
   415                                  		
   416                                  		;mov	ah, 0 ; in (byte)
   417                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   418                                  		
   419                                  		test	al, 80h
   420                                  		jnz	short resGMbusy1
   421                                  		dec	dx
   422                                  		;in	al, dx
   423                                  
   424                                  		;mov	ah, 0 ; in (byte)
   425                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   426                                  
   427                                  		cmp	al, 0FEh
   428                                  		jne	short rGMerror
   429                                  		inc	dx		;{ switch into UART mode }
   430                                  resGMbusy2:
   431                                  		;in	al, dx
   432                                  
   433                                  		;mov	ah, 0 ; in (byte)
   434                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   435                                  		
   436                                  		test	al, 40h
   437                                  		jnz	short resGMbusy2
   438                                  		mov	al, 3Fh
   439                                  		;out	dx, al
   440                                  
   441                                  		;mov	ah, 1 ; out (byte)
   442                                  		inc	ah ; 1
   443                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   444                                  rGMerror:
   445                                  %endmacro
   446                                  
   447                                  ;***********************************************
   448                                  ;* descript. : mute midi channels 0..15        *
   449                                  ;* parameter : none                	       *
   450                                  ;* sideeffect: ax,cx		               *
   451                                  ;* back		 : none                	       *
   452                                  ;***********************************************
   453                                  %macro		silence 0
   454                                  		mov	cx, 15 ; 0Fh
   455                                  Siloop:	
   456                                  		mov	ax, cx
   457                                  		add	al, CMD_CHANGEPARAM ; 0B0h
   458                                  		call	writeGM
   459                                  		mov	al, MOD_ALLNOTESOFF ; 7Bh
   460                                  		call	writeGM
   461                                  		xor	al, al
   462                                  		call	writeGM
   463                                  		loop	Siloop
   464                                  Sinosound:
   465                                  %endmacro
   466                                  
   467                                  ;***********************************************
   468                                  ;* descript. : create the reactor wall texture *
   469                                  ;* parameter : none		               *
   470                                  ;* sideeffect: ax,bx,cx,di,es                  *
   471                                  ;* back      : none			       *
   472                                  ;* length    : 45 bytes		               *
   473                                  ;***********************************************
   474                                  %macro		reactorWall 0
   475                                  		mov	edi, dword [tseg] ; 11/02/2017
   476                                  		mov	cx, 4096 ; 1000h
   477                                  rsmloop:
   478                                  		mov	ax, di
   479                                  		;and	ax, 0FFFh 
   480                                  		test	al, 8
   481                                  		jle	short rsnonot1
   482                                  		not	al
   483                                  rsnonot1:
   484                                  		and	al, 15 ; 0Fh
   485                                  		mov	bx, ax
   486                                  		mov	ax, di
   487                                  		and	ax, 0FFFh ; 18/12/2016
   488                                  		shr	ax, 6
   489                                  		test	al, 8
   490                                  		jle	short rsnonot2
   491                                  		not	al
   492                                  rsnonot2:
   493                                  		and	al, 15 ; 0Fh
   494                                  		cmp	al, bl
   495                                  		jle	short rstakeal
   496                                  		mov	ax, bx
   497                                  rstakeal:
   498                                  		add	al, 224 ; 0E0h
   499                                  		stosb
   500                                  		loop	rsmloop
   501                                  %endmacro
   502                                  
   503                                  ;***********************************************
   504                                  ;* descript. : calc background-fractal         *
   505                                  ;* parameter : none		               *
   506                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   507                                  ;* back      : none			       *
   508                                  ;***********************************************
   509                                  %macro		createFrac2 0
   510                                  		mov	edi, dword [tseg+72] ; 11/02/2017
   511                                  		mov	ebx, edi
   512                                  		mov	al, 20	; 14h
   513                                  		call	setFrac
   514                                  		mov	edi, ebx
   515                                  		add	di, 64  ; 16/01/2017
   516                                  		;mov	cx, 4096-64 ; 0FC0h
   517                                  		mov	ecx, 4096-64 ; ??
   518                                  		mov	ebx, 4  ; 16/12/2016
   519                                  cF1loop:
   520                                  		;mov	bx, 4
   521                                  		call	rnd
   522                                  		add	al, [edi-64]  ; byte [es:di-64] (*) 16 bit
   523                                  		add	al, [edi-63]  ; byte [es:di-63] (*)
   524                                  		dec	ax
   525                                  		shr	ax, 1
   526                                  		stosb
   527                                  		loop	cF1loop
   528                                  %endmacro
   529                                  
   530                                  ;***********************************************
   531                                  ;* descript. : calc random noise fractal       *
   532                                  ;* parameter : none		               *
   533                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   534                                  ;* back      : none			       *
   535                                  ;***********************************************
   536                                  %macro		createFrac3 0
   537                                  		mov	edi, dword [tseg+76] ; 11/02/2017
   538                                  		mov	dword [es_], edi ; 06/02/2017
   539                                  		mov	al, 3
   540                                  		call	setFrac
   541                                  		;mov	cx, 4096 ; 1000h
   542                                  		mov	ecx, 4096 ; ??
   543                                  		mov	ebx, ecx
   544                                  cF3loop:
   545                                  		;mov	bx, 4096 ; 1000h
   546                                  		call	rnd
   547                                  		mov	edi, dword [es_] ; 06/02/2017
   548                                  		add	di, ax ; 16/01/2017
   549                                  		inc	byte [edi]
   550                                  		loop	cF3loop
   551                                  %endmacro
   552                                  
   553                                  ;***********************************************
   554                                  ;* descript. : init stars (positions and state)*
   555                                  ;* parameter : none			       *
   556                                  ;* sideeffect: eax,bx,cx,edx,si,di,es          *
   557                                  ;* back      : none		               *
   558                                  ;***********************************************
   559                                  %macro		initStars 0
   560                                  		;mov	cx, 30 ; 1Eh
   561                                  		mov	ecx, 30 ; ??
   562                                  		mov	edi, stars
   563                                  		xor	ebx, ebx ; ? 18/12/2016
   564                                  iSloop:	
   565                                  		mov	bx, 256 ; 100h
   566                                  		call	rnd
   567                                  		stosb
   568                                  		mov	bx, 4096-(64*5) ; 0EC0h
   569                                  		add	bx, 128 ; 80h
   570                                  		call	rnd
   571                                  		add	ax, 64  ; 40h
   572                                  		stosw
   573                                  		loop	iSloop
   574                                  %endmacro
   575                                  
   576                                  ;***********************************************
   577                                  ;* descript. : add effects to fractals	       *
   578                                  ;* parameter : none		               *
   579                                  ;* sideeffect: ax,bx,cx,di,es		       *
   580                                  ;* back      : none		               *
   581                                  ;***********************************************
   582                                  %macro		effects 0
   583                                  		; effects
   584                                  		;mov	cx, 26		; 1Ah
   585                                  		mov	ecx, 26 ; ??
   586                                  		mov	esi, aE
   587                                  		;mov	si, aE
   588                                  		xor	ebx, ebx
   589                                  		xor	edi, edi
   590                                  effmloop:
   591                                  		push	cx
   592                                  		mov	bl, byte [esi]	; mseg+effect
   593                                  		mov	dl, bl
   594                                  		shr	dl, 4
   595                                  		and	bl, 0Fh ; 15
   596                                  		; 11/02/2017
   597                                  		shl	bl, 2 ; *4
   598                                  		mov	ebp, dword [ebx+tseg]
   599                                  		;
   600                                  		movzx	cx, byte [esi+2] ; y1
   601                                  effyloop:
   602                                  		movzx	bx, byte [esi+1] ; x1
   603                                  effxloop:
   604                                  		mov	di, cx
   605                                  		shl	di, 6
   606                                  		add	di, bx
   607                                  		mov	al, dl
   608                                  		dec	al
   609                                  		jz	short effect1
   610                                  		dec	al
   611                                  		jz	short effect2
   612                                  		mov	ax, bx
   613                                  		add	ax, cx
   614                                  		and	al, 4
   615                                  		;jz	short effdonot
   616                                  		jz	short effect1
   617                                  		mov	al, 152 ; 98h
   618                                  effdonot:
   619                                  		jmp	short effect1
   620                                  effect2:
   621                                  		mov	al, byte [ebp+edi] ; 16/12/2016
   622                                  effect1:
   623                                  		add	al, byte [esi+5]   ; value
   624                                  		mov	byte [ebp+edi], al ; 16/12/2016
   625                                  		inc	bl
   626                                  		cmp	bl, byte [esi+3]   ; x2
   627                                  		jle	short effxloop
   628                                  		inc	cx
   629                                  		cmp	cl, byte [esi+4] ; y2
   630                                  		jle	short effyloop
   631                                  		add	si, 6
   632                                  		pop	cx
   633                                  		loop	effmloop
   634                                  %endmacro
   635                                  
   636                                  ;***********************************************
   637                                  ;* descript. : copy fractals and add value     *
   638                                  ;* parameter : none		               *
   639                                  ;* sideeffect: al,cx,di,es,fs		       *
   640                                  ;* back      : none		               *
   641                                  ;***********************************************
   642                                  %macro		addFractals 0
   643                                  		mov	esi, aF
   644                                  		;mov	si, aF
   645                                  		mov	dl, 8 ; 11/02/2017
   646                                  		xor	ebx, ebx
   647                                  aFloop:
   648                                  		mov	bl, dl
   649                                  		; 11/02/2017
   650                                  		mov	edi, dword [ebx+tseg] ; es:
   651                                  		lodsw
   652                                  		mov	bl, al ; 16 bit offset (original)
   653                                  		shl	bl, 1 ; 32 bit offset
   654                                  		;
   655                                  		mov	ebp, dword [ebx+tseg] ; fs:
   656                                  		;
   657                                  		;mov	cx, 4096 ; 1000h
   658                                  		mov	ecx, 4096 ; ??
   659                                  aFiloop:
   660                                  		mov	al, [ebp]  ; [fs:di]
   661                                  		add	al, ah
   662                                  		stosb
   663                                  		inc	ebp
   664                                  		loop	aFiloop
   665                                  		 ; 11/02/2017
   666                                  		add	dl, 4
   667                                  		cmp	dl, 60
   668                                  		jle	short aFloop
   669                                  %endmacro
   670                                  
   671                                  ;***********************************************
   672                                  ;* descript. : calculate and initalize textures*
   673                                  ;* parameter : none			       *
   674                                  ;* sideeffect: al,cx,di,es,fs		       *
   675                                  ;* back      : none			       *
   676                                  ;***********************************************
   677                                  %macro		addLava 0
   678                                  		mov	ebp, dword [tseg+44] ; 11/02/2017
   679                                  		;
   680                                  		mov	edi, 4095	; 0FFFh
   681                                  		;mov	cx, 20		; 14h
   682                                  		mov	ecx, 20 ; ??
   683                                  		mov	al, 94		; 5Eh
   684                                  aLyloop:
   685                                  		push	ecx
   686                                  		shl	cx, 3
   687                                  aLxloop:
   688                                  		push	edi
   689                                  		push	eax
   690                                  		;mov	bx, 64		; 40h
   691                                  		mov	ebx, 64
   692                                  		call	rnd
   693                                  		sub	di, ax
   694                                  		pop	eax
   695                                  		mov	[ebp+edi], al ; 17/01/2017
   696                                  		pop	edi
   697                                  		loop	aLxloop
   698                                  		pop	ecx
   699                                  		dec	al
   700                                  		sub	di, 64 		; 40h
   701                                  		loop	aLyloop
   702                                  %endmacro
   703                                  
   704                                  ;***********************************************
   705                                  ;* descript. : calculate and initalize textures*
   706                                  ;* parameter : none		               *
   707                                  ;* sideeffect: al,cx,di,es,fs		       *
   708                                  ;* back      : none		               *
   709                                  ;***********************************************
   710                                  %macro		initTextures 0
   711                                  		;mov	bx, 34	; 22h
   712                                  		mov	ebx, 68 ; 11/02/2017
   713                                  		push	800	; 320h
   714                                  		push	5
   715                                  		call	createFrac1
   716                                  		;mov	bx, 32	; 20h
   717                                  		mov	ebx, 64 ; 11/02/2017
   718                                  		push	112	; 70h
   719                                  		push	15	; 0Fh
   720                                  		call	createFrac1
   721                                  		createFrac2
   722                                  		createFrac3
   723                                  		initStars
   724                                  		reactorWall
   725                                  		addFractals
   726                                  		effects
   727                                  		addLava
   728                                  %endmacro
   729                                  
   730                                  ;***********************************************
   731                                  ;* descript. : cycle "range" colors at "base"  *
   732                                  ;* parameter : none		               *
   733                                  ;* sideeffect: ax,(bl),cx,si,di,es             *
   734                                  ;* back      : none			       *
   735                                  ;***********************************************
   736                                  %macro		colorCycle 0
   737                                  		base	equ 6*32
   738                                                  range	equ 32
   739                                  		
   740                                  		mov	edi, palette+(base*3)
   741                                  		mov	esi, edi
   742                                  		lodsw
   743                                  		;mov	bl,[esi]  ; works only with fire (no blue)
   744                                  		inc	esi
   745                                  		;mov	cx, (range*3-3)
   746                                  		mov	ecx, (range*3-3) ; ??
   747                                  		rep movsb
   748                                  		stosw
   749                                  		;mov	[edi],bl  ; works only with fire (no blue)
   750                                  %endmacro
   751                                  
   752                                  ;***********************************************
   753                                  ;* descript. : animate the stars	       *
   754                                  ;* parameter : none			       *
   755                                  ;* sideeffect: ax,bx,cx,dl,si,di,es            *
   756                                  ;* back      : none			       *
   757                                  ;***********************************************
   758                                  %macro		animStars 0
   759                                  		_base	equ 7*32
   760                                  
   761                                  		mov	edi, dword [tseg+4] ; 11/02/2017
   762                                  		mov	ebp, edi
   763                                  		call	clearFrac
   764                                  
   765                                  		;mov	ecx, 30
   766                                  		;mov	cl, 30	; 1Eh
   767                                  		mov	ecx, 30 ; ??
   768                                  		mov	ebx, stars
   769                                  		;mov	bx, stars
   770                                  aSoloop:
   771                                  		dec	byte [ebx]
   772                                  		mov	ah, [ebx]
   773                                  		and	ah, 63	; 3Fh
   774                                  		cmp	ah, 31	; 1Fh
   775                                  		jbe	short aSnonot
   776                                  		not	ah
   777                                  		and	ah, 31	; 1Fh
   778                                  aSnonot:
   779                                  		shr	ah, 1
   780                                  		; 05/02/2017
   781                                  		movzx	edi, word [ebx+1]
   782                                  		add	edi, ebp
   783                                  
   784                                  		push	ecx
   785                                  		push	ebx
   786                                  
   787                                  		mov	edx, 64-5 ; 3Bh
   788                                  		mov	cx, _base*256+0 ; 0E000h
   789                                  		call	setstarbob
   790                                  
   791                                  		pop	ebx
   792                                  		pop	ecx
   793                                  		add	bx, 3
   794                                  		loop	aSoloop
   795                                  %endmacro
   796                                  
   797                                  ;***********************************************
   798                                  ;* descript. : calculate shading tab           *
   799                                  ;* parameter : none		               *
   800                                  ;* sideeffect: ax,bl,cx,di,es                  *
   801                                  ;* back      : none		               *
   802                                  ;***********************************************
   803                                  %macro		calcShadeTab 0
   804                                  		mov	edi, shadetab
   805                                  		xor	bl, bl
   806                                  cSolp:
   807                                  		inc	bl
   808                                  		;xor	cx, cx
   809                                  		xor	ecx, ecx ; ??
   810                                  cSilp1:
   811                                  		mov	al, cl
   812                                  		and	al, 31	; 1Fh
   813                                  		mul	bl
   814                                  		add	ax, ax
   815                                  		mov	al, cl
   816                                  		and	al, 224	; 0E0h
   817                                  		add	al, ah
   818                                  		stosb
   819                                  		inc	cl
   820                                  		cmp	cl, 192 ; 0C0h
   821                                  		jne	short cSilp1
   822                                  cSilp2:
   823                                  		mov	al, cl
   824                                  		stosb
   825                                  		inc	cl
   826                                  		jnz	short cSilp2
   827                                  		cmp	bl, 128	; 80h
   828                                  		jne	short cSolp
   829                                  %endmacro
   830                                  
   831                                  ;***********************************************
   832                                  ;* descript. : expand a song       	       *
   833                                  ;* parameter : si:song base adress	       *
   834                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
   835                                  ;* back      : none                	       *
   836                                  ;***********************************************
   837                                  %macro		expandSong 0
   838                                                  mov	esi, credits
   839                                                  mov	ebx, channels
   840                                                  mov	edi, songdata
   841                                  EPSwhile:	lodsw
   842                                                  dec	al
   843                                                  js      short EPSendwhile
   844                                                  mov	[ebx+channel.trk], al ; [ebx+2]
   845                                                  add	al, CMD_CHANGEPRG ; 0C0h
   846                                                  call	setinstr
   847                                                  mov	[ebx+channel.adr], di ; [ebx+4]	
   848                                                 	call	expand
   849                                                  xor	al, al
   850                                                  stosb
   851                                                  add	bx, 6
   852                                                  inc	word [tracks]
   853                                                  jmp	short EPSwhile
   854                                  EPSendwhile:
   855                                  %endmacro
   856                                  
   857                                  ;***********************************************
   858                                  ;* descript. : parse the script,rotate and move*
   859                                  ;* parameter : none                	       *
   860                                  ;* sideeffect: all		               *
   861                                  ;* back      : none		               *
   862                                  ;***********************************************
   863                                  %macro		scriptIt 0
   864                                   		; scriptIt
   865                                  		;mov	cx, [ticker]
   866                                  		movzx	ecx, word [ticker] ; 22/01/2017
   867                                  		mov	word [ticker], 0
   868                                  		or	cx, cx
   869                                  		jz	sItickerNull
   870                                  sImloop:
   871                                  		push	ecx
   872                                  		mov	esi, zspeed
   873                                  		;mov	si, zspeed
   874                                  		;dec	word  [esi+10]	      ;	scriptanz
   875                                  		dec	word [scriptanz]
   876                                  		jns	short sIwaitTimer
   877                                  		;mov	bx, [esi+8]	      ;	scriptptr
   878                                  		;movzx	ebx, word [esi+8]	
   879                                  		movzx	ebx, word [scriptptr]
   880                                  		mov	al, [ebx+script]
   881                                  		or	al, al
   882                                  		jz	_exit_
   883                                  		mov	bx, ax
   884                                  		and	bl, 7
   885                                  		;mov	[esi+12], bl	      ;	scriptins
   886                                  		mov	[scriptins], bl
   887                                  		dec	bl
   888                                  		jnz	short sInegateTurn
   889                                  		; (cmd = NEG ZSTEP)  
   890                                  		neg	word [zstep]
   891                                  sInegateTurn:
   892                                  		and	ax, 0F8h
   893                                  		add	ax, ax
   894                                  		;mov	[esi+10], ax	      ; scriptanz
   895                                  		mov	[scriptanz], ax
   896                                  		;inc	word [esi+8]	      ; scriptptr
   897                                  		inc	word [scriptptr]
   898                                  sIwaitTimer:
   899                                  		;mov	al, [esi+12]	      ;	scriptins
   900                                  		mov	al, [scriptins]
   901                                  		cbw
   902                                  		sub	ch, ch ; 23/01/2017
   903                                  		dec	ax
   904                                  		jnz	short sInoturn
   905                                  		; (cmd = NEG ZSTEP)  
   906                                  		mov	bx, [zstep]
   907                                  		;add	[esi+6], bx	      ; ozw
   908                                  		add	[ozw], bx
   909                                  		jmp	short sI_1 ; 23/01/2017	
   910                                  sInoturn:
   911                                  		mov	cl, 3
   912                                  sIrotateLoop:
   913                                  		dec	ax
   914                                  		jnz	short sInoIncrement
   915                                  		; (cmd = INC SPEED or INC XSTEP or INC YSTEP)  
   916                                  		inc	word [esi]	      ; zspeed, oxw, oyw
   917                                  		jmp	short sI_1 ; 23/01/2017	 	   	
   918                                  sInoIncrement:
   919                                  		dec	ax
   920                                  		jnz	short sInoDecrement
   921                                  		; (cmd = DEC SPEED or DEC XSTEP or DEC YSTEP)  
   922                                  		dec	word [esi]	      ; zspeed, oxw, oyw
   923                                  		jmp	short sI_1 ; 23/01/2017	 
   924                                  sInoDecrement:
   925                                  		inc	esi
   926                                  		inc	esi
   927                                  		loop	sIrotateLoop
   928                                  sI_1: ; 23/01/2017
   929                                  		;mov	si, zspeed+2	      ; oxw 	
   930                                  		mov	si, oxw	
   931                                  		mov	cl, 3
   932                                  		xor	eax, eax
   933                                  sIpushloop:
   934                                  		lodsw			      ; oxw, oyw, ozw	
   935                                  		sar	ax, 2
   936                                  		push	eax
   937                                  		loop	sIpushloop
   938                                  
   939                                  		imul	ax, word [si-4], 16   ; [oyw]*16 	
   940                                  		push	eax		        	
   941                                  		call	calcRotMat
   942                                  
   943                                  		mov	cl, 3
   944                                  		xor	esi, esi
   945                                  sImoveLoop:
   946                                  		fld	dword [esi+owmat+24]
   947                                  		fimul	word [zspeed]
   948                                  		fidiv	word [CONST1792]
   949                                  		fadd	dword [esi+ob]
   950                                  		fstp	dword [esi+ob]
   951                                  		add	si, 4
   952                                  		loop	sImoveLoop
   953                                  		pop	ecx
   954                                  		dec	cx
   955                                  		jnz	sImloop
   956                                  sItickerNull:
   957                                  %endmacro
   958                                  
   959                                  ;***********************************************
   960                                  ;* descript. : rotate all points from o -> rp  *
   961                                  ;* parameter : none                	       *
   962                                  ;* sideeffect: all		               *
   963                                  ;* back      : none		               *
   964                                  ;***********************************************
   965                                  %macro		rotation 0
   966                                  		;;mov	cx, [o+object.panz]
   967                                  		;movzx	ecx, word [o+object.panz] ; ??
   968                                  		movzx	ecx, word [object.panz]
   969                                  		;mov	esi, o+object.p
   970                                  		mov	esi, object.p
   971                                  		mov	edi, rp
   972                                  rotmlp:
   973                                  		;mov	bx, wmat
   974                                  		mov	ebx, wmat
   975                                  		mov	dx, 3
   976                                  rotilp:	
   977                                  		fild	word [esi+0] ; point.x
   978                                  		fsub	dword [ob+vector.x]
   979                                  		fmul	dword [ebx+0]
   980                                  		fild	word [esi+2] ; point.y
   981                                  		fsub	dword [ob+vector.y]
   982                                  		fmul	dword [ebx+4]
   983                                  		fild	word [esi+4] ; point.z
   984                                  		fsub	dword [ob+vector.z]
   985                                  		fmul	dword [ebx+8]
   986                                  		fadd	
   987                                  		fadd
   988                                  		;faddp
   989                                  		;faddp
   990                                  		fstp	dword [edi]
   991                                  		add	di, 4
   992                                  		;add	edi, 4
   993                                  		add	bx, 12	; 0Ch
   994                                  		dec	dx
   995                                  		jnz	short rotilp
   996                                  		add	si, 8 ; next point (29/01/2017)
   997                                  		;add	esi, 8
   998                                  		loop	rotmlp
   999                                  %endmacro
  1000                                  
  1001                                  ;***********************************************
  1002                                  ;* descript. : sort faces by z-koord	       *
  1003                                  ;* parameter : none		               *
  1004                                  ;* sideeffect: ax,bx,cx,dx,si,di,es            *
  1005                                  ;* back      : none		               *
  1006                                  ;***********************************************
  1007                                  %macro		sortFaces 0
  1008                                  		mov	edi, facei
  1009                                  		push	edi ; facei
  1010                                  		;mov	esi, o+object.f
  1011                                  		;;mov	si, o+object.f
  1012                                  		mov	esi, object.f
  1013                                  		mov	eax, esi ; pointer to faces
  1014                                  		;;mov	cx, [o+object.fanz]
  1015                                  		;movzx	ecx, word [o+object.fanz] ; ??
  1016                                  		movzx	ecx, word [object.fanz]
  1017                                  
  1018                                  		xor	ebx, ebx ; ?
  1019                                  sFmloop:
  1020                                  		fldz
  1021                                  		push	ecx
  1022                                  		mov	cx, 4
  1023                                  sFiloop:
  1024                                  		imul	bx, word [esi], 12 ; number of points (of face)
  1025                                  		inc	esi
  1026                                  		inc	esi
  1027                                  		fsub	dword [ebx+rp+vector.z]
  1028                                  		loop	sFiloop
  1029                                  		pop	ecx
  1030                                  		fistp	word [edi] ; z distance (face total) (29/01/2017) 
  1031                                  		inc	edi
  1032                                  		inc	edi
  1033                                  		;stosw		; face address (in 'o+object.f')
  1034                                  		stosw		; face address (in 'object.f')
  1035                                  		add	ax, 10
  1036                                  		inc	esi
  1037                                  		inc	esi
  1038                                  		loop	sFmloop
  1039                                  		;push	edi	; facei+4*(o+object.fanz-1)
  1040                                  		push	edi	; facei+4*(object.fanz-1)
  1041                                  		call	qsort
  1042                                  %endmacro
  1043                                  
  1044                                  ;***********************************************
  1045                                  ;* descript. : animate the door  	       *
  1046                                  ;* parameter : none		               *
  1047                                  ;* sideeffect: ax,cx,si,di,es                  *
  1048                                  ;* back      : none		               *
  1049                                  ;***********************************************
  1050                                  %macro		animDoor 0
  1051                                  		;mov	ax, [doortimer]
  1052                                  		movzx	eax, word [doortimer]
  1053                                  		or	ax, ax
  1054                                  		jns	short aDnounder
  1055                                  		xor	ax, ax
  1056                                  		jmp	short alreadydrawed
  1057                                  aDnounder:
  1058                                  		cmp	byte [once], 0
  1059                                  		jne	short alreadydrawed
  1060                                  		inc	byte [once]
  1061                                  		push	ax
  1062                                  		starbackground
  1063                                  		pop	ax
  1064                                  alreadydrawed:
  1065                                  		cmp	ax, 24
  1066                                  		jle	short aDnoover
  1067                                  		mov	ax, 24
  1068                                  aDnoover:
  1069                                  		shl	ax, 6
  1070                                  		; 11/02/2017
  1071                                  		mov	edi, dword [tseg+52]
  1072                                  		mov	ebp, edi
  1073                                  		mov	esi, dword [tseg+60]
  1074                                  		mov	ebx, esi
  1075                                  		add	si, ax ; 16/01/2017
  1076                                  		;mov	cx, 1024
  1077                                  		mov	ecx, 1024 ; ??
  1078                                  		rep movsw
  1079                                  		mov	esi, ebx
  1080                                  		add	si, 2048 ; 16/01/2017
  1081                                  		sub	si, ax
  1082                                  		push	si
  1083                                  		mov	ch, 4  ; cx = 1024
  1084                                  		rep movsw
  1085                                  		; 16/01/2017
  1086                                  		pop	cx
  1087                                  		and	cx, 4095 ; 0FFFh
  1088                                  		mov	edi, ebp ; 05/02/2017
  1089                                  		add	di, cx
  1090                                  		;
  1091                                  		mov	cx, ax
  1092                                  		xor	ax, ax
  1093                                  		rep stosw
  1094                                  %endmacro
  1095                                  
  1096                                  ;***********************************************
  1097                                  ;* descript. : play a tick of the song	       *
  1098                                  ;* parameter : none                	       *
  1099                                  ;* sideeffect: ax,bx,cx,dx,si		       *
  1100                                  ;* back      : none                	       *
  1101                                  ;***********************************************
  1102                                  %macro		playsong 0
  1103                                  		;mov	cx, [tracks]
  1104                                  		movzx	ecx, word [tracks] ; ??
  1105                                  		;mov	si, channels
  1106                                  		mov	esi, channels
  1107                                  PSmloop:
  1108                                  		dec	word [esi+channel.del]
  1109                                  		jg	short PSdelayed
  1110                                  		mov	ax, [esi+channel.trk]
  1111                                  		add	al, CMD_NOTEOFF	; 80h
  1112                                  		call	setnote
  1113                                  		;mov	bx, [esi+channel.adr]
  1114                                  		movzx	ebx, word [esi+channel.adr] ; ??
  1115                                  		mov	ah, 127 	; 7Fh
  1116                                  		cmp	byte [ebx], 0
  1117                                  		jz	short PStrackend
  1118                                  		mov	ah, [ebx]
  1119                                  		mov	[esi+channel.ln], ah
  1120                                  		mov	al, [esi+channel.trk]
  1121                                  		add	al, CMD_NOTEON	; 90h
  1122                                  		call	setnote
  1123                                  		mov	al, [ebx+1]
  1124                                  		mov	bl, SONGSPEED	; 1Dh
  1125                                  		mul	bl
  1126                                  PStrackend:
  1127                                  		mov	[esi+channel.del], ax
  1128                                  		add	word [esi+channel.adr], 2
  1129                                  PSdelayed:
  1130                                  		add	si, 6
  1131                                  		loop	PSmloop
  1132                                  PSnosound:
  1133                                  %endmacro
  1134                                  
  1135                                  ;***********************************************
  1136                                  ;* descript. : dump palette to CRT             *
  1137                                  ;* parameter : bl:intensity (0..255)           *
  1138                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1139                                  ;* back      : none		               *
  1140                                  ;***********************************************
  1141                                  %macro		setPalette2 0
  1142                                  		xor	al, al
  1143                                  		mov	dx, 3C8h
  1144                                  		;out	dx, al
  1145                                  		
  1146                                  		mov 	ah, 1 ; out (byte)
  1147                                  		int	34h ; TRDOS 386 - IOCTL interrupt
  1148                                  		
  1149                                  		inc	dx
  1150                                  		mov	esi, palette
  1151                                  		;mov	cx, 768 ; 300h
  1152                                  		mov	ecx, 768 ; ??
  1153                                  _sp2loop:
  1154                                  		;rep outsb
  1155                                  		
  1156                                  		lodsb	
  1157                                  		;mov 	ah, 1 ; out (byte)
  1158                                  		;mov 	dx, 3C9h
  1159                                  		;out 	dx, al
  1160                                  		int	34h ; TRDOS 386 - IOCTL interrupt
  1161                                  		loop	_sp2loop
  1162                                  %endmacro
  1163                                  
  1164                                  ;***********************************************
  1165                                  ;* descript. : clear starbackground            *
  1166                                  ;* parameter : none		               *
  1167                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1168                                  ;* back      : none		               *
  1169                                  ;***********************************************
  1170                                  %macro		cls 0
  1171                                  		mov	edi, dword [bseg] ; 11/02/2017
  1172                                  		;
  1173                                  		mov	esi, 0A0000h + (320*5) ; 0A0640h
  1174                                  		;mov	cx, 32000 ; 7D00h
  1175                                  		mov	ecx, 32000 ; ??
  1176                                  clsloop:
  1177                                  		lodsb
  1178                                  		stosb
  1179                                  		stosb
  1180                                  		loop	clsloop
  1181                                  %endmacro
  1182                                  
  1183                                  ;***********************************************
  1184                                  ;* descript. : draw starbackground             *
  1185                                  ;* parameter : none		               *
  1186                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1187                                  ;* back      : none		               *
  1188                                  ;***********************************************
  1189                                  %macro		starbackground 0
  1190                                  		mov	edi, dword [bseg] ; 11/02/2017
  1191                                  		;
  1192                                  		mov	ebp, edi
  1193                                  		;mov	cx, 100 ; 64h
  1194                                  		mov	ecx, 100 ; ??
  1195                                  starbackloop:
  1196                                  		push	cx
  1197                                  		;mov	bx, 320*155 ; 0C1C0h
  1198                                  		mov	ebx, 320*155 ; ??
  1199                                  		call	rnd
  1200                                  		add	ax, 320*20  ; 1900h
  1201                                  		; 05/02/2017
  1202                                  		movzx	edi, ax
  1203                                  		add	edi, ebp 
  1204                                  		and	ah, 7
  1205                                  		;mov	dx, 320-5   ; 13Bh
  1206                                  		mov	edx, 320-5 ; ?? 
  1207                                  		mov	cx, 2
  1208                                  		call	setstarbob
  1209                                  		pop	cx
  1210                                  		loop	starbackloop
  1211                                  %endmacro
  1212                                  
  1213                                  ;***********************************************
  1214                                  ;* descript. : create identity matrix	       *
  1215                                  ;* parameter : ds:di address                   *
  1216                                  ;* sideeffect: cx,di		   	       *
  1217                                  ;* back      : none			       *
  1218                                  ;***********************************************
  1219                                  %macro		identityMat 0
  1220                                  		mov	ch, 2
  1221                                  iMolp:
  1222                                  		mov	cl, 2
  1223                                  iMilp:
  1224                                  		fldz
  1225                                  		cmp	ch, cl
  1226                                  		jne	short iMwritezero
  1227                                  		fstp	st0
  1228                                  		fld1
  1229                                  iMwritezero:
  1230                                  		fstp	dword [edi]
  1231                                  		add	di, 4
  1232                                  		dec	cl
  1233                                  		jns	short iMilp
  1234                                  		dec	ch
  1235                                  		jns	short iMolp
  1236                                  %endmacro
  1237                                  
  1238                                  ;=============================================================================
  1239                                  ;               entry point
  1240                                  ;=============================================================================
  1241                                  ;***********************************************
  1242                                  ;* descript. : entry point		       *
  1243                                  ;* parameter : none		               *
  1244                                  ;* sideeffect: all		               *
  1245                                  ;* back      : none		               *
  1246                                  ;***********************************************
  1247                                  
  1248                                  [BITS 32] ; 80386 Protected Mode (32 bit) intructions
  1249                                  
  1250                                  [ORG 0] 
  1251                                  
  1252                                  start:
  1253                                  		; DIRECT VGA MEMORY ACCESS
  1254                                  		;xor	ebx, ebx
  1255 00000000 B705                    		mov	bh, 5 ; Direct access/map to VGA memory (0A0000h)
  1256                                  		;mov	eax, _video ; 1Fh
  1257 00000002 66B81F00                		mov	ax, 1Fh ; sys _video ; TRDOS 386 Video functions
  1258 00000006 CD40                    		int	40h   ; TRDOS 386 system call
  1259                                  
  1260                                  		; eax = 0A0000h
  1261 00000008 21C0                    		and	eax, eax
  1262 0000000A 0F8489050000            		jz      terminate ; error (eax = 0)
  1263                                  
  1264                                  		; clear bss (18/12/2016)
  1265                                  		;mov	edi, bss_start ; ??		
  1266 00000010 66BF[A616]              		mov	di, bss_start
  1267 00000014 66B9742F                		mov	cx, (bss_end - bss_start)/4
  1268                                  		;mov	ecx, (bss_end - bss_start)/4
  1269 00000018 31C0                    		xor	eax, eax
  1270 0000001A F3AB                    		rep	stosd
  1271                                  
  1272                                  		; 11/02/2017
  1273                                  		;mov	edi, vseg ; ??
  1274 0000001C 66BF[2A37]              		mov	di, vseg
  1275 00000020 B800000100              		mov	eax, 10000h
  1276 00000025 AB                      		stosd			; virtual screen address
  1277 00000026 0500000100              		add	eax, 10000h
  1278 0000002B AB                      		stosd			; star background address
  1279 0000002C 0500000100              		add	eax, 10000h
  1280 00000031 66B91400                		mov	cx, 20
  1281                                  segloop:				; texture addresses
  1282 00000035 AB                      		stosd
  1283 00000036 0500100000              		add	eax, 1000h
  1284 0000003B E2F8                    		loop	segloop
  1285                                  
  1286                                  		; 22/01/2017
  1287 0000003D DBE3                    		fninit
  1288                                  
  1289                                  		;nullData
  1290                                  		;resetGM
  1291                                  		;expandSong
  1292                                  
  1293 0000003F E8990E0000              		call	createWorld
  1294                                  
  1295                                  		set320x200
  1295 00000044 66B81300            <1>  mov ax, 13h
  1295                              <1> 
  1295                              <1> 
  1295 00000048 CD31                <1>  int 31h
  1296                                  
  1297 0000004A 86E0                    		xchg	ah, al 		; ah = write string = 13h, 
  1298                                  					; al = write mode = 0
  1299 0000004C 66BB1C00                		mov	bx, 1Ch
  1300 00000050 BD[5D160000]            		mov	ebp, omniscent
  1301 00000055 66B90900                		mov	cx, omniend-omniscent ; 9
  1302 00000059 66BA0601                		mov	dx, 106h
  1303                                  		;int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1304                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1305                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1306                                  					; ES:BP	-> start of string
  1307 0000005D CD31                    		int	31h ; TRDOS 386 - Video interrupt
  1308                                  
  1309 0000005F 6601CD                  		add	bp, cx
  1310 00000062 B110                    		mov	cl, sancend-sanction ; 11h
  1311 00000064 66BA010C                		mov	dx, 0C01h
  1312                                  		;int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1313                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1314                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1315                                  					; ES:BP	-> start of string
  1316 00000068 CD31                    		int	31h ; TRDOS 386 - Video interrupt
  1317                                  
  1318                                  		makePalette
  1318                              <1> 
  1318 0000006A BB03000000          <1>  mov ebx, 3
  1318                              <1> mPcolor:
  1318                              <1> 
  1318 0000006F BE[21120000]        <1>  mov esi, colors
  1318 00000074 BF[02170000]        <1>  mov edi, palette
  1318 00000079 30F6                <1>  xor dh, dh
  1318 0000007B AC                  <1>  lodsb
  1318                              <1> 
  1318 0000007C 0FB6C8              <1>  movzx ecx, al
  1318                              <1> mPouter:
  1318 0000007F 51                  <1>  push ecx
  1318 00000080 8A0E                <1>  mov cl, [esi]
  1318 00000082 8A2433              <1>  mov ah, [ebx+esi]
  1318 00000085 6629D0              <1>  sub ax, dx
  1318 00000088 52                  <1>  push edx
  1318 00000089 6699                <1>  cwd
  1318 0000008B 66F7F9              <1>  idiv cx
  1318 0000008E 5A                  <1>  pop edx
  1318                              <1> mPinner:
  1318 0000008F 6601C2              <1>  add dx, ax
  1318 00000092 88741FFF            <1>  mov [edi+ebx-1], dh
  1318 00000096 6683C703            <1>  add di, 3
  1318 0000009A E2F3                <1>  loop mPinner
  1318 0000009C 6683C604            <1>  add si, 4
  1318 000000A0 59                  <1>  pop ecx
  1318 000000A1 E2DC                <1>  loop mPouter
  1318 000000A3 664B                <1>  dec bx
  1318 000000A5 75C8                <1>  jnz short mPcolor
  1319                                  		
  1320                                  		initTextures
  1320                              <1> 
  1320 000000A7 BB44000000          <1>  mov ebx, 68
  1320 000000AC 6820030000          <1>  push 800
  1320 000000B1 6A05                <1>  push 5
  1320 000000B3 E85E060000          <1>  call createFrac1
  1320                              <1> 
  1320 000000B8 BB40000000          <1>  mov ebx, 64
  1320 000000BD 6A70                <1>  push 112
  1320 000000BF 6A0F                <1>  push 15
  1320 000000C1 E850060000          <1>  call createFrac1
  1320                              <1>  createFrac2
  1320 000000C6 8B3D[7A370000]      <2>  mov edi, dword [tseg+72]
  1320 000000CC 89FB                <2>  mov ebx, edi
  1320 000000CE B014                <2>  mov al, 20
  1320 000000D0 E839060000          <2>  call setFrac
  1320 000000D5 89DF                <2>  mov edi, ebx
  1320 000000D7 6683C740            <2>  add di, 64
  1320                              <2> 
  1320 000000DB B9C00F0000          <2>  mov ecx, 4096-64
  1320 000000E0 BB04000000          <2>  mov ebx, 4
  1320                              <2> cF1loop:
  1320                              <2> 
  1320 000000E5 E8BB050000          <2>  call rnd
  1320 000000EA 0247C0              <2>  add al, [edi-64]
  1320 000000ED 0247C1              <2>  add al, [edi-63]
  1320 000000F0 6648                <2>  dec ax
  1320 000000F2 66D1E8              <2>  shr ax, 1
  1320 000000F5 AA                  <2>  stosb
  1320 000000F6 E2ED                <2>  loop cF1loop
  1320                              <1>  createFrac3
  1320 000000F8 8B3D[7E370000]      <2>  mov edi, dword [tseg+76]
  1320 000000FE 893D[64D20000]      <2>  mov dword [es_], edi
  1320 00000104 B003                <2>  mov al, 3
  1320 00000106 E803060000          <2>  call setFrac
  1320                              <2> 
  1320 0000010B B900100000          <2>  mov ecx, 4096
  1320 00000110 89CB                <2>  mov ebx, ecx
  1320                              <2> cF3loop:
  1320                              <2> 
  1320 00000112 E88E050000          <2>  call rnd
  1320 00000117 8B3D[64D20000]      <2>  mov edi, dword [es_]
  1320 0000011D 6601C7              <2>  add di, ax
  1320 00000120 FE07                <2>  inc byte [edi]
  1320 00000122 E2EE                <2>  loop cF3loop
  1320                              <1>  initStars
  1320                              <2> 
  1320 00000124 B91E000000          <2>  mov ecx, 30
  1320 00000129 BF[CE360000]        <2>  mov edi, stars
  1320 0000012E 31DB                <2>  xor ebx, ebx
  1320                              <2> iSloop:
  1320 00000130 66BB0001            <2>  mov bx, 256
  1320 00000134 E86C050000          <2>  call rnd
  1320 00000139 AA                  <2>  stosb
  1320 0000013A 66BBC00E            <2>  mov bx, 4096-(64*5)
  1320 0000013E 6681C38000          <2>  add bx, 128
  1320 00000143 E85D050000          <2>  call rnd
  1320 00000148 6683C040            <2>  add ax, 64
  1320 0000014C 66AB                <2>  stosw
  1320 0000014E E2E0                <2>  loop iSloop
  1320                              <1>  reactorWall
  1320 00000150 8B3D[32370000]      <2>  mov edi, dword [tseg]
  1320 00000156 66B90010            <2>  mov cx, 4096
  1320                              <2> rsmloop:
  1320 0000015A 6689F8              <2>  mov ax, di
  1320                              <2> 
  1320 0000015D A808                <2>  test al, 8
  1320 0000015F 7E02                <2>  jle short rsnonot1
  1320 00000161 F6D0                <2>  not al
  1320                              <2> rsnonot1:
  1320 00000163 240F                <2>  and al, 15
  1320 00000165 6689C3              <2>  mov bx, ax
  1320 00000168 6689F8              <2>  mov ax, di
  1320 0000016B 6625FF0F            <2>  and ax, 0FFFh
  1320 0000016F 66C1E806            <2>  shr ax, 6
  1320 00000173 A808                <2>  test al, 8
  1320 00000175 7E02                <2>  jle short rsnonot2
  1320 00000177 F6D0                <2>  not al
  1320                              <2> rsnonot2:
  1320 00000179 240F                <2>  and al, 15
  1320 0000017B 38D8                <2>  cmp al, bl
  1320 0000017D 7E03                <2>  jle short rstakeal
  1320 0000017F 6689D8              <2>  mov ax, bx
  1320                              <2> rstakeal:
  1320 00000182 04E0                <2>  add al, 224
  1320 00000184 AA                  <2>  stosb
  1320 00000185 E2D3                <2>  loop rsmloop
  1320                              <1>  addFractals
  1320 00000187 BE[FE120000]        <2>  mov esi, aF
  1320                              <2> 
  1320 0000018C B208                <2>  mov dl, 8
  1320 0000018E 31DB                <2>  xor ebx, ebx
  1320                              <2> aFloop:
  1320 00000190 88D3                <2>  mov bl, dl
  1320                              <2> 
  1320 00000192 8BBB[32370000]      <2>  mov edi, dword [ebx+tseg]
  1320 00000198 66AD                <2>  lodsw
  1320 0000019A 88C3                <2>  mov bl, al
  1320 0000019C D0E3                <2>  shl bl, 1
  1320                              <2> 
  1320 0000019E 8BAB[32370000]      <2>  mov ebp, dword [ebx+tseg]
  1320                              <2> 
  1320                              <2> 
  1320 000001A4 B900100000          <2>  mov ecx, 4096
  1320                              <2> aFiloop:
  1320 000001A9 8A4500              <2>  mov al, [ebp]
  1320 000001AC 00E0                <2>  add al, ah
  1320 000001AE AA                  <2>  stosb
  1320 000001AF 45                  <2>  inc ebp
  1320 000001B0 E2F7                <2>  loop aFiloop
  1320                              <2> 
  1320 000001B2 80C204              <2>  add dl, 4
  1320 000001B5 80FA3C              <2>  cmp dl, 60
  1320 000001B8 7ED6                <2>  jle short aFloop
  1320                              <1>  effects
  1320                              <2> 
  1320                              <2> 
  1320 000001BA B91A000000          <2>  mov ecx, 26
  1320 000001BF BE[62120000]        <2>  mov esi, aE
  1320                              <2> 
  1320 000001C4 31DB                <2>  xor ebx, ebx
  1320 000001C6 31FF                <2>  xor edi, edi
  1320                              <2> effmloop:
  1320 000001C8 6651                <2>  push cx
  1320 000001CA 8A1E                <2>  mov bl, byte [esi]
  1320 000001CC 88DA                <2>  mov dl, bl
  1320 000001CE C0EA04              <2>  shr dl, 4
  1320 000001D1 80E30F              <2>  and bl, 0Fh
  1320                              <2> 
  1320 000001D4 C0E302              <2>  shl bl, 2
  1320 000001D7 8BAB[32370000]      <2>  mov ebp, dword [ebx+tseg]
  1320                              <2> 
  1320 000001DD 660FB64E02          <2>  movzx cx, byte [esi+2]
  1320                              <2> effyloop:
  1320 000001E2 660FB65E01          <2>  movzx bx, byte [esi+1]
  1320                              <2> effxloop:
  1320 000001E7 6689CF              <2>  mov di, cx
  1320 000001EA 66C1E706            <2>  shl di, 6
  1320 000001EE 6601DF              <2>  add di, bx
  1320 000001F1 88D0                <2>  mov al, dl
  1320 000001F3 FEC8                <2>  dec al
  1320 000001F5 7416                <2>  jz short effect1
  1320 000001F7 FEC8                <2>  dec al
  1320 000001F9 740E                <2>  jz short effect2
  1320 000001FB 6689D8              <2>  mov ax, bx
  1320 000001FE 6601C8              <2>  add ax, cx
  1320 00000201 2404                <2>  and al, 4
  1320                              <2> 
  1320 00000203 7408                <2>  jz short effect1
  1320 00000205 B098                <2>  mov al, 152
  1320                              <2> effdonot:
  1320 00000207 EB04                <2>  jmp short effect1
  1320                              <2> effect2:
  1320 00000209 8A443D00            <2>  mov al, byte [ebp+edi]
  1320                              <2> effect1:
  1320 0000020D 024605              <2>  add al, byte [esi+5]
  1320 00000210 88443D00            <2>  mov byte [ebp+edi], al
  1320 00000214 FEC3                <2>  inc bl
  1320 00000216 3A5E03              <2>  cmp bl, byte [esi+3]
  1320 00000219 7ECC                <2>  jle short effxloop
  1320 0000021B 6641                <2>  inc cx
  1320 0000021D 3A4E04              <2>  cmp cl, byte [esi+4]
  1320 00000220 7EC0                <2>  jle short effyloop
  1320 00000222 6683C606            <2>  add si, 6
  1320 00000226 6659                <2>  pop cx
  1320 00000228 E29E                <2>  loop effmloop
  1320                              <1>  addLava
  1320 0000022A 8B2D[5E370000]      <2>  mov ebp, dword [tseg+44]
  1320                              <2> 
  1320 00000230 BFFF0F0000          <2>  mov edi, 4095
  1320                              <2> 
  1320 00000235 B914000000          <2>  mov ecx, 20
  1320 0000023A B05E                <2>  mov al, 94
  1320                              <2> aLyloop:
  1320 0000023C 51                  <2>  push ecx
  1320 0000023D 66C1E103            <2>  shl cx, 3
  1320                              <2> aLxloop:
  1320 00000241 57                  <2>  push edi
  1320 00000242 50                  <2>  push eax
  1320                              <2> 
  1320 00000243 BB40000000          <2>  mov ebx, 64
  1320 00000248 E858040000          <2>  call rnd
  1320 0000024D 6629C7              <2>  sub di, ax
  1320 00000250 58                  <2>  pop eax
  1320 00000251 88443D00            <2>  mov [ebp+edi], al
  1320 00000255 5F                  <2>  pop edi
  1320 00000256 E2E9                <2>  loop aLxloop
  1320 00000258 59                  <2>  pop ecx
  1320 00000259 FEC8                <2>  dec al
  1320 0000025B 6683EF40            <2>  sub di, 64
  1320 0000025F E2DB                <2>  loop aLyloop
  1321                                  
  1322                                  		calcShadeTab
  1322 00000261 BF[82370000]        <1>  mov edi, shadetab
  1322 00000266 30DB                <1>  xor bl, bl
  1322                              <1> cSolp:
  1322 00000268 FEC3                <1>  inc bl
  1322                              <1> 
  1322 0000026A 31C9                <1>  xor ecx, ecx
  1322                              <1> cSilp1:
  1322 0000026C 88C8                <1>  mov al, cl
  1322 0000026E 241F                <1>  and al, 31
  1322 00000270 F6E3                <1>  mul bl
  1322 00000272 6601C0              <1>  add ax, ax
  1322 00000275 88C8                <1>  mov al, cl
  1322 00000277 24E0                <1>  and al, 224
  1322 00000279 00E0                <1>  add al, ah
  1322 0000027B AA                  <1>  stosb
  1322 0000027C FEC1                <1>  inc cl
  1322 0000027E 80F9C0              <1>  cmp cl, 192
  1322 00000281 75E9                <1>  jne short cSilp1
  1322                              <1> cSilp2:
  1322 00000283 88C8                <1>  mov al, cl
  1322 00000285 AA                  <1>  stosb
  1322 00000286 FEC1                <1>  inc cl
  1322 00000288 75F9                <1>  jnz short cSilp2
  1322 0000028A 80FB80              <1>  cmp bl, 128
  1322 0000028D 75D9                <1>  jne short cSolp
  1323                                  
  1324 0000028F 8925[86360000]          		mov	dword [oldstack], esp
  1325                                  
  1326                                  		startTimer
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326                              <1> 
  1326 00000295 BB00840000          <1>  mov ebx, 8400h
  1326 0000029A B901000000          <1>  mov ecx, 1
  1326 0000029F BA[A2050000]        <1>  mov edx, timer_callback
  1326 000002A4 B821000000          <1>  mov eax, 33
  1326 000002A9 CD40                <1>  int 40h
  1326 000002AB 0F82AF020000        <1>  jc loc_err_exit
  1326                              <1> 
  1326 000002B1 A2[29370000]        <1>  mov [timer_event_number], al
  1326                              <1> 
  1327                                  		startKBDHandler
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327                              <1> 
  1327 000002B6 90                  <1>  nop
  1328                                  		cls
  1328 000002B7 8B3D[2E370000]      <1>  mov edi, dword [bseg]
  1328                              <1> 
  1328 000002BD BE40060A00          <1>  mov esi, 0A0000h + (320*5)
  1328                              <1> 
  1328 000002C2 B9007D0000          <1>  mov ecx, 32000
  1328                              <1> clsloop:
  1328 000002C7 AC                  <1>  lodsb
  1328 000002C8 AA                  <1>  stosb
  1328 000002C9 AA                  <1>  stosb
  1328 000002CA E2FB                <1>  loop clsloop
  1329                                  mainloop:
  1330                                  		setPalette2
  1330 000002CC 30C0                <1>  xor al, al
  1330 000002CE 66BAC803            <1>  mov dx, 3C8h
  1330                              <1> 
  1330                              <1> 
  1330 000002D2 B401                <1>  mov ah, 1
  1330 000002D4 CD34                <1>  int 34h
  1330                              <1> 
  1330 000002D6 6642                <1>  inc dx
  1330 000002D8 BE[02170000]        <1>  mov esi, palette
  1330                              <1> 
  1330 000002DD B900030000          <1>  mov ecx, 768
  1330                              <1> _sp2loop:
  1330                              <1> 
  1330                              <1> 
  1330 000002E2 AC                  <1>  lodsb
  1330                              <1> 
  1330                              <1> 
  1330                              <1> 
  1330 000002E3 CD34                <1>  int 34h
  1330 000002E5 E2FB                <1>  loop _sp2loop
  1331                                  
  1332                                  		scriptIt
  1332                              <1> 
  1332                              <1> 
  1332 000002E7 0FB70D[FE160000]    <1>  movzx ecx, word [ticker]
  1332 000002EE 66C705[FE160000]00- <1>  mov word [ticker], 0
  1332 000002F6 00                  <1>
  1332 000002F7 6609C9              <1>  or cx, cx
  1332 000002FA 0F84D2000000        <1>  jz sItickerNull
  1332                              <1> sImloop:
  1332 00000300 51                  <1>  push ecx
  1332 00000301 BE[F0160000]        <1>  mov esi, zspeed
  1332                              <1> 
  1332                              <1> 
  1332 00000306 66FF0D[FA160000]    <1>  dec word [scriptanz]
  1332 0000030D 7940                <1>  jns short sIwaitTimer
  1332                              <1> 
  1332                              <1> 
  1332 0000030F 0FB71D[F8160000]    <1>  movzx ebx, word [scriptptr]
  1332 00000316 8A83[DC150000]      <1>  mov al, [ebx+script]
  1332 0000031C 08C0                <1>  or al, al
  1332 0000031E 0F843C020000        <1>  jz _exit_
  1332 00000324 6689C3              <1>  mov bx, ax
  1332 00000327 80E307              <1>  and bl, 7
  1332                              <1> 
  1332 0000032A 881D[FC160000]      <1>  mov [scriptins], bl
  1332 00000330 FECB                <1>  dec bl
  1332 00000332 7507                <1>  jnz short sInegateTurn
  1332                              <1> 
  1332 00000334 66F71D[59160000]    <1>  neg word [zstep]
  1332                              <1> sInegateTurn:
  1332 0000033B 6625F800            <1>  and ax, 0F8h
  1332 0000033F 6601C0              <1>  add ax, ax
  1332                              <1> 
  1332 00000342 66A3[FA160000]      <1>  mov [scriptanz], ax
  1332                              <1> 
  1332 00000348 66FF05[F8160000]    <1>  inc word [scriptptr]
  1332                              <1> sIwaitTimer:
  1332                              <1> 
  1332 0000034F A0[FC160000]        <1>  mov al, [scriptins]
  1332 00000354 6698                <1>  cbw
  1332 00000356 28ED                <1>  sub ch, ch
  1332 00000358 6648                <1>  dec ax
  1332 0000035A 7510                <1>  jnz short sInoturn
  1332                              <1> 
  1332 0000035C 668B1D[59160000]    <1>  mov bx, [zstep]
  1332                              <1> 
  1332 00000363 66011D[F6160000]    <1>  add [ozw], bx
  1332 0000036A EB18                <1>  jmp short sI_1
  1332                              <1> sInoturn:
  1332 0000036C B103                <1>  mov cl, 3
  1332                              <1> sIrotateLoop:
  1332 0000036E 6648                <1>  dec ax
  1332 00000370 7505                <1>  jnz short sInoIncrement
  1332                              <1> 
  1332 00000372 66FF06              <1>  inc word [esi]
  1332 00000375 EB0D                <1>  jmp short sI_1
  1332                              <1> sInoIncrement:
  1332 00000377 6648                <1>  dec ax
  1332 00000379 7505                <1>  jnz short sInoDecrement
  1332                              <1> 
  1332 0000037B 66FF0E              <1>  dec word [esi]
  1332 0000037E EB04                <1>  jmp short sI_1
  1332                              <1> sInoDecrement:
  1332 00000380 46                  <1>  inc esi
  1332 00000381 46                  <1>  inc esi
  1332 00000382 E2EA                <1>  loop sIrotateLoop
  1332                              <1> sI_1:
  1332                              <1> 
  1332 00000384 66BE[F216]          <1>  mov si, oxw
  1332 00000388 B103                <1>  mov cl, 3
  1332 0000038A 31C0                <1>  xor eax, eax
  1332                              <1> sIpushloop:
  1332 0000038C 66AD                <1>  lodsw
  1332 0000038E 66C1F802            <1>  sar ax, 2
  1332 00000392 50                  <1>  push eax
  1332 00000393 E2F7                <1>  loop sIpushloop
  1332                              <1> 
  1332 00000395 66676B44FC10        <1>  imul ax, word [si-4], 16
  1332 0000039B 50                  <1>  push eax
  1332 0000039C E8970A0000          <1>  call calcRotMat
  1332                              <1> 
  1332 000003A1 B103                <1>  mov cl, 3
  1332 000003A3 31F6                <1>  xor esi, esi
  1332                              <1> sImoveLoop:
  1332 000003A5 D986[9A160000]      <1>  fld dword [esi+owmat+24]
  1332 000003AB DE0D[F0160000]      <1>  fimul word [zspeed]
  1332 000003B1 DE35[CE100000]      <1>  fidiv word [CONST1792]
  1332 000003B7 D886[76160000]      <1>  fadd dword [esi+ob]
  1332 000003BD D99E[76160000]      <1>  fstp dword [esi+ob]
  1332 000003C3 6683C604            <1>  add si, 4
  1332 000003C7 E2DC                <1>  loop sImoveLoop
  1332 000003C9 59                  <1>  pop ecx
  1332 000003CA 6649                <1>  dec cx
  1332 000003CC 0F852EFFFFFF        <1>  jnz sImloop
  1332                              <1> sItickerNull:
  1333                                  
  1334                                  		animDoor
  1334                              <1> 
  1334 000003D2 0FB705[5B160000]    <1>  movzx eax, word [doortimer]
  1334 000003D9 6609C0              <1>  or ax, ax
  1334 000003DC 7905                <1>  jns short aDnounder
  1334 000003DE 6631C0              <1>  xor ax, ax
  1334 000003E1 EB4A                <1>  jmp short alreadydrawed
  1334                              <1> aDnounder:
  1334 000003E3 803D[FD160000]00    <1>  cmp byte [once], 0
  1334 000003EA 7541                <1>  jne short alreadydrawed
  1334 000003EC FE05[FD160000]      <1>  inc byte [once]
  1334 000003F2 6650                <1>  push ax
  1334                              <1>  starbackground
  1334 000003F4 8B3D[2E370000]      <2>  mov edi, dword [bseg]
  1334                              <2> 
  1334 000003FA 89FD                <2>  mov ebp, edi
  1334                              <2> 
  1334 000003FC B964000000          <2>  mov ecx, 100
  1334                              <2> starbackloop:
  1334 00000401 6651                <2>  push cx
  1334                              <2> 
  1334 00000403 BBC0C10000          <2>  mov ebx, 320*155
  1334 00000408 E898020000          <2>  call rnd
  1334 0000040D 66050019            <2>  add ax, 320*20
  1334                              <2> 
  1334 00000411 0FB7F8              <2>  movzx edi, ax
  1334 00000414 01EF                <2>  add edi, ebp
  1334 00000416 80E407              <2>  and ah, 7
  1334                              <2> 
  1334 00000419 BA3B010000          <2>  mov edx, 320-5
  1334 0000041E 66B90200            <2>  mov cx, 2
  1334 00000422 E8F1010000          <2>  call setstarbob
  1334 00000427 6659                <2>  pop cx
  1334 00000429 E2D6                <2>  loop starbackloop
  1334 0000042B 6658                <1>  pop ax
  1334                              <1> alreadydrawed:
  1334 0000042D 6683F818            <1>  cmp ax, 24
  1334 00000431 7E04                <1>  jle short aDnoover
  1334 00000433 66B81800            <1>  mov ax, 24
  1334                              <1> aDnoover:
  1334 00000437 66C1E006            <1>  shl ax, 6
  1334                              <1> 
  1334 0000043B 8B3D[66370000]      <1>  mov edi, dword [tseg+52]
  1334 00000441 89FD                <1>  mov ebp, edi
  1334 00000443 8B35[6E370000]      <1>  mov esi, dword [tseg+60]
  1334 00000449 89F3                <1>  mov ebx, esi
  1334 0000044B 6601C6              <1>  add si, ax
  1334                              <1> 
  1334 0000044E B900040000          <1>  mov ecx, 1024
  1334 00000453 F366A5              <1>  rep movsw
  1334 00000456 89DE                <1>  mov esi, ebx
  1334 00000458 6681C60008          <1>  add si, 2048
  1334 0000045D 6629C6              <1>  sub si, ax
  1334 00000460 6656                <1>  push si
  1334 00000462 B504                <1>  mov ch, 4
  1334 00000464 F366A5              <1>  rep movsw
  1334                              <1> 
  1334 00000467 6659                <1>  pop cx
  1334 00000469 6681E1FF0F          <1>  and cx, 4095
  1334 0000046E 89EF                <1>  mov edi, ebp
  1334 00000470 6601CF              <1>  add di, cx
  1334                              <1> 
  1334 00000473 6689C1              <1>  mov cx, ax
  1334 00000476 6631C0              <1>  xor ax, ax
  1334 00000479 F366AB              <1>  rep stosw
  1335                                  
  1336                                  		; 11/02/2017
  1337 0000047C 8B3D[2A370000]          		mov	edi, dword [vseg]
  1338 00000482 8B35[2E370000]          		mov	esi, dword [bseg]
  1339 00000488 E8AB010000              		call	copyseg
  1340                                  
  1341                                  		rotation
  1341                              <1> 
  1341                              <1> 
  1341 0000048D 0FB70D[621A0000]    <1>  movzx ecx, word [object.panz]
  1341                              <1> 
  1341 00000494 BE[661A0000]        <1>  mov esi, object.p
  1341 00000499 BF[62B90000]        <1>  mov edi, rp
  1341                              <1> rotmlp:
  1341                              <1> 
  1341 0000049E BB[A8160000]        <1>  mov ebx, wmat
  1341 000004A3 66BA0300            <1>  mov dx, 3
  1341                              <1> rotilp:
  1341 000004A7 DF06                <1>  fild word [esi+0]
  1341 000004A9 D825[76160000]      <1>  fsub dword [ob+vector.x]
  1341 000004AF D80B                <1>  fmul dword [ebx+0]
  1341 000004B1 DF4602              <1>  fild word [esi+2]
  1341 000004B4 D825[7A160000]      <1>  fsub dword [ob+vector.y]
  1341 000004BA D84B04              <1>  fmul dword [ebx+4]
  1341 000004BD DF4604              <1>  fild word [esi+4]
  1341 000004C0 D825[7E160000]      <1>  fsub dword [ob+vector.z]
  1341 000004C6 D84B08              <1>  fmul dword [ebx+8]
  1341 000004C9 DEC1                <1>  fadd
  1341 000004CB DEC1                <1>  fadd
  1341                              <1> 
  1341                              <1> 
  1341 000004CD D91F                <1>  fstp dword [edi]
  1341 000004CF 6683C704            <1>  add di, 4
  1341                              <1> 
  1341 000004D3 6683C30C            <1>  add bx, 12
  1341 000004D7 664A                <1>  dec dx
  1341 000004D9 75CC                <1>  jnz short rotilp
  1341 000004DB 6683C608            <1>  add si, 8
  1341                              <1> 
  1341 000004DF E2BD                <1>  loop rotmlp
  1342                                  		sortFaces
  1342 000004E1 BF[22CC0000]        <1>  mov edi, facei
  1342 000004E6 57                  <1>  push edi
  1342                              <1> 
  1342                              <1> 
  1342 000004E7 BE[E6260000]        <1>  mov esi, object.f
  1342 000004EC 89F0                <1>  mov eax, esi
  1342                              <1> 
  1342                              <1> 
  1342 000004EE 0FB70D[641A0000]    <1>  movzx ecx, word [object.fanz]
  1342                              <1> 
  1342 000004F5 31DB                <1>  xor ebx, ebx
  1342                              <1> sFmloop:
  1342 000004F7 D9EE                <1>  fldz
  1342 000004F9 51                  <1>  push ecx
  1342 000004FA 66B90400            <1>  mov cx, 4
  1342                              <1> sFiloop:
  1342 000004FE 666B1E0C            <1>  imul bx, word [esi], 12
  1342 00000502 46                  <1>  inc esi
  1342 00000503 46                  <1>  inc esi
  1342 00000504 D8A3[6AB90000]      <1>  fsub dword [ebx+rp+vector.z]
  1342 0000050A E2F2                <1>  loop sFiloop
  1342 0000050C 59                  <1>  pop ecx
  1342 0000050D DF1F                <1>  fistp word [edi]
  1342 0000050F 47                  <1>  inc edi
  1342 00000510 47                  <1>  inc edi
  1342                              <1> 
  1342 00000511 66AB                <1>  stosw
  1342 00000513 6683C00A            <1>  add ax, 10
  1342 00000517 46                  <1>  inc esi
  1342 00000518 46                  <1>  inc esi
  1342 00000519 E2DC                <1>  loop sFmloop
  1342                              <1> 
  1342 0000051B 57                  <1>  push edi
  1342 0000051C E841010000          <1>  call qsort
  1343                                  
  1344 00000521 EB1D                    jmp short xyz
  1345                                  
  1346 00000523 31C0                    		xor	eax, eax
  1347                                  		;movzx	ecx, word [o+object.fanz]
  1348 00000525 0FB70D[641A0000]        		movzx	ecx, word [object.fanz]
  1349                                  
  1350 0000052C BE[22CC0000]            		mov	esi, facei
  1351                                  drawloop:
  1352 00000531 66AD                    		lodsw
  1353 00000533 66AD                    		lodsw
  1354                                  		;mov	ebx, eax ; face address in 'o+object.f'
  1355 00000535 89C3                    		mov	ebx, eax ; face address in 'object.f'
  1356 00000537 60                      		pushad
  1357 00000538 E874060000              		call	drawclippedface
  1358 0000053D 61                      		popad
  1359 0000053E E2F1                    		loop	drawloop
  1360                                  
  1361                                  xyz:
  1362 00000540 8B35[2A370000]          		mov	esi, dword [vseg] ; 11/02/2017
  1363                                  
  1364 00000546 8B35[32370000]          mov esi, dword [tseg]
  1365                                  
  1366 0000054C BF00000A00              		mov	edi, 0A0000h
  1367 00000551 E8E2000000              		call	copyseg
  1368                                  
  1369 00000556 B401                    		mov	ah, 1	; Check keyboard buffer
  1370 00000558 CD32                    		int	32h	; TRDOS 386 Keyboard interrupt
  1371                                  		;jnz	_exit_  ; exit
  1372                                  		;jmp	mainloop
  1373 0000055A 0F846CFDFFFF            		jz	mainloop ; 11/02/2017
  1374                                  
  1375                                  loc_err_exit:
  1376                                  _exit_:
  1377 00000560 8B25[86360000]          		mov	esp, dword [oldstack]
  1378                                  		silence
  1378 00000566 66B90F00            <1>  mov cx, 15
  1378                              <1> Siloop:
  1378 0000056A 6689C8              <1>  mov ax, cx
  1378 0000056D 04B0                <1>  add al, CMD_CHANGEPARAM
  1378 0000056F E85D010000          <1>  call writeGM
  1378 00000574 B07B                <1>  mov al, MOD_ALLNOTESOFF
  1378 00000576 E856010000          <1>  call writeGM
  1378 0000057B 30C0                <1>  xor al, al
  1378 0000057D E84F010000          <1>  call writeGM
  1378 00000582 E2E6                <1>  loop Siloop
  1378                              <1> Sinosound:
  1379                                  		stopKBDHandler
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379                              <1> 
  1379 00000584 90                  <1>  nop
  1380                                  		stopTimer
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380 00000585 0FB61D[29370000]    <1>  movzx ebx, byte [timer_event_number]
  1380                              <1> 
  1380                              <1> 
  1380                              <1> 
  1380 0000058C B821000000          <1>  mov eax, 33
  1380 00000591 CD40                <1>  int 40h
  1380                              <1> 
  1381                                  ;restore_text_mode:
  1382                                  		set80x25
  1382 00000593 66B80300            <1>  mov ax, 3
  1382                              <1> 
  1382                              <1> 
  1382 00000597 CD31                <1>  int 31h
  1383                                  terminate:
  1384                                  		sys 	_exit   ; INT 40h
  1384                              <1> 
  1384                              <1> 
  1384                              <1> 
  1384                              <1> 
  1384                              <1>  %if %0 >= 2
  1384                              <1>  mov ebx, %2
  1384                              <1>  %if %0 >= 3
  1384                              <1>  mov ecx, %3
  1384                              <1>  %if %0 = 4
  1384                              <1>  mov edx, %4
  1384                              <1>  %endif
  1384                              <1>  %endif
  1384                              <1>  %endif
  1384 00000599 B801000000          <1>  mov eax, %1
  1384                              <1> 
  1384 0000059E CD40                <1>  int 40h
  1385                                  here:
  1386 000005A0 EBFE                    		jmp	short here
  1387                                  
  1388                                  ;==============================================================================
  1389                                  ;		interrupt handler
  1390                                  ;==============================================================================
  1391                                  ;***********************************************
  1392                                  ;* descript. : timer routine                   *
  1393                                  ;* parameter : none		               *
  1394                                  ;* sideeffect: none		               *
  1395                                  ;* back      : none		               *
  1396                                  ;***********************************************
  1397                                  
  1398                                  timer_callback:
  1399                                  		;playsong
  1400                                  
  1401 000005A2 66FF05[FE160000]        		inc	word [ticker]
  1402 000005A9 FE05[28370000]          		inc	byte [twice]
  1403                                  		;and	byte [twice], 7
  1404                                  		;jnz	short tr_1
  1405                                  		
  1406                                  		colorCycle
  1406                              <1>  base equ 6*32
  1406                              <1>  range equ 32
  1406                              <1> 
  1406 000005AF BF[42190000]        <1>  mov edi, palette+(base*3)
  1406 000005B4 89FE                <1>  mov esi, edi
  1406 000005B6 66AD                <1>  lodsw
  1406                              <1> 
  1406 000005B8 46                  <1>  inc esi
  1406                              <1> 
  1406 000005B9 B95D000000          <1>  mov ecx, (range*3-3)
  1406 000005BE F3A4                <1>  rep movsb
  1406 000005C0 66AB                <1>  stosw
  1406                              <1> 
  1407                                  		animStars
  1407                              <1>  _base equ 7*32
  1407                              <1> 
  1407 000005C2 8B3D[36370000]      <1>  mov edi, dword [tseg+4]
  1407 000005C8 89FD                <1>  mov ebp, edi
  1407 000005CA E83D010000          <1>  call clearFrac
  1407                              <1> 
  1407                              <1> 
  1407                              <1> 
  1407 000005CF B91E000000          <1>  mov ecx, 30
  1407 000005D4 BB[CE360000]        <1>  mov ebx, stars
  1407                              <1> 
  1407                              <1> aSoloop:
  1407 000005D9 FE0B                <1>  dec byte [ebx]
  1407 000005DB 8A23                <1>  mov ah, [ebx]
  1407 000005DD 80E43F              <1>  and ah, 63
  1407 000005E0 80FC1F              <1>  cmp ah, 31
  1407 000005E3 7605                <1>  jbe short aSnonot
  1407 000005E5 F6D4                <1>  not ah
  1407 000005E7 80E41F              <1>  and ah, 31
  1407                              <1> aSnonot:
  1407 000005EA D0EC                <1>  shr ah, 1
  1407                              <1> 
  1407 000005EC 0FB77B01            <1>  movzx edi, word [ebx+1]
  1407 000005F0 01EF                <1>  add edi, ebp
  1407                              <1> 
  1407 000005F2 51                  <1>  push ecx
  1407 000005F3 53                  <1>  push ebx
  1407                              <1> 
  1407 000005F4 BA3B000000          <1>  mov edx, 64-5
  1407 000005F9 66B900E0            <1>  mov cx, _base*256+0
  1407 000005FD E816000000          <1>  call setstarbob
  1407                              <1> 
  1407 00000602 5B                  <1>  pop ebx
  1407 00000603 59                  <1>  pop ecx
  1407 00000604 6683C303            <1>  add bx, 3
  1407 00000608 E2CF                <1>  loop aSoloop
  1408                                  	
  1409 0000060A 66FF05[5B160000]        		inc	word [doortimer]
  1410                                  tr_1:
  1411 00000611 B827000000              		mov	eax, 39	; 'sysrele'
  1412 00000616 CD40                    		int	40h	; TRDOS 386 system call
  1413                                  	
  1414                                  ;==============================================================================
  1415                                  ;		sub routines
  1416                                  ;==============================================================================
  1417                                  ;***********************************************
  1418                                  ;* descript. : draw a the starbob	       *
  1419                                  ;* parameter : ds,es: source seg,dest seg      *
  1420                                  ;* sideeffect: ax,cx,si,di	               *
  1421                                  ;* back      : none		               *
  1422                                  ;***********************************************
  1423                                  
  1424                                  setstarbob:
  1425 00000618 BE[1A130000]            		mov	esi, bob
  1426 0000061D B305                    		mov	bl, 5
  1427                                  yloop:
  1428 0000061F B705                    		mov	bh, 5
  1429                                  xloop:
  1430 00000621 AC                      		lodsb
  1431 00000622 28E0                    		sub	al, ah
  1432 00000624 7E06                    		jle	short aSnodraw
  1433 00000626 00E8                    		add	al, ch
  1434 00000628 D2E0                    		shl	al, cl
  1435 0000062A 8807                    		mov	byte [edi], al
  1436                                  aSnodraw:
  1437                                  		;inc	di
  1438 0000062C 47                      		inc	edi
  1439 0000062D FECF                    		dec	bh
  1440 0000062F 75F0                    		jnz	short xloop
  1441 00000631 01D7                    		add	edi, edx ; 05/02/2017
  1442 00000633 FECB                    		dec	bl
  1443 00000635 75E8                    		jnz	short yloop
  1444 00000637 C3                      		retn
  1445                                  
  1446                                  ;***********************************************
  1447                                  ;* descript. : copy 16000 longs ds --> es      *
  1448                                  ;* parameter : ds,es: source seg,dest seg      *
  1449                                  ;* sideeffect: ax,cx,si,di	               *
  1450                                  ;* back      : none		               *
  1451                                  ;***********************************************
  1452                                  
  1453                                  copyseg:
  1454                                  		;mov	cx, 16000 ; 3E80h
  1455 00000638 B9803E0000              		mov	ecx, 16000 ; ??
  1456 0000063D F3A5                    		rep movsd
  1457 0000063F C3                      		retn
  1458                                  
  1459                                  ;***********************************************
  1460                                  ;* descript. : expand a part of the song       *
  1461                                  ;* parameter : si:base adress		       *
  1462                                  ;* sideeffect: si,ax		               *
  1463                                  ;* back      : ax=si:new baseadress            *
  1464                                  ;***********************************************
  1465                                  
  1466                                  expand:
  1467 00000640 8A0E                    EPwhile: 	mov	cl, byte [esi]
  1468 00000642 08C9                    		or	cl, cl
  1469 00000644 7418                    		jz	short EPendwhile
  1470 00000646 7912                    		jns	short EPnote
  1471                                  EPcall:
  1472 00000648 51                      		push	ecx
  1473 00000649 56                      		push	esi
  1474 0000064A 46                      		inc	esi
  1475 0000064B E8F0FFFFFF              		call	expand
  1476 00000650 5E                      		pop	esi
  1477 00000651 59                      		pop	ecx
  1478 00000652 FEC1                    		inc	cl
  1479 00000654 75F2                    		jnz	short EPcall
  1480 00000656 89C6                    		mov	esi, eax
  1481 00000658 EBE6                    		jmp	short EPwhile 
  1482                                  EPnote:
  1483 0000065A 66A5                    		movsw
  1484 0000065C EBE2                    		jmp	short EPwhile
  1485                                  EPendwhile:
  1486 0000065E 46                      		inc	esi
  1487 0000065F 89F0                    		mov	eax, esi
  1488 00000661 C3                      		retn
  1489                                  
  1490                                  ;***********************************************
  1491                                  ;* descript. : recursive index quicksort       *
  1492                                  ;* parameter : l,r:stack left and right border *
  1493                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
  1494                                  ;* back      : none		               *
  1495                                  ;***********************************************
  1496                                  
  1497                                  qsort:
  1498 00000662 58                      		pop	eax 	; get address
  1499 00000663 59                      		pop	ecx	; get 2. param r
  1500 00000664 5B                      		pop	ebx	; get 1. param l
  1501 00000665 50                      		push	eax	; store address
  1502                                  
  1503 00000666 39D9                    		cmp	ecx, ebx
  1504                                  		;jle	short QSendrek
  1505 00000668 763A                    		jna	short QSendrek
  1506 0000066A 89DE                    		mov	esi, ebx
  1507 0000066C 89CF                    		mov	edi, ecx  	
  1508 0000066E 668B16                  		mov	dx, word [esi]
  1509                                  QSrepeat:
  1510 00000671 663916                  QSwhile1:	cmp	word [esi], dx
  1511 00000674 7E05                    		jle	short QSwhile2
  1512 00000676 83C604                  		add	esi, 4
  1513 00000679 EBF6                    		jmp	short QSwhile1
  1514                                  QSwhile2:
  1515 0000067B 663917                  		cmp	word [edi], dx
  1516 0000067E 7D05                    		jnl	short QSwhile2e
  1517 00000680 83EF04                  		sub	edi, 4
  1518 00000683 EBF6                    		jmp	short QSwhile2
  1519                                  QSwhile2e:
  1520 00000685 39FE                    		cmp	esi, edi
  1521                                  		;jg	short QSnoswap
  1522                                  		;jg	short _QSnoswap ; 29/01/2017
  1523 00000687 770D                    		ja	short _QSnoswap ; 10/02/2017
  1524 00000689 AD                      		lodsd
  1525 0000068A 8707                    		xchg	eax, dword [edi]
  1526 0000068C 8946FC                  		mov	dword [esi-4], eax
  1527 0000068F 83EF04                  		sub	edi, 4
  1528                                  QSnoswap:
  1529 00000692 39FE                    		cmp	esi, edi
  1530                                  		;jle	short QSrepeat
  1531 00000694 76DB                    		jna	short QSrepeat
  1532                                  _QSnoswap: ; 29/01/2017
  1533 00000696 56                      		push	esi 
  1534 00000697 51                      		push	ecx
  1535 00000698 53                      		push	ebx
  1536 00000699 57                      		push	edi
  1537 0000069A E8C3FFFFFF              		call	qsort
  1538 0000069F E8BEFFFFFF              		call	qsort
  1539                                  QSendrek:
  1540 000006A4 C3                      		retn
  1541                                  
  1542                                  ;***********************************************
  1543                                  ;* descript. : returns a pseudo random number  *
  1544                                  ;* parameter : bx=range		               *
  1545                                  ;* sideeffect: eax,edx,si		       *
  1546                                  ;* back      : ax=rnd(range)                   *
  1547                                  ;***********************************************
  1548                                  
  1549                                  rnd:
  1550 000006A5 BE[D4100000]            		mov	esi, randommul
  1551                                  		;mov	si, randommul
  1552 000006AA AD                      		lodsd
  1553 000006AB F726                    		mul	dword [esi] ; randomseed
  1554 000006AD 40                      		inc	eax
  1555 000006AE 8906                    		mov	[esi], eax  ; randomseed
  1556 000006B0 66AD                    		lodsw
  1557 000006B2 66AD                    		lodsw
  1558 000006B4 66F7E3                  		mul	bx
  1559 000006B7 6692                    		xchg	ax, dx
  1560 000006B9 C3                      		retn
  1561                                  
  1562                                  ;***********************************************
  1563                                  ;* descript. : set timer speed to 1193180/AX   *
  1564                                  ;*             interrupts per second           *
  1565                                  ;* parameter : bx		               *
  1566                                  ;* sideeffect: ax		               *
  1567                                  ;* back      : none		               *
  1568                                  ;***********************************************
  1569                                  
  1570                                  setTimer:	; set timer speed to 1193180/BX (TRDOS 386)
  1571 000006BA B036                    		mov	al, 36h
  1572                                  		;out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1573                                  
  1574 000006BC B401                    		mov	ah, 1 ; out (byte)
  1575 000006BE 66BA4300                		mov	dx, 43h
  1576 000006C2 CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1577                                  
  1578 000006C4 88D8                    		mov	al, bl
  1579                                  		;out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1580                                  		
  1581 000006C6 66BA4000                		mov	dx, 40h
  1582                                  		;mov	ah, 1 ; out (byte)
  1583 000006CA CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1584                                  
  1585 000006CC 88F8                    		mov	al, bh
  1586                                  		;out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1587                                  		
  1588                                  		;mov	ah, 1 ; out (byte)
  1589                                  		;mov	dx, 40h
  1590 000006CE CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1591                                  
  1592 000006D0 C3                      		retn
  1593                                  
  1594                                  ;***********************************************
  1595                                  ;* descript. : send a byte to the GM-Port      *
  1596                                  ;* parameter : al:midi command                 *
  1597                                  ;* sideeffect: dx		               *
  1598                                  ;* back      : none		               *
  1599                                  ;***********************************************
  1600                                  
  1601                                  writeGM:
  1602 000006D1 66BA3103                		mov	dx, GMPort  ; 331h
  1603 000006D5 6651                    		push	cx
  1604 000006D7 6650                    		push	ax
  1605 000006D9 30C9                    		xor	cl, cl
  1606                                  busy:
  1607 000006DB FEC9                    		dec	cl
  1608 000006DD 7408                    		jz	short timeOut
  1609                                  		;in	al, dx
  1610                                  
  1611 000006DF B400                    		mov	ah, 0	; in (byte)
  1612 000006E1 CD34                      		int	34h	; TRDOS 386 - IOCTL interrupt
  1613                                  		
  1614 000006E3 A840                    		test	al, 40h
  1615 000006E5 75F4                    		jnz	short busy
  1616                                  
  1617                                  timeOut:				; CODE XREF: writeGM+8j
  1618 000006E7 6658                    		pop	ax
  1619 000006E9 6659                    		pop	cx
  1620 000006EB 664A                    		dec	dx
  1621                                  		;out	dx, al
  1622                                  		
  1623 000006ED B401                    		mov	ah, 1	; out (byte)
  1624 000006EF CD34                      		int	34h	; TRDOS 386 - IOCTL interrupt
  1625                                  
  1626 000006F1 C3                      		retn
  1627                                  
  1628                                  ;***********************************************
  1629                                  ;* descript. : send NOTEON command, volume 127 *
  1630                                  ;* parameter : al:channel;ah:note              *
  1631                                  ;* sideeffect: dx,al		               *
  1632                                  ;* back      : none		               *
  1633                                  ;***********************************************
  1634                                  
  1635                                  setnote:
  1636 000006F2 E808000000              		call	setinstr
  1637 000006F7 B07F                    		mov	al, 127	; 7Fh
  1638 000006F9 E8D3FFFFFF              		call	writeGM
  1639 000006FE C3                      		retn
  1640                                  
  1641                                  ;***********************************************
  1642                                  ;* descript. : send CHANGEPRG command	       *
  1643                                  ;* parameter : al:channel;ah:instrument        *
  1644                                  ;* sideeffect: dx,al		               *
  1645                                  ;* back      : none		               *
  1646                                  ;***********************************************
  1647                                  
  1648                                  setinstr:
  1649 000006FF E8CDFFFFFF              		call	writeGM
  1650 00000704 88E0                    		mov	al, ah
  1651 00000706 E8C6FFFFFF              		call	writeGM
  1652 0000070B C3                      		retn
  1653                                  
  1654                                  ;***********************************************
  1655                                  ;* descript. : clear/set the fractal es: to al *
  1656                                  ;* parameter : al,es		               *
  1657                                  ;* sideeffect: ax,cx,di,es  	               *
  1658                                  ;* back      : none			       *
  1659                                  ;***********************************************
  1660                                  
  1661                                  clearFrac:
  1662 0000070C 31C0                    		xor	eax, eax
  1663                                  setFrac:
  1664                                  		;mov	cx, 4096 ; 1000h
  1665 0000070E B900100000              		mov	ecx, 4096 ; ??
  1666 00000713 F3AA                    		rep stosb
  1667 00000715 C3                      		retn
  1668                                  
  1669                                  ;***********************************************
  1670                                  ;* descript. : calc shade bob fractal          *
  1671                                  ;* parameter : es:seg;num,rad:stack            *
  1672                                  ;* sideeffect: all			       *
  1673                                  ;* back      : none			       *
  1674                                  ;***********************************************
  1675                                  
  1676                                  createFrac1:
  1677                                  		rad	equ 8  ; arg 1 in [esp+4]
  1678                                  		num	equ 12 ; arg 2 in [esp+8]
  1679                                  
  1680 00000716 55                      		push	ebp
  1681 00000717 89E5                    		mov	ebp, esp
  1682                                  		;
  1683                                  		; 11/02/2017
  1684 00000719 8BBB[32370000]          		mov	edi, dword [ebx+tseg] ; es:
  1685 0000071F 893D[64D20000]          		mov	dword [es_], edi  ; 16/01/2017
  1686 00000725 E8E2FFFFFF              		call	clearFrac
  1687                                  		;mov	si, circletab
  1688 0000072A BE[8E360000]            		mov	esi, circletab
  1689                                  		;mov	dx, word [ebp+rad]
  1690 0000072F 8B5508                  		mov	edx, dword [ebp+rad]		
  1691 00000732 88D0                    		mov	al, dl
  1692 00000734 F6EA                    		imul	dl
  1693                                  		;mov	di, ax
  1694 00000736 6689C3                  		mov	bx, ax ; 16/01/2017
  1695                                  		;mov	cx, dx
  1696                                  		;add	cx, cx
  1697 00000739 89D1                    		mov	ecx, edx ; ??
  1698 0000073B 01C9                    		add	ecx, ecx ; ??
  1699                                  CCTloop:
  1700 0000073D 88D0                    		mov	al, dl
  1701 0000073F F6EA                    		imul	dl
  1702 00000741 66F7D8                  		neg	ax
  1703                                  		;add	ax, di
  1704 00000744 6601D8                  		add	ax, bx ; 16/01/2017
  1705 00000747 668906                  		mov	word [esi], ax
  1706 0000074A DF06                    		fild	word [esi]
  1707 0000074C D9FA                    		fsqrt
  1708 0000074E DF1E                    		fistp	word [esi]
  1709 00000750 46                      		inc	esi
  1710 00000751 46                      		inc	esi
  1711 00000752 664A                    		dec	dx
  1712 00000754 E2E7                    		loop	CCTloop
  1713                                  
  1714 00000756 668B4D0C                		mov	cx, word [ebp+num]
  1715                                  SBloop1:
  1716 0000075A 51                      		push	ecx
  1717 0000075B BB00100000              		mov	ebx, 4096 ; 1000h
  1718 00000760 E840FFFFFF              		call	rnd
  1719 00000765 0FB7F8                  		movzx	edi, ax ; 05/02/2017
  1720 00000768 66BE[8E36]              		mov	si, circletab
  1721 0000076C 668B4D08                		mov	cx, word [ebp+rad]
  1722                                  		;add	cx, cx
  1723 00000770 01C9                    		add	ecx, ecx ; ??
  1724 00000772 8B1D[64D20000]          		mov	ebx, dword [es_]
  1725                                  SBloop2:
  1726 00000778 51                      		push	ecx
  1727 00000779 66AD                    		lodsw
  1728 0000077B 6689C1                  		mov	cx, ax
  1729 0000077E 6601C9                  		add	cx, cx
  1730 00000781 7410                    		jz	short SBskip
  1731 00000783 57                      		push	edi
  1732 00000784 6629C7                  		sub	di, ax
  1733                                  SBloop3:
  1734 00000787 6681E7FF0F              		and	di, 4095  ; 0FFFh
  1735 0000078C FE041F                  		inc	byte [edi+ebx] ; 17/01/2017
  1736 0000078F 47                      		inc	edi
  1737 00000790 E2F5                    		loop	SBloop3
  1738 00000792 5F                      		pop	edi
  1739                                  SBskip:
  1740 00000793 6683C740                		add	di, 64 ; 40h
  1741 00000797 59                      		pop	ecx
  1742 00000798 E2DE                    		loop	SBloop2
  1743 0000079A 59                      		pop	ecx
  1744 0000079B E2BD                    		loop	SBloop1
  1745 0000079D 5D                      		pop	ebp
  1746 0000079E C20800                  		ret	8
  1747                                  
  1748                                  ;***********************************************
  1749                                  ;* descript. : draw a perpective-texturemapped *
  1750                                  ;*	       and g.-shaded n-sided polygon   *
  1751                                  ;* parameter : far ptr to poly, sides, textnum *
  1752                                  ;* sideeffect: all			       *
  1753                                  ;* back      : none			       *
  1754                                  ;* length    : 700 bytes		       *
  1755                                  ;***********************************************
  1756                                  
  1757                                  scansubtextpoly:
  1758                                  		; 30/01/2017
  1759                                  		col	equ 8   ; arg 1, [esp+4]  ; dcf.col value
  1760                                  		n	equ 12  ; arg 2, [esp+8]  ; dcf.j value
  1761                                  		pol	equ 16  ; arg 3, [esp+12] ; dcf.p2 address
  1762                                  
  1763                                  		; 06/02/2017
  1764 000007A1 55                       		push	ebp
  1765 000007A2 89E5                    		mov	ebp, esp
  1766                                  
  1767                                  		; 21/01/2017
  1768 000007A4 B8FF7F0000              		mov	eax, 32767
  1769 000007A9 89C2                    		mov	edx, eax
  1770 000007AB 89C3                    		mov	ebx, eax
  1771 000007AD 66F7DB                  		neg	bx	 ; -32767 ; 8001h
  1772 000007B0 89DE                    		mov	esi, ebx ; -32767
  1773                                  		
  1774                                  		;edi = 32 bit address (in stack) /// 18/01/2017		
  1775 000007B2 8B7D10                  		mov	edi, dword [ebp+pol] ; [ebp+16] ; dcf.p2 ; face structure
  1776                                  
  1777 000007B5 31C9                    		xor	ecx, ecx
  1778                                  minmax:
  1779 000007B7 663B4712                		cmp	ax, word [edi+2+edge.e+edges.x] ; [edi+12h]
  1780 000007BB 7E04                    		jle	short noswap1
  1781 000007BD 668B4712                		mov	ax, word [edi+2+edge.e+edges.x] ; [edi+12h]
  1782                                  noswap1:
  1783 000007C1 663B5F12                		cmp	bx, word [edi+2+edge.e+edges.x] ; [edi+12h]
  1784 000007C5 7D04                    		jge	short noswap2
  1785 000007C7 668B5F12                		mov	bx, word [edi+2+edge.e+edges.x] ; [edi+12h]
  1786                                  noswap2:
  1787 000007CB 663B570C                		cmp	dx, word [edi+edge.py]  ; [edi+0Ch]
  1788 000007CF 7E12                    		jle	short noswap3
  1789 000007D1 668B570C                		mov	dx, word [edi+edge.py]  ; [edi+0Ch]
  1790 000007D5 66890D[64D40000]        		mov	word [sstp.l], cx
  1791 000007DC 66890D[66D40000]        		mov	word [sstp.r], cx
  1792                                  noswap3:
  1793 000007E3 663B770C                		cmp	si, word [edi+edge.py]  ; [edi+0Ch]
  1794 000007E7 7D04                    		jge	short noswap4
  1795 000007E9 668B770C                		mov	si, word [edi+edge.py]  ; [edi+0Ch]
  1796                                  noswap4:
  1797 000007ED 6683C724                		add	di, 36 ; 24h
  1798 000007F1 6641                    		inc	cx
  1799 000007F3 663B4D0C                		cmp	cx, word [ebp+n] ; [ebp+12]
  1800                                  				   ; dcf.j ; number of visible edges/points
  1801 000007F7 75BE                    		jne	short minmax
  1802                                  
  1803 000007F9 6683FB00                		cmp	bx, 0
  1804 000007FD 0F8C54030000            		jl	exitDraw
  1805 00000803 663D4001                		cmp	ax, XMAX  ; 140h
  1806 00000807 0F8F4A030000            		jg	exitDraw
  1807                                  
  1808 0000080D 6683FE15                		cmp	si, YMIN  ; 15h
  1809 00000811 0F8C40030000            		jl	exitDraw
  1810 00000817 6681FAB300              		cmp	dx, YMAX  ; 0B3h
  1811 0000081C 0F8F35030000            		jg	exitDraw
  1812 00000822 668915[5ED40000]        		mov	word [sstp.miny], dx
  1813 00000829 668935[60D40000]        		mov	word [sstp.maxy], si
  1814                                  
  1815                                  		;{ down clipping }
  1816 00000830 66813D[60D40000]B3-     		cmp	word [sstp.maxy], YMAX ; 0B3h
  1816 00000838 00                 
  1817 00000839 7E09                    		jle	short noclipdown
  1818 0000083B 66C705[60D40000]B3-     		mov	word [sstp.maxy], YMAX ; 0B3h
  1818 00000843 00                 
  1819                                  noclipdown:
  1820 00000844 66A1[5ED40000]          		mov	ax, word [sstp.miny]
  1821 0000084A 663B05[60D40000]        		cmp	ax, word [sstp.maxy]
  1822 00000851 0F8400030000            		je	exitDraw
  1823 00000857 66A3[62D40000]          		mov	word [sstp.y], ax
  1824                                  		; 05/02/2017
  1825 0000085D 8B5D08                  		mov	ebx, dword [ebp+col]	; [ebp+8]
  1826                                  					 ; dcf.col ; shade/color index
  1827                                  		; 11/02/2017
  1828 00000860 66C1E302                		shl	bx, 2 ; *4
  1829 00000864 A1[2A370000]            		mov	eax, dword [vseg]
  1830 00000869 A3[64D20000]            		mov	dword [es_], eax
  1831 0000086E 8B83[32370000]          		mov	eax, dword [ebx+tseg]
  1832 00000874 A3[68D20000]            		mov	dword [fs_], eax
  1833                                  for:
  1834 00000879 0FB705[62D40000]        		movzx	eax, word [sstp.y]
  1835 00000880 663B05[60D40000]        		cmp	ax, word [sstp.maxy]
  1836 00000887 0F8FCA020000            		jg	exitDraw
  1837 0000088D 0F848B000000            		je	exitwhile2
  1838                                  while1:
  1839                                  		;mov	ax, word [sstp.y]
  1840                                  		;cmp	ax, word [sstp.maxy]
  1841                                  		;jge	short while2	
  1842                                  		; 05/02/2017
  1843 00000893 666B1D[64D40000]24      		imul	bx, word [sstp.l], 36
  1844 0000089B 0FB7F3                  		movzx	esi, bx
  1845 0000089E 037510                  		add	esi, dword [ebp+pol]	; [ebp+16]
  1846                                  
  1847 000008A1 663B460C                		cmp	ax, word [esi+edge.py]	; [esi+0Ch]
  1848 000008A5 7530                    		jne	short while2
  1849                                  
  1850 000008A7 668B1D[64D40000]        		mov	bx, word [sstp.l]
  1851 000008AE 664B                    		dec	bx
  1852 000008B0 7D06                    		jge	short nounder
  1853 000008B2 668B5D0C                		mov	bx, word [ebp+n]	; [ebp+12]
  1854                                  				 	; dcf.j ; visible edges/points
  1855 000008B6 664B                    		dec	bx
  1856                                  nounder:
  1857 000008B8 66891D[64D40000]        		mov	word [sstp.l], bx
  1858 000008BF 31FF                    		xor	edi, edi
  1859 000008C1 E895020000              		call	calcDeltas
  1860 000008C6 66A1[62D40000]          		mov	ax, word [sstp.y]
  1861 000008CC 663B05[60D40000]        		cmp	ax, word [sstp.maxy]
  1862 000008D3 7D49                    		jge	short exitwhile2	
  1863 000008D5 EBBC                    		jmp	short while1
  1864                                  while2:
  1865                                  		;mov	ax, word [sstp.y]
  1866 000008D7 663B05[60D40000]        		cmp	ax, word [sstp.maxy]
  1867 000008DE 7D3E                    		jge	short exitwhile2
  1868                                  		; 05/02/2017
  1869 000008E0 666B1D[66D40000]24      		imul	bx, word [sstp.r], 36
  1870 000008E8 0FB7F3                  		movzx	esi, bx
  1871 000008EB 037510                  		add	esi, dword [ebp+pol]	; [ebp+16]
  1872                                  
  1873 000008EE 663B460C                		cmp	ax, word [esi+edge.py]	; [esi+0Ch]
  1874 000008F2 752A                    		jne	short exitwhile2
  1875                                  
  1876 000008F4 668B1D[66D40000]        		mov	bx, word [sstp.r]
  1877 000008FB 6643                    		inc	bx
  1878 000008FD 663B5D0C                		cmp	bx, word [ebp+n]	; [ebp+12]
  1879 00000901 7C02                    		jl	short noover
  1880                                  		;xor	bx, bx
  1881 00000903 31DB                    		xor	ebx, ebx
  1882                                  noover:
  1883 00000905 66891D[66D40000]        		mov	word [sstp.r], bx
  1884 0000090C BF14000000              		mov	edi, 20  ; 14h
  1885 00000911 E845020000              		call	calcDeltas
  1886                                  		;
  1887 00000916 66A1[62D40000]          		mov	ax, word [sstp.y]
  1888 0000091C EBB9                    		jmp	short while2
  1889                                  exitwhile2:
  1890                                  		;{ up clipping }
  1891 0000091E 66833D[62D40000]15      		cmp	word [sstp.y], YMIN	; 15h
  1892 00000926 0F8C08020000            		jl	clipup
  1893 0000092C 31DB                    		xor	ebx, ebx
  1894 0000092E 31C9                    		xor	ecx, ecx
  1895 00000930 668B1D[E4D30000]        		mov	bx, word [sstp.edg+2+edges.x]
  1896 00000937 66891D[5AD40000]        		mov	word [sstp.mx1], bx 
  1897 0000093E 668B0D[F8D30000]        		mov	cx, word [sstp.edg+20+2+edges.x]
  1898 00000945 66890D[5CD40000]        		mov	word [sstp.mx2], cx
  1899 0000094C 6629D9                  		sub	cx, bx
  1900 0000094F 0F84DF010000            		jz	exitol
  1901 00000955 66833D[5CD40000]00      		cmp	word [sstp.mx2], 0
  1902 0000095D 0F8ED1010000            		jle	exitol
  1903 00000963 66813D[5AD40000]40-     		cmp	word [sstp.mx1], XMAX ; 140h
  1903 0000096B 01                 
  1904 0000096C 0F8FC2010000            		jg	exitol
  1905                                  
  1906 00000972 66F7DB                  		neg	bx
  1907 00000975 790D                    		jns	short myelse
  1908 00000977 6631DB                  		xor	bx, bx
  1909 0000097A EB11                    		jmp	short myendif
  1910                                  _nodivbyzero:
  1911 0000097C 8B87[46D40000]          		mov	eax, dword [edi+sstp.del+40]
  1912 00000982 EB26                    		jmp	short nodivbyzero
  1913                                  myelse:
  1914 00000984 66C705[5AD40000]00-     		mov	word [sstp.mx1], 0
  1914 0000098C 00                 
  1915                                  myendif:
  1916 0000098D BF10000000              		mov	edi, 16 ; 10h
  1917                                  addloop1:
  1918                                  		;{ calculate deltas }
  1919 00000992 8B87[F6D30000]          		mov	eax, dword [edi+sstp.edg+20]
  1920 00000998 2B87[E2D30000]          		sub	eax, dword [edi+sstp.edg]
  1921 0000099E 99                      		cdq
  1922                                  		;jcxz	nodivbyzero
  1923 0000099F 67E3DA                  		jcxz	_nodivbyzero
  1924 000009A2 F7F9                    		idiv	ecx
  1925 000009A4 8987[46D40000]          		mov	dword [edi+sstp.del+40], eax
  1926                                  nodivbyzero:
  1927                                  		;{ left clipping }
  1928 000009AA 8B87[46D40000]          		mov	eax, dword [edi+sstp.del+40]
  1929 000009B0 F7EB                    		imul	ebx
  1930 000009B2 0387[E2D30000]          		add	eax, dword [edi+sstp.edg]
  1931 000009B8 8987[0AD40000]          		mov	dword [edi+sstp.edg+40], eax
  1932 000009BE 6683EF04                		sub	di, 4
  1933 000009C2 75CE                    		jnz	short addloop1
  1934                                  
  1935 000009C4 66A1[56D40000]          		mov	ax, word [sstp.del+40+16]
  1936 000009CA 66A3[81100000]          		mov	word [dels_pos_w], ax
  1937                                  
  1938                                  		;{ right clipping }
  1939 000009D0 66813D[5CD40000]40-     		cmp	word  [sstp.mx2], XMAX
  1939 000009D8 01                 
  1940 000009D9 7E09                    		jle	short norightclip
  1941 000009DB 66C705[5CD40000]40-     		mov	word  [sstp.mx2], XMAX
  1941 000009E3 01                 
  1942                                  norightclip:
  1943 000009E4 66693D[62D40000]40-     		imul	di, word [sstp.y], 320
  1943 000009EC 01                 
  1944 000009ED 66033D[5AD40000]        		add	di, word [sstp.mx1]
  1945                                  		
  1946 000009F4 66BB0001                		mov	bx, 256 ; 100h
  1947 000009F8 A1[0ED40000]            		mov	eax, dword [sstp.edg+40+edges.u]
  1948 000009FD F7EB                    		imul	ebx
  1949 000009FF F73D[16D40000]          		idiv	dword [sstp.edg+40+edges.w]
  1950 00000A05 66A3[6CD40000]          		mov	word [sstp.uu2], ax
  1951 00000A0B A1[12D40000]            		mov	eax, dword [sstp.edg+40+edges.v]
  1952 00000A10 F7EB                    		imul	ebx
  1953 00000A12 F73D[16D40000]          		idiv	dword [sstp.edg+40+edges.w]
  1954 00000A18 66A3[6ED40000]          		mov	word [sstp.vv2], ax
  1955                                  outloop:
  1956 00000A1E 668B0D[5CD40000]        		mov	cx, word [sstp.mx2]
  1957 00000A25 662B0D[5AD40000]        		sub	cx, word [sstp.mx1]
  1958 00000A2C 0F8E02010000            		jle	exitol
  1959 00000A32 6683F910                		cmp	cx, SUBRANGE ; 10h
  1960 00000A36 7E04                    		jle	short lastSeg
  1961 00000A38 66B91000                		mov	cx, SUBRANGE ; 10h
  1962                                  lastSeg:
  1963                                  		;{ uu1:=uu2 }
  1964                                  		;{ vv1:=vv2 }
  1965 00000A3C A1[6ED40000]            		mov	eax, dword [sstp.vv2]
  1966 00000A41 A3[6AD40000]            		mov	dword [sstp.vv1], eax
  1967                                  
  1968 00000A46 A1[4AD40000]            		mov	eax, dword [sstp.del+40+edges.u]
  1969 00000A4B F7E9                    		imul	ecx
  1970 00000A4D 0105[0ED40000]          		add	dword [sstp.edg+40+edges.u], eax
  1971 00000A53 A1[4ED40000]            		mov	eax, dword [sstp.del+40+edges.v]
  1972 00000A58 F7E9                    		imul	ecx
  1973 00000A5A 0105[12D40000]          		add	dword [sstp.edg+40+edges.v], eax
  1974 00000A60 A1[52D40000]            		mov	eax, dword [sstp.del+40+edges.w]
  1975 00000A65 F7E9                    		imul	ecx
  1976 00000A67 0105[16D40000]          		add	dword [sstp.edg+40+edges.w], eax
  1977                                  
  1978 00000A6D 66BB0001                		mov	bx, 256 ; 100h
  1979 00000A71 A1[0ED40000]            		mov	eax, dword [sstp.edg+40+edges.u]
  1980 00000A76 F7EB                    		imul	ebx
  1981 00000A78 F73D[16D40000]          		idiv	dword [sstp.edg+40+edges.w]
  1982 00000A7E 66A3[6CD40000]          		mov	word [sstp.uu2], ax
  1983 00000A84 A1[12D40000]            		mov	eax, dword [sstp.edg+40+edges.v]
  1984 00000A89 F7EB                    		imul	ebx
  1985 00000A8B F73D[16D40000]          		idiv	dword [sstp.edg+40+edges.w]
  1986 00000A91 66A3[6ED40000]          		mov	word [sstp.vv2], ax
  1987                                  
  1988 00000A97 66A1[6CD40000]          		mov	ax, word [sstp.uu2]
  1989 00000A9D 662B05[68D40000]        		sub	ax, word [sstp.uu1]
  1990 00000AA4 6699                    		cwd
  1991 00000AA6 66F7F9                  		idiv	cx
  1992 00000AA9 66A3[83100000]          		mov	word [ddu_pos_w], ax
  1993                                  
  1994 00000AAF 66A1[6ED40000]          		mov	ax, word [sstp.vv2]
  1995 00000AB5 662B05[6AD40000]        		sub	ax, word [sstp.vv1]
  1996 00000ABC 6699                    		cwd
  1997 00000ABE 66F7F9                  		idiv	cx
  1998 00000AC1 66A3[85100000]          		mov	word [ddv_pos_w], ax
  1999                                  
  2000 00000AC7 668B35[6AD40000]        		mov	si, word [sstp.vv1]
  2001 00000ACE 668B15[68D40000]        		mov	dx, word [sstp.uu1]
  2002 00000AD5 66A1[1AD40000]          		mov	ax, word [sstp.edg+40+16]
  2003                                  innerloop:
  2004                                   		; 05/02/2017
  2005 00000ADB 0FB7DE                  		movzx	ebx, si
  2006 00000ADE 30DB                    		xor	bl, bl
  2007 00000AE0 66C1EB02                		shr	bx, 2
  2008 00000AE4 00F3                    		add	bl, dh
  2009 00000AE6 031D[68D20000]          		add	ebx, dword [fs_]
  2010 00000AEC 0FB61B                  		movzx	ebx, byte [ebx] ; [fs:bx]
  2011 00000AEF 08DB                    		or	bl, bl
  2012 00000AF1 7415                    		jz	short dels_pos
  2013 00000AF3 88E7                    		mov	bh, ah
  2014 00000AF5 8A9B[82370000]          		mov	bl, byte [ebx+shadetab]
  2015                                  
  2016 00000AFB 56                      		push	esi
  2017 00000AFC 0FB7F7                  		movzx	esi, di
  2018 00000AFF 0335[64D20000]          		add	esi, dword [es_]
  2019 00000B05 881E                    		mov	byte [esi], bl	; [es:di] 
  2020 00000B07 5E                      		pop	esi
  2021                                  dels_pos:	
  2022 00000B08 660305[81100000]        		add	ax, word [dels_pos_w] ;{word ptr dels}
  2023                                  ddu_pos:	
  2024 00000B0F 660315[83100000]        		add	dx, word [ddu_pos_w]  ;{word ptr ddu }
  2025                                  ddv_pos:	
  2026 00000B16 660335[85100000]        		add	si, word [ddv_pos_w]  ;{word ptr ddv }
  2027                                  
  2028 00000B1D 6647                    		inc	di	
  2029 00000B1F E2BA                    		loop	innerloop
  2030                                  
  2031 00000B21 66A3[1AD40000]          		mov	word [sstp.edg+40+16], ax
  2032 00000B27 668305[5AD40000]10      		add	word [sstp.mx1], SUBRANGE
  2033 00000B2F E9EAFEFFFF              		jmp	outloop
  2034                                  exitol:
  2035 00000B34 BF24000000              clipup:		mov	edi, 36 ; 24h
  2036                                  addloop:
  2037 00000B39 8B87[1ED40000]          		mov	eax, dword [edi+sstp.del]
  2038 00000B3F 0187[E2D30000]          		add	dword [edi+sstp.edg], eax
  2039 00000B45 6683EF04                		sub	di, 4
  2040 00000B49 79EE                    		jns	short addloop
  2041 00000B4B 66FF05[62D40000]        		inc	word [sstp.y]
  2042 00000B52 E922FDFFFF              		jmp	for
  2043                                  exitDraw:
  2044 00000B57 5D                      		pop	ebp
  2045 00000B58 C20C00                  		ret	12
  2046                                  
  2047                                    ;***********************************************
  2048                                    ;* descript. : calc deltas for vertical interp.*
  2049                                    ;* parameter : none			         *
  2050                                    ;* sideeffect: all		 	         *
  2051                                    ;***********************************************
  2052                                  
  2053                                  calcDeltas:
  2054 00000B5B 666BD324                		imul	dx, bx,	36
  2055 00000B5F 89F3                    		mov	ebx, esi
  2056 00000B61 0FB7F2                  		movzx	esi, dx
  2057 00000B64 037510                  		add	esi, dword [ebp+pol]  ; [ebp+16]
  2058                                  		;
  2059 00000B67 668B460C                		mov	ax, word [esi+12]
  2060 00000B6B 662B05[62D40000]        		sub	ax, word [sstp.y]
  2061 00000B72 0FBFC0                  		movsx	eax, ax
  2062 00000B75 A3[74D40000]            		mov	dword [sstp.dy], eax
  2063 00000B7A 66B90500                		mov	cx, 5
  2064                                  cDloop:
  2065 00000B7E 8B5310                  		mov	edx, dword [ebx+16]
  2066 00000B81 8997[E2D30000]          		mov	dword [edi+sstp.edg], edx
  2067 00000B87 8B4610                  		mov	eax, dword [esi+16]
  2068 00000B8A 29D0                    		sub	eax, edx
  2069 00000B8C 99                      		cdq
  2070 00000B8D 66833D[74D40000]00      		cmp	word [sstp.dy], 0
  2071 00000B95 740C                    		je	short cDskip
  2072 00000B97 F73D[74D40000]          		idiv	dword [sstp.dy]
  2073 00000B9D 8987[1ED40000]          		mov	dword [edi+sstp.del], eax
  2074                                  cDskip:
  2075 00000BA3 BA04000000              		mov	edx, 4
  2076 00000BA8 01D7                    		add	edi, edx ; +4
  2077 00000BAA 01D6                    		add	esi, edx ; +4
  2078 00000BAC 01D3                    		add	ebx, edx ; +4
  2079 00000BAE E2CE                    		loop	cDloop
  2080 00000BB0 C3                      		retn
  2081                                  
  2082                                  ;***********************************************
  2083                                  ;* descript. : clip a poly at the viewplane,   *
  2084                                  ;*             project and draw it	       *
  2085                                  ;* parameter : bx:adress of the face	       *
  2086                                  ;* sideeffect: all		 	       *
  2087                                  ;* back      : none			       *
  2088                                  ;***********************************************
  2089                                  
  2090                                  drawclippedface:
  2091                                  		; 06/02/2017
  2092 00000BB1 BE[38130000]            		mov	esi, uvtab
  2093                                  		;mov	si, uvtab
  2094 00000BB6 31FF                    		xor	edi, edi
  2095                                  		;mov	ecx, 4
  2096 00000BB8 66B90400                		mov	cx, 4
  2097                                  dCFinitloop:
  2098                                  		;push	ebx	; face addr (in 'o+object.f')(29/01/2017)
  2099 00000BBC 53                      		push	ebx	; face addr (in 'object.f')
  2100                                  		;movzx	ebx, word [ebx]
  2101 00000BBD 668B1B                  		mov	bx, word [ebx] ; point index into 'rp:' ? (29/01/2017)
  2102                                  
  2103 00000BC0 53                      		push	ebx
  2104 00000BC1 666BDB0C                		imul	bx, bx, 12 ; (point vector size = 12 bytes)
  2105 00000BC5 81C3[62B90000]          		add	ebx, rp	  ; addr of rotated point vects (29/01/2017)
  2106 00000BCB 8B03                    		mov	eax, dword [ebx]
  2107                                  		; vector(4-cx).x
  2108 00000BCD 8987[7AD20000]          		mov	dword [edi+dcf.p0+0], eax
  2109                                  		; vector(4-cx).y
  2110 00000BD3 8B4304                  		mov	eax, dword [ebx+4]
  2111 00000BD6 8987[7ED20000]          		mov	dword [edi+dcf.p0+4], eax
  2112                                  
  2113 00000BDC D94308                  		fld	dword [ebx+8]
  2114                                  		; vector(4-cx).z
  2115 00000BDF D997[82D20000]          		fst	dword [edi+dcf.p0+8]
  2116 00000BE5 DF1D[72D20000]          		fistp	word [dcf.h]	; dcf.h = z distance
  2117 00000BEB 5B                      		pop	ebx
  2118                                  
  2119 00000BEC 66A1[72D20000]          		mov	ax, word [dcf.h]
  2120 00000BF2 66050002                		add	ax, 512	; 200h
  2121 00000BF6 0F8881010000            		js	dCFbackclip   ; not visible ? (29/01/2017) 
  2122                                  
  2123 00000BFC 663DFF01                		cmp	ax, 511 ; 1FFh
  2124 00000C00 7E04                    		jle	short intensityOK
  2125 00000C02 66B8FF01                		mov	ax, 511 ; 1FFh	; maximum z distance (dept) ?
  2126                                  intensityOK:
  2127 00000C06 66C1E303                		shl	bx, 3 ; point index * 8
  2128 00000C0A 31D2                    		xor	edx, edx
  2129 00000C0C 66C1E007                		shl	ax, 7
  2130                                  		;mul	word [ebx+o+6+object.p]	; [ebx+o+6+4]
  2131 00000C10 66F7A3[6C1A0000]        		mul	word [ebx+6+object.p] ; 10/02/2017
  2132                                  		; edges(4-cx).s
  2133 00000C17 8997[9AD20000]          		mov	dword [edi+dcf.p0+32], edx
  2134                                  
  2135 00000C1D 30E4                    		xor	ah, ah
  2136 00000C1F 8A4604                  		mov	al, byte [esi+4]
  2137 00000C22 C1E010                  		shl	eax, 16	; 10h
  2138                                  		; edges(4-cx).v
  2139 00000C25 8987[92D20000]          		mov	dword [edi+dcf.p0+24], eax
  2140                                  
  2141 00000C2B AC                      		lodsb
  2142 00000C2C C1E010                  		shl	eax, 16	; 10h
  2143                                  		; edges(4-cx).u
  2144 00000C2F 8987[8ED20000]          		mov	dword [edi+dcf.p0+20], eax
  2145                                  
  2146 00000C35 5B                      		pop	ebx
  2147 00000C36 43                      		inc	ebx
  2148 00000C37 43                      		inc	ebx
  2149 00000C38 6683C724                		add	di, 36	; 24h  ; size of edge
  2150                                  		;loop	dCFinitloop
  2151 00000C3C 6649                    		dec	cx
  2152 00000C3E 0F8578FFFFFF            		jnz	dCFinitloop
  2153                                  
  2154                                  		; end of p1, p2, p3, p4 point dimensioning of face
  2155                                  		; 
  2156                                  		; p1 ...... p2
  2157                                  		;  .	    .	
  2158                                  		;  . shade  .
  2159                                  		;  .        .
  2160                                  		; p3 ...... p4
  2161                                  		;
  2162                                  		; p1 (x,y,z) ... p4 (x,y,z)
  2163                                  		;
  2164                                  
  2165 00000C44 668B03                  		mov	ax, word [ebx]		; shade
  2166 00000C47 66A3[76D20000]          		mov	word [dcf.col], ax
  2167                                  
  2168 00000C4D 31DB                    		xor	ebx, ebx
  2169 00000C4F 66891D[74D20000]        		mov	word [dcf.j], bx
  2170                                  
  2171                                  		; vector(3).z
  2172 00000C56 D905[EED20000]          		fld	dword [dcf.p0+108+8]
  2173 00000C5C D9E4                    		ftst
  2174                                  		;fstsw	ax
  2175 00000C5E DFE0                    		fnstsw	ax
  2176 00000C60 DDD8                    		fstp	st0
  2177 00000C62 9E                      		sahf
  2178 00000C63 7302                    		jae	short isFalse
  2179 00000C65 664B                    		dec	bx
  2180                                  isFalse:
  2181 00000C67 881D[78D20000]          		mov	byte [dcf.is_in], bl
  2182 00000C6D 31F6                    		xor	esi, esi
  2183 00000C6F 31FF                    		xor	edi, edi 
  2184                                  forloop:
  2185                                  		; vector(0-3).z
  2186 00000C71 D986[82D20000]          		fld	dword [esi+dcf.p0+8]
  2187 00000C77 D9E4                    		ftst
  2188                                  		;fstsw	ax
  2189 00000C79 DFE0                    		fnstsw	ax
  2190 00000C7B DDD8                    		fstp	st0
  2191 00000C7D 9E                      		sahf
  2192 00000C7E 7338                    		jae	short elseFall
  2193                                  
  2194 00000C80 803D[78D20000]FF        		cmp	byte [dcf.is_in], 0FFh ; -1 ; true
  2195 00000C87 740B                    		je	short inside
  2196 00000C89 E8F0000000              		call	clipsub
  2197                                  		; { OUT / IN }
  2198 00000C8E F615[78D20000]          		not	byte [dcf.is_in]
  2199                                  inside:
  2200 00000C94 57                      		push	edi
  2201 00000C95 56                      		push	esi
  2202                                  		;lea	edi, [edi+dcf.p2]
  2203                                  		;lea	esi, [esi+dcf.p0]
  2204 00000C96 81C7[2ED30000]          		add	edi, dcf.p2
  2205 00000C9C 81C6[7AD20000]          		add	esi, dcf.p0
  2206                                  
  2207 00000CA2 66B91200                		mov	cx, 18	; 12h
  2208 00000CA6 F366A5                  		rep movsw		; { IN / IN }
  2209                                  
  2210 00000CA9 5E                      		pop	esi
  2211 00000CAA 5F                      		pop	edi
  2212 00000CAB 6683C724                		add	di, 36	; 24h
  2213 00000CAF 66FF05[74D20000]        		inc	word [dcf.j]
  2214 00000CB6 EB14                    		jmp	short dCFendif
  2215                                  elseFall:
  2216 00000CB8 803D[78D20000]FF        		cmp	byte [dcf.is_in], 0FFh
  2217 00000CBF 750B                    		jne	short outside
  2218 00000CC1 E8B8000000              		call	clipsub
  2219                                  		; { IN / OUT }
  2220 00000CC6 F615[78D20000]          		not	byte [dcf.is_in]
  2221                                  outside:
  2222 00000CCC 6683C624                dCFendif:	add	si, 36 ; 24h
  2223 00000CD0 6681FE9000              		cmp	si, 4*36 ; 90h
  2224 00000CD5 759A                    		jne	short forloop
  2225                                  
  2226 00000CD7 668B0D[74D20000]        		mov	cx, word [dcf.j]
  2227 00000CDE 6683F902                		cmp	cx, 2
  2228 00000CE2 0F8C95000000            		jl	dCFnodraw
  2229 00000CE8 31FF                    		xor	edi, edi
  2230                                  dCFloop:
  2231 00000CEA DF05[C8100000]          		fild	word [CONST13]
  2232 00000CF0 D8A7[36D30000]          		fsub	dword [edi+dcf.p2+8]
  2233 00000CF6 DE35[CC100000]          		fidiv	word [CONST160]
  2234                                  		
  2235 00000CFC D987[32D30000]          		fld	dword [edi+dcf.p2+4]
  2236 00000D02 D8F1                    		fdiv	st0, st1
  2237 00000D04 DE05[CA100000]          		fiadd	word [CONST100]
  2238 00000D0A DB9F[3AD30000]          		fistp	dword [edi+dcf.p2+12]
  2239                                  		
  2240 00000D10 D987[2ED30000]          		fld	dword [edi+dcf.p2]
  2241 00000D16 D80D[C4100000]          		fmul	dword [ASPECT_PLACE]
  2242 00000D1C D8F1                    		fdiv	st0, st1
  2243 00000D1E DE05[CC100000]          		fiadd	word [CONST160]
  2244 00000D24 D9FC                    		frndint
  2245 00000D26 DA0D[D0100000]          		fimul	dword [CONST65536]
  2246 00000D2C DB9F[3ED30000]          		fistp	dword [edi+dcf.p2+16]
  2247                                  
  2248 00000D32 DB87[42D30000]          		fild	dword [edi+dcf.p2+20]
  2249 00000D38 D8F1                    		fdiv	st0, st1
  2250 00000D3A DB9F[42D30000]          		fistp	dword [edi+dcf.p2+20]
  2251                                  		
  2252 00000D40 DB87[46D30000]          		fild	dword [edi+dcf.p2+24]
  2253 00000D46 D8F1                    		fdiv	st0, st1
  2254 00000D48 DB9F[46D30000]          		fistp	dword [edi+dcf.p2+24]
  2255                                  		
  2256 00000D4E DB05[D0100000]          		fild	dword [CONST65536]
  2257 00000D54 D8F1                    		fdiv	st0, st1
  2258 00000D56 DB9F[4AD30000]          		fistp	dword [edi+dcf.p2+28]
  2259                                  		
  2260 00000D5C DDD8                    		fstp	st0
  2261 00000D5E 6683C724                		add	di, 36 ; 24h
  2262 00000D62 E286                    		loop	dCFloop
  2263                                  		;dec	cx
  2264                                  		;jnz	dCFloop
  2265                                  
  2266                                  		;lea	edi, [dcf.p2]
  2267 00000D64 BF[2ED30000]            		mov	edi, dcf.p2
  2268 00000D69 57                      		push	edi
  2269 00000D6A 66FF35[74D20000]        		push	word [dcf.j] 
  2270 00000D71 66FF35[76D20000]        		push	word [dcf.col]
  2271 00000D78 E824FAFFFF              		call	scansubtextpoly
  2272                                  dCFnodraw:
  2273                                  dCFbackclip:
  2274 00000D7D C3                      		retn
  2275                                  
  2276                                  clipsub:
  2277                                  		; 05/02/2017
  2278 00000D7E 56                      		push	esi
  2279 00000D7F 57                      		push	edi
  2280 00000D80 8D46DC                  		lea	eax, [esi-36]
  2281 00000D83 83F800                  		cmp	eax, 0
  2282 00000D86 7D05                    		jge	short cSnounder
  2283 00000D88 B86C000000              		mov	eax, 108 ; 6Ch
  2284                                  cSnounder:
  2285 00000D8D D986[82D20000]          		fld	dword [esi+dcf.p0+8]
  2286 00000D93 D9C0                    		fld	st0
  2287 00000D95 97                      		xchg	eax, edi
  2288 00000D96 D8A7[82D20000]          		fsub	dword [edi+dcf.p0+8]
  2289 00000D9C 97                      		xchg	eax, edi
  2290 00000D9D DEF9                    		fdivp	st1, st0
  2291                                  		;fdiv
  2292                                  
  2293 00000D9F BB[33130000]            		mov	ebx, cliptab
  2294 00000DA4 66B90600                		mov	cx, 6
  2295 00000DA8 31D2                    		xor	edx, edx
  2296                                  dCFclipLoop2:
  2297 00000DAA 97                      		xchg	eax, edi
  2298 00000DAB D987[7AD20000]          		fld	dword [edi+dcf.p0]
  2299 00000DB1 97                      		xchg	eax, edi
  2300 00000DB2 D8A6[7AD20000]          		fsub	dword [esi+dcf.p0]
  2301 00000DB8 D8C9                    		fmul	st0, st1
  2302 00000DBA D886[7AD20000]          		fadd	dword [esi+dcf.p0]
  2303 00000DC0 D99F[2ED30000]          		fstp	dword [edi+dcf.p2]
  2304                                  
  2305 00000DC6 8A13                    		mov	dl, byte [ebx]
  2306 00000DC8 43                      		inc	ebx
  2307 00000DC9 01D7                    		add	edi, edx
  2308 00000DCB 01D6                    		add	esi, edx
  2309 00000DCD 01D0                    		add	eax, edx
  2310 00000DCF E2D9                    		loop	dCFclipLoop2
  2311 00000DD1 DDD8                    		fstp	st0
  2312 00000DD3 5F                      		pop	edi
  2313 00000DD4 5E                      		pop	esi
  2314 00000DD5 66FF05[74D20000]        		inc	word [dcf.j]
  2315                                  		;add	edi, 36
  2316 00000DDC 6683C724                		add	di, 36 ; 24h
  2317 00000DE0 C3                      		retn
  2318                                  
  2319                                  
  2320                                  ;***********************************************
  2321                                  ;* descript. : rotate point over one axis      *
  2322                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2323                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2324                                  ;* sideeffect: empty copro-stack               *
  2325                                  ;* back      : none			       *
  2326                                  ;***********************************************
  2327                                  
  2328                                  rotateAxis:
  2329 00000DE1 D9EB                    		fldpi				;{ PI,a}
  2330 00000DE3 DEC9                    		fmulp	st1, st0		;{ PI*a}	
  2331                                  		;fmul
  2332 00000DE5 DA35[D0100000]          		fidiv	dword [CONST65536]	;{ PI*a/65536}
  2333 00000DEB D9FB                    		fsincos				;{ cos,sin}
  2334 00000DED D9C0                    		fld	st0			;{ cos,cos,sin}
  2335 00000DEF D80E                    		fmul	dword [esi] 		;{ y*cos,cos,sin}
  2336 00000DF1 D9C2                    		fld	st2			;{ sin,y*cos,cos,sin}
  2337 00000DF3 D80B                    		fmul	dword [ebx]		;{ z*sin,y*cos,cos,sin}
  2338 00000DF5 DEE9                    		fsubp	st1, st0		;{ y*cos-z*sin,cos,sin}
  2339 00000DF7 D9CA                    		fxch	st2			;{ sin,cos,y*cos-z*sin}
  2340 00000DF9 D80E                    		fmul	dword [esi]		;{ y*sin,cos,y*cos-z*sin}
  2341 00000DFB D9C9                    		fxch	st1			;{ cos,y*sin,y*cos-z*sin}
  2342 00000DFD D80B                    		fmul	dword [ebx]		;{ z*cos,y*sin,y*cos-z*sin}
  2343 00000DFF DEC1                    		faddp	st1, st0		;{ y*sin+z*cos,y*cos-z*sin}
  2344 00000E01 D91B                    		fstp	dword [ebx]		;{ y*cos-z*sin}
  2345 00000E03 D91E                    		fstp	dword [esi]		;{}
  2346 00000E05 C3                      		retn
  2347                                  
  2348                                  ;***********************************************
  2349                                  ;* descript. : rotate point		       *
  2350                                  ;* parameter : a,b,c:angles,adr:address        *
  2351                                  ;* sideeffect: all		 	       *
  2352                                  ;* back      : none			       *
  2353                                  ;***********************************************
  2354                                  
  2355                                  xyzRotate:
  2356                                  		adr	equ 8   ; arg 1, [esp+4]
  2357                                  		c	equ 12	; arg 2, [esp+8]	
  2358                                  		b	equ 16  ; arg 3, [esp+12]
  2359                                  		a	equ 20  ; arg 4, [esp+16]
  2360                                  
  2361 00000E06 55                      		push	ebp
  2362 00000E07 89E5                    		mov	ebp, esp
  2363                                  	
  2364 00000E09 8B7D08                  		mov	edi, [ebp+adr]
  2365 00000E0C DF4514                  		fild	word [ebp+a]
  2366 00000E0F 8D5F08                  		lea	ebx, [edi+8]
  2367 00000E12 8D7704                  		lea	esi, [edi+4]
  2368 00000E15 E8C7FFFFFF              		call	rotateAxis
  2369 00000E1A DF4510                  		fild	word [ebp+b]
  2370 00000E1D 8D1F                    		lea	ebx, [edi]
  2371 00000E1F 8D7708                  		lea	esi, [edi+8]
  2372 00000E22 E8BAFFFFFF              		call	rotateAxis
  2373 00000E27 DF450C                  		fild	word [ebp+c]
  2374 00000E2A 8D5F04                  		lea	ebx, [edi+4]
  2375 00000E2D 8D37                    		lea	esi, [edi]
  2376 00000E2F E8ADFFFFFF              		call	rotateAxis
  2377                                  
  2378 00000E34 5D                      		pop	ebp
  2379 00000E35 C21000                  		ret	16
  2380                                  
  2381                                  ;***********************************************
  2382                                  ;* descript. : calculate world matrix	       *
  2383                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2384                                  ;* sideeffect: all		 	       *
  2385                                  ;* back      : none			       *
  2386                                  ;***********************************************
  2387                                  
  2388                                  calcRotMat:
  2389                                  		neig	equ 8   ; arg 1, [esp+4]
  2390                                  		zw	equ 12	; arg 2, [esp+8]	
  2391                                  		yw	equ 16  ; arg 3, [esp+12]
  2392                                  		xw	equ 20  ; arg 4, [esp+16]
  2393                                  
  2394 00000E38 55                      		push	ebp
  2395 00000E39 89E5                    		mov	ebp, esp
  2396                                  
  2397 00000E3B BF[CC160000]            		mov	edi, nwmat
  2398                                  		identityMat
  2398 00000E40 B502                <1>  mov ch, 2
  2398                              <1> iMolp:
  2398 00000E42 B102                <1>  mov cl, 2
  2398                              <1> iMilp:
  2398 00000E44 D9EE                <1>  fldz
  2398 00000E46 38CD                <1>  cmp ch, cl
  2398 00000E48 7504                <1>  jne short iMwritezero
  2398 00000E4A DDD8                <1>  fstp st0
  2398 00000E4C D9E8                <1>  fld1
  2398                              <1> iMwritezero:
  2398 00000E4E D91F                <1>  fstp dword [edi]
  2398 00000E50 6683C704            <1>  add di, 4
  2398 00000E54 FEC9                <1>  dec cl
  2398 00000E56 79EC                <1>  jns short iMilp
  2398 00000E58 FECD                <1>  dec ch
  2398 00000E5A 79E6                <1>  jns short iMolp
  2399 00000E5C 31FF                    		xor	edi, edi
  2400                                  cRMolp:
  2401 00000E5E 57                      		push	edi
  2402 00000E5F FF7514                  		push	dword [ebp+xw]
  2403 00000E62 FF7510                  		push	dword [ebp+yw]
  2404 00000E65 FF750C                  		push	dword [ebp+zw]
  2405                                  		;add	edi, nwmat
  2406 00000E68 6681C7[CC16]            		add	di, nwmat
  2407 00000E6D 57                      		push	edi
  2408 00000E6E E893FFFFFF              		call	xyzRotate
  2409 00000E73 5F                      		pop	edi
  2410 00000E74 31DB                    		xor	ebx, ebx
  2411                                  cRMilp:
  2412 00000E76 D987[CC160000]          		fld	dword [edi+nwmat]
  2413 00000E7C D88B[82160000]          		fmul	dword [ebx+owmat]
  2414 00000E82 D987[D0160000]          		fld	dword [edi+nwmat+4]
  2415 00000E88 D88B[8E160000]          		fmul	dword [ebx+owmat+12]
  2416 00000E8E D987[D4160000]          		fld	dword [edi+nwmat+8]
  2417 00000E94 D88B[9A160000]          		fmul	dword [ebx+owmat+24]
  2418 00000E9A DEC1                    		fadd
  2419 00000E9C DEC1                    		fadd
  2420 00000E9E D9943B[82160000]        		fst	dword [ebx+edi+owmat]
  2421 00000EA5 D99C3B[A8160000]        		fstp	dword [ebx+edi+wmat]
  2422 00000EAC 6683C304                		add	bx, 4
  2423 00000EB0 80FB0C                  		cmp	bl, 12
  2424 00000EB3 75C1                    		jne	short cRMilp
  2425 00000EB5 6683C70C                		add	di, 12
  2426 00000EB9 6683FF24                		cmp	di, 36
  2427 00000EBD 759F                    		jne	short cRMolp
  2428                                  
  2429 00000EBF BE[A8160000]            		mov	esi, wmat
  2430 00000EC4 66B90300                		mov	cx, 3
  2431                                  cRMneigloop:
  2432 00000EC8 DF4508                  		fild	word [ebp+neig]
  2433 00000ECB 8D5E0C                  		lea	ebx, [esi+12]
  2434 00000ECE E80EFFFFFF              		call	rotateAxis
  2435 00000ED3 6683C604                		add	si, 4
  2436 00000ED7 E2EF                    		loop	cRMneigloop
  2437                                  
  2438 00000ED9 5D                      		pop	ebp
  2439 00000EDA C21000                  		ret	16
  2440                                  
  2441                                  ;***********************************************
  2442                                  ;* descript. : create the world		       *
  2443                                  ;* parameter : none			       *
  2444                                  ;* sideeffect: all		               *
  2445                                  ;* back      : none			       *
  2446                                  ;***********************************************
  2447                                  
  2448                                  createWorld:
  2449                                  		; 06/02/2017
  2450 00000EDD BE[85130000]            		mov	esi, world
  2451                                  		;mov	cx, 4
  2452 00000EE2 B904000000              		mov	ecx, 4 ; ??
  2453                                  cWworldLoop:
  2454 00000EE7 51                      		push	ecx
  2455 00000EE8 56                      		push	esi
  2456 00000EE9 BF[82B70000]            		mov	edi, p
  2457 00000EEE BB[FAB70000]            		mov	ebx, pr
  2458 00000EF3 66BE[5813]              		mov	si, print
  2459 00000EF7 B10F                    		mov	cl, 15 ; 0Fh
  2460                                  cWinitStartRoom:
  2461 00000EF9 51                      		push	ecx
  2462 00000EFA B103                    		mov	cl, 3
  2463                                  cWinnerLoop:
  2464 00000EFC AC                      		lodsb  ; byte data (to be converted to dword) from the 'print:'
  2465 00000EFD 6698                    		cbw    ; convert byte to word with sign (0E0h -> FFE0h)	
  2466 00000EFF 66AB                    		stosw  ; store world coordinate/dimension as integer (word), to 'p:' 
  2467 00000F01 DF47FE                  		fild	word [edi-2]
  2468 00000F04 D91B                    		fstp	dword [ebx] ; store coordinate as floatpoint (29/01/2017)
  2469 00000F06 6683C304                		add	bx, 4 ; next dimension (x,y,z) in 'pr:'
  2470 00000F0A E2F0                    		loop	cWinnerLoop
  2471 00000F0C 59                      		pop	ecx
  2472 00000F0D 66B8007F                		mov	ax, 127*256 ; 7F00h ;  4th dimension in 'p:' (29/01/2017)
  2473 00000F11 66AB                    		stosw
  2474 00000F13 E2E4                    		loop	cWinitStartRoom
  2475 00000F15 5E                      		pop	esi
  2476                                  cWmainLoop:
  2477 00000F16 AC                      		lodsb	; the byte from 'world:' for shade and direction ( 29/01/2017)
  2478 00000F17 3CFF                    		cmp	al, 255 ; 0FFh
  2479 00000F19 0F8458010000            		je	cWexit  ; end of stage (1 to 4) (29/01/2017)
  2480                                  
  2481 00000F1F 88C7                    		mov	bh, al  ; High 4 bits for shading (29/01/2017)
  2482 00000F21 6681E30070              		and	bx, 7000h
  2483 00000F26 80C70F                  		add	bh, 15 ; 0Fh
  2484 00000F29 66891D[6ED20000]        		mov	word [cw.shade], bx
  2485 00000F30 6683E00F                		and	ax, 0Fh ; 15   ; Low 4 bits for direction (29/01/2017)
  2486 00000F34 66A3[6CD20000]          		mov	word [cw.direc], ax
  2487                                  
  2488 00000F3A 31DB                    		xor	ebx, ebx
  2489                                  cWsideLoop:
  2490 00000F3C F6C304                  		test	bl, 4
  2491 00000F3F 7405                    		jz	short cWfirstNibble
  2492 00000F41 AC                      		lodsb
  2493 00000F42 240F                    		and	al, 0Fh ; 15
  2494 00000F44 EB05                    		jmp	short cWsecondNibble
  2495                                  cWfirstNibble:
  2496 00000F46 8A06                    		mov	al, byte [esi]
  2497 00000F48 C0E804                  		shr	al, 4
  2498                                  cWsecondNibble:
  2499 00000F4B 31FF                    		xor	edi, edi ; 10/02/2017 (is this necessary?)
  2500 00000F4D 30E4                    		xor	ah, ah
  2501 00000F4F 6648                    		dec	ax
  2502 00000F51 7868                    		js	short cWnoWall ; ax = 0 -> ax = 0FFFFh (29/01/2017)
  2503                                  		;imul	di, word [o+object.fanz], 10 ; 0Ah
  2504 00000F53 666B3D[641A0000]0A      		imul	di, word [object.fanz], 10 ; 10/02/2017
  2505                                  		;add	di, o+object.f ; base address + offset
  2506                                  		;add	di, object.f ; base address + offset		
  2507 00000F5B 81C7[E6260000]          		add	edi, object.f ; 10/02/2017
  2508                                  		;inc	word [o+object.fanz] ; faces = faces + 1
  2509 00000F61 66FF05[641A0000]        		inc	word [object.fanz] ; faces = faces + 1
  2510 00000F68 66894708                		mov	word [edi+8], ax ; 4th word is shading value (29/01/2017)
  2511                                  
  2512 00000F6C 53                      		push	ebx
  2513 00000F6D 56                      		push	esi
  2514 00000F6E B104                    		mov	cl, 4
  2515                                  cWaddPointloop:
  2516                                  		;movsx	esi, byte [ebx+cube] ; cube coordinate offset (29/01/207)
  2517                                  		;xor	esi, esi ; 10/02/2017
  2518                                  		;movsx	si, byte [ebx+cube]
  2519 00000F70 0FB6B3[40130000]        		movzx	esi, byte [ebx+cube] ; 11/02/2017
  2520 00000F77 81C6[82B70000]          		add	esi, p ; + base address (p:) (29/01/2017)
  2521                                  
  2522 00000F7D 57                      		push	edi
  2523                                  		;mov	edi, o+object.p  ; p area of object structure (in o:)
  2524 00000F7E BF[661A0000]            		mov	edi, object.p ; 10/02/2017
  2525 00000F83 51                      		push	ecx
  2526                                  		;mov	cx, word [o+object.panz] ; number of points (for object.p)
  2527 00000F84 668B0D[621A0000]        		mov	cx, word [object.panz] ; 10/02/2017
  2528 00000F8B 6631C0                  		xor	ax, ax
  2529 00000F8E 67E318                  		jcxz	cWfirstPoint
  2530                                  cWsearchPointLoop: ; check point coordinates are same or not (29/01/2017)
  2531 00000F91 8B16                    		mov	edx, dword [esi]
  2532 00000F93 3B17                    		cmp	edx, dword [edi]
  2533 00000F95 750A                    		jne	short cWdifferent
  2534 00000F97 668B5604                		mov	dx, word [esi+4]
  2535 00000F9B 663B5704                		cmp	dx, word [edi+4]
  2536 00000F9F 7411                    		je	short cWpointExists
  2537                                  cWdifferent:
  2538 00000FA1 6640                    		inc	ax ; number of different points (of object)
  2539 00000FA3 6683C708                		add	di, 8
  2540 00000FA7 E2E8                    		loop	cWsearchPointLoop
  2541                                  cWfirstPoint:
  2542 00000FA9 A5                      		movsd
  2543 00000FAA A5                      		movsd
  2544                                  		;inc	word [o+object.panz] ; points = points + 1
  2545 00000FAB 66FF05[621A0000]        		inc	word [object.panz] ; 10/02/2017
  2546                                  cWpointExists:
  2547 00000FB2 59                      		pop	ecx
  2548 00000FB3 5F                      		pop	edi
  2549 00000FB4 66AB                    		stosw   ; store num of different points (29/01/2017)
  2550                                  			; in the Xth word of face structure (5 words)
  2551                                  			; (Xth word of 'object.f', X = 4-CL)
  2552 00000FB6 43                      		inc	ebx
  2553 00000FB7 E2B7                    		loop	cWaddPointloop
  2554 00000FB9 5E                      		pop	esi
  2555 00000FBA 5B                      		pop	ebx
  2556                                  cWnoWall:
  2557 00000FBB 6683C304                		add	bx, 4
  2558 00000FBF 6683FB18                		cmp	bx, 24 ; 18h
  2559 00000FC3 0F8573FFFFFF            		jne	cWsideLoop
  2560                                  
  2561                                  		;xor	edi, edi ; 10/02/2017
  2562 00000FC9 666B3D[6CD20000]0C      		imul	di, word [cw.direc], 12
  2563                                  		;movsx	edi, di ; 05/02/2017
  2564 00000FD1 B103                    		mov	cl, 3
  2565                                  		;mov	ebx, pr+96
  2566 00000FD3 66BB[5AB8]              		mov	bx, pr+96 ; 24th dword of 'pr:'
  2567                                  cWaddStepLoop:
  2568 00000FD7 D94348                  		fld	dword [ebx+72] ; [ebx+48h]
  2569 00000FDA D8043B                  		fadd	dword [ebx+edi]
  2570 00000FDD D95B48                  		fstp	dword [ebx+72]
  2571 00000FE0 6683C304                		add	bx, 4
  2572 00000FE4 E2F1                    		loop	cWaddStepLoop
  2573                                  
  2574 00000FE6 807EFC00                		cmp	byte [esi-4], 0
  2575 00000FEA 7D27                    		jge	short cWsimpleRoom
  2576                                  
  2577 00000FEC 66BB[FAB7]              		mov	bx, pr
  2578 00000FF0 B10E                    		mov	cl, 14 ; 0Eh
  2579                                  cWrotloop:
  2580 00000FF2 60                      		pushad
  2581 00000FF3 B103                    		mov	cl, 3
  2582 00000FF5 8A16                    		mov	dl, byte [esi]
  2583                                  cWpushLoop:
  2584 00000FF7 31C0                    		xor	eax, eax
  2585 00000FF9 D0EA                    		shr	dl, 1
  2586 00000FFB 7305                    		jnc	short cWnoRot
  2587 00000FFD 8A26                    		mov	ah, byte [esi]
  2588                                  		;and	ax, 0F000h
  2589 00000FFF 80E4F0                  		and	ah, 0F0h
  2590                                  		;push	ax
  2591                                  		;jmp	short cWendIf
  2592                                  cWnoRot:
  2593                                  		;push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2594 00001002 50                      		push	eax
  2595                                  cWendIf:
  2596 00001003 E2F2                    		loop	cWpushLoop
  2597 00001005 53                      		push	ebx ; arg 1 (addr)
  2598 00001006 E8FBFDFFFF              		call	xyzRotate
  2599 0000100B 61                      		popad
  2600 0000100C 6683C30C                		add	bx, 12 ; 0Ch
  2601 00001010 E2E0                    		loop	cWrotloop
  2602 00001012 46                      		inc	esi
  2603                                  cWsimpleRoom:
  2604 00001013 668B1D[6CD20000]        		mov	bx, word [cw.direc]
  2605 0000101A 66C1E302                		shl	bx, 2
  2606 0000101E B104                    		mov	cl, 4
  2607                                  cWpointCopyLoop:
  2608 00001020 60                      		pushad
  2609                                  		;movsx	esi, byte [ebx+cube]
  2610                                  		;xor esi, esi ; 10/02/2017
  2611                                  		;movsx	si, byte [ebx+cube]
  2612 00001021 0FB6B3[40130000]        		movzx	esi, byte [ebx+cube] ; 11/02/2017
  2613 00001028 89F0                    		mov	eax, esi
  2614 0000102A 81C6[82B70000]          		add	esi, p ; + base address of 'p:'
  2615 00001030 80F307                  		xor	bl, 7
  2616                                  		;movsx	edi, byte [ebx+cube]
  2617                                  		;xor	edi, edi ; 10/02/2017
  2618 00001033 660FBEBB[40130000]      		movsx	di, byte [ebx+cube]
  2619 0000103B 81C7[82B70000]          		add	edi, p ; + base address of 'p:'
  2620 00001041 56                      		push	esi 
  2621 00001042 A5                      		movsd
  2622 00001043 A5                      		movsd
  2623 00001044 5E                      		pop	esi
  2624                                  
  2625 00001045 89C3                    		mov	ebx, eax
  2626 00001047 D1EB                    		shr	ebx, 1
  2627 00001049 01C3                    		add	ebx, eax
  2628 0000104B BF[FAB70000]            		mov	edi, pr ; + base address of 'pr:'
  2629 00001050 B103                    		mov	cl, 3
  2630                                  cWSround:
  2631 00001052 D9043B                  		fld	dword [ebx+edi]
  2632 00001055 D887A8000000            		fadd	dword [edi+168]  ; [edi+0A8h]
  2633 0000105B DF1E                    		fistp	word [esi] ; world coordinate/dimension
  2634 0000105D 6683C704                		add	di, 4
  2635 00001061 46                      		inc	esi
  2636 00001062 46                      		inc	esi
  2637 00001063 E2ED                    		loop	cWSround
  2638 00001065 66A1[6ED20000]          		mov	ax, word [cw.shade]
  2639 0000106B 668906                  		mov	word [esi], ax ; 4th word
  2640 0000106E 61                      		popad
  2641 0000106F 43                      		inc	ebx
  2642 00001070 E2AE                    		loop	cWpointCopyLoop
  2643 00001072 E99FFEFFFF              		jmp	cWmainLoop
  2644                                  cWexit:
  2645 00001077 59                      		pop	ecx
  2646 00001078 6649                    		dec	cx
  2647 0000107A 0F8567FEFFFF            		jnz	cWworldLoop
  2648 00001080 C3                      		retn
  2649                                  
  2650                                  ; 17/01/2017
  2651 00001081 1111                    dels_pos_w:	dw 1111h
  2652 00001083 1111                    ddu_pos_w:	dw 1111h
  2653 00001085 1111                    ddv_pos_w:	dw 1111h
  2654                                  
  2655                                  prg_msg:
  2656 00001087 4552444F47414E2054-     		db	'ERDOGAN TAN - TRDOS 386 VGA Test - SNCOMNI.PRG'
  2656 00001090 414E202D205452444F-
  2656 00001099 532033383620564741-
  2656 000010A2 2054657374202D2053-
  2656 000010AB 4E434F4D4E492E5052-
  2656 000010B4 47                 
  2657 000010B5 0D0A                    		db	0Dh, 0Ah
  2658 000010B7 31312F30322F323031-     		db	'11/02/2017'
  2658 000010C0 37                 
  2659 000010C1 0D0A                    		db	0Dh, 0Ah
  2660 000010C3 00                      		db	0 
  2661                                  
  2662                                  align 4
  2663                                  
  2664                                  ;=============================================================================
  2665                                  ;               preinitialized data
  2666                                  ;=============================================================================
  2667                                  
  2668 000010C4 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  2669 000010C8 0D00                    CONST13:	dw 13			; 000Dh			
  2670 000010CA 6400                    CONST100:	dw CENTERY		; 0064h
  2671 000010CC A000                    CONST160:	dw CENTERX		; 00A0h
  2672 000010CE 0007                    CONST1792:	dw 1792			; 0700h
  2673 000010D0 00000100                CONST65536:	dd 65536		; 00010000h
  2674 000010D4 05840808                randommul:	dd 134775813		; 08088405h
  2675 000010D8 FB100000                randomseed:	dd 4347			; 000010FBh
  2676                                  credits:
  2677 000010DC 0250FB                  		db	 2, 80,-5
  2678 000010DF FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  2678 000010E8 51023E0245024F023E-
  2678 000010F1 024502             
  2679 000010F4 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  2679 000010FD 0200               
  2680 000010FF FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  2680 00001108 51023E0246024F023E-
  2680 00001111 024602             
  2681 00001114 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  2681 0000111D 0200               
  2682 0000111F 00                      		db       0
  2683 00001120 37203820                		db      55,32,56,32			; { pat 10 }
  2684 00001124 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  2685 0000112A 39203220                		db      57,32,50,32		 	; { pat 12 }
  2686 0000112E 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  2687 00001134 3740                    		db      55,64		   		; { pat 14 }
  2688 00001136 FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  2688 0000113F 00                 
  2689 00001140 FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  2689 00001149 00                 
  2690 0000114A 00                      		db       0
  2691 0000114B 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  2692 00001151 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  2692 0000115A 083C08             
  2693 0000115D 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  2693 00001166 08                 
  2694 00001167 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  2695 0000116F 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  2696 00001177 3E80                    		db      62,128		  		;{ pat 8,9 }
  2697 00001179 4380                    		db      67,128		  		;{ pat 10,11 }
  2698 0000117B 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  2698 00001184 08                 
  2699 00001185 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  2700 00001189 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  2701 0000118D FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  2702 00001193 FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  2703 00001199 00                      		db       0
  2704 0000119A 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  2705 000011A0 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  2706 000011A8 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  2706 000011B1 08                 
  2707 000011B2 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  2707 000011BB 18                 
  2708 000011BC 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  2708 000011C5 08                 
  2709 000011C6 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  2710 000011CE FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  2711 000011D4 FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  2712 000011DA 00                      		db       0
  2713 000011DB 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  2713 000011E4 2A012A0100         
  2714 000011E9 F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  2714 000011F2 2A0100             
  2715 000011F5 E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  2715 000011FE 2A012602           
  2716 00001202 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  2717 0000120A 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  2717 00001213 0126022A022E022601-
  2717 0000121C 2A0100             
  2718 0000121F 00                      		db     	 0
  2719 00001220 00                      		db	 0
  2720                                  
  2721                                  ; colortable 65 bytes
  2722 00001221 10                      colors 		db	16
  2723 00001222 1F3F3F3F                                db      31,63,63,63
  2724 00001226 01000000                                db	 1, 0, 0, 0
  2725 0000122A 1F28203F                                db      31,40,32,63
  2726 0000122E 01000000                                db	 1, 0, 0, 0
  2727 00001232 1F3F0000                                db      31,63, 0, 0
  2728 00001236 01060100                                db	 1, 6, 1, 0
  2729 0000123A 1F3F2914                                db      31,63,41,20
  2730 0000123E 01000000                                db	 1, 0, 0, 0
  2731 00001242 1F3F3F08                                db      31,63,63, 8
  2732 00001246 01000000                                db	 1, 0, 0, 0
  2733 0000124A 1F38383F                                db	31,56,56,63
  2734 0000124E 013F0000                                db	 1,63, 0, 0
  2735 00001252 103F3F00                                db      16,63,63, 0
  2736 00001256 103F0000                                db      16,63, 0, 0
  2737 0000125A 01160500                                db	 1,22, 5, 0
  2738 0000125E 073F3811                                db       7,63,56,17
  2739                                  
  2740                                  ; parameter for the texture effects 156 bytes
  2741 00001262 130F0F31310A            aE              db	013h,15,15,49,49,10
  2742 00001268 131010303011                            db      013h,16,16,48,48,17
  2743 0000126E 1311112F2F18                            db      013h,17,17,47,47,24
  2744 00001274 1312122E2EBE                            db      013h,18,18,46,46,190
  2745 0000127A 1315152B2B1E                            db      013h,21,21,43,43,30
  2746 00001280 2500003E1E03                            db      025h,0,0,62,30,3
  2747 00001286 2503033E1E07                            db      025h,3,3,62,30,7
  2748 0000128C 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  2749 00001292 2500203E3E03                            db      025h,0,32,62,62,3
  2750 00001298 2503233E3E07                            db      025h,3,35,62,62,7
  2751 0000129E 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  2752 000012A4 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  2753 000012AA 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  2754 000012B0 2C000B3F1004                            db      02Ch,0,11,63,16,4
  2755 000012B6 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  2756 000012BC 2C00303F3504                            db      02Ch,0,48,63,53,4
  2757 000012C2 2E13182C2705                            db      02Eh,19,24,44,39,5
  2758 000012C8 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  2759 000012CE 2E14192B2607                            db      02Eh,20,25,43,38,7
  2760 000012D4 3E14192B2606                            db      03Eh,20,25,43,38,6
  2761 000012DA 2F00183F1E06                            db      02Fh,0,24,63,30,6
  2762 000012E0 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  2763 000012E6 3F00193F1E06                            db      03Fh,0,25,63,30,6
  2764 000012EC 2F00203F2606                            db      02Fh,0,32,63,38,6
  2765 000012F2 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  2766 000012F8 3F00213F2606                            db      03Fh,0,33,63,38,6
  2767                                  
  2768                                  ; parameter for fractaladd 28 bytes
  2769 000012FE 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  2769 00001307 0020202040         
  2770 0000130C 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  2770 00001315 0024002400         
  2771                                  
  2772                                  ; star bob for the sparcling stars texture 25 bytes
  2773 0000131A 0000030000              bob:            db	0,0,3,0,0
  2774 0000131F 0002050200                              db	0,2,5,2,0
  2775 00001324 0305070503                              db	3,5,7,5,3
  2776 00001329 0002050200                              db	0,2,5,2,0
  2777 0000132E 0000030000                              db	0,0,3,0,0
  2778                                  
  2779 00001333 04040C0408              cliptab:	db	4,4,12,4,8
  2780                                  
  2781 00001338 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  2782                                  
  2783 00001340 08283010                cube:		db	1*8,5*8,6*8,2*8
  2784 00001344 18382000                                db      3*8,7*8,4*8,0*8
  2785 00001348 10303818                                db      2*8,6*8,7*8,3*8
  2786 0000134C 00202808                                db      0*8,4*8,5*8,1*8
  2787 00001350 38302820                        	db	7*8,6*8,5*8,4*8
  2788 00001354 00081018                                db      0*8,1*8,2*8,3*8
  2789                                  
  2790 00001358 E0E0E0                  print:		db	-32,-32,-32
  2791 0000135B 20E0E0                                  db       32,-32,-32
  2792 0000135E 2020E0                                  db   	 32, 32,-32
  2793 00001361 E020E0                                  db  	-32, 32,-32
  2794 00001364 E0E020                                  db  	-32,-32, 32
  2795 00001367 20E020                                  db       32,-32, 32
  2796 0000136A 202020                                  db   	 32, 32, 32
  2797 0000136D E02020                                  db  	-32, 32, 32
  2798 00001370 400000                                  db       64,  0,  0
  2799 00001373 C00000                                  db      -64,  0,  0
  2800 00001376 004000                                  db        0, 64,  0
  2801 00001379 00C000                                  db        0,-64,  0
  2802 0000137C 000040                                  db        0,  0, 64
  2803 0000137F 0000C0                                  db        0,  0,-64
  2804 00001382 000000                                  db	  0,  0,  0
  2805                                  
  2806                                  ; world contruction data 599 bytes
  2807 00001385 71700006                world:		db	071h,070h,000h,006h
  2808 00001389 72000006                                db	072h,000h,000h,006h
  2809 0000138D 71007006                                db	071h,000h,070h,006h
  2810 00001391 73077006                                db	073h,007h,070h,006h
  2811 00001395 73070006                                db	073h,007h,000h,006h
  2812 00001399 70070706                                db	070h,007h,007h,006h
  2813 0000139D 74000706                                db	074h,000h,007h,006h
  2814 000013A1 70000740                                db	070h,000h,007h,040h
  2815 000013A5 72700750                                db	072h,070h,007h,050h
  2816 000013A9 72700050                                db	072h,070h,000h,050h
  2817 000013AD 71707050                                db	071h,070h,070h,050h
  2818 000013B1 73007040                                db	073h,000h,070h,040h
  2819 000013B5 71000040                                db	071h,000h,000h,040h
  2820 000013B9 72000050                                db	072h,000h,000h,050h
  2821 000013BD 71007050                                db	071h,000h,070h,050h
  2822 000013C1 73077046                                db	073h,007h,070h,046h
  2823 000013C5 73000046                                db	073h,000h,000h,046h
  2824 000013C9 70070746                                db	070h,007h,007h,046h
  2825 000013CD 72000750                                db	072h,000h,007h,050h
  2826 000013D1 71000000                                db	071h,000h,000h,000h
  2827 000013D5 71000000                                db	071h,000h,000h,000h
  2828 000013D9 7100BB56                                db	071h,000h,0BBh,056h
  2829 000013DD 700FBB46                                db	070h,00Fh,0BBh,046h
  2830 000013E1 FF                                      db	0FFh
  2831 000013E2 33000000                                db	033h,000h,000h,000h
  2832 000013E6 F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  2833 000013EB B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  2834 000013F0 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2835 000013F5 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2836 000013FA 3000BB56                                db	030h,000h,0BBh,056h
  2837 000013FE F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2838 00001403 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2839 00001408 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2840 0000140D 9000BB5611                              db	090h,000h,0BBh,056h,011h
  2841 00001412 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2842 00001417 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2843 0000141C F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2844 00001421 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2845 00001426 3000BB56                                db	030h,000h,0BBh,056h
  2846 0000142A 1000BB56                                db	010h,000h,0BBh,056h
  2847                                  
  2848 0000142E 34000000                                db	034h,000h,000h,000h
  2849 00001432 32050080                                db	032h,005h,000h,080h
  2850 00001436 35058080                                db	035h,005h,080h,080h
  2851 0000143A 35058000                                db	035h,005h,080h,000h
  2852 0000143E 33058008                                db	033h,005h,080h,008h
  2853 00001442 33050008                                db	033h,005h,000h,008h
  2854 00001446 74050808                                db	074h,005h,008h,008h
  2855 0000144A 74050000                                db	074h,005h,000h,000h
  2856 0000144E 73050880                                db	073h,005h,008h,080h
  2857 00001452 75000000                                db	075h,000h,000h,000h
  2858 00001456 75050888                                db	075h,005h,008h,088h
  2859 0000145A 70000000                                db	070h,000h,000h,000h
  2860 0000145E 74640808                                db	074h,064h,008h,008h
  2861 00001462 74600800                                db	074h,060h,008h,000h
  2862 00001466 72640880                                db	072h,064h,008h,080h
  2863 0000146A 05600080                                db	005h,060h,000h,080h
  2864 0000146E 05600000                                db	005h,060h,000h,000h
  2865 00001472 02600008                                db	002h,060h,000h,008h
  2866 00001476 34600008                                db	034h,060h,000h,008h
  2867 0000147A 34600000                                db	034h,060h,000h,000h
  2868 0000147E 32600080                                db	032h,060h,000h,080h
  2869 00001482 35600080                                db	035h,060h,000h,080h
  2870 00001486 35600000                                db	035h,060h,000h,000h
  2871 0000148A 32600008                                db	032h,060h,000h,008h
  2872 0000148E 34350008                                db	034h,035h,000h,008h
  2873 00001492 14650000                                db      014h,065h,000h,000h
  2874 00001496 32350080                                db      032h,035h,000h,080h
  2875 0000149A 35350080                               	db      035h,035h,000h,080h
  2876 0000149E 15650000                               	db      015h,065h,000h,000h
  2877 000014A2 32350008                                db	032h,035h,000h,008h
  2878 000014A6 34358008                                db	034h,035h,080h,008h
  2879 000014AA 14650000                               	db      014h,065h,000h,000h
  2880 000014AE 32358080                               	db      032h,035h,080h,080h
  2881 000014B2 75000000                		db	075h,000h,000h,000h
  2882 000014B6 5265E077                		db	052h,065h,0E0h,077h
  2883 000014BA 32640E77                		db	032h,064h,00Eh,077h
  2884 000014BE 12650077                		db	012h,065h,000h,077h
  2885 000014C2 00650077                		db	000h,065h,000h,077h
  2886 000014C6 FF                      		db	0FFh
  2887 000014C7 32000000                		db	032h,000h,000h,000h
  2888 000014CB F000000014              		db	0F0h,000h,000h,000h,014h
  2889 000014D0 B000000014              		db	0B0h,000h,000h,000h,014h
  2890 000014D5 30000000                		db	030h,000h,000h,000h
  2891 000014D9 F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  2892 000014DE F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  2893 000014E3 3000DD46                		db	030h,000h,0DDh,046h
  2894 000014E7 3000DD56                		db	030h,000h,0DDh,056h
  2895 000014EB 3000DD56                		db	030h,000h,0DDh,056h
  2896 000014EF 32000050                		db	032h,000h,000h,050h
  2897 000014F3 300AA050                		db	030h,00Ah,0A0h,050h
  2898 000014F7 3300A050                		db	033h,000h,0A0h,050h
  2899 000014FB 30000050                		db	030h,000h,000h,050h
  2900 000014FF 32700050                		db	032h,070h,000h,050h
  2901 00001503 3000A050                		db	030h,000h,0A0h,050h
  2902 00001507 33A0A750                		db	033h,0A0h,0A7h,050h
  2903 0000150B 33000000                		db	033h,000h,000h,000h
  2904 0000150F 31A07A50                		db	031h,0A0h,07Ah,050h
  2905 00001513 31000A50                		db	031h,000h,00Ah,050h
  2906 00001517 31000A50                		db	031h,000h,00Ah,050h
  2907 0000151B 320A0A50                		db	032h,00Ah,00Ah,050h
  2908 0000151F 35000000                		db	035h,000h,000h,000h
  2909 00001523 720A0000                		db	072h,00Ah,000h,000h
  2910 00001527 700AA000                		db	070h,00Ah,0A0h,000h
  2911 0000152B 7300A000                		db	073h,000h,0A0h,000h
  2912 0000152F 70000000                		db	070h,000h,000h,000h
  2913 00001533 72000000                		db	072h,000h,000h,000h
  2914 00001537 7000A000                		db	070h,000h,0A0h,000h
  2915 0000153B 73A0A000                		db	073h,0A0h,0A0h,000h
  2916 0000153F 73A00099                		db	073h,0A0h,000h,099h
  2917 00001543 71A00A00                		db	071h,0A0h,00Ah,000h
  2918 00001547 71000A00                		db	071h,000h,00Ah,000h
  2919 0000154B 71000A00                                db	071h,000h,00Ah,000h
  2920 0000154F 750A0A00                                db	075h,00Ah,00Ah,000h
  2921 00001553 700C0C03                                db	070h,00Ch,00Ch,003h
  2922 00001557 70000C03                                db	070h,000h,00Ch,003h
  2923 0000155B 70000C03                                db	070h,000h,00Ch,003h
  2924 0000155F 72C07C03                                db	072h,0C0h,07Ch,003h
  2925 00001563 72000000                                db	072h,000h,000h,000h
  2926 00001567 71C0C703                                db	071h,0C0h,0C7h,003h
  2927 0000156B 7300C003                                db	073h,000h,0C0h,003h
  2928 0000156F 71700003                                db	071h,070h,000h,003h
  2929 00001573 72000003                                db	072h,000h,000h,003h
  2930 00001577 7100C003                                db	071h,000h,0C0h,003h
  2931 0000157B 730CC003                                db	073h,00Ch,0C0h,003h
  2932 0000157F 71000003                                db	071h,000h,000h,003h
  2933 00001583 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  2934 00001587 FF                                      db	0FFh
  2935 00001588 32000000                                db	032h,000h,000h,000h
  2936 0000158C F000700614                              db	0F0h,000h,070h,006h,014h
  2937 00001591 B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  2938 00001596 3000DD56                                db	030h,000h,0DDh,056h
  2939 0000159A B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  2940 0000159F 32DD0056                                db	032h,0DDh,000h,056h
  2941 000015A3 32DD0056                                db	032h,0DDh,000h,056h
  2942 000015A7 32DD0056                                db	032h,0DDh,000h,056h
  2943 000015AB 7000F056                                db	070h,000h,0F0h,056h
  2944 000015AF 7000BB56                                db	070h,000h,0BBh,056h
  2945 000015B3 32B00B46                                db	032h,0B0h,00Bh,046h
  2946 000015B7 72BB0056                                db	072h,0BBh,000h,056h
  2947 000015BB 71B0B056                                db	071h,0B0h,0B0h,056h
  2948 000015BF 71021156                                db	071h,002h,011h,056h
  2949 000015C3 71221156                                db	071h,022h,011h,056h
  2950 000015C7 31201156                                db	031h,020h,011h,056h
  2951 000015CB 730BB056                                db	073h,00Bh,0B0h,056h
  2952 000015CF 73BB0056                                db	073h,0BBh,000h,056h
  2953 000015D3 300B0B46                                db	030h,00Bh,00Bh,046h
  2954 000015D7 3000BB56                                db	030h,000h,0BBh,056h
  2955 000015DB FF                                      db	0FFh
  2956                                  
  2957                                  ; flying script	126 bytes
  2958                                  script:
  2959                                  ;     7 6 5 4 3 2 1 0
  2960                                  ;	  v v v v v c c c
  2961                                  ;
  2962                                  ;	  v = VALUE
  2963                                  ;	  c = COMMAND
  2964                                  ;
  2965                                  ;	  0 = NOP
  2966                                  ;	  1 = NEG ZSTEP
  2967                                  ;	  2 = INC SPEED
  2968                                  ;	  3 = DEC SPEED
  2969                                  ;	  4 = INC XSTEP
  2970                                  ;	  5 = DEC XSTEP
  2971                                  ;	  6 = INC YSTEP
  2972                                  ;	  7 = INC YSTEP
  2973                                  
  2974 000015DC A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  2975 000015E2 F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  2976 000015E8 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  2977 000015EE F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  2978 000015F4 F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  2979 000015FA 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  2980 00001600 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  2981 00001606 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  2982 0000160C F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  2983 00001612 A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  2984 00001618 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  2985 0000161E 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  2986 00001624 A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  2987 0000162A B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  2988 00001630 A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  2989 00001636 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  2990 0000163C 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  2991 00001642 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  2992 00001648 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  2993 0000164E 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  2994 00001654 F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  2995                                  
  2996 00001659 0100                    zstep:		dw	1			
  2997 0000165B 66EF                    doortimer	dw 	-4250	; 0EF66h
  2998 0000165D 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  2999                                  omniend:
  3000 00001666 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  3000 0000166F 4B9A5050455253     
  3001                                  sancend:
  3002 00001676 0000A5C3                ob:		dd 	-330.0	; vector.x
  3003 0000167A 00000000                		dd 	   0.0	; vector.y	
  3004 0000167E 00008042                		dd	  64.0	; vector.z	
  3005                                  owmat:
  3006 00001682 00000000                		dd 	   0.0	; vector.x
  3007 00001686 000080BF                		dd 	  -1.0	; vector.y
  3008 0000168A 00000000                		dd	   0.0  ; vector.z
  3009                                  ;owmat+12:
  3010 0000168E 00000000                		dd 	   0.0	; vector.x
  3011 00001692 00000000                		dd 	   0.0	; vector.y
  3012 00001696 000080BF                		dd	  -1.0  ; vector.z
  3013                                  ;owmat+24:
  3014 0000169A 0000803F                		dd 	   1.0	; vector.x
  3015 0000169E 00000000                		dd 	   0.0	; vector.y
  3016 000016A2 00000000                		dd	   0.0  ; vector.z
  3017                                  
  3018                                  bss_start:
  3019                                  
  3020                                  ABSOLUTE bss_start
  3021                                  
  3022 000016A6 <res 00000002>          alignb 4
  3023                                  
  3024                                  ; 05/02/2017 (32 bit -> 16 bit)
  3025                                  
  3026                                  ;=============================================================================
  3027                                  ;        	null-initialized data
  3028                                  ;=============================================================================
  3029                                  
  3030                                  nullstart:
  3031 000016A8 <res 00000024>          wmat:           resb	matrix.size  ; 36
  3032 000016CC <res 00000024>          nwmat:		resb	matrix.size  ; 36
  3033 000016F0 <res 00000002>          zspeed:		resw	1
  3034 000016F2 <res 00000002>          oxw:		resw	1
  3035 000016F4 <res 00000002>          oyw:		resw	1
  3036 000016F6 <res 00000002>          ozw:		resw	1
  3037 000016F8 <res 00000002>          scriptptr:	resw	1
  3038 000016FA <res 00000002>          scriptanz:	resw	1
  3039 000016FC <res 00000001>          scriptins:	resb	1
  3040 000016FD <res 00000001>          once:		resb	1
  3041 000016FE <res 00000002>          ticker:		resw	1
  3042 00001700 <res 00000002>          tracks:		resw	1
  3043 00001702 <res 00000300>          palette:        resb 	768
  3044 00001A02 <res 00000060>          channels:       resb	16*6
  3045                                  ;o:		resb	object.size ; 7204
  3046                                  ; 10/02/2017
  3047 00001A62 <res 00000002>          object.panz:	resw 1
  3048 00001A64 <res 00000002>          object.fanz:	resw 1
  3049 00001A66 <res 00000C80>          object.p:	resb point.size*MAXPOINTS
  3050 000026E6 <res 00000FA0>          object.f:	resb face.size*MAXFACES
  3051                                  nullend:
  3052                                  
  3053                                  ;=============================================================================
  3054                                  ;       	uninitialized data
  3055                                  ;=============================================================================
  3056 00003686 <res 00000002>          oldstack        resw	1
  3057                                  Old08IrqPtr:
  3058 00003688 <res 00000002>          Old08Irqofs:	resw	1
  3059 0000368A <res 00000002>          Old08Irqseg:	resw	1
  3060                                  ;Old09IrqPtr:
  3061                                  ;Old09Irqofs:	resw	1
  3062                                  ;Old09Irqseg:	resw	1
  3063                                  ;songdata:	resb	3605
  3064 0000368C <res 00000002>          root:   	resw	1
  3065 0000368E <res 00000040>          circletab:	resw	32
  3066 000036CE <res 0000005A>          stars:		resb	90
  3067 00003728 <res 00000001>          twice:		resb	1
  3068 00003729 <res 00000001>          timer_event_number:	resb 1 ; 06/02/2017
  3069                                  ; 11/02/2017
  3070 0000372A <res 00000004>          vseg:		resd	1
  3071 0000372E <res 00000004>          bseg:		resd    1
  3072 00003732 <res 00000050>          tseg:   	resd	20
  3073                                  ;
  3074 00003782 <res 00008000>          shadetab:	resb	256*128
  3075 0000B782 <res 00000078>          p:		resw	4*15
  3076 0000B7FA <res 000000B4>          pr:		resd	3*15
  3077 0000B8AE <res 000000B4>          po:		resb	poly.size ; 5*36
  3078 0000B962 <res 000012C0>          rp:		resd	3*MAXPOINTS ; 3*400
  3079 0000CC22 <res 00000640>          facei:		resd    MAXFACES ; 400
  3080                                  
  3081 0000D262 <res 00000002>          alignb 4
  3082 0000D264 <res 00000004>          es_:		resd    1 ; 16/01/2017
  3083 0000D268 <res 00000004>          fs_:		resd	1 ; 16/01/2017
  3084                                  
  3085                                  ; 06/02/2017
  3086 0000D26C <res 00000002>          cw.direc:	resw	1 ; word
  3087 0000D26E <res 00000002>          cw.shade:	resw	1 ; word
  3088                                  ;
  3089 0000D270 <res 00000002>          dcf.d:		resw	1 ; word
  3090 0000D272 <res 00000002>          dcf.h:		resw	1 ; word	
  3091 0000D274 <res 00000002>          dcf.j:		resw	1 ; word
  3092 0000D276 <res 00000002>          dcf.col:	resw	1 ; word
  3093 0000D278 <res 00000001>          dcf.is_in:	resb	1 ; byte
  3094 0000D279 <res 00000001>          		resb	1
  3095 0000D27A <res 000000B4>          dcf.p0:		resb	poly.size ; 5*36 bytes
  3096 0000D32E <res 000000B4>          dcf.p2:		resb	poly.size ; 5*36 bytes
  3097                                  ;
  3098 0000D3E2 <res 0000003C>          sstp.edg:	resb	edges.size * 3 ; 60 bytes
  3099 0000D41E <res 0000003C>          sstp.del:	resb	edges.size * 3 ; 60 bytes 
  3100 0000D45A <res 00000002>          sstp.mx1:	resw	1 ; word
  3101 0000D45C <res 00000002>          sstp.mx2:	resw	1 ; word	 				
  3102 0000D45E <res 00000002>          sstp.miny:	resw	1 ; word
  3103 0000D460 <res 00000002>          sstp.maxy:	resw	1 ; word
  3104 0000D462 <res 00000002>          sstp.y:		resw	1 ; word
  3105 0000D464 <res 00000002>          sstp.l:		resw	1 ; word	 				
  3106 0000D466 <res 00000002>          sstp.r:		resw	1 ; word
  3107 0000D468 <res 00000002>          sstp.uu1:	resw	1 ; word
  3108 0000D46A <res 00000002>          sstp.vv1:	resw	1 ; word
  3109 0000D46C <res 00000002>          sstp.uu2:	resw	1 ; word	 				
  3110 0000D46E <res 00000002>          sstp.vv2:	resw	1 ; word
  3111 0000D470 <res 00000002>          sstp.ddu:	resw	1 ; word
  3112 0000D472 <res 00000002>          sstp.ddv:	resw	1 ; word
  3113 0000D474 <res 00000004>          sstp.dy:	resd	1 ; dword
  3114                                  
  3115                                  alignb 4
  3116                                  
  3117                                  bss_end:
