     1                                  ; ****************************************************************************
     2                                  ; sncomni.s (for MSDOS)
     3                                  ; ----------------------------------------------------------------------------
     4                                  ; SNCOMNI.COM ! VGA DEMO-TEST program !  NASM version by Erdogan TAN
     5                                  ;
     6                                  ; 04/02/2017
     7                                  ;
     8                                  ; [ Last Modification: 12/08/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                                  
    16                                  ;		   ----====> Omniscent <====----
    17                                  ;
    18                                  ;   Omniscent was done by Pinker of SANCTION for the Mekka '97. The song
    19                                  ;   was written by Nyphton. It place XXX out of XXX.
    20                                  ;
    21                                  ;   Special thanks in alphabetical order :
    22                                  ;
    23                                  ;       Andreas Mautsch     (beta testing)
    24                                  ;       Axel Scheel Meyer   (MACM sources, nice IRC chat's)
    25                                  ;       Christian Cohnen    (for his help on perspective texture mapping and
    26                                  ;	   		designing world and script)
    27                                  ;       Daniel Weinand	    (song)
    28                                  ;       Funk                (for give me the idea trying a 4K Descent)
    29                                  ;       Stephanie Schepers  (moral and food support ;-) )
    30                                  ;
    31                                  ;       and all other SANCTION dudes for supporting this product !
    32                                  
    33                                  SECTION .text
    34                                  
    35                                  [BITS 16] ; x86 Real Mode (16 bit) intructions
    36                                  
    37                                  [ORG 100h] 
    38                                  
    39                                  ;==============================================================================
    40                                  ;		   constants
    41                                  ;==============================================================================
    42                                  
    43                                  GMPort		equ 0331h
    44                                  CMD_NOTEON      equ 090h
    45                                  CMD_NOTEOFF     equ 080h
    46                                  CMD_CHANGEPARAM equ 0B0h
    47                                  CMD_CHANGEPRG   equ 0C0h
    48                                  MOD_ALLNOTESOFF equ 07Bh
    49                                  MAXFACES	equ 400
    50                                  MAXPOINTS	equ 400
    51                                  SONGSPEED   	equ 29
    52                                  XMAX		equ 320
    53                                  YMIN		equ 21
    54                                  YMAX		equ 179
    55                                  SUBRANGE	equ 16
    56                                  %define ASPECT_RATIO 1.2
    57                                  CENTERX		equ 160
    58                                  CENTERY		equ 100
    59                                  
    60                                  ;==============================================================================
    61                                  ;		   structures
    62                                  ;==============================================================================
    63                                  
    64                                  struc channel
    65 00000000 <res 00000002>           .del:	resw 1
    66 00000002 <res 00000001>           .trk:	resb 1
    67 00000003 <res 00000001>           .ln:	resb 1
    68 00000004 <res 00000002>           .adr:	resw 1
    69                                  endstruc
    70                                  
    71                                  struc matrix
    72 00000000 <res 00000024>          	resd 9
    73                                   .size:
    74                                  endstruc
    75                                  
    76                                  struc vector
    77 00000000 <res 00000004>           .x:	resd 1
    78 00000004 <res 00000004>           .y:	resd 1
    79 00000008 <res 00000004>           .z:	resd 1
    80                                   .size:
    81                                  endstruc
    82                                  
    83                                  struc point
    84 00000000 <res 00000002>           .x:	resw 1
    85 00000002 <res 00000002>           .y:	resw 1
    86 00000004 <res 00000002>           .z:	resw 1
    87 00000006 <res 00000002>           .s:	resw 1
    88                                   .size:
    89                                  endstruc
    90                                  
    91                                  struc face
    92 00000000 <res 0000000A>          	resw 5
    93                                   .size: 	
    94                                  endstruc
    95                                  
    96                                  ;struc object
    97                                  ; .panz: resw 1
    98                                  ; .fanz: resw 1
    99                                  ; .p:	resb point.size*MAXPOINTS
   100                                  ; .f:	resb face.size*MAXFACES
   101                                  ; .size:
   102                                  ;endstruc
   103                                  
   104                                  struc edges
   105 00000000 <res 00000004>           .x:	resd 1
   106 00000004 <res 00000004>           .u:	resd 1
   107 00000008 <res 00000004>           .v:	resd 1
   108 0000000C <res 00000004>           .w:	resd 1
   109 00000010 <res 00000004>           .s:	resd 1
   110                                   .size:	
   111                                  endstruc
   112                                  
   113                                  struc edge
   114 00000000 <res 0000000C>           .p:	resb vector.size
   115 0000000C <res 00000004>           .py:	resd 1
   116 00000010 <res 00000014>           .e:	resb edges.size
   117                                   .size:
   118                                  endstruc
   119                                  
   120                                  struc poly
   121 00000000 <res 000000B4>          	resb edge.size*5
   122                                   .size:	
   123                                  endstruc
   124                                  
   125                                  ;==============================================================================
   126                                  ;		      %macros
   127                                  ;==============================================================================
   128                                  ;***********************************************
   129                                  ;* descript. : start timer interrupt 70/s      *
   130                                  ;* parameter : none			       *
   131                                  ;* sideeffect: all		 	       *
   132                                  ;* back      : none			       *
   133                                  ;***********************************************
   134                                  %macro		startTimer 0
   135                                                  mov     ax, 03508h
   136                                                  int     21h
   137                                                  mov     [Old08Irqseg], es
   138                                                  mov     [Old08Irqofs], bx
   139                                                  mov     ax, 02508h
   140                                                  mov     dx, irqHandler08
   141                                                  int     21h
   142                                  		
   143                                  		mov	bx, 3409 ; 1193180/3409 = 350 ticks per second (*!)
   144                                  		call	setTimer
   145                                  %endmacro
   146                                  
   147                                  ;***********************************************
   148                                  ;* descript. : stop timer interrupt            *
   149                                  ;* parameter : none			       *
   150                                  ;* sideeffect: all		 	       *
   151                                  ;* back      : none			       *
   152                                  ;***********************************************
   153                                  %macro		stopTimer 0
   154                                                  push    ds
   155                                                  xor     bx, bx			; set timer to default
   156                                                  call    setTimer		; 18.2 ticks per second
   157                                                  mov     ax, 02508h      	; restore old IRQ-vector
   158                                                  lds     dx, [Old08IrqPtr]
   159                                                  int     21h
   160                                                  pop     ds
   161                                  %endmacro
   162                                  
   163                                  ;***********************************************
   164                                  ;* descript. : start keyboard handler          *
   165                                  ;* parameter : none			       *
   166                                  ;* sideeffect: all		 	       *
   167                                  ;* back      : none			       *
   168                                  ;***********************************************
   169                                  %macro		startKBDHandler 0
   170                                                  ;mov     ax, 03509h
   171                                                  ;int     21h
   172                                                  ;mov     [Old09Irqseg], es
   173                                                  ;mov     [Old09Irqofs], bx
   174                                                  ;mov     ax, 02509h
   175                                                  ;mov     dx, irqHandler09
   176                                                  ;int     21h
   177                                  
   178                                  		nop
   179                                  %endmacro
   180                                  
   181                                  ;***********************************************
   182                                  ;* descript. : stop keyboard handler           *
   183                                  ;* parameter : none			       *
   184                                  ;* sideeffect: all		               *
   185                                  ;* back      : none		               *
   186                                  ;***********************************************
   187                                  %macro		stopKBDHandler 0
   188                                                  ;push    ds
   189                                                  ;mov     ax,02509h		; restore old IRQ-vector
   190                                                  ;lds     dx, [Old09IrqPtr]	;
   191                                                  ;int     21h
   192                                                  ;pop     ds
   193                                  
   194                                  		nop
   195                                  %endmacro
   196                                  
   197                                  ;***********************************************
   198                                  ;* descript. : zero null-initialized data      *
   199                                  ;* parameter : none			       *
   200                                  ;* sideeffect: all		               *
   201                                  ;* back      : none		               *
   202                                  ;***********************************************
   203                                  %macro		nullData 0
   204                                  		mov	di, nullstart
   205                                  		mov	cx, nullend-nullstart
   206                                  		xor	al, al
   207                                                  rep	stosb
   208                                  %endmacro
   209                                  
   210                                  ;***********************************************
   211                                  ;* descript. : set textmode		       *
   212                                  ;* parameter : none		               *
   213                                  ;* sideeffect: all		               *
   214                                  ;* back      : none		               *
   215                                  ;***********************************************
   216                                  %macro		set80x25 0
   217                                  		mov	ax, 3
   218                                  		int	10h	; - VIDEO - SET	VIDEO MODE
   219                                  				; AL = mode
   220                                  %endmacro
   221                                  
   222                                  ;***********************************************
   223                                  ;* descript. : set gfx-mode 320x200            *
   224                                  ;* parameter : none		               *
   225                                  ;* sideeffect: all		               *
   226                                  ;* back      : none		               *
   227                                  ;***********************************************
   228                                  %macro		set320x200 0
   229                                  		mov	ax, 13h
   230                                  		int	10h		; - VIDEO - SET	VIDEO MODE
   231                                  					; AL = mode
   232                                  %endmacro
   233                                  
   234                                  ;***********************************************
   235                                  ;* descript. : calculate a smooth colorrange   *
   236                                  ;* parameter : none             	       *
   237                                  ;* sideeffect: all              	       *
   238                                  ;* back	     : none                	       *
   239                                  ;***********************************************
   240                                  %macro		makePalette 0
   241                                  		push	ds
   242                                  		pop	es
   243                                  		mov	bx, 3
   244                                  mPcolor:
   245                                  		mov	si, colors
   246                                  		mov	di, palette
   247                                  		xor	dh, dh
   248                                  		lodsb
   249                                  		movzx	cx, al
   250                                  mPouter:
   251                                  		push	cx
   252                                  		mov	cl, [si]
   253                                  		mov	ah, [bx+si]
   254                                  		sub	ax, dx
   255                                  		push	dx
   256                                  		cwd
   257                                  		idiv	cx
   258                                  		pop	dx
   259                                  mPinner:
   260                                  		add	dx, ax
   261                                  		;mov	[es:di+bx-1], dh
   262                                  		mov	[di+bx-1], dh
   263                                  		add	di, 3
   264                                  		loop	mPinner
   265                                  		add	si, 4
   266                                  		pop	cx
   267                                  		loop	mPouter
   268                                  		dec	bx
   269                                  		jnz	short mPcolor
   270                                  %endmacro
   271                                  
   272                                  ;***********************************************
   273                                  ;* descript. : reset the GM-Port and switch to *
   274                                  ;*             UART mode.		       *
   275                                  ;* parameter : none			       *
   276                                  ;* sideeffect: dx,al		               *
   277                                  ;* back      : none		               *
   278                                  ;***********************************************
   279                                  %macro		resetGM 0
   280                                  		mov	dx, GMPort
   281                                  		mov	ax, 0FFh
   282                                  		;mov	al, 0FFh
   283                                  		out	dx, al
   284                                  		;sub	cl, cl
   285                                  resGMbusy1:
   286                                  		;dec	cl
   287                                  		dec	ah
   288                                  		jz	short rGMerror	;{ timeout }
   289                                  		in	al, dx		;{ read acknowledge }
   290                                  		
   291                                  		test	al, 80h
   292                                  		jnz	short resGMbusy1
   293                                  		dec	dx
   294                                  		in	al, dx
   295                                  
   296                                  		cmp	al, 0FEh
   297                                  		jne	short rGMerror
   298                                  		inc	dx		;{ switch into UART mode }
   299                                  resGMbusy2:
   300                                  		in	al, dx
   301                                  
   302                                  		test	al, 40h
   303                                  		jnz	short resGMbusy2
   304                                  		mov	al, 3Fh
   305                                  		out	dx, al
   306                                  rGMerror:
   307                                  %endmacro
   308                                  
   309                                  ;***********************************************
   310                                  ;* descript. : mute midi channels 0..15        *
   311                                  ;* parameter : none                	       *
   312                                  ;* sideeffect: ax,cx		               *
   313                                  ;* back		 : none                	       *
   314                                  ;***********************************************
   315                                  %macro		silence 0
   316                                  		mov	cx, 15 ; 0Fh
   317                                  Siloop:	
   318                                  		mov	ax, cx
   319                                  		add	al, CMD_CHANGEPARAM ; 0B0h
   320                                  		call	writeGM
   321                                  		mov	al, MOD_ALLNOTESOFF ; 7Bh
   322                                  		call	writeGM
   323                                  		xor	al, al
   324                                  		call	writeGM
   325                                  		loop	Siloop
   326                                  Sinosound:
   327                                  %endmacro
   328                                  
   329                                  ;***********************************************
   330                                  ;* descript. : create the reactor wall texture *
   331                                  ;* parameter : none		               *
   332                                  ;* sideeffect: ax,bx,cx,di,es                  *
   333                                  ;* back      : none			       *
   334                                  ;* length    : 45 bytes		               *
   335                                  ;***********************************************
   336                                  %macro		reactorWall 0
   337                                  		mov	es, [tseg]
   338                                  		xor	di, di
   339                                  		mov	cx, 4096 ; 1000h
   340                                  rsmloop:
   341                                  		mov	ax, di
   342                                  		test	al, 8
   343                                  		jle	short rsnonot1
   344                                  		not	al
   345                                  rsnonot1:
   346                                  		and	al, 15 ; 0Fh
   347                                  		mov	bx, ax
   348                                  		mov	ax, di
   349                                  		shr	ax, 6
   350                                  		test	al, 8
   351                                  		jle	short rsnonot2
   352                                  		not	al
   353                                  rsnonot2:
   354                                  		and	al, 15 ; 0Fh
   355                                  		cmp	al, bl
   356                                  		jle	short rstakeal
   357                                  		mov	ax, bx
   358                                  rstakeal:
   359                                  		add	al, 224 ; 0E0h
   360                                  		stosb
   361                                  		loop	rsmloop
   362                                  %endmacro
   363                                  
   364                                  ;***********************************************
   365                                  ;* descript. : calc background-fractal         *
   366                                  ;* parameter : none		               *
   367                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   368                                  ;* back      : none			       *
   369                                  ;***********************************************
   370                                  %macro		createFrac2 0
   371                                  		mov	es, [tseg+36]
   372                                  		mov	al, 20	; 14h
   373                                  		call	setFrac
   374                                  		mov	di, 64	; 40h
   375                                  		mov	cx, 4096-64
   376                                  		mov	bx, 4
   377                                  cF1loop:
   378                                  		;mov	bx, 4
   379                                  		call	rnd
   380                                  		add	al, [es:di-64]
   381                                  		add	al, [es:di-63]
   382                                  		dec	ax
   383                                  		shr	ax, 1
   384                                  		stosb
   385                                  		loop	cF1loop
   386                                  %endmacro
   387                                  
   388                                  ;***********************************************
   389                                  ;* descript. : calc random noise fractal       *
   390                                  ;* parameter : none		               *
   391                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   392                                  ;* back      : none			       *
   393                                  ;***********************************************
   394                                  %macro		createFrac3 0
   395                                  		mov	es, [tseg+38]
   396                                  		mov	al, 3
   397                                  		call	setFrac
   398                                  		mov	cx, 4096 ; 1000h
   399                                  		;mov	bx, cx
   400                                  cF3loop:
   401                                  		mov	bx, 4096 ; 1000h
   402                                  		call	rnd
   403                                  		mov	di, ax 
   404                                  		inc	byte [es:di]
   405                                  		loop	cF3loop
   406                                  %endmacro
   407                                  
   408                                  ;***********************************************
   409                                  ;* descript. : init stars (positions and state)*
   410                                  ;* parameter : none			       *
   411                                  ;* sideeffect: eax,bx,cx,edx,si,di,es          *
   412                                  ;* back      : none		               *
   413                                  ;***********************************************
   414                                  %macro		initStars 0
   415                                  		push	ds
   416                                  		pop	es
   417                                  		mov	cx, 30 ; 1Eh
   418                                  		mov	di, stars
   419                                  iSloop:	
   420                                  		mov	bx, 256 ; 100h
   421                                  		call	rnd
   422                                  		stosb
   423                                  		mov	bx, 4096-(64*5) ; 0EC0h
   424                                  		add	bx, 128 ; 80h
   425                                  		call	rnd
   426                                  		add	ax, 64  ; 40h
   427                                  		stosw
   428                                  		loop	iSloop
   429                                  %endmacro
   430                                  
   431                                  ;***********************************************
   432                                  ;* descript. : add effects to fractals	       *
   433                                  ;* parameter : none		               *
   434                                  ;* sideeffect: ax,bx,cx,di,es		       *
   435                                  ;* back      : none		               *
   436                                  ;***********************************************
   437                                  %macro		effects 0
   438                                  		mov	cx, 26	; 1Ah
   439                                  		mov	si, aE
   440                                  effmloop:
   441                                  		push	cx
   442                                  		mov	bl, [si]	; mseg+effect
   443                                  		mov	dl, bl
   444                                  		shr	dl, 4
   445                                  		and	bl, 0Fh ; 15
   446                                  		;add	bx, bx
   447                                  		shl	bl, 1
   448                                  		mov	es, [bx+tseg]
   449                                  		movzx	cx, byte [si+2] ; y1
   450                                  effyloop:
   451                                  		movzx	bx, byte [si+1] ; x1
   452                                  effxloop:
   453                                  		mov	di, cx
   454                                  		shl	di, 6
   455                                  		add	di, bx
   456                                  		mov	al, dl
   457                                  		dec	al
   458                                  		jz	short effect1
   459                                  		dec	al
   460                                  		jz	short effect2
   461                                  		mov	ax, bx
   462                                  		add	ax, cx
   463                                  		and	al, 4
   464                                  		;jz	short effdonot
   465                                  		jz	short effect1
   466                                  		mov	al, 152 ; 98h
   467                                  effdonot:
   468                                  		jmp	short effect1
   469                                  effect2:
   470                                  		mov	al, [es:di]
   471                                  effect1:
   472                                  		add	al, [si+5]	; value
   473                                  		mov	[es:di], al
   474                                  		inc	bx
   475                                  		cmp	bl, [si+3]	; x2
   476                                  		jle	short effxloop
   477                                  		inc	cx
   478                                  		cmp	cl, [si+4]	; y2
   479                                  		jle	short effyloop
   480                                  		add	si, 6
   481                                  		pop	cx
   482                                  		loop	effmloop
   483                                  %endmacro
   484                                  
   485                                  ;***********************************************
   486                                  ;* descript. : copy fractals and add value     *
   487                                  ;* parameter : none		               *
   488                                  ;* sideeffect: al,cx,di,es,fs		       *
   489                                  ;* back      : none		               *
   490                                  ;***********************************************
   491                                  %macro		addFractals 0
   492                                  		mov	si, aF
   493                                  		mov	dl, 4
   494                                  aFloop:
   495                                  		movzx	bx, dl
   496                                  		mov	es, [bx+tseg]
   497                                  		lodsw
   498                                  		mov	bl, al
   499                                  		mov	fs, [bx+tseg]		
   500                                  		xor	di, di
   501                                  		mov	cx, 4096 ; 1000h
   502                                  aFiloop:
   503                                  		mov	al, [fs:di]
   504                                  		add	al, ah
   505                                  		stosb
   506                                  		loop	aFiloop
   507                                  		add	dl, 2
   508                                  		;inc	dx
   509                                  		;inc	dx
   510                                  		cmp	dl, 30
   511                                  		jle	short aFloop
   512                                  %endmacro
   513                                  
   514                                  ;***********************************************
   515                                  ;* descript. : calculate and initalize textures*
   516                                  ;* parameter : none			       *
   517                                  ;* sideeffect: al,cx,di,es,fs		       *
   518                                  ;* back      : none			       *
   519                                  ;***********************************************
   520                                  %macro		addLava 0
   521                                  		mov	es, [tseg+22]
   522                                  		mov	di, 4095	; 0FFFh
   523                                  		mov	cx, 20		; 14h
   524                                  		mov	al, 94		; 5Eh
   525                                  aLyloop:
   526                                  		push	cx
   527                                  		shl	cx, 3
   528                                  aLxloop:
   529                                  		push	di
   530                                  		push	ax
   531                                  		mov	bx, 64		; 40h
   532                                  		call	rnd
   533                                  		sub	di, ax
   534                                  		pop	ax
   535                                  		;stosb
   536                                  		mov	[es:di], al
   537                                  		pop	di
   538                                  		loop	aLxloop
   539                                  		pop	cx
   540                                  		dec	al
   541                                  		sub	di, 64 		; 40h
   542                                  		loop	aLyloop
   543                                  %endmacro
   544                                  
   545                                  ;***********************************************
   546                                  ;* descript. : calculate and initalize textures*
   547                                  ;* parameter : none		               *
   548                                  ;* sideeffect: al,cx,di,es,fs		       *
   549                                  ;* back      : none		               *
   550                                  ;***********************************************
   551                                  %macro		initTextures 0
   552                                  		mov	bx, 34	; 22h
   553                                  		push	800	; 320h
   554                                  		push	5
   555                                  		call	createFrac1
   556                                  		mov	bx, 32	; 20h
   557                                  		push	112	; 70h
   558                                  		push	15	; 0Fh
   559                                  		call	createFrac1
   560                                  		createFrac2
   561                                  		createFrac3
   562                                  		initStars
   563                                  		reactorWall
   564                                  		addFractals
   565                                  		effects
   566                                  		addLava
   567                                  %endmacro
   568                                  
   569                                  ;***********************************************
   570                                  ;* descript. : cycle "range" colors at "base"  *
   571                                  ;* parameter : none		               *
   572                                  ;* sideeffect: ax,(bl),cx,si,di,es             *
   573                                  ;* back      : none			       *
   574                                  ;***********************************************
   575                                  %macro		colorCycle 0
   576                                  		base	equ 6*32
   577                                                  range	equ 32
   578                                  		
   579                                  		push	ds
   580                                  		pop	es
   581                                  		mov	di, palette+(base*3)
   582                                  		mov	si, di
   583                                  		lodsw
   584                                  		;mov	bl, [si]  ; works only with fire (no blue)
   585                                  		inc	si
   586                                  		mov	cx, (range*3-3)
   587                                  		rep movsb
   588                                  		stosw
   589                                  		;mov	[di], bl  ; works only with fire (no blue)
   590                                  %endmacro
   591                                  
   592                                  ;***********************************************
   593                                  ;* descript. : animate the stars	       *
   594                                  ;* parameter : none			       *
   595                                  ;* sideeffect: ax,bx,cx,dl,si,di,es            *
   596                                  ;* back      : none			       *
   597                                  ;***********************************************
   598                                  %macro		animStars 0
   599                                  		_base	equ 7*32
   600                                  
   601                                  		mov	es, [tseg+2]
   602                                  		call	clearFrac
   603                                  
   604                                  		mov	cl, 30	; 1Eh
   605                                  		mov	bx, stars
   606                                  aSoloop:
   607                                  		dec	byte [bx]
   608                                  		mov	ah, [bx]
   609                                  		and	ah, 63	; 3Fh
   610                                  		cmp	ah, 31	; 1Fh
   611                                  		jbe	short aSnonot
   612                                  		not	ah
   613                                  		and	ah, 31	; 1Fh
   614                                  aSnonot:
   615                                  		shr	ah, 1
   616                                  		mov	di, [bx+1]
   617                                  		push	cx
   618                                  		push	bx
   619                                  
   620                                  		mov	dx, 64-5 ; 3Bh
   621                                  		mov	cx, _base*256+0 ; 0E000h
   622                                  		call	setstarbob
   623                                  
   624                                  		pop	bx
   625                                  		pop	cx
   626                                  		add	bx, 3
   627                                  		loop	aSoloop
   628                                  %endmacro
   629                                  
   630                                  ;***********************************************
   631                                  ;* descript. : calculate shading tab           *
   632                                  ;* parameter : none		               *
   633                                  ;* sideeffect: ax,bl,cx,di,es                  *
   634                                  ;* back      : none		               *
   635                                  ;***********************************************
   636                                  %macro		calcShadeTab 0
   637                                  		push	ds
   638                                  		pop	es
   639                                  		mov	di, shadetab
   640                                  		xor	bl, bl
   641                                  cSolp:
   642                                  		inc	bl
   643                                  		xor	cx, cx
   644                                  cSilp1:
   645                                  		mov	al, cl
   646                                  		and	al, 31	; 1Fh
   647                                  		mul	bl
   648                                  		add	ax, ax
   649                                  		mov	al, cl
   650                                  		and	al, 224	; 0E0h
   651                                  		add	al, ah
   652                                  		stosb
   653                                  		inc	cl
   654                                  		cmp	cl, 192 ; 0C0h
   655                                  		jne	short cSilp1
   656                                  cSilp2:
   657                                  		mov	al, cl
   658                                  		stosb
   659                                  		inc	cl
   660                                  		jnz	short cSilp2
   661                                  		cmp	bl, 128	; 80h
   662                                  		jne	short cSolp
   663                                  %endmacro
   664                                  
   665                                  ;***********************************************
   666                                  ;* descript. : expand a song       	       *
   667                                  ;* parameter : si:song base adress	       *
   668                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
   669                                  ;* back      : none                	       *
   670                                  ;***********************************************
   671                                  %macro		expandSong 0
   672                                                  mov	si, credits
   673                                                  mov	bx, channels
   674                                                  mov	di, songdata
   675                                  EPSwhile:	lodsw
   676                                                  dec	al
   677                                                  js      short EPSendwhile
   678                                                  mov	[bx+channel.trk], al ; [bx+2]
   679                                                  add	al, CMD_CHANGEPRG ; 0C0h
   680                                                  call	setinstr
   681                                                  mov	[bx+channel.adr], di ; [bx+4]	
   682                                                 	call	expand
   683                                                  xor	al, al
   684                                                  stosb
   685                                                  add	bx, 6
   686                                                  inc	word [tracks]
   687                                                  jmp	short EPSwhile
   688                                  EPSendwhile:
   689                                  %endmacro
   690                                  
   691                                  ;***********************************************
   692                                  ;* descript. : parse the script,rotate and move*
   693                                  ;* parameter : none                	       *
   694                                  ;* sideeffect: all		               *
   695                                  ;* back      : none		               *
   696                                  ;***********************************************
   697                                  %macro		scriptIt 0
   698                                  		mov	cx, [ticker]
   699                                  		mov	word [ticker], 0
   700                                  		or	cx, cx
   701                                  		jz	sItickerNull
   702                                  sImloop:
   703                                  		push	cx
   704                                  		mov	si, zspeed
   705                                  		;dec	word [si+10]	      ;	scriptanz
   706                                  		dec	word [scriptanz]
   707                                  		jns	short sIwaitTimer
   708                                  		;mov	bx, [si+8]	      ;	scriptptr
   709                                  		mov	bx, [scriptptr]
   710                                  		mov	al, [bx+script]
   711                                  		or	al, al
   712                                  		jz	_exit_
   713                                  		mov	bx, ax
   714                                  		and	bl, 7
   715                                  		;mov	[si+12], bl           ;	scriptins
   716                                  		mov	[scriptins], bl
   717                                  		dec	bl
   718                                  		jnz	short sInegateTurn
   719                                  		; (cmd = NEG ZSTEP)  
   720                                  		neg	word [zstep]
   721                                  sInegateTurn:
   722                                  		and	ax, 0F8h
   723                                  		add	ax, ax
   724                                  		;mov	[si+10], ax           ; scriptanz
   725                                  		mov	word [scriptanz], ax
   726                                  		;inc	word [si+8]	      ; scriptptr
   727                                  		inc	word [scriptptr]
   728                                  sIwaitTimer:
   729                                  		;mov	al, [si+12]           ;	scriptins
   730                                  		mov	al, [scriptins]
   731                                  		cbw
   732                                  		xor	ch, ch
   733                                  		dec	ax
   734                                  		jnz	short sInoturn
   735                                  		; (cmd = NEG ZSTEP)  
   736                                  		mov	bx, [zstep]
   737                                  		;add	[si+6], bx	      ; ozw
   738                                  		add	[ozw], bx
   739                                  		jmp	short sI_1	
   740                                  sInoturn:
   741                                  		mov	cl, 3
   742                                  		;mov	cx, 3
   743                                  sIrotateLoop:
   744                                  		dec	ax
   745                                  		jnz	short sInoIncrement
   746                                  		; (cmd = INC SPEED or INC XSTEP or INC YSTEP)  
   747                                  		inc	word [si]	      ; zspeed, oxw, oyw
   748                                  		jmp	short sI_1	   	
   749                                  sInoIncrement:
   750                                  		dec	ax
   751                                  		jnz	short sInoDecrement
   752                                  		; (cmd = DEC SPEED or DEC XSTEP or DEC YSTEP)  
   753                                  		dec	word [si]	      ; zspeed, oxw, oyw
   754                                  		jmp	short sI_1
   755                                  sInoDecrement:
   756                                  		inc	si
   757                                  		inc	si
   758                                  		loop	sIrotateLoop
   759                                  sI_1:
   760                                  		;mov	si, zspeed+2	      ; oxw 	
   761                                  		mov	si, oxw	
   762                                  		mov	cl, 3
   763                                  sIpushloop:
   764                                  		lodsw			      ; oxw, oyw, ozw	
   765                                  		sar	ax, 2
   766                                  		push	ax
   767                                  		loop	sIpushloop
   768                                  
   769                                  		imul	ax, word [si-4], 16   ; [oyw]*16 	
   770                                  		push	ax		        	
   771                                  		call	calcRotMat
   772                                  
   773                                  		mov	cl, 3
   774                                  		xor	si, si
   775                                  sImoveLoop:
   776                                  		fld	dword [si+owmat+24]
   777                                  		fimul	word [zspeed]
   778                                  		fidiv	word [CONST1792]
   779                                  		fadd	dword [si+ob]
   780                                  		fstp	dword [si+ob]
   781                                  		add	si, 4
   782                                  		loop	sImoveLoop
   783                                  		pop	cx
   784                                  		dec	cx
   785                                  		jnz	sImloop
   786                                  sItickerNull:
   787                                  %endmacro
   788                                  
   789                                  ;***********************************************
   790                                  ;* descript. : rotate all points from o -> rp  *
   791                                  ;* parameter : none                	       *
   792                                  ;* sideeffect: all		               *
   793                                  ;* back      : none		               *
   794                                  ;***********************************************
   795                                  %macro		rotation 0
   796                                  		mov	cx, [object.panz]
   797                                  		mov	si, object.p
   798                                  		mov	di, rp
   799                                  rotmlp:
   800                                  		mov	bx, wmat
   801                                  		mov	dx, 3
   802                                  rotilp:	
   803                                  		fild	word [si+0] ; point.x
   804                                  		fsub	dword [ob+vector.x]
   805                                  		fmul	dword [bx+0]
   806                                  		fild	word [si+2] ; point.y
   807                                  		fsub	dword [ob+vector.y]
   808                                  		fmul	dword [bx+4]
   809                                  		fild	word [si+4] ; point.z
   810                                  		fsub	dword [ob+vector.z]
   811                                  		fmul	dword [bx+8]
   812                                  		;fadd	
   813                                  		;fadd
   814                                  		faddp
   815                                  		faddp
   816                                  		fstp	dword [di]
   817                                  		add	di, 4
   818                                  		add	bx, 12	; 0Ch
   819                                  		dec	dx
   820                                  		jnz	short rotilp
   821                                  		add	si, 8 ; next point
   822                                  		loop	rotmlp
   823                                  %endmacro
   824                                  
   825                                  ;***********************************************
   826                                  ;* descript. : sort faces by z-koord	       *
   827                                  ;* parameter : none		               *
   828                                  ;* sideeffect: ax,bx,cx,dx,si,di,es            *
   829                                  ;* back      : none		               *
   830                                  ;***********************************************
   831                                  %macro		sortFaces 0
   832                                  		push	ds
   833                                  		pop	es
   834                                  		mov	di, facei
   835                                  		push	di ; facei
   836                                  		mov	si, object.f
   837                                  		mov	ax, si ; pointer to faces
   838                                  		mov	cx, [object.fanz]
   839                                  sFmloop:
   840                                  		fldz
   841                                  		push	cx
   842                                  		mov	cx, 4
   843                                  sFiloop:
   844                                  		imul	bx, word [si], 12 ; number of points (of face)
   845                                  		inc	si
   846                                  		inc	si
   847                                  		fsub	dword [bx+rp+vector.z]
   848                                  		loop	sFiloop
   849                                  		pop	cx
   850                                  		fistp	word [di] ; z distance (face total)
   851                                  		inc	di
   852                                  		inc	di
   853                                  		stosw		; face address (in 'object.f')
   854                                  		add	ax, 10
   855                                  		inc	si
   856                                  		inc	si
   857                                  		loop	sFmloop
   858                                  		push	di	; facei+4*(object.fanz-1)
   859                                  		call	qsort
   860                                  %endmacro
   861                                  
   862                                  ;***********************************************
   863                                  ;* descript. : animate the door  	       *
   864                                  ;* parameter : none		               *
   865                                  ;* sideeffect: ax,cx,si,di,es                  *
   866                                  ;* back      : none		               *
   867                                  ;***********************************************
   868                                  %macro		animDoor 0
   869                                  		mov	ax, [doortimer]
   870                                  		or	ax, ax
   871                                  		jns	short aDnounder
   872                                  		xor	ax, ax
   873                                  		jmp	short alreadydrawed
   874                                  aDnounder:
   875                                  		cmp	byte [once], 0
   876                                  		jne	short alreadydrawed
   877                                  		inc	byte [once]
   878                                  		push	ax
   879                                  		starbackground
   880                                  		pop	ax
   881                                  alreadydrawed:
   882                                  		cmp	ax, 24
   883                                  		jle	short aDnoover
   884                                  		mov	ax, 24
   885                                  aDnoover:
   886                                  		shl	ax, 6
   887                                  		push	ds
   888                                  		mov	es, [tseg+26]
   889                                  		mov	ds, [tseg+30]
   890                                  		mov	si, ax
   891                                  		xor	di, di
   892                                  		mov	cx, 1024
   893                                  		rep movsw
   894                                  		mov	si, 2048
   895                                                  sub	si, ax
   896                                  		push	si
   897                                  		mov	ch, 4  ; cx = 1024
   898                                  		rep movsw
   899                                  		pop	di
   900                                  		mov	cx, ax
   901                                  		xor	ax, ax
   902                                  		rep stosw
   903                                  		pop	ds
   904                                  %endmacro
   905                                  
   906                                  ;***********************************************
   907                                  ;* descript. : play a tick of the song	       *
   908                                  ;* parameter : none                	       *
   909                                  ;* sideeffect: ax,bx,cx,dx,si		       *
   910                                  ;* back      : none                	       *
   911                                  ;***********************************************
   912                                  %macro		playsong 0
   913                                  		mov	cx, [tracks]
   914                                  		mov	si, channels
   915                                  PSmloop:
   916                                  		dec	word [si+channel.del]
   917                                  		jg	short PSdelayed
   918                                  		mov	ax, [si+channel.trk]
   919                                  		add	al, CMD_NOTEOFF	; 80h
   920                                  		call	setnote
   921                                  		mov	bx, [si+channel.adr]
   922                                  		mov	ah, 127 	; 7Fh
   923                                  		cmp	byte [bx], 0
   924                                  		jz	short PStrackend
   925                                  		mov	ah, [bx]
   926                                  		mov	[si+channel.ln], ah
   927                                  		mov	al, [si+channel.trk]
   928                                  		add	al, CMD_NOTEON	; 90h
   929                                  		call	setnote
   930                                  		mov	al, [bx+1]
   931                                  		mov	bl, SONGSPEED	; 1Dh
   932                                  		mul	bl
   933                                  PStrackend:
   934                                  		mov	[si+channel.del], ax
   935                                  		add	word [si+channel.adr], 2
   936                                  PSdelayed:
   937                                  		add	si, 6
   938                                  		loop	PSmloop
   939                                  PSnosound:
   940                                  %endmacro
   941                                  
   942                                  ;***********************************************
   943                                  ;* descript. : dump palette to CRT             *
   944                                  ;* parameter : bl:intensity (0..255)           *
   945                                  ;* sideeffect: ax,es,di,cx,dx                  *
   946                                  ;* back      : none		               *
   947                                  ;***********************************************
   948                                  %macro		setPalette2 0
   949                                  		xor	al, al
   950                                  		mov	dx, 3C8h
   951                                  		out	dx, al
   952                                  		inc	dx
   953                                  		mov	si, palette
   954                                  		mov	cx, 768 ; 300h
   955                                  		rep outsb
   956                                  %endmacro
   957                                  
   958                                  ;***********************************************
   959                                  ;* descript. : clear starbackground            *
   960                                  ;* parameter : none		               *
   961                                  ;* sideeffect: ax,es,di,cx,dx                  *
   962                                  ;* back      : none		               *
   963                                  ;***********************************************
   964                                  %macro		cls 0
   965                                  		push	ds
   966                                  		mov	es, [bseg]
   967                                  		;push	0A000h
   968                                  		;pop	ds
   969                                  		mov	si, 0A000h
   970                                  		mov	ds, si
   971                                  		mov	si, 320*5
   972                                  		xor	di, di
   973                                  		mov	cx, 32000 ; 7D00h
   974                                  clsloop:
   975                                  		lodsb
   976                                  		stosb
   977                                  		stosb
   978                                  		loop	clsloop
   979                                  		pop	ds
   980                                  %endmacro
   981                                  
   982                                  ;***********************************************
   983                                  ;* descript. : draw starbackground             *
   984                                  ;* parameter : none		               *
   985                                  ;* sideeffect: ax,es,di,cx,dx                  *
   986                                  ;* back      : none		               *
   987                                  ;***********************************************
   988                                  %macro		starbackground 0
   989                                  		mov	es, [bseg]
   990                                  		mov	cx, 100 ; 64h
   991                                  starbackloop:
   992                                  		push	cx
   993                                  		mov	bx, 320*155 ; 0C1C0h
   994                                  		call	rnd
   995                                  		add	ax, 320*20  ; 1900h
   996                                  		mov	di, ax
   997                                  		and	ah, 7
   998                                  		mov	dx, 320-5   ; 13Bh
   999                                  		mov	cx, 2
  1000                                  		call	setstarbob
  1001                                  		pop	cx
  1002                                  		loop	starbackloop
  1003                                  %endmacro
  1004                                  
  1005                                  ;***********************************************
  1006                                  ;* descript. : create identity matrix	       *
  1007                                  ;* parameter : ds:di address                   *
  1008                                  ;* sideeffect: cx,di		   	       *
  1009                                  ;* back      : none			       *
  1010                                  ;***********************************************
  1011                                  %macro		identityMat 0
  1012                                  		mov	ch, 2
  1013                                  iMolp:
  1014                                  		mov	cl, 2
  1015                                  iMilp:
  1016                                  		fldz
  1017                                  		cmp	ch, cl
  1018                                  		jne	short iMwritezero
  1019                                  		fstp	st0
  1020                                  		fld1
  1021                                  iMwritezero:
  1022                                  		fstp	dword [di]
  1023                                  		add	di, 4
  1024                                  		dec	cl
  1025                                  		jns	short iMilp
  1026                                  		dec	ch
  1027                                  		jns	short iMolp
  1028                                  %endmacro
  1029                                  
  1030                                  ;=============================================================================
  1031                                  ;               entry point
  1032                                  ;=============================================================================
  1033                                  ;***********************************************
  1034                                  ;* descript. : entry point		       *
  1035                                  ;* parameter : none		               *
  1036                                  ;* sideeffect: all		               *
  1037                                  ;* back      : none		               *
  1038                                  ;***********************************************
  1039                                  
  1040                                  start:
  1041                                  		;mov	ax, cs
  1042                                  		;mov	ds, ax
  1043                                  		;mov	es, ax
  1044                                  
  1045                                  		;; clear bss
  1046                                  		;mov	di, bss_start
  1047                                  		;mov	cx, (bss_end - bss_start)/4
  1048                                  		;xor	eax, eax
  1049                                  		;rep	stosd
  1050                                  
  1051 00000000 8CC8                    		mov	ax, cs
  1052 00000002 BF[5B33]                		mov	di, vseg
  1053 00000005 050010                  		add	ax, 1000h
  1054 00000008 AB                      		stosw			; virtual screen address
  1055 00000009 050010                  		add	ax, 1000h
  1056 0000000C AB                      		stosw			; star background address
  1057 0000000D 050010                  		add	ax, 1000h
  1058 00000010 B91400                  		mov	cx, 20
  1059                                  segloop:				; texture addresses
  1060 00000013 AB                      		stosw
  1061                                  		;add	ax, 100h
  1062 00000014 FEC4                    		inc	ah
  1063 00000016 E2FB                    		loop	segloop
  1064                                  
  1065                                  		;fninit
  1066                                  
  1067                                  		nullData
  1068 00000018 BF[DA12]            <1>  mov di, nullstart
  1069 0000001B B9DE1F              <1>  mov cx, nullend-nullstart
  1070 0000001E 30C0                <1>  xor al, al
  1071 00000020 F3AA                <1>  rep stosb
  1072                                  		resetGM
  1073 00000022 BA3103              <1>  mov dx, GMPort
  1074 00000025 B8FF00              <1>  mov ax, 0FFh
  1075                              <1> 
  1076 00000028 EE                  <1>  out dx, al
  1077                              <1> 
  1078                              <1> resGMbusy1:
  1079                              <1> 
  1080 00000029 FECC                <1>  dec ah
  1081 0000002B 7414                <1>  jz short rGMerror
  1082 0000002D EC                  <1>  in al, dx
  1083                              <1> 
  1084 0000002E A880                <1>  test al, 80h
  1085 00000030 75F7                <1>  jnz short resGMbusy1
  1086 00000032 4A                  <1>  dec dx
  1087 00000033 EC                  <1>  in al, dx
  1088                              <1> 
  1089 00000034 3CFE                <1>  cmp al, 0FEh
  1090 00000036 7509                <1>  jne short rGMerror
  1091 00000038 42                  <1>  inc dx
  1092                              <1> resGMbusy2:
  1093 00000039 EC                  <1>  in al, dx
  1094                              <1> 
  1095 0000003A A840                <1>  test al, 40h
  1096 0000003C 75FB                <1>  jnz short resGMbusy2
  1097 0000003E B03F                <1>  mov al, 3Fh
  1098 00000040 EE                  <1>  out dx, al
  1099                              <1> rGMerror:
  1100                                  		expandSong
  1101 00000041 BE[100D]            <1>  mov si, credits
  1102 00000044 BB[3416]            <1>  mov bx, channels
  1103 00000047 BF[04CF]            <1>  mov di, songdata
  1104 0000004A AD                  <1> EPSwhile: lodsw
  1105 0000004B FEC8                <1>  dec al
  1106 0000004D 781A                <1>  js short EPSendwhile
  1107 0000004F 884702              <1>  mov [bx+channel.trk], al
  1108 00000052 04C0                <1>  add al, CMD_CHANGEPRG
  1109 00000054 E86605              <1>  call setinstr
  1110 00000057 897F04              <1>  mov [bx+channel.adr], di
  1111 0000005A E8C604              <1>  call expand
  1112 0000005D 30C0                <1>  xor al, al
  1113 0000005F AA                  <1>  stosb
  1114 00000060 83C306              <1>  add bx, 6
  1115 00000063 FF06[3213]          <1>  inc word [tracks]
  1116 00000067 EBE1                <1>  jmp short EPSwhile
  1117                              <1> EPSendwhile:
  1118                                  
  1119 00000069 E8170B                  		call	createWorld
  1120                                  
  1121                                  		set320x200
  1122 0000006C B81300              <1>  mov ax, 13h
  1123 0000006F CD10                <1>  int 10h
  1124                              <1> 
  1125                                  
  1126 00000071 86E0                    		xchg	ah, al 		; ah = write string = 13h, 
  1127                                  					; al = write mode = 0
  1128 00000073 BB1C00                  		mov	bx, 1Ch
  1129 00000076 BD[9112]                		mov	bp, omniscent
  1130 00000079 B90900                  		mov	cx, omniend-omniscent ; 9
  1131 0000007C BA0601                  		mov	dx, 106h
  1132 0000007F CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1133                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1134                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1135                                  					; ES:BP	-> start of string
  1136 00000081 01CD                    		add	bp, cx
  1137 00000083 B110                    		mov	cl, sancend-sanction ; 11h
  1138 00000085 BA010C                  		mov	dx, 0C01h
  1139 00000088 CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1140                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1141                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1142                                  					; ES:BP	-> start of string
  1143                                  		makePalette
  1144 0000008A 1E                  <1>  push ds
  1145 0000008B 07                  <1>  pop es
  1146 0000008C BB0300              <1>  mov bx, 3
  1147                              <1> mPcolor:
  1148 0000008F BE[550E]            <1>  mov si, colors
  1149 00000092 BF[3413]            <1>  mov di, palette
  1150 00000095 30F6                <1>  xor dh, dh
  1151 00000097 AC                  <1>  lodsb
  1152 00000098 0FB6C8              <1>  movzx cx, al
  1153                              <1> mPouter:
  1154 0000009B 51                  <1>  push cx
  1155 0000009C 8A0C                <1>  mov cl, [si]
  1156 0000009E 8A20                <1>  mov ah, [bx+si]
  1157 000000A0 29D0                <1>  sub ax, dx
  1158 000000A2 52                  <1>  push dx
  1159 000000A3 99                  <1>  cwd
  1160 000000A4 F7F9                <1>  idiv cx
  1161 000000A6 5A                  <1>  pop dx
  1162                              <1> mPinner:
  1163 000000A7 01C2                <1>  add dx, ax
  1164                              <1> 
  1165 000000A9 8871FF              <1>  mov [di+bx-1], dh
  1166 000000AC 83C703              <1>  add di, 3
  1167 000000AF E2F6                <1>  loop mPinner
  1168 000000B1 83C604              <1>  add si, 4
  1169 000000B4 59                  <1>  pop cx
  1170 000000B5 E2E4                <1>  loop mPouter
  1171 000000B7 4B                  <1>  dec bx
  1172 000000B8 75D5                <1>  jnz short mPcolor
  1173                                  		
  1174                                  		initTextures
  1175 000000BA BB2200              <1>  mov bx, 34
  1176 000000BD 682003              <1>  push 800
  1177 000000C0 6A05                <1>  push 5
  1178 000000C2 E80B05              <1>  call createFrac1
  1179 000000C5 BB2000              <1>  mov bx, 32
  1180 000000C8 6A70                <1>  push 112
  1181 000000CA 6A0F                <1>  push 15
  1182 000000CC E80105              <1>  call createFrac1
  1183                              <1>  createFrac2
  1184 000000CF 8E06[8333]          <2>  mov es, [tseg+36]
  1185 000000D3 B014                <2>  mov al, 20
  1186 000000D5 E8F004              <2>  call setFrac
  1187 000000D8 BF4000              <2>  mov di, 64
  1188 000000DB B9C00F              <2>  mov cx, 4096-64
  1189 000000DE BB0400              <2>  mov bx, 4
  1190                              <2> cF1loop:
  1191                              <2> 
  1192 000000E1 E89D04              <2>  call rnd
  1193 000000E4 260245C0            <2>  add al, [es:di-64]
  1194 000000E8 260245C1            <2>  add al, [es:di-63]
  1195 000000EC 48                  <2>  dec ax
  1196 000000ED D1E8                <2>  shr ax, 1
  1197 000000EF AA                  <2>  stosb
  1198 000000F0 E2EF                <2>  loop cF1loop
  1199                              <1>  createFrac3
  1200 000000F2 8E06[8533]          <2>  mov es, [tseg+38]
  1201 000000F6 B003                <2>  mov al, 3
  1202 000000F8 E8CD04              <2>  call setFrac
  1203 000000FB B90010              <2>  mov cx, 4096
  1204                              <2> 
  1205                              <2> cF3loop:
  1206 000000FE BB0010              <2>  mov bx, 4096
  1207 00000101 E87D04              <2>  call rnd
  1208 00000104 89C7                <2>  mov di, ax
  1209 00000106 26FE05              <2>  inc byte [es:di]
  1210 00000109 E2F3                <2>  loop cF3loop
  1211                              <1>  initStars
  1212 0000010B 1E                  <2>  push ds
  1213 0000010C 07                  <2>  pop es
  1214 0000010D B91E00              <2>  mov cx, 30
  1215 00000110 BF[0033]            <2>  mov di, stars
  1216                              <2> iSloop:
  1217 00000113 BB0001              <2>  mov bx, 256
  1218 00000116 E86804              <2>  call rnd
  1219 00000119 AA                  <2>  stosb
  1220 0000011A BBC00E              <2>  mov bx, 4096-(64*5)
  1221 0000011D 81C38000            <2>  add bx, 128
  1222 00000121 E85D04              <2>  call rnd
  1223 00000124 83C040              <2>  add ax, 64
  1224 00000127 AB                  <2>  stosw
  1225 00000128 E2E9                <2>  loop iSloop
  1226                              <1>  reactorWall
  1227 0000012A 8E06[5F33]          <2>  mov es, [tseg]
  1228 0000012E 31FF                <2>  xor di, di
  1229 00000130 B90010              <2>  mov cx, 4096
  1230                              <2> rsmloop:
  1231 00000133 89F8                <2>  mov ax, di
  1232 00000135 A808                <2>  test al, 8
  1233 00000137 7E02                <2>  jle short rsnonot1
  1234 00000139 F6D0                <2>  not al
  1235                              <2> rsnonot1:
  1236 0000013B 240F                <2>  and al, 15
  1237 0000013D 89C3                <2>  mov bx, ax
  1238 0000013F 89F8                <2>  mov ax, di
  1239 00000141 C1E806              <2>  shr ax, 6
  1240 00000144 A808                <2>  test al, 8
  1241 00000146 7E02                <2>  jle short rsnonot2
  1242 00000148 F6D0                <2>  not al
  1243                              <2> rsnonot2:
  1244 0000014A 240F                <2>  and al, 15
  1245 0000014C 38D8                <2>  cmp al, bl
  1246 0000014E 7E02                <2>  jle short rstakeal
  1247 00000150 89D8                <2>  mov ax, bx
  1248                              <2> rstakeal:
  1249 00000152 04E0                <2>  add al, 224
  1250 00000154 AA                  <2>  stosb
  1251 00000155 E2DC                <2>  loop rsmloop
  1252                              <1>  addFractals
  1253 00000157 BE[320F]            <2>  mov si, aF
  1254 0000015A B204                <2>  mov dl, 4
  1255                              <2> aFloop:
  1256 0000015C 0FB6DA              <2>  movzx bx, dl
  1257 0000015F 8E87[5F33]          <2>  mov es, [bx+tseg]
  1258 00000163 AD                  <2>  lodsw
  1259 00000164 88C3                <2>  mov bl, al
  1260 00000166 8EA7[5F33]          <2>  mov fs, [bx+tseg]
  1261 0000016A 31FF                <2>  xor di, di
  1262 0000016C B90010              <2>  mov cx, 4096
  1263                              <2> aFiloop:
  1264 0000016F 648A05              <2>  mov al, [fs:di]
  1265 00000172 00E0                <2>  add al, ah
  1266 00000174 AA                  <2>  stosb
  1267 00000175 E2F8                <2>  loop aFiloop
  1268 00000177 80C202              <2>  add dl, 2
  1269                              <2> 
  1270                              <2> 
  1271 0000017A 80FA1E              <2>  cmp dl, 30
  1272 0000017D 7EDD                <2>  jle short aFloop
  1273                              <1>  effects
  1274 0000017F B91A00              <2>  mov cx, 26
  1275 00000182 BE[960E]            <2>  mov si, aE
  1276                              <2> effmloop:
  1277 00000185 51                  <2>  push cx
  1278 00000186 8A1C                <2>  mov bl, [si]
  1279 00000188 88DA                <2>  mov dl, bl
  1280 0000018A C0EA04              <2>  shr dl, 4
  1281 0000018D 80E30F              <2>  and bl, 0Fh
  1282                              <2> 
  1283 00000190 D0E3                <2>  shl bl, 1
  1284 00000192 8E87[5F33]          <2>  mov es, [bx+tseg]
  1285 00000196 0FB64C02            <2>  movzx cx, byte [si+2]
  1286                              <2> effyloop:
  1287 0000019A 0FB65C01            <2>  movzx bx, byte [si+1]
  1288                              <2> effxloop:
  1289 0000019E 89CF                <2>  mov di, cx
  1290 000001A0 C1E706              <2>  shl di, 6
  1291 000001A3 01DF                <2>  add di, bx
  1292 000001A5 88D0                <2>  mov al, dl
  1293 000001A7 FEC8                <2>  dec al
  1294 000001A9 7413                <2>  jz short effect1
  1295 000001AB FEC8                <2>  dec al
  1296 000001AD 740C                <2>  jz short effect2
  1297 000001AF 89D8                <2>  mov ax, bx
  1298 000001B1 01C8                <2>  add ax, cx
  1299 000001B3 2404                <2>  and al, 4
  1300                              <2> 
  1301 000001B5 7407                <2>  jz short effect1
  1302 000001B7 B098                <2>  mov al, 152
  1303                              <2> effdonot:
  1304 000001B9 EB03                <2>  jmp short effect1
  1305                              <2> effect2:
  1306 000001BB 268A05              <2>  mov al, [es:di]
  1307                              <2> effect1:
  1308 000001BE 024405              <2>  add al, [si+5]
  1309 000001C1 268805              <2>  mov [es:di], al
  1310 000001C4 43                  <2>  inc bx
  1311 000001C5 3A5C03              <2>  cmp bl, [si+3]
  1312 000001C8 7ED4                <2>  jle short effxloop
  1313 000001CA 41                  <2>  inc cx
  1314 000001CB 3A4C04              <2>  cmp cl, [si+4]
  1315 000001CE 7ECA                <2>  jle short effyloop
  1316 000001D0 83C606              <2>  add si, 6
  1317 000001D3 59                  <2>  pop cx
  1318 000001D4 E2AF                <2>  loop effmloop
  1319                              <1>  addLava
  1320 000001D6 8E06[7533]          <2>  mov es, [tseg+22]
  1321 000001DA BFFF0F              <2>  mov di, 4095
  1322 000001DD B91400              <2>  mov cx, 20
  1323 000001E0 B05E                <2>  mov al, 94
  1324                              <2> aLyloop:
  1325 000001E2 51                  <2>  push cx
  1326 000001E3 C1E103              <2>  shl cx, 3
  1327                              <2> aLxloop:
  1328 000001E6 57                  <2>  push di
  1329 000001E7 50                  <2>  push ax
  1330 000001E8 BB4000              <2>  mov bx, 64
  1331 000001EB E89303              <2>  call rnd
  1332 000001EE 29C7                <2>  sub di, ax
  1333 000001F0 58                  <2>  pop ax
  1334                              <2> 
  1335 000001F1 268805              <2>  mov [es:di], al
  1336 000001F4 5F                  <2>  pop di
  1337 000001F5 E2EF                <2>  loop aLxloop
  1338 000001F7 59                  <2>  pop cx
  1339 000001F8 FEC8                <2>  dec al
  1340 000001FA 83EF40              <2>  sub di, 64
  1341 000001FD E2E3                <2>  loop aLyloop
  1342                                  
  1343                                  		calcShadeTab
  1344 000001FF 1E                  <1>  push ds
  1345 00000200 07                  <1>  pop es
  1346 00000201 BF[8733]            <1>  mov di, shadetab
  1347 00000204 30DB                <1>  xor bl, bl
  1348                              <1> cSolp:
  1349 00000206 FEC3                <1>  inc bl
  1350 00000208 31C9                <1>  xor cx, cx
  1351                              <1> cSilp1:
  1352 0000020A 88C8                <1>  mov al, cl
  1353 0000020C 241F                <1>  and al, 31
  1354 0000020E F6E3                <1>  mul bl
  1355 00000210 01C0                <1>  add ax, ax
  1356 00000212 88C8                <1>  mov al, cl
  1357 00000214 24E0                <1>  and al, 224
  1358 00000216 00E0                <1>  add al, ah
  1359 00000218 AA                  <1>  stosb
  1360 00000219 FEC1                <1>  inc cl
  1361 0000021B 80F9C0              <1>  cmp cl, 192
  1362 0000021E 75EA                <1>  jne short cSilp1
  1363                              <1> cSilp2:
  1364 00000220 88C8                <1>  mov al, cl
  1365 00000222 AA                  <1>  stosb
  1366 00000223 FEC1                <1>  inc cl
  1367 00000225 75F9                <1>  jnz short cSilp2
  1368 00000227 80FB80              <1>  cmp bl, 128
  1369 0000022A 75DA                <1>  jne short cSolp
  1370                                  
  1371 0000022C 8926[B832]              		mov	[oldstack], sp
  1372                                  
  1373                                  		startTimer
  1374 00000230 B80835              <1>  mov ax, 03508h
  1375 00000233 CD21                <1>  int 21h
  1376 00000235 8C06[BC32]          <1>  mov [Old08Irqseg], es
  1377 00000239 891E[BA32]          <1>  mov [Old08Irqofs], bx
  1378 0000023D B80825              <1>  mov ax, 02508h
  1379 00000240 BA[5A04]            <1>  mov dx, irqHandler08
  1380 00000243 CD21                <1>  int 21h
  1381                              <1> 
  1382 00000245 BB510D              <1>  mov bx, 3409
  1383 00000248 E84903              <1>  call setTimer
  1384                                  		startKBDHandler
  1385                              <1> 
  1386                              <1> 
  1387                              <1> 
  1388                              <1> 
  1389                              <1> 
  1390                              <1> 
  1391                              <1> 
  1392                              <1> 
  1393 0000024B 90                  <1>  nop
  1394                                  		cls
  1395 0000024C 1E                  <1>  push ds
  1396 0000024D 8E06[5D33]          <1>  mov es, [bseg]
  1397                              <1> 
  1398                              <1> 
  1399 00000251 BE00A0              <1>  mov si, 0A000h
  1400 00000254 8EDE                <1>  mov ds, si
  1401 00000256 BE4006              <1>  mov si, 320*5
  1402 00000259 31FF                <1>  xor di, di
  1403 0000025B B9007D              <1>  mov cx, 32000
  1404                              <1> clsloop:
  1405 0000025E AC                  <1>  lodsb
  1406 0000025F AA                  <1>  stosb
  1407 00000260 AA                  <1>  stosb
  1408 00000261 E2FB                <1>  loop clsloop
  1409 00000263 1F                  <1>  pop ds
  1410                                  mainloop:
  1411 00000264 B401                    		mov	ah, 1	; Check keyboard buffer
  1412 00000266 CD16                    		int	16h	; Keyboard interrupt
  1413 00000268 0F85BB01                		jnz	_exit_  ; exit
  1414                                  
  1415                                  		setPalette2
  1416 0000026C 30C0                <1>  xor al, al
  1417 0000026E BAC803              <1>  mov dx, 3C8h
  1418 00000271 EE                  <1>  out dx, al
  1419 00000272 42                  <1>  inc dx
  1420 00000273 BE[3413]            <1>  mov si, palette
  1421 00000276 B90003              <1>  mov cx, 768
  1422 00000279 F36E                <1>  rep outsb
  1423                                  
  1424                                  		scriptIt
  1425 0000027B 8B0E[3013]          <1>  mov cx, [ticker]
  1426 0000027F C706[3013]0000      <1>  mov word [ticker], 0
  1427 00000285 09C9                <1>  or cx, cx
  1428 00000287 0F849300            <1>  jz sItickerNull
  1429                              <1> sImloop:
  1430 0000028B 51                  <1>  push cx
  1431 0000028C BE[2213]            <1>  mov si, zspeed
  1432                              <1> 
  1433 0000028F FF0E[2C13]          <1>  dec word [scriptanz]
  1434 00000293 792B                <1>  jns short sIwaitTimer
  1435                              <1> 
  1436 00000295 8B1E[2A13]          <1>  mov bx, [scriptptr]
  1437 00000299 8A87[1012]          <1>  mov al, [bx+script]
  1438 0000029D 08C0                <1>  or al, al
  1439 0000029F 0F848401            <1>  jz _exit_
  1440 000002A3 89C3                <1>  mov bx, ax
  1441 000002A5 80E307              <1>  and bl, 7
  1442                              <1> 
  1443 000002A8 881E[2E13]          <1>  mov [scriptins], bl
  1444 000002AC FECB                <1>  dec bl
  1445 000002AE 7504                <1>  jnz short sInegateTurn
  1446                              <1> 
  1447 000002B0 F71E[8D12]          <1>  neg word [zstep]
  1448                              <1> sInegateTurn:
  1449 000002B4 25F800              <1>  and ax, 0F8h
  1450 000002B7 01C0                <1>  add ax, ax
  1451                              <1> 
  1452 000002B9 A3[2C13]            <1>  mov word [scriptanz], ax
  1453                              <1> 
  1454 000002BC FF06[2A13]          <1>  inc word [scriptptr]
  1455                              <1> sIwaitTimer:
  1456                              <1> 
  1457 000002C0 A0[2E13]            <1>  mov al, [scriptins]
  1458 000002C3 98                  <1>  cbw
  1459 000002C4 30ED                <1>  xor ch, ch
  1460 000002C6 48                  <1>  dec ax
  1461 000002C7 750A                <1>  jnz short sInoturn
  1462                              <1> 
  1463 000002C9 8B1E[8D12]          <1>  mov bx, [zstep]
  1464                              <1> 
  1465 000002CD 011E[2813]          <1>  add [ozw], bx
  1466 000002D1 EB14                <1>  jmp short sI_1
  1467                              <1> sInoturn:
  1468 000002D3 B103                <1>  mov cl, 3
  1469                              <1> 
  1470                              <1> sIrotateLoop:
  1471 000002D5 48                  <1>  dec ax
  1472 000002D6 7504                <1>  jnz short sInoIncrement
  1473                              <1> 
  1474 000002D8 FF04                <1>  inc word [si]
  1475 000002DA EB0B                <1>  jmp short sI_1
  1476                              <1> sInoIncrement:
  1477 000002DC 48                  <1>  dec ax
  1478 000002DD 7504                <1>  jnz short sInoDecrement
  1479                              <1> 
  1480 000002DF FF0C                <1>  dec word [si]
  1481 000002E1 EB04                <1>  jmp short sI_1
  1482                              <1> sInoDecrement:
  1483 000002E3 46                  <1>  inc si
  1484 000002E4 46                  <1>  inc si
  1485 000002E5 E2EE                <1>  loop sIrotateLoop
  1486                              <1> sI_1:
  1487                              <1> 
  1488 000002E7 BE[2413]            <1>  mov si, oxw
  1489 000002EA B103                <1>  mov cl, 3
  1490                              <1> sIpushloop:
  1491 000002EC AD                  <1>  lodsw
  1492 000002ED C1F802              <1>  sar ax, 2
  1493 000002F0 50                  <1>  push ax
  1494 000002F1 E2F9                <1>  loop sIpushloop
  1495                              <1> 
  1496 000002F3 6B44FC10            <1>  imul ax, word [si-4], 16
  1497 000002F7 50                  <1>  push ax
  1498 000002F8 E80408              <1>  call calcRotMat
  1499                              <1> 
  1500 000002FB B103                <1>  mov cl, 3
  1501 000002FD 31F6                <1>  xor si, si
  1502                              <1> sImoveLoop:
  1503 000002FF D984[CE12]          <1>  fld dword [si+owmat+24]
  1504 00000303 DE0E[2213]          <1>  fimul word [zspeed]
  1505 00000307 DE36[020D]          <1>  fidiv word [CONST1792]
  1506 0000030B D884[AA12]          <1>  fadd dword [si+ob]
  1507 0000030F D99C[AA12]          <1>  fstp dword [si+ob]
  1508 00000313 83C604              <1>  add si, 4
  1509 00000316 E2E7                <1>  loop sImoveLoop
  1510 00000318 59                  <1>  pop cx
  1511 00000319 49                  <1>  dec cx
  1512 0000031A 0F856DFF            <1>  jnz sImloop
  1513                              <1> sItickerNull:
  1514                                  
  1515                                  		animDoor
  1516 0000031E A1[8F12]            <1>  mov ax, [doortimer]
  1517 00000321 09C0                <1>  or ax, ax
  1518 00000323 7904                <1>  jns short aDnounder
  1519 00000325 31C0                <1>  xor ax, ax
  1520 00000327 EB2F                <1>  jmp short alreadydrawed
  1521                              <1> aDnounder:
  1522 00000329 803E[2F13]00        <1>  cmp byte [once], 0
  1523 0000032E 7528                <1>  jne short alreadydrawed
  1524 00000330 FE06[2F13]          <1>  inc byte [once]
  1525 00000334 50                  <1>  push ax
  1526                              <1>  starbackground
  1527 00000335 8E06[5D33]          <2>  mov es, [bseg]
  1528 00000339 B96400              <2>  mov cx, 100
  1529                              <2> starbackloop:
  1530 0000033C 51                  <2>  push cx
  1531 0000033D BBC0C1              <2>  mov bx, 320*155
  1532 00000340 E83E02              <2>  call rnd
  1533 00000343 050019              <2>  add ax, 320*20
  1534 00000346 89C7                <2>  mov di, ax
  1535 00000348 80E407              <2>  and ah, 7
  1536 0000034B BA3B01              <2>  mov dx, 320-5
  1537 0000034E B90200              <2>  mov cx, 2
  1538 00000351 E8A501              <2>  call setstarbob
  1539 00000354 59                  <2>  pop cx
  1540 00000355 E2E5                <2>  loop starbackloop
  1541 00000357 58                  <1>  pop ax
  1542                              <1> alreadydrawed:
  1543 00000358 83F818              <1>  cmp ax, 24
  1544 0000035B 7E03                <1>  jle short aDnoover
  1545 0000035D B81800              <1>  mov ax, 24
  1546                              <1> aDnoover:
  1547 00000360 C1E006              <1>  shl ax, 6
  1548 00000363 1E                  <1>  push ds
  1549 00000364 8E06[7933]          <1>  mov es, [tseg+26]
  1550 00000368 8E1E[7D33]          <1>  mov ds, [tseg+30]
  1551 0000036C 89C6                <1>  mov si, ax
  1552 0000036E 31FF                <1>  xor di, di
  1553 00000370 B90004              <1>  mov cx, 1024
  1554 00000373 F3A5                <1>  rep movsw
  1555 00000375 BE0008              <1>  mov si, 2048
  1556 00000378 29C6                <1>  sub si, ax
  1557 0000037A 56                  <1>  push si
  1558 0000037B B504                <1>  mov ch, 4
  1559 0000037D F3A5                <1>  rep movsw
  1560 0000037F 5F                  <1>  pop di
  1561 00000380 89C1                <1>  mov cx, ax
  1562 00000382 31C0                <1>  xor ax, ax
  1563 00000384 F3AB                <1>  rep stosw
  1564 00000386 1F                  <1>  pop ds
  1565                                  
  1566 00000387 1E                      		push	ds
  1567 00000388 8E06[5B33]              		mov	es, [vseg]
  1568 0000038C 8E1E[5D33]              		mov	ds, [bseg]
  1569 00000390 E88501                  		call	copyseg
  1570 00000393 1F                      		pop	ds
  1571                                  
  1572                                  		rotation
  1573 00000394 8B0E[9416]          <1>  mov cx, [object.panz]
  1574 00000398 BE[9816]            <1>  mov si, object.p
  1575 0000039B BF[67B5]            <1>  mov di, rp
  1576                              <1> rotmlp:
  1577 0000039E BB[DA12]            <1>  mov bx, wmat
  1578 000003A1 BA0300              <1>  mov dx, 3
  1579                              <1> rotilp:
  1580 000003A4 DF04                <1>  fild word [si+0]
  1581 000003A6 D826[AA12]          <1>  fsub dword [ob+vector.x]
  1582 000003AA D80F                <1>  fmul dword [bx+0]
  1583 000003AC DF4402              <1>  fild word [si+2]
  1584 000003AF D826[AE12]          <1>  fsub dword [ob+vector.y]
  1585 000003B3 D84F04              <1>  fmul dword [bx+4]
  1586 000003B6 DF4404              <1>  fild word [si+4]
  1587 000003B9 D826[B212]          <1>  fsub dword [ob+vector.z]
  1588 000003BD D84F08              <1>  fmul dword [bx+8]
  1589                              <1> 
  1590                              <1> 
  1591 000003C0 DEC1                <1>  faddp
  1592 000003C2 DEC1                <1>  faddp
  1593 000003C4 D91D                <1>  fstp dword [di]
  1594 000003C6 83C704              <1>  add di, 4
  1595 000003C9 83C30C              <1>  add bx, 12
  1596 000003CC 4A                  <1>  dec dx
  1597 000003CD 75D5                <1>  jnz short rotilp
  1598 000003CF 83C608              <1>  add si, 8
  1599 000003D2 E2CA                <1>  loop rotmlp
  1600                                  		sortFaces
  1601 000003D4 1E                  <1>  push ds
  1602 000003D5 07                  <1>  pop es
  1603 000003D6 BF[27C8]            <1>  mov di, facei
  1604 000003D9 57                  <1>  push di
  1605 000003DA BE[1823]            <1>  mov si, object.f
  1606 000003DD 89F0                <1>  mov ax, si
  1607 000003DF 8B0E[9616]          <1>  mov cx, [object.fanz]
  1608                              <1> sFmloop:
  1609 000003E3 D9EE                <1>  fldz
  1610 000003E5 51                  <1>  push cx
  1611 000003E6 B90400              <1>  mov cx, 4
  1612                              <1> sFiloop:
  1613 000003E9 6B1C0C              <1>  imul bx, word [si], 12
  1614 000003EC 46                  <1>  inc si
  1615 000003ED 46                  <1>  inc si
  1616 000003EE D8A7[6FB5]          <1>  fsub dword [bx+rp+vector.z]
  1617 000003F2 E2F5                <1>  loop sFiloop
  1618 000003F4 59                  <1>  pop cx
  1619 000003F5 DF1D                <1>  fistp word [di]
  1620 000003F7 47                  <1>  inc di
  1621 000003F8 47                  <1>  inc di
  1622 000003F9 AB                  <1>  stosw
  1623 000003FA 83C00A              <1>  add ax, 10
  1624 000003FD 46                  <1>  inc si
  1625 000003FE 46                  <1>  inc si
  1626 000003FF E2E2                <1>  loop sFmloop
  1627 00000401 57                  <1>  push di
  1628 00000402 E83D01              <1>  call qsort
  1629                                  
  1630 00000405 8B0E[9616]              		mov	cx, [object.fanz]
  1631 00000409 BE[27C8]                		mov	si, facei
  1632                                  drawloop:
  1633 0000040C AD                      		lodsw
  1634 0000040D AD                      		lodsw
  1635 0000040E 89C3                    		mov	bx, ax ; face address in 'object.f'
  1636 00000410 60                      		pusha
  1637 00000411 E8FC04                  		call	drawclippedface
  1638 00000414 61                      		popa
  1639 00000415 E2F5                    		loop	drawloop
  1640                                  	
  1641 00000417 1E                      		push	ds
  1642 00000418 6800A0                  		push	0A000h
  1643 0000041B 07                      		pop	es
  1644 0000041C 8E1E[5B33]              		mov	ds, [vseg]
  1645 00000420 E8F500                  		call	copyseg
  1646 00000423 1F                      		pop	ds
  1647 00000424 E93DFE                  		jmp	mainloop
  1648                                  loc_err_exit:
  1649                                  _exit_:
  1650 00000427 0E                      		push	cs
  1651 00000428 1F                      		pop	ds
  1652 00000429 8B26[B832]              		mov	sp, [oldstack]
  1653                                  		silence
  1654 0000042D B90F00              <1>  mov cx, 15
  1655                              <1> Siloop:
  1656 00000430 89C8                <1>  mov ax, cx
  1657 00000432 04B0                <1>  add al, CMD_CHANGEPARAM
  1658 00000434 E86A01              <1>  call writeGM
  1659 00000437 B07B                <1>  mov al, MOD_ALLNOTESOFF
  1660 00000439 E86501              <1>  call writeGM
  1661 0000043C 30C0                <1>  xor al, al
  1662 0000043E E86001              <1>  call writeGM
  1663 00000441 E2ED                <1>  loop Siloop
  1664                              <1> Sinosound:
  1665                                  		stopKBDHandler
  1666                              <1> 
  1667                              <1> 
  1668                              <1> 
  1669                              <1> 
  1670                              <1> 
  1671                              <1> 
  1672 00000443 90                  <1>  nop
  1673                                  		stopTimer
  1674 00000444 1E                  <1>  push ds
  1675 00000445 31DB                <1>  xor bx, bx
  1676 00000447 E84A01              <1>  call setTimer
  1677 0000044A B80825              <1>  mov ax, 02508h
  1678 0000044D C516[BA32]          <1>  lds dx, [Old08IrqPtr]
  1679 00000451 CD21                <1>  int 21h
  1680 00000453 1F                  <1>  pop ds
  1681                                  		set80x25
  1682 00000454 B80300              <1>  mov ax, 3
  1683 00000457 CD10                <1>  int 10h
  1684                              <1> 
  1685 00000459 C3                      		ret
  1686                                  
  1687                                  ;==============================================================================
  1688                                  ;		interrupt handler
  1689                                  ;==============================================================================
  1690                                  ;***********************************************
  1691                                  ;* descript. : timer routine                   *
  1692                                  ;* parameter : none		               *
  1693                                  ;* sideeffect: none		               *
  1694                                  ;* back      : none		               *
  1695                                  ;***********************************************
  1696                                  
  1697                                  irqHandler08:
  1698 0000045A 60                      		pusha
  1699                                  		
  1700 0000045B 1E                      		push	ds
  1701 0000045C 06                      		push	es
  1702                                  
  1703 0000045D 0E                      		push	cs
  1704 0000045E 1F                      		pop	ds
  1705                                  
  1706                                  		playsong
  1707 0000045F 8B0E[3213]          <1>  mov cx, [tracks]
  1708 00000463 BE[3416]            <1>  mov si, channels
  1709                              <1> PSmloop:
  1710 00000466 FF0C                <1>  dec word [si+channel.del]
  1711 00000468 7F2C                <1>  jg short PSdelayed
  1712 0000046A 8B4402              <1>  mov ax, [si+channel.trk]
  1713 0000046D 0480                <1>  add al, CMD_NOTEOFF
  1714 0000046F E84201              <1>  call setnote
  1715 00000472 8B5C04              <1>  mov bx, [si+channel.adr]
  1716 00000475 B47F                <1>  mov ah, 127
  1717 00000477 803F00              <1>  cmp byte [bx], 0
  1718 0000047A 7414                <1>  jz short PStrackend
  1719 0000047C 8A27                <1>  mov ah, [bx]
  1720 0000047E 886403              <1>  mov [si+channel.ln], ah
  1721 00000481 8A4402              <1>  mov al, [si+channel.trk]
  1722 00000484 0490                <1>  add al, CMD_NOTEON
  1723 00000486 E82B01              <1>  call setnote
  1724 00000489 8A4701              <1>  mov al, [bx+1]
  1725 0000048C B31D                <1>  mov bl, SONGSPEED
  1726 0000048E F6E3                <1>  mul bl
  1727                              <1> PStrackend:
  1728 00000490 8904                <1>  mov [si+channel.del], ax
  1729 00000492 83440402            <1>  add word [si+channel.adr], 2
  1730                              <1> PSdelayed:
  1731 00000496 83C606              <1>  add si, 6
  1732 00000499 E2CB                <1>  loop PSmloop
  1733                              <1> PSnosound:
  1734                                  
  1735 0000049B FF06[3013]              		inc	word [ticker]
  1736 0000049F FE06[5A33]              		inc	byte [twice]
  1737 000004A3 8026[5A33]07            		and	byte [twice], 7
  1738 000004A8 7547                    		jnz	short iH08notyet
  1739                                  
  1740                                  		colorCycle
  1741                              <1>  base equ 6*32
  1742                              <1>  range equ 32
  1743                              <1> 
  1744 000004AA 1E                  <1>  push ds
  1745 000004AB 07                  <1>  pop es
  1746 000004AC BF[7415]            <1>  mov di, palette+(base*3)
  1747 000004AF 89FE                <1>  mov si, di
  1748 000004B1 AD                  <1>  lodsw
  1749                              <1> 
  1750 000004B2 46                  <1>  inc si
  1751 000004B3 B95D00              <1>  mov cx, (range*3-3)
  1752 000004B6 F3A4                <1>  rep movsb
  1753 000004B8 AB                  <1>  stosw
  1754                              <1> 
  1755                                  		animStars
  1756                              <1>  _base equ 7*32
  1757                              <1> 
  1758 000004B9 8E06[6133]          <1>  mov es, [tseg+2]
  1759 000004BD E80601              <1>  call clearFrac
  1760                              <1> 
  1761 000004C0 B11E                <1>  mov cl, 30
  1762 000004C2 BB[0033]            <1>  mov bx, stars
  1763                              <1> aSoloop:
  1764 000004C5 FE0F                <1>  dec byte [bx]
  1765 000004C7 8A27                <1>  mov ah, [bx]
  1766 000004C9 80E43F              <1>  and ah, 63
  1767 000004CC 80FC1F              <1>  cmp ah, 31
  1768 000004CF 7605                <1>  jbe short aSnonot
  1769 000004D1 F6D4                <1>  not ah
  1770 000004D3 80E41F              <1>  and ah, 31
  1771                              <1> aSnonot:
  1772 000004D6 D0EC                <1>  shr ah, 1
  1773 000004D8 8B7F01              <1>  mov di, [bx+1]
  1774 000004DB 51                  <1>  push cx
  1775 000004DC 53                  <1>  push bx
  1776                              <1> 
  1777 000004DD BA3B00              <1>  mov dx, 64-5
  1778 000004E0 B900E0              <1>  mov cx, _base*256+0
  1779 000004E3 E81300              <1>  call setstarbob
  1780                              <1> 
  1781 000004E6 5B                  <1>  pop bx
  1782 000004E7 59                  <1>  pop cx
  1783 000004E8 83C303              <1>  add bx, 3
  1784 000004EB E2D8                <1>  loop aSoloop
  1785                                  	
  1786 000004ED FF06[8F12]              		inc	word [doortimer]
  1787                                  iH08notyet:
  1788 000004F1 B020                    		mov	al, 20h
  1789 000004F3 E620                    		out	20h, al
  1790                                  		
  1791 000004F5 07                      		pop	es
  1792 000004F6 1F                      		pop	ds
  1793 000004F7 61                      		popa
  1794 000004F8 CF                      		iret
  1795                                  
  1796                                  ;***********************************************
  1797                                  ;* descript. : keyboard- / breakhandler	       *
  1798                                  ;* parameter : none		               *
  1799                                  ;* sideeffect: none		               *
  1800                                  ;* back      : none		               *
  1801                                  ;* length    : 12 bytes		               *
  1802                                  ;***********************************************
  1803                                  ;
  1804                                  ;irqHandler09:
  1805                                  		;push    ax
  1806                                  		;mov     al, 20h
  1807                                  		;out     20h, al
  1808                                  		;in      al, 60h
  1809                                  		;dec     al
  1810                                  		;pop     ax
  1811                                  		;je	_exit_
  1812                                  		;iret
  1813                                  	
  1814                                  ;==============================================================================
  1815                                  ;		sub routines
  1816                                  ;==============================================================================
  1817                                  ;***********************************************
  1818                                  ;* descript. : draw a the starbob	       *
  1819                                  ;* parameter : ds,es: source seg,dest seg      *
  1820                                  ;* sideeffect: ax,cx,si,di	               *
  1821                                  ;* back      : none		               *
  1822                                  ;***********************************************
  1823                                  
  1824                                  setstarbob:
  1825 000004F9 BE[4E0F]                		mov	si, bob
  1826 000004FC B305                    		mov	bl, 5
  1827                                  yloop:
  1828 000004FE B705                    		mov	bh, 5
  1829                                  xloop:
  1830 00000500 AC                      		lodsb
  1831 00000501 28E0                    		sub	al, ah
  1832 00000503 7E07                    		jle	short aSnodraw
  1833 00000505 00E8                    		add	al, ch
  1834 00000507 D2E0                    		shl	al, cl
  1835 00000509 268805                  		mov	[es:di], al
  1836                                  		;mov	[di], al
  1837                                  aSnodraw:
  1838 0000050C 47                      		inc	di
  1839 0000050D FECF                    		dec	bh
  1840 0000050F 75EF                    		jnz	short xloop
  1841 00000511 01D7                    		add	di, dx
  1842 00000513 FECB                    		dec	bl
  1843 00000515 75E7                    		jnz	short yloop
  1844 00000517 C3                      		retn
  1845                                  
  1846                                  ;***********************************************
  1847                                  ;* descript. : copy 16000 longs ds --> es      *
  1848                                  ;* parameter : ds,es: source seg,dest seg      *
  1849                                  ;* sideeffect: ax,cx,si,di	               *
  1850                                  ;* back      : none		               *
  1851                                  ;***********************************************
  1852                                  
  1853                                  copyseg:
  1854 00000518 31FF                    		xor	di, di
  1855 0000051A 31F6                    		xor	si, si
  1856 0000051C B9803E                  		mov	cx, 16000 ; 3E80h
  1857 0000051F F366A5                  		rep movsd
  1858 00000522 C3                      		retn
  1859                                  
  1860                                  ;***********************************************
  1861                                  ;* descript. : expand a part of the song       *
  1862                                  ;* parameter : si:base adress		       *
  1863                                  ;* sideeffect: si,ax		               *
  1864                                  ;* back      : ax=si:new baseadress            *
  1865                                  ;***********************************************
  1866                                  
  1867                                  expand:
  1868 00000523 8A0C                    EPwhile: 	mov	cl, [si]
  1869 00000525 08C9                    		or	cl, cl
  1870 00000527 7415                    		jz	short EPendwhile
  1871 00000529 7910                    		jns	short EPnote
  1872                                  EPcall:
  1873 0000052B 51                      		push	cx
  1874 0000052C 56                      		push	si
  1875 0000052D 46                      		inc	si
  1876 0000052E E8F2FF                  		call	expand
  1877 00000531 5E                      		pop	si
  1878 00000532 59                      		pop	cx
  1879 00000533 FEC1                    		inc	cl
  1880 00000535 75F4                    		jnz	short EPcall
  1881 00000537 89C6                    		mov	si, ax
  1882 00000539 EBE8                    		jmp	short EPwhile 
  1883                                  EPnote:
  1884 0000053B A5                      		movsw
  1885 0000053C EBE5                    		jmp	short EPwhile
  1886                                  EPendwhile:
  1887 0000053E 46                      		inc	si
  1888 0000053F 89F0                    		mov	ax, si
  1889 00000541 C3                      		retn
  1890                                  
  1891                                  ;***********************************************
  1892                                  ;* descript. : recursive index quicksort       *
  1893                                  ;* parameter : l,r:stack left and right border *
  1894                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
  1895                                  ;* back      : none		               *
  1896                                  ;***********************************************
  1897                                  
  1898                                  qsort:
  1899 00000542 58                      		pop	ax 	; get address
  1900 00000543 59                      		pop	cx	; get 2. param r
  1901 00000544 5B                      		pop	bx	; get 1. param l
  1902 00000545 50                      		push	ax	; store address
  1903                                  
  1904 00000546 39D9                    		cmp	cx, bx
  1905 00000548 7E36                    		jle	short QSendrek
  1906 0000054A 89DE                    		mov	si, bx
  1907 0000054C 89CF                    		mov	di, cx  	
  1908 0000054E 8B14                    		mov	dx, [si]
  1909                                  QSrepeat:
  1910 00000550 3914                    QSwhile1:	cmp	[si], dx
  1911 00000552 7E05                    		jle	short QSwhile2
  1912 00000554 83C604                  		add	si, 4
  1913 00000557 EBF7                    		jmp	short QSwhile1
  1914                                  QSwhile2:
  1915 00000559 3915                    		cmp	[di], dx
  1916 0000055B 7D05                    		jnl	short QSwhile2e
  1917 0000055D 83EF04                  		sub	di, 4
  1918 00000560 EBF7                    		jmp	short QSwhile2
  1919                                  QSwhile2e:
  1920 00000562 39FE                    		cmp	si, di
  1921                                  		;jg	short QSnoswap
  1922 00000564 7F10                    		jg	short _QSnoswap
  1923 00000566 66AD                    		lodsd
  1924 00000568 668705                  		xchg	eax, [di]
  1925 0000056B 668944FC                		mov	[si-4], eax
  1926 0000056F 83EF04                  		sub	di, 4
  1927                                  QSnoswap:
  1928 00000572 39FE                    		cmp	si, di
  1929 00000574 7EDA                    		jle	short QSrepeat
  1930                                  _QSnoswap:
  1931 00000576 56                      		push	si 
  1932 00000577 51                      		push	cx
  1933 00000578 53                      		push	bx
  1934 00000579 57                      		push	di
  1935 0000057A E8C5FF                  		call	qsort
  1936 0000057D E8C2FF                  		call	qsort
  1937                                  QSendrek:
  1938 00000580 C3                      		retn
  1939                                  
  1940                                  ;***********************************************
  1941                                  ;* descript. : returns a pseudo random number  *
  1942                                  ;* parameter : bx=range		               *
  1943                                  ;* sideeffect: eax,edx,si		       *
  1944                                  ;* back      : ax=rnd(range)                   *
  1945                                  ;***********************************************
  1946                                  
  1947                                  rnd:
  1948 00000581 BE[080D]                		mov	si, randommul
  1949 00000584 66AD                    		lodsd
  1950 00000586 66F724                  		mul	dword [si] ; randomseed
  1951 00000589 6640                    		inc	eax
  1952 0000058B 668904                  		mov	[si], eax  ; randomseed
  1953 0000058E AD                      		lodsw
  1954 0000058F AD                      		lodsw
  1955 00000590 F7E3                    		mul	bx
  1956 00000592 92                      		xchg	ax, dx
  1957 00000593 C3                      		retn
  1958                                  
  1959                                  ;***********************************************
  1960                                  ;* descript. : set timer speed to 1193180/AX   *
  1961                                  ;*             interrupts per second           *
  1962                                  ;* parameter : bx		               *
  1963                                  ;* sideeffect: ax		               *
  1964                                  ;* back      : none		               *
  1965                                  ;***********************************************
  1966                                  
  1967                                  setTimer:	; set timer speed to 1193180/BX (TRDOS 386)
  1968 00000594 B036                    		mov	al, 36h
  1969 00000596 E643                    		out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1970 00000598 88D8                    		mov	al, bl
  1971 0000059A E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1972 0000059C 88F8                    		mov	al, bh
  1973 0000059E E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1974 000005A0 C3                      		retn
  1975                                  
  1976                                  ;***********************************************
  1977                                  ;* descript. : send a byte to the GM-Port      *
  1978                                  ;* parameter : al:midi command                 *
  1979                                  ;* sideeffect: dx		               *
  1980                                  ;* back      : none		               *
  1981                                  ;***********************************************
  1982                                  
  1983                                  writeGM:
  1984 000005A1 BA3103                  		mov	dx, GMPort  ; 331h
  1985 000005A4 50                      		push	ax
  1986 000005A5 31C0                    		xor	ax, ax
  1987                                  busy:
  1988 000005A7 FECC                    		dec	ah
  1989 000005A9 7405                    		jz	short timeOut
  1990 000005AB EC                      		in	al, dx
  1991 000005AC A840                    		test	al, 40h
  1992 000005AE 75F7                    		jnz	short busy
  1993                                  timeOut:
  1994 000005B0 58                      		pop	ax
  1995 000005B1 4A                      		dec	dx
  1996 000005B2 EE                      		out	dx, al
  1997 000005B3 C3                      		retn
  1998                                  
  1999                                  ;***********************************************
  2000                                  ;* descript. : send NOTEON command, volume 127 *
  2001                                  ;* parameter : al:channel;ah:note              *
  2002                                  ;* sideeffect: dx,al		               *
  2003                                  ;* back      : none		               *
  2004                                  ;***********************************************
  2005                                  
  2006                                  setnote:
  2007 000005B4 E80600                  		call	setinstr
  2008 000005B7 B07F                    		mov	al, 127	; 7Fh
  2009 000005B9 E8E5FF                  		call	writeGM
  2010 000005BC C3                      		retn
  2011                                  
  2012                                  ;***********************************************
  2013                                  ;* descript. : send CHANGEPRG command	       *
  2014                                  ;* parameter : al:channel;ah:instrument        *
  2015                                  ;* sideeffect: dx,al		               *
  2016                                  ;* back      : none		               *
  2017                                  ;***********************************************
  2018                                  
  2019                                  setinstr:
  2020 000005BD E8E1FF                  		call	writeGM
  2021 000005C0 88E0                    		mov	al, ah
  2022 000005C2 E8DCFF                  		call	writeGM
  2023 000005C5 C3                      		retn
  2024                                  
  2025                                  ;***********************************************
  2026                                  ;* descript. : clear/set the fractal es: to al *
  2027                                  ;* parameter : al,es		               *
  2028                                  ;* sideeffect: ax,cx,di,es  	               *
  2029                                  ;* back      : none			       *
  2030                                  ;***********************************************
  2031                                  
  2032                                  clearFrac:
  2033 000005C6 31C0                    		xor	ax, ax
  2034                                  setFrac:
  2035 000005C8 31FF                    		xor	di, di
  2036 000005CA B90010                  		mov	cx, 4096 ; 1000h
  2037 000005CD F3AA                    		rep stosb
  2038 000005CF C3                      		retn
  2039                                  
  2040                                  ;***********************************************
  2041                                  ;* descript. : calc shade bob fractal          *
  2042                                  ;* parameter : es:seg;num,rad:stack            *
  2043                                  ;* sideeffect: all			       *
  2044                                  ;* back      : none			       *
  2045                                  ;***********************************************
  2046                                  
  2047                                  createFrac1:
  2048                                  		rad	equ 4 ; arg 1 in [sp+2]
  2049                                  		num	equ 6 ; arg 2 in [sp+4]
  2050                                  
  2051 000005D0 55                      		push	bp
  2052 000005D1 89E5                    		mov	bp, sp
  2053                                  
  2054 000005D3 8E87[5F33]              		mov	es, [bx+tseg]
  2055 000005D7 E8ECFF                  		call	clearFrac
  2056                                  
  2057 000005DA BE[C032]                		mov	si, circletab
  2058 000005DD 8B5604                  		mov	dx, [bp+rad]
  2059 000005E0 88D0                    		mov	al, dl
  2060 000005E2 F6EA                    		imul	dl
  2061                                  		;mov	di, ax
  2062 000005E4 89C3                    		mov	bx, ax
  2063 000005E6 89D1                    		mov	cx, dx
  2064 000005E8 01C9                    		add	cx, cx
  2065                                  CCTloop:
  2066 000005EA 88D0                    		mov	al, dl
  2067 000005EC F6EA                    		imul	dl
  2068 000005EE F7D8                    		neg	ax
  2069                                  		;add	ax, di
  2070 000005F0 01D8                    		add	ax, bx
  2071 000005F2 8904                    		mov	[si], ax
  2072 000005F4 DF04                    		fild	word [si]
  2073 000005F6 D9FA                    		fsqrt
  2074 000005F8 DF1C                    		fistp	word [si]
  2075 000005FA 46                      		inc	si
  2076 000005FB 46                      		inc	si
  2077 000005FC 4A                      		dec	dx
  2078 000005FD E2EB                    		loop	CCTloop
  2079                                  
  2080 000005FF 8B4E06                  		mov	cx, [bp+num]
  2081                                  SBloop1:
  2082 00000602 51                      		push	cx
  2083 00000603 BB0010                  		mov	bx, 4096 ; 1000h
  2084 00000606 E878FF                  		call	rnd
  2085 00000609 89C7                    		mov	di, ax
  2086 0000060B BE[C032]                		mov	si, circletab
  2087 0000060E 8B4E04                  		mov	cx, [bp+rad]
  2088 00000611 01C9                    		add	cx, cx
  2089                                  SBloop2:
  2090 00000613 51                      		push	cx
  2091 00000614 AD                      		lodsw
  2092 00000615 89C1                    		mov	cx, ax
  2093 00000617 01C9                    		add	cx, cx
  2094 00000619 740E                    		jz	short SBskip
  2095 0000061B 57                      		push	di
  2096 0000061C 29C7                    		sub	di, ax
  2097                                  SBloop3:
  2098 0000061E 81E7FF0F                		and	di, 4095  ; 0FFFh
  2099 00000622 26FE05                  		inc	byte [es:di]
  2100 00000625 47                      		inc	di
  2101 00000626 E2F6                    		loop	SBloop3
  2102 00000628 5F                      		pop	di
  2103                                  SBskip:
  2104 00000629 83C740                  		add	di, 64 ; 40h
  2105 0000062C 59                      		pop	cx
  2106 0000062D E2E4                    		loop	SBloop2
  2107 0000062F 59                      		pop	cx
  2108 00000630 E2D0                    		loop	SBloop1
  2109 00000632 5D                      		pop	bp
  2110 00000633 C20400                  		ret	4
  2111                                  
  2112                                  ;***********************************************
  2113                                  ;* descript. : draw a perpective-texturemapped *
  2114                                  ;*	       and g.-shaded n-sided polygon   *
  2115                                  ;* parameter : far ptr to poly, sides, textnum *
  2116                                  ;* sideeffect: all			       *
  2117                                  ;* back      : none			       *
  2118                                  ;* length    : 700 bytes		       *
  2119                                  ;***********************************************
  2120                                  
  2121                                  scansubtextpoly:
  2122                                  		; 11/08/2017
  2123                                  		col	equ 4  ; arg 1, [sp+2] ; dcf.col value
  2124                                  		n	equ 6  ; arg 2, [sp+4] ; dcf.j value
  2125                                  		pol	equ 8  ; arg 3, [sp+6] ; dcf.p2 address
  2126                                  
  2127 00000636 55                       		push	bp
  2128 00000637 89E5                    		mov	bp, sp
  2129                                  
  2130 00000639 B8FF7F                  		mov	ax, 32767
  2131 0000063C 89C2                    		mov	dx, ax
  2132 0000063E 89C3                    		mov	bx, ax
  2133 00000640 F7DB                    		neg	bx	; -32767 ; 8001h
  2134 00000642 89DE                    		mov	si, bx	; -32767
  2135                                  
  2136                                  		; di = dcf.p2 address
  2137 00000644 8B7E08                  		mov	di, [bp+pol] ; [bp+8] ; dcf.p2 ; face structure
  2138                                  
  2139 00000647 31C9                    		xor	cx, cx
  2140                                  minmax:
  2141 00000649 3B4512                  		cmp	ax, [di+2+edge.e+edges.x] ; [di+12h]
  2142 0000064C 7E03                    		jle	short noswap1
  2143 0000064E 8B4512                  		mov	ax, [di+2+edge.e+edges.x] ; [di+12h]
  2144                                  noswap1:
  2145 00000651 3B5D12                  		cmp	bx, [di+2+edge.e+edges.x] ; [di+12h]
  2146 00000654 7D03                    		jge	short noswap2
  2147 00000656 8B5D12                  		mov	bx, [di+2+edge.e+edges.x] ; [di+12h]
  2148                                  noswap2:
  2149 00000659 3B550C                  		cmp	dx, [di+edge.py]  ; [di+0Ch]
  2150 0000065C 7E0B                    		jle	short noswap3
  2151 0000065E 8B550C                  		mov	dx, [di+edge.py]  ; [di+0Ch]
  2152 00000661 890E[7ECE]              		mov	[sstp.l], cx
  2153 00000665 890E[7CCE]              		mov	[sstp.r], cx
  2154                                  noswap3:
  2155 00000669 3B750C                  		cmp	si, [di+edge.py]  ; [di+0Ch]
  2156 0000066C 7D03                    		jge	short noswap4
  2157 0000066E 8B750C                  		mov	si, [di+edge.py]  ; [di+0Ch]
  2158                                  noswap4:
  2159 00000671 83C724                  		add	di, 36 ; 24h
  2160 00000674 41                      		inc	cx
  2161 00000675 3B4E06                  		cmp	cx, [bp+n] ; [bp+6]
  2162                                  				   ; dcf.j ; number of visible edges/points
  2163 00000678 75CF                    		jne	short minmax
  2164                                  
  2165 0000067A 83FB00                  		cmp	bx, 0
  2166 0000067D 0F8C4002                		jl	exitDraw
  2167 00000681 3D4001                  		cmp	ax, XMAX  ; 140h
  2168 00000684 0F8F3902                		jg	exitDraw
  2169                                  
  2170 00000688 83FE15                  		cmp	si, YMIN  ; 15h
  2171 0000068B 0F8C3202                		jl	exitDraw
  2172 0000068F 81FAB300                		cmp	dx, YMAX  ; 0B3h
  2173 00000693 0F8F2A02                		jg	exitDraw
  2174 00000697 8916[84CE]              		mov	[sstp.miny], dx
  2175 0000069B 8936[82CE]              		mov	[sstp.maxy], si
  2176                                  
  2177                                  		;{ down clipping }
  2178 0000069F 813E[82CE]B300          		cmp	word [sstp.maxy], YMAX ; 0B3h
  2179 000006A5 7E06                    		jle	short noclipdown
  2180 000006A7 C706[82CE]B300          		mov	word [sstp.maxy], YMAX ; 0B3h
  2181                                  noclipdown:
  2182 000006AD A1[84CE]                		mov	ax, [sstp.miny]
  2183 000006B0 3B06[82CE]              		cmp	ax, [sstp.maxy]
  2184 000006B4 0F840902                		je	exitDraw
  2185 000006B8 A3[80CE]                		mov	[sstp.y], ax
  2186 000006BB 8B5E04                  		mov	bx, [bp+col]	   ; [bp+4]
  2187                                  					   ; dcf.col ; shade/color value
  2188 000006BE 01DB                    		add	bx, bx
  2189 000006C0 8E06[5B33]              		mov	es, [vseg]
  2190 000006C4 8EA7[5F33]              		mov	fs, [bx+tseg]
  2191                                  for:
  2192 000006C8 A1[80CE]                		mov	ax, [sstp.y]
  2193 000006CB 3B06[82CE]              		cmp	ax, [sstp.maxy]
  2194 000006CF 0F8FEE01                		jg	exitDraw
  2195 000006D3 745E                    		je	exitwhile2
  2196                                  while1:
  2197                                  		;mov	ax, [sstp.y]
  2198                                  		;cmp	ax, [sstp.maxy]
  2199                                  		;jge	short while2	
  2200                                  
  2201 000006D5 8B7608                  		mov	si, [bp+pol]	   ; [bp+8]
  2202 000006D8 6B1E[7ECE]24            		imul	bx, word [sstp.l], 36
  2203 000006DD 01DE                    		add	si, bx
  2204                                  		;mov	si, bx
  2205                                  		;add	si, [bp+pol]	   ; [bp+8]
  2206                                  
  2207 000006DF 3B440C                  		cmp	ax, [si+edge.py]   ; [si+0Ch]
  2208 000006E2 751F                    		jne	short while2
  2209                                  
  2210 000006E4 8B1E[7ECE]              		mov	bx, [sstp.l]
  2211 000006E8 4B                      		dec	bx
  2212 000006E9 7D04                    		jge	short nounder
  2213 000006EB 8B5E06                  		mov	bx, [bp+n]         ; [bp+6]
  2214                                  					   ; dcf.j ; visible edges/points
  2215 000006EE 4B                      		dec	bx
  2216                                  nounder:
  2217 000006EF 891E[7ECE]              		mov	[sstp.l], bx
  2218 000006F3 31FF                    		xor	di, di
  2219 000006F5 E8CD01                  		call	calcDeltas
  2220 000006F8 A1[80CE]                		mov	ax, [sstp.y]
  2221 000006FB 3B06[82CE]              		cmp	ax, [sstp.maxy]
  2222 000006FF 7D32                    		jge	short exitwhile2	
  2223 00000701 EBD2                    		jmp	short while1
  2224                                  while2:
  2225                                  		;mov	ax, [sstp.y]
  2226 00000703 3B06[82CE]              		cmp	ax, [sstp.maxy]
  2227 00000707 7D2A                    		jge	short exitwhile2
  2228 00000709 8B7608                  		mov	si, [bp+pol]	   ; [bp+8]
  2229 0000070C 6B1E[7CCE]24            		imul	bx, word [sstp.r], 36
  2230 00000711 01DE                    		add	si, bx
  2231                                  		;
  2232                                  		;mov	si, bx
  2233                                  		;add	si, [bp+pol]	   ; [bp+8]
  2234                                  
  2235 00000713 3B440C                  		cmp	ax, [si+edge.py]   ; [si+0Ch]
  2236 00000716 751B                    		jne	short exitwhile2
  2237                                  
  2238 00000718 8B1E[7CCE]              		mov	bx, [sstp.r]
  2239 0000071C 43                      		inc	bx
  2240 0000071D 3B5E06                  		cmp	bx, [bp+n]	   ; [bp+6]
  2241 00000720 7C02                    		jl	short noover
  2242 00000722 31DB                    		xor	bx, bx
  2243                                  noover:
  2244 00000724 891E[7CCE]              		mov	[sstp.r], bx
  2245 00000728 BF1400                  		mov	di, 20  ; 14h
  2246 0000072B E89701                  		call	calcDeltas
  2247                                  		;
  2248 0000072E A1[80CE]                		mov	ax, [sstp.y]
  2249 00000731 EBD0                    		jmp	short while2
  2250                                  exitwhile2:
  2251                                  		;{ up clipping }
  2252 00000733 833E[80CE]15            		cmp	word [sstp.y], YMIN	; 15h
  2253 00000738 0F8C6C01                		jl	clipup
  2254 0000073C 6631DB                  		xor	ebx, ebx
  2255 0000073F 6631C9                  		xor	ecx, ecx
  2256 00000742 8B1E[C8CE]              		mov	bx, [sstp.edg+2+edges.x]
  2257 00000746 891E[88CE]              		mov	[sstp.mx1], bx
  2258 0000074A 8B0E[DCCE]              		mov	cx, [sstp.edg+20+2+edges.x]
  2259 0000074E 890E[86CE]              		mov	[sstp.mx2], cx
  2260 00000752 29D9                    		sub	cx, bx
  2261 00000754 0F845001                		jz	exitol
  2262 00000758 833E[86CE]00            		cmp	word [sstp.mx2], 0
  2263 0000075D 0F8E4701                		jle	exitol
  2264 00000761 813E[88CE]4001          		cmp	word [sstp.mx1], XMAX ; 140h
  2265 00000767 0F8F3D01                		jg	exitol
  2266                                  
  2267 0000076B F7DB                    		neg	bx
  2268 0000076D 790B                    		jns	short myelse
  2269 0000076F 31DB                    		xor	bx, bx
  2270 00000771 EB0D                    		jmp	short myendif
  2271                                  _nodivbyzero:
  2272 00000773 668B85[B2CE]            		mov	eax, [di+sstp.del+40]
  2273 00000778 EB1F                    		jmp	short nodivbyzero
  2274                                  myelse:
  2275 0000077A C706[88CE]0000          		mov	word [sstp.mx1], 0
  2276                                  myendif:
  2277 00000780 BF1000                  		mov	di, 16 ; 10h
  2278                                  addloop1:
  2279                                  		;{ calculate deltas }
  2280 00000783 668B85[DACE]            		mov	eax, [di+sstp.edg+20]
  2281 00000788 662B85[C6CE]            		sub	eax, [di+sstp.edg]
  2282 0000078D 6699                    		cdq
  2283                                  		;jcxz	nodivbyzero
  2284 0000078F E3E2                    		jcxz	_nodivbyzero
  2285 00000791 66F7F9                  		idiv	ecx
  2286 00000794 668985[B2CE]            		mov	[di+sstp.del+40], eax
  2287                                  nodivbyzero:
  2288                                  		;{ left clipping }
  2289 00000799 668B85[B2CE]            		mov	eax, [di+sstp.del+40]
  2290 0000079E 66F7EB                  		imul	ebx
  2291 000007A1 660385[C6CE]            		add	eax, [di+sstp.edg]
  2292 000007A6 668985[EECE]            		mov	[di+sstp.edg+40], eax
  2293 000007AB 83EF04                  		sub	di, 4
  2294 000007AE 75D3                    		jnz	short addloop1
  2295                                  
  2296 000007B0 A1[C2CE]                		mov	ax, [sstp.del+40+16]
  2297                                  		;mov	[cs:dels_pos+1], ax
  2298 000007B3 A3[CA0C]                		mov	[dels_pos_w], ax
  2299                                  
  2300                                  		;{ right clipping }
  2301 000007B6 813E[86CE]4001          		cmp	word  [sstp.mx2], XMAX
  2302 000007BC 7E06                    		jle	short norightclip
  2303 000007BE C706[86CE]4001          		mov	word  [sstp.mx2], XMAX  ; 140h
  2304                                  norightclip:
  2305 000007C4 693E[80CE]4001          		imul	di, word [sstp.y], 320
  2306 000007CA 033E[88CE]              		add	di, [sstp.mx1]
  2307                                  		
  2308 000007CE BB0001                  		mov	bx, 256 ; 100h
  2309 000007D1 66A1[F2CE]              		mov	eax, [sstp.edg+40+edges.u]
  2310 000007D5 66F7EB                  		imul	ebx
  2311 000007D8 66F73E[FACE]            		idiv	dword [sstp.edg+40+edges.w]
  2312 000007DD A3[76CE]                		mov	[sstp.uu2], ax
  2313 000007E0 66A1[F6CE]              		mov	eax, [sstp.edg+40+edges.v]
  2314 000007E4 66F7EB                  		imul	ebx
  2315 000007E7 66F73E[FACE]            		idiv	dword [sstp.edg+40+edges.w]
  2316 000007EC A3[74CE]                		mov	[sstp.vv2], ax
  2317                                  outloop:
  2318 000007EF 8B0E[86CE]              		mov	cx, [sstp.mx2]
  2319 000007F3 2B0E[88CE]              		sub	cx, [sstp.mx1]
  2320 000007F7 0F8EAD00                		jle	exitol
  2321 000007FB 83F910                  		cmp	cx, SUBRANGE ; 10h
  2322 000007FE 7E03                    		jle	short lastSeg
  2323 00000800 B91000                  		mov	cx, SUBRANGE ; 10h
  2324                                  lastSeg:
  2325                                  		;{ uu1:=uu2 }
  2326                                  		;{ vv1:=vv2 }
  2327 00000803 66A1[74CE]              		mov	eax, [sstp.vv2]
  2328 00000807 66A3[78CE]              		mov	[sstp.vv1], eax
  2329                                  
  2330 0000080B 66A1[B6CE]              		mov	eax, [sstp.del+40+edges.u]
  2331 0000080F 66F7E9                  		imul	ecx
  2332 00000812 660106[F2CE]            		add	[sstp.edg+40+edges.u], eax
  2333 00000817 66A1[BACE]              		mov	eax, [sstp.del+40+edges.v]
  2334 0000081B 66F7E9                  		imul	ecx
  2335 0000081E 660106[F6CE]            		add	[sstp.edg+40+edges.v], eax
  2336 00000823 66A1[BECE]              		mov	eax, [sstp.del+40+edges.w]
  2337 00000827 66F7E9                  		imul	ecx
  2338 0000082A 660106[FACE]            		add	[sstp.edg+40+edges.w], eax
  2339                                  
  2340 0000082F BB0001                  		mov	bx, 256 ; 100h
  2341 00000832 66A1[F2CE]              		mov	eax, [sstp.edg+40+edges.u]
  2342 00000836 66F7EB                  		imul	ebx
  2343 00000839 66F73E[FACE]            		idiv	dword [sstp.edg+40+edges.w]
  2344 0000083E A3[76CE]                		mov	[sstp.uu2], ax
  2345 00000841 66A1[F6CE]              		mov	eax, [sstp.edg+40+edges.v]
  2346 00000845 66F7EB                  		imul	ebx
  2347 00000848 66F73E[FACE]            		idiv	dword [sstp.edg+40+edges.w]
  2348 0000084D A3[74CE]                		mov	[sstp.vv2], ax
  2349                                  
  2350 00000850 A1[76CE]                		mov	ax, [sstp.uu2]
  2351 00000853 2B06[7ACE]              		sub	ax, [sstp.uu1]
  2352 00000857 99                      		cwd
  2353 00000858 F7F9                    		idiv	cx
  2354                                  		;mov	[cs:ddu_pos+2], ax
  2355 0000085A A3[CC0C]                		mov	[ddu_pos_w], ax
  2356                                  
  2357 0000085D A1[74CE]                		mov	ax, [sstp.vv2]
  2358 00000860 2B06[78CE]              		sub	ax, [sstp.vv1]
  2359 00000864 99                      		cwd
  2360 00000865 F7F9                    		idiv	cx
  2361                                  		;mov	[cs:ddv_pos+2], ax
  2362 00000867 A3[CE0C]                		mov	[ddv_pos_w], ax
  2363                                  
  2364 0000086A 8B36[78CE]              		mov	si, [sstp.vv1]
  2365 0000086E 8B16[7ACE]              		mov	dx, [sstp.uu1]
  2366 00000872 A1[FECE]                		mov	ax, [sstp.edg+40+16]
  2367                                  innerloop:
  2368 00000875 89F3                    		mov	bx, si
  2369 00000877 30DB                    		xor	bl, bl
  2370 00000879 C1EB02                  		shr	bx, 2
  2371 0000087C 00F3                    		add	bl, dh
  2372 0000087E 648A1F                  		mov	bl, [fs:bx]
  2373 00000881 08DB                    		or	bl, bl
  2374 00000883 7409                    		jz	short dels_pos
  2375 00000885 88E7                    		mov	bh, ah
  2376 00000887 8A9F[8733]              		mov	bl, [bx+shadetab]
  2377                                  
  2378 0000088B 26881D                  		mov	[es:di], bl
  2379                                  
  2380                                  ;dels_pos:	add ax, 1111h ;{word ptr dels}
  2381                                  ;ddu_pos:	add dx, 1111h ;{word ptr ddu }
  2382                                  ;ddv_pos:	add si, 1111h ;{word ptr ddv }
  2383                                  
  2384                                  dels_pos:	
  2385 0000088E 0306[CA0C]              		add	ax, [dels_pos_w]
  2386                                  ddu_pos:	
  2387 00000892 0316[CC0C]              		add	dx, [ddu_pos_w]
  2388                                  ddv_pos:	
  2389 00000896 0336[CE0C]              		add	si, [ddv_pos_w]
  2390                                  
  2391 0000089A 47                      		inc	di	
  2392 0000089B E2D8                    		loop	innerloop
  2393                                  
  2394 0000089D A3[FECE]                		mov	[sstp.edg+40+16], ax
  2395 000008A0 8306[88CE]10            		add	word [sstp.mx1], SUBRANGE
  2396 000008A5 E947FF                  		jmp	outloop
  2397                                  exitol:
  2398 000008A8 BF2400                  clipup:		mov	di, 36 ; 24h
  2399                                  addloop:
  2400 000008AB 668B85[8ACE]            		mov	eax, [di+sstp.del]
  2401 000008B0 660185[C6CE]            		add	[di+sstp.edg], eax
  2402 000008B5 83EF04                  		sub	di, 4
  2403 000008B8 79F1                    		jns	short addloop
  2404 000008BA FF06[80CE]              		inc	word [sstp.y]
  2405 000008BE E907FE                  		jmp	for
  2406                                  exitDraw:
  2407 000008C1 5D                      		pop	bp
  2408                                  	
  2409 000008C2 C20600                  		ret	6
  2410                                  
  2411                                    ;***********************************************
  2412                                    ;* descript. : calc deltas for vertical interp.*
  2413                                    ;* parameter : none			         *
  2414                                    ;* sideeffect: all		 	         *
  2415                                    ;***********************************************
  2416                                  
  2417                                  calcDeltas:
  2418 000008C5 6BD324                  		imul	dx, bx,	36
  2419 000008C8 89F3                    		mov	bx, si
  2420 000008CA 8B7608                  		mov	si, [bp+pol]	; [bp+8]
  2421 000008CD 01D6                    		add	si, dx
  2422                                  		;
  2423                                  		;mov	si, dx
  2424                                  		;add	si, [bp+pol]	; [bp+8]	
  2425 000008CF 8B440C                  		mov	ax, [si+12]
  2426 000008D2 2B06[80CE]              		sub	ax, [sstp.y]
  2427 000008D6 660FBFC0                		movsx	eax, ax
  2428 000008DA 66A3[6CCE]              		mov	[sstp.dy], eax
  2429 000008DE B90500                  		mov	cx, 5
  2430                                  cDloop:
  2431 000008E1 668B5710                		mov	edx, [bx+16]
  2432 000008E5 668995[C6CE]            		mov	[di+sstp.edg], edx
  2433 000008EA 668B4410                		mov	eax, [si+16]
  2434 000008EE 6629D0                  		sub	eax, edx
  2435 000008F1 6699                    		cdq
  2436 000008F3 833E[6CCE]00            		cmp	word [sstp.dy], 0
  2437 000008F8 740A                    		je	short cDskip
  2438 000008FA 66F73E[6CCE]            		idiv	dword [sstp.dy]
  2439 000008FF 668985[8ACE]            		mov	[di+sstp.del], eax
  2440                                  cDskip:
  2441 00000904 83C704                  		add	di, 4
  2442 00000907 83C604                  		add	si, 4
  2443 0000090A 83C304                  		add	bx, 4
  2444 0000090D E2D2                    		loop	cDloop
  2445 0000090F C3                      		retn
  2446                                  
  2447                                  
  2448                                  ;***********************************************
  2449                                  ;* descript. : clip a poly at the viewplane,   *
  2450                                  ;*             project and draw it	       *
  2451                                  ;* parameter : bx:adress of the face	       *
  2452                                  ;* sideeffect: all		 	       *
  2453                                  ;* back      : none			       *
  2454                                  ;***********************************************
  2455                                  
  2456                                  drawclippedface:
  2457                                  		; 11/08/2017
  2458                                  
  2459                                  		dcf.d	equ -2	  ; word
  2460                                  		dcf.h	equ -4	  ; word	
  2461                                  		dcf.j	equ -6	  ; word
  2462                                  		dcf.col equ -8	  ; word
  2463                                  		dcf.is_in equ -10 ; byte
  2464                                  		dcf.p0	equ -190  ; poly (5*36 bytes)
  2465                                  		dcf.p2	equ -370  ; poly (5*36 bytes)
  2466                                  		;
  2467                                  		;dcf.pad equ -372  ; padding (for dword boundary)
  2468                                  
  2469 00000910 C8720100                		enter	370, 0  ; 172h
  2470                                  		;enter	372, 0  ; 174h ; 12/12/2016
  2471                                   			; push bp ; mov bp, sp ; sub sp, 372
  2472 00000914 BE[6C0F]                		mov	si, uvtab
  2473 00000917 31FF                    		xor	di, di
  2474 00000919 B90400                  		mov	cx, 4
  2475                                  dCFinitloop:
  2476 0000091C 53                      		push	bx	; face addr (in 'object.f')(29/01/2017)
  2477 0000091D 8B1F                    		mov	bx, word [bx] ; point index into 'rp:' ? (29/01/2017)
  2478                                  
  2479 0000091F 53                      		push	bx
  2480 00000920 6BDB0C                  		imul	bx, bx, 12 ; (point vector size = 12 bytes)
  2481 00000923 81C3[67B5]              		add	bx, rp	  ; addr of rotated point vects (29/01/2017)
  2482 00000927 668B07                  		mov	eax, dword [bx]
  2483                                  		; vector(4-cx).x
  2484 0000092A 66898342FF              		mov	dword [bp+di+dcf.p0+0], eax	; [bp+di-0BEh]
  2485                                  		; vector(4-cx).y
  2486 0000092F 668B4704                		mov	eax, dword [bx+4]
  2487 00000933 66898346FF              		mov	dword [bp+di+dcf.p0+4], eax	; [bp+di-0BAh]
  2488                                  
  2489 00000938 D94708                  		fld	dword [bx+8]
  2490                                  		; vector(4-cx).z
  2491 0000093B D9934AFF                		fst	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  2492 0000093F DF5EFC                  		fistp	word [bp+dcf.h]		; [bp-04h]	
  2493                                  						; dcf.h = z distance
  2494 00000942 5B                      		pop	bx
  2495                                  
  2496 00000943 8B46FC                  		mov	ax, word [bp+dcf.h]		; [bp-04h]
  2497 00000946 050002                  		add	ax, 512	; 200h
  2498 00000949 0F881401                		js	dCFbackclip   ; not visible ? (29/01/2017) 
  2499                                  
  2500 0000094D 3DFF01                  		cmp	ax, 511 ; 1FFh
  2501 00000950 7E03                    		jle	short intensityOK
  2502 00000952 B8FF01                  		mov	ax, 511 ; 1FFh		; maximum z distance (dept) ?
  2503                                  intensityOK:
  2504 00000955 C1E303                  		shl	bx, 3 ; point index * 8
  2505 00000958 6631D2                  		xor	edx, edx
  2506 0000095B C1E007                  		shl	ax, 7
  2507 0000095E F7A7[9E16]              		mul	word [bx+6+object.p]
  2508                                  		; edges(4-cx).s
  2509 00000962 66899362FF              		mov	dword [bp+di+dcf.p0+32], edx	; [bp+di-9Eh]
  2510                                  
  2511 00000967 30E4                    		xor	ah, ah
  2512 00000969 8A4404                  		mov	al, byte [si+4]
  2513 0000096C 66C1E010                		shl	eax, 16	; 10h
  2514                                  		; edges(4-cx).v
  2515 00000970 6689835AFF              		mov	dword [bp+di+dcf.p0+24], eax	; [bp+di-0A6h]
  2516                                  
  2517 00000975 AC                      		lodsb
  2518 00000976 66C1E010                		shl	eax, 16	; 10h
  2519                                  		; edges(4-cx).u
  2520 0000097A 66898356FF              		mov	dword [bp+di+dcf.p0+20], eax	; [bp+di-0AAh]
  2521                                  
  2522 0000097F 5B                      		pop	bx
  2523 00000980 43                      		inc	bx
  2524 00000981 43                      		inc	bx
  2525 00000982 83C724                  		add	di, 36	; 24h  ; size of edge
  2526 00000985 E295                    		loop	dCFinitloop
  2527                                  		;dec	cx
  2528                                  		;jnz	dCFinitloop
  2529                                  
  2530                                  		; end of p1, p2, p3, p4 point dimensioning of face
  2531                                  		; 
  2532                                  		; p1 ...... p2
  2533                                  		;  .	    .	
  2534                                  		;  . shade  .
  2535                                  		;  .        .
  2536                                  		; p3 ...... p4
  2537                                  		;
  2538                                  		; p1 (x,y,z) ... p4 (x,y,z)
  2539                                  		;
  2540                                  
  2541 00000987 8B07                    		mov	ax, word [bx]		; shade
  2542 00000989 8946F8                  		mov	word [bp+dcf.col], ax	; [bp-08h]
  2543                                  
  2544 0000098C 31DB                    		xor	bx, bx
  2545 0000098E 895EFA                  		mov	word [bp+dcf.j], bx	; [bp-06h]
  2546                                  
  2547                                  		; vector(3).z
  2548 00000991 D946B6                  		fld	dword [bp+dcf.p0+108+8] ; [bp-4Ah]
  2549 00000994 D9E4                    		ftst
  2550                                  		;fstsw	ax
  2551 00000996 DFE0                    		fnstsw	ax
  2552 00000998 DDD8                    		fstp	st0
  2553 0000099A 9E                      		sahf
  2554 0000099B 7301                    		jae	short isFalse
  2555 0000099D 4B                      		dec	bx
  2556                                  isFalse:
  2557 0000099E 885EF6                  		mov	byte [bp+dcf.is_in], bl	; [bp-0Ah]
  2558 000009A1 31F6                    		xor	si, si
  2559 000009A3 31FF                    		xor	di, di 
  2560                                  forloop:
  2561                                  		; vector(0-3).z
  2562 000009A5 D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  2563 000009A9 D9E4                    		ftst
  2564                                  		;fstsw	ax
  2565 000009AB DFE0                    		fnstsw	ax
  2566 000009AD DDD8                    		fstp	st0
  2567 000009AF 9E                      		sahf
  2568 000009B0 732B                    		jae	short elseFall
  2569                                  
  2570 000009B2 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; -1 ; true
  2571 000009B6 7406                    		je	short inside
  2572 000009B8 E8A800                  		call	clipsub
  2573                                  		; { OUT / IN }
  2574 000009BB F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  2575                                  inside:
  2576 000009BE 57                      		push	di
  2577 000009BF 56                      		push	si
  2578 000009C0 8DBB8EFE                		lea	di, [bp+di+dcf.p2]	; [bp+di-172h]
  2579 000009C4 8DB242FF                		lea	si, [bp+si+dcf.p0]	; [bp+si-0BEh]
  2580                                  
  2581 000009C8 16                      		push	ss
  2582 000009C9 07                      		pop	es
  2583 000009CA 1E                      		push	ds
  2584 000009CB 16                      		push	ss
  2585 000009CC 1F                      		pop	ds
  2586 000009CD B91200                  		mov	cx, 18	; 12h
  2587 000009D0 F3A5                    		rep movsw			; { IN / IN }
  2588 000009D2 1F                      		pop	ds
  2589                                  
  2590 000009D3 5E                      		pop	si
  2591 000009D4 5F                      		pop	di
  2592 000009D5 83C724                  		add	di, 36	; 24h
  2593 000009D8 FF46FA                  		inc	word [bp+dcf.j]		; [bp-06h]
  2594 000009DB EB0C                    		jmp	short dCFendif
  2595                                  elseFall:
  2596 000009DD 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; [bp-0Ah]
  2597 000009E1 7506                    		jne	short outside
  2598 000009E3 E87D00                  		call	clipsub
  2599                                  		; { IN / OUT }
  2600 000009E6 F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  2601                                  outside:
  2602 000009E9 83C624                  dCFendif:	add	si, 36 ; 24h
  2603 000009EC 81FE9000                		cmp	si, 4*36 ; 90h
  2604 000009F0 75B3                    		jne	short forloop
  2605                                  
  2606 000009F2 8B4EFA                  		mov	cx, word [bp+dcf.j]	; [bp-06h]
  2607 000009F5 83F902                  		cmp	cx, 2
  2608 000009F8 7C67                    		jl	dCFnodraw
  2609 000009FA 31FF                    		xor	di, di
  2610                                  dCFloop:
  2611 000009FC DF06[FC0C]              		fild	word [CONST13]
  2612 00000A00 D8A396FE                		fsub	dword [bp+di+dcf.p2+8]	; [bp+di-16Ah]
  2613 00000A04 DE36[000D]              		fidiv	word [CONST160]
  2614                                  		
  2615 00000A08 D98392FE                		fld	dword [bp+di+dcf.p2+4]	; [bp+di-16Eh]
  2616 00000A0C D8F1                    		fdiv	st0, st1
  2617 00000A0E DE06[FE0C]              		fiadd	word [CONST100]
  2618 00000A12 DB9B9AFE                		fistp	dword [bp+di+dcf.p2+12] ; [bp+di-166h]
  2619                                  		
  2620 00000A16 D9838EFE                		fld	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2621 00000A1A D80E[F80C]              		fmul	dword [ASPECT_PLACE]
  2622 00000A1E D8F1                    		fdiv	st0, st1
  2623 00000A20 DE06[000D]              		fiadd	word [CONST160]
  2624 00000A24 D9FC                    		frndint
  2625 00000A26 DA0E[040D]              		fimul	dword [CONST65536]
  2626 00000A2A DB9B9EFE                		fistp	dword [bp+di+dcf.p2+16] ; [bp+di-162h]
  2627                                  
  2628 00000A2E DB83A2FE                		fild	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2629 00000A32 D8F1                    		fdiv	st0, st1
  2630 00000A34 DB9BA2FE                		fistp	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2631                                  		
  2632 00000A38 DB83A6FE                		fild	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2633 00000A3C D8F1                    		fdiv	st0, st1
  2634 00000A3E DB9BA6FE                		fistp	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2635                                  		
  2636 00000A42 DB06[040D]              		fild	dword [CONST65536]
  2637 00000A46 D8F1                    		fdiv	st0, st1
  2638 00000A48 DB9BAAFE                		fistp	dword [bp+di+dcf.p2+28] ; [bp+di-156h]
  2639                                  		
  2640 00000A4C DDD8                    		fstp	st0
  2641 00000A4E 83C724                  		add	di, 36 ; 24h
  2642 00000A51 E2A9                    		loop	dCFloop
  2643                                  		;dec	cx
  2644                                  		;jnz	dCFloop
  2645                                  
  2646 00000A53 8DBE8EFE                		lea	di, [bp+dcf.p2]		; [bp-172h]
  2647 00000A57 57                      		push	di
  2648 00000A58 FF76FA                  		push	word [bp+dcf.j]		; [bp-06h]	 
  2649 00000A5B FF76F8                  		push	word [bp+dcf.col]	; [bp-08h]
  2650 00000A5E E8D5FB                  		call	scansubtextpoly
  2651                                  dCFnodraw:
  2652 00000A61 C9                      dCFbackclip:	leave
  2653                                  			; mov sp, bp ; pop bp
  2654 00000A62 C3                      		retn
  2655                                  
  2656                                  clipsub:
  2657 00000A63 56                      		push	si
  2658 00000A64 57                      		push	di
  2659 00000A65 8D44DC                  		lea	ax, [si-36]		; [si-24h]
  2660 00000A68 83F800                  		cmp	ax, 0
  2661 00000A6B 7D03                    		jge	short cSnounder
  2662 00000A6D B86C00                  		mov	ax, 108 ; 6Ch
  2663                                  cSnounder:
  2664 00000A70 D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  2665 00000A74 D9C0                    		fld	st0
  2666 00000A76 97                      		xchg	ax, di
  2667 00000A77 D8A34AFF                		fsub	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  2668 00000A7B 97                      		xchg	ax, di
  2669 00000A7C DEF9                    		fdivp	st1, st0
  2670                                  		;fdiv
  2671                                  
  2672 00000A7E BB[670F]                		mov	bx, cliptab
  2673 00000A81 B90600                  		mov	cx, 6
  2674                                  dCFclipLoop2:
  2675 00000A84 97                      		xchg	ax, di
  2676 00000A85 D98342FF                		fld	dword [bp+di+dcf.p0]	; [bp+di-0BEh]
  2677 00000A89 97                      		xchg	ax, di
  2678 00000A8A D8A242FF                		fsub	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2679 00000A8E D8C9                    		fmul	st0, st1
  2680 00000A90 D88242FF                		fadd	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2681 00000A94 D99B8EFE                		fstp	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2682                                  
  2683 00000A98 8A17                    		mov	dl, byte [bx]
  2684 00000A9A 43                      		inc	bx
  2685 00000A9B 30F6                    		xor	dh, dh
  2686 00000A9D 01D7                    		add	di, dx
  2687 00000A9F 01D6                    		add	si, dx
  2688 00000AA1 01D0                    		add	ax, dx
  2689 00000AA3 E2DF                    		loop	dCFclipLoop2
  2690 00000AA5 DDD8                    		fstp	st0
  2691 00000AA7 5F                      		pop	di
  2692 00000AA8 5E                      		pop	si
  2693 00000AA9 FF46FA                  		inc	word [bp+dcf.j] 	; [bp-6]
  2694 00000AAC 83C724                  		add	di, 36 ; 24h
  2695 00000AAF C3                      		retn
  2696                                  
  2697                                  ;***********************************************
  2698                                  ;* descript. : rotate point over one axis      *
  2699                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2700                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2701                                  ;* sideeffect: empty copro-stack               *
  2702                                  ;* back      : none			       *
  2703                                  ;***********************************************
  2704                                  
  2705                                  rotateAxis:
  2706 00000AB0 D9EB                    		fldpi				;{ PI,a}
  2707 00000AB2 DEC9                    		fmulp	st1, st0		;{ PI*a}	
  2708                                  		;fmul
  2709 00000AB4 DA36[040D]              		fidiv	dword [CONST65536]	;{ PI*a/65536}
  2710 00000AB8 D9FB                    		fsincos				;{ cos,sin}
  2711 00000ABA D9C0                    		fld	st0			;{ cos,cos,sin}
  2712 00000ABC D80C                    		fmul	dword [si] 		;{ y*cos,cos,sin}
  2713 00000ABE D9C2                    		fld	st2			;{ sin,y*cos,cos,sin}
  2714 00000AC0 D80F                    		fmul	dword [bx]		;{ z*sin,y*cos,cos,sin}
  2715 00000AC2 DEE9                    		fsubp	st1, st0		;{ y*cos-z*sin,cos,sin}
  2716 00000AC4 D9CA                    		fxch	st2			;{ sin,cos,y*cos-z*sin}
  2717 00000AC6 D80C                    		fmul	dword [si]		;{ y*sin,cos,y*cos-z*sin}
  2718 00000AC8 D9C9                    		fxch	st1			;{ cos,y*sin,y*cos-z*sin}
  2719 00000ACA D80F                    		fmul	dword [bx]		;{ z*cos,y*sin,y*cos-z*sin}
  2720 00000ACC DEC1                    		faddp	st1, st0		;{ y*sin+z*cos,y*cos-z*sin}
  2721 00000ACE D91F                    		fstp	dword [bx]		;{ y*cos-z*sin}
  2722 00000AD0 D91C                    		fstp	dword [si]		;{}
  2723 00000AD2 C3                      		retn
  2724                                  
  2725                                  ;***********************************************
  2726                                  ;* descript. : rotate point		       *
  2727                                  ;* parameter : a,b,c:angles,adr:address        *
  2728                                  ;* sideeffect: all		 	       *
  2729                                  ;* back      : none			       *
  2730                                  ;***********************************************
  2731                                  
  2732                                  xyzRotate:
  2733                                  		adr	equ 4	; arg 1, [sp+2]
  2734                                  		c	equ 6	; arg 2, [sp+4]	
  2735                                  		b	equ 8	; arg 3, [sp+6]
  2736                                  		a	equ 10	; arg 4, [sp+8]
  2737                                  
  2738 00000AD3 55                      		push	bp
  2739 00000AD4 89E5                    		mov	bp, sp
  2740                                  	
  2741 00000AD6 8B7E04                  		mov	di, [bp+adr]
  2742 00000AD9 DF460A                  		fild	word [bp+a]
  2743 00000ADC 8D5D08                  		lea	bx, [di+8]
  2744 00000ADF 8D7504                  		lea	si, [di+4]
  2745 00000AE2 E8CBFF                  		call	rotateAxis
  2746 00000AE5 DF4608                  		fild	word [bp+b]
  2747 00000AE8 8D1D                    		lea	bx, [di]
  2748 00000AEA 8D7508                  		lea	si, [di+8]
  2749 00000AED E8C0FF                  		call	rotateAxis
  2750 00000AF0 DF4606                  		fild	word [bp+c]
  2751 00000AF3 8D5D04                  		lea	bx, [di+4]
  2752 00000AF6 8D35                    		lea	si, [di]
  2753 00000AF8 E8B5FF                  		call	rotateAxis
  2754                                  
  2755 00000AFB 5D                      		pop	bp
  2756 00000AFC C20800                  		ret	8
  2757                                  
  2758                                  ;***********************************************
  2759                                  ;* descript. : calculate world matrix	       *
  2760                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2761                                  ;* sideeffect: all		 	       *
  2762                                  ;* back      : none			       *
  2763                                  ;***********************************************
  2764                                  
  2765                                  calcRotMat:
  2766                                  		neig	equ 4   ; arg 1, [sp+2]
  2767                                  		zw	equ 6	; arg 2, [sp+4]	
  2768                                  		yw	equ 8	; arg 3, [sp+6]
  2769                                  		xw	equ 10  ; arg 4, [sp+8]
  2770                                  
  2771 00000AFF 55                      		push	bp
  2772 00000B00 89E5                    		mov	bp, sp
  2773                                  
  2774 00000B02 BF[FE12]                		mov	di, nwmat
  2775                                  		identityMat
  2776 00000B05 B502                <1>  mov ch, 2
  2777                              <1> iMolp:
  2778 00000B07 B102                <1>  mov cl, 2
  2779                              <1> iMilp:
  2780 00000B09 D9EE                <1>  fldz
  2781 00000B0B 38CD                <1>  cmp ch, cl
  2782 00000B0D 7504                <1>  jne short iMwritezero
  2783 00000B0F DDD8                <1>  fstp st0
  2784 00000B11 D9E8                <1>  fld1
  2785                              <1> iMwritezero:
  2786 00000B13 D91D                <1>  fstp dword [di]
  2787 00000B15 83C704              <1>  add di, 4
  2788 00000B18 FEC9                <1>  dec cl
  2789 00000B1A 79ED                <1>  jns short iMilp
  2790 00000B1C FECD                <1>  dec ch
  2791 00000B1E 79E7                <1>  jns short iMolp
  2792 00000B20 31FF                    		xor	di, di
  2793                                  cRMolp:
  2794 00000B22 57                      		push	di
  2795 00000B23 FF760A                  		push	word [bp+xw]
  2796 00000B26 FF7608                  		push	word [bp+yw]
  2797 00000B29 FF7606                  		push	word [bp+zw]
  2798 00000B2C 81C7[FE12]              		add	di, nwmat
  2799 00000B30 57                      		push	di
  2800 00000B31 E89FFF                  		call	xyzRotate
  2801 00000B34 5F                      		pop	di
  2802 00000B35 31DB                    		xor	bx, bx
  2803                                  cRMilp:
  2804 00000B37 D985[FE12]              		fld	dword [di+nwmat]
  2805 00000B3B D88F[B612]              		fmul	dword [bx+owmat]
  2806 00000B3F D985[0213]              		fld	dword [di+nwmat+4]
  2807 00000B43 D88F[C212]              		fmul	dword [bx+owmat+12]
  2808 00000B47 D985[0613]              		fld	dword [di+nwmat+8]
  2809 00000B4B D88F[CE12]              		fmul	dword [bx+owmat+24]
  2810 00000B4F DEC1                    		fadd
  2811 00000B51 DEC1                    		fadd
  2812 00000B53 D991[B612]              		fst	dword [bx+di+owmat]
  2813 00000B57 D999[DA12]              		fstp	dword [bx+di+wmat]
  2814 00000B5B 83C304                  		add	bx, 4
  2815 00000B5E 80FB0C                  		cmp	bl, 12
  2816 00000B61 75D4                    		jne	short cRMilp
  2817 00000B63 83C70C                  		add	di, 12
  2818 00000B66 83FF24                  		cmp	di, 36
  2819 00000B69 75B7                    		jne	short cRMolp
  2820                                  
  2821 00000B6B BE[DA12]                		mov	si, wmat
  2822 00000B6E B90300                  		mov	cx, 3
  2823                                  cRMneigloop:
  2824 00000B71 DF4604                  		fild	word [bp+neig]
  2825 00000B74 8D5C0C                  		lea	bx, [si+12]
  2826 00000B77 E836FF                  		call	rotateAxis
  2827 00000B7A 83C604                  		add	si, 4
  2828 00000B7D E2F2                    		loop	cRMneigloop
  2829                                  
  2830 00000B7F 5D                      		pop	bp
  2831 00000B80 C20800                  		ret	8
  2832                                  
  2833                                  ;***********************************************
  2834                                  ;* descript. : create the world		       *
  2835                                  ;* parameter : none			       *
  2836                                  ;* sideeffect: all		               *
  2837                                  ;* back      : none			       *
  2838                                  ;***********************************************
  2839                                  
  2840                                  createWorld:
  2841                                  		; 11/08/2017
  2842                                  
  2843 00000B83 BE[B90F]                		mov	si, world
  2844 00000B86 B90400                  		mov	cx, 4
  2845                                  cWworldLoop:
  2846 00000B89 51                      		push	cx
  2847 00000B8A 56                      		push	si
  2848 00000B8B BF[87B3]                		mov	di, p
  2849 00000B8E BB[FFB3]                		mov	bx, pr
  2850 00000B91 BE[8C0F]                		mov	si, print
  2851 00000B94 B10F                    		mov	cl, 15 ; 0Fh
  2852                                  cWinitStartRoom:
  2853 00000B96 51                      		push	cx
  2854 00000B97 B103                    		mov	cl, 3
  2855                                  cWinnerLoop:
  2856 00000B99 AC                      		lodsb  ; byte data (to be converted to dword) from the 'print:'
  2857 00000B9A 98                      		cbw    ; convert byte to word with sign (0E0h -> FFE0h)	
  2858 00000B9B AB                      		stosw  ; store world coordinate/dimension as integer (word), to 'p:' 
  2859 00000B9C DF45FE                  		fild	word [di-2]
  2860 00000B9F D91F                    		fstp	dword [bx] ; store coordinate as floatpoint
  2861 00000BA1 83C304                  		add	bx, 4 ; next dimension (x,y,z) in 'pr:'
  2862 00000BA4 E2F3                    		loop	cWinnerLoop
  2863 00000BA6 59                      		pop	cx
  2864 00000BA7 B8007F                  		mov	ax, 127*256 ; 7F00h ;  4th dimension in 'p:'
  2865 00000BAA AB                      		stosw
  2866 00000BAB E2E9                    		loop	cWinitStartRoom
  2867 00000BAD 5E                      		pop	si
  2868                                  cWmainLoop:
  2869 00000BAE AC                      		lodsb	; the byte from 'world:' for shade and direction
  2870 00000BAF 3CFF                    		cmp	al, 255 ; 0FFh
  2871 00000BB1 0F840E01                		je	cWexit  ; end of stage (1 to 4)
  2872                                  
  2873 00000BB5 88C7                    		mov	bh, al  ; High 4 bits for shading
  2874 00000BB7 81E30070                		and	bx, 7000h
  2875 00000BBB 80C70F                  		add	bh, 15 ; 0Fh
  2876 00000BBE 891E[6ACE]              		mov	[cw.shade], bx
  2877 00000BC2 83E00F                  		and	ax, 0Fh ; 15   ; Low 4 bits for direction
  2878 00000BC5 A3[68CE]                		mov	[cw.direc], ax
  2879                                  
  2880 00000BC8 31DB                    		xor	bx, bx
  2881                                  cWsideLoop:
  2882 00000BCA F6C304                  		test	bl, 4
  2883 00000BCD 7405                    		jz	short cWfirstNibble
  2884 00000BCF AC                      		lodsb
  2885 00000BD0 240F                    		and	al, 0Fh ; 15
  2886 00000BD2 EB05                    		jmp	short cWsecondNibble
  2887                                  cWfirstNibble:
  2888 00000BD4 8A04                    		mov	al, [si]
  2889 00000BD6 C0E804                  		shr	al, 4
  2890                                  cWsecondNibble:
  2891 00000BD9 30E4                    		xor	ah, ah
  2892 00000BDB 48                      		dec	ax
  2893 00000BDC 7850                    		js	short cWnoWall ; ax = 0 -> ax = 0FFFFh
  2894 00000BDE 6B3E[9616]0A            		imul	di, word [object.fanz], 10 ; 0Ah
  2895 00000BE3 81C7[1823]              		add	di, object.f ; base address + offset
  2896 00000BE7 FF06[9616]              		inc	word [object.fanz] ; faces = faces + 1
  2897 00000BEB 894508                  		mov	word [di+8], ax ; 4th word is shading value
  2898                                  
  2899 00000BEE 53                      		push	bx
  2900 00000BEF 56                      		push	si
  2901 00000BF0 B104                    		mov	cl, 4
  2902                                  cWaddPointloop:
  2903 00000BF2 0FBEB7[740F]            		movsx	si, byte [bx+cube] ; cube coordinate offset
  2904 00000BF7 81C6[87B3]              		add	si, p ; + base address (p:)
  2905                                  
  2906 00000BFB 57                      		push	di
  2907 00000BFC BF[9816]                		mov	di, object.p  ; p area of object structure
  2908 00000BFF 51                      		push	cx
  2909 00000C00 8B0E[9416]              		mov	cx, [object.panz] ; number of points (for object.p)
  2910 00000C04 31C0                    		xor	ax, ax
  2911 00000C06 E316                    		jcxz	cWfirstPoint
  2912                                  cWsearchPointLoop: ; check point coordinates are same or not
  2913 00000C08 668B14                  		mov	edx, [si]
  2914 00000C0B 663B15                  		cmp	edx, [di]
  2915 00000C0E 7508                    		jne	short cWdifferent
  2916 00000C10 8B5404                  		mov	dx, [si+4]
  2917 00000C13 3B5504                  		cmp	dx, [di+4]
  2918 00000C16 740E                    		je	short cWpointExists
  2919                                  cWdifferent:
  2920 00000C18 40                      		inc	ax ; number of different points (of object)
  2921 00000C19 83C708                  		add	di, 8
  2922 00000C1C E2EA                    		loop	cWsearchPointLoop
  2923                                  cWfirstPoint:
  2924 00000C1E 66A5                    		movsd
  2925 00000C20 66A5                    		movsd
  2926 00000C22 FF06[9416]              		inc	word [object.panz] ; points = points + 1
  2927                                  cWpointExists:
  2928 00000C26 59                      		pop	cx
  2929 00000C27 5F                      		pop	di
  2930 00000C28 AB                      		stosw   ; store num of different points
  2931                                  			; in the Xth word of face structure (5 words)
  2932                                  			; (Xth word of 'object.f', X = 4-CL)
  2933 00000C29 43                      		inc	bx
  2934 00000C2A E2C6                    		loop	cWaddPointloop
  2935 00000C2C 5E                      		pop	si
  2936 00000C2D 5B                      		pop	bx
  2937                                  cWnoWall:
  2938 00000C2E 83C304                  		add	bx, 4
  2939 00000C31 83FB18                  		cmp	bx, 24 ; 18h
  2940 00000C34 7594                    		jne	short cWsideLoop
  2941                                  
  2942 00000C36 6B3E[68CE]0C            		imul	di, word [cw.direc], 12
  2943                                  		; max value of [cw.direc] = 0Fh
  2944 00000C3B B103                    		mov	cl, 3
  2945 00000C3D BB[5FB4]                		mov	bx, pr+96 ; 24th dword of 'pr:'
  2946                                  cWaddStepLoop:
  2947 00000C40 D94748                  		fld	dword [bx+72] ; [bx+48h]
  2948 00000C43 D801                    		fadd	dword [bx+di]
  2949 00000C45 D95F48                  		fstp	dword [bx+72]
  2950 00000C48 83C304                  		add	bx, 4
  2951 00000C4B E2F3                    		loop	cWaddStepLoop
  2952                                  
  2953 00000C4D 807CFC00                		cmp	byte [si-4], 0
  2954 00000C51 7D23                    		jge	short cWsimpleRoom
  2955                                  
  2956 00000C53 BB[FFB3]                		mov	bx, pr
  2957 00000C56 B10E                    		mov	cl, 14 ; 0Eh
  2958                                  cWrotloop:
  2959 00000C58 60                      		pusha
  2960 00000C59 B103                    		mov	cl, 3
  2961 00000C5B 8A14                    		mov	dl, [si]
  2962                                  cWpushLoop:
  2963 00000C5D 31C0                    		xor	ax, ax
  2964 00000C5F D0EA                    		shr	dl, 1
  2965 00000C61 7305                    		jnc	short cWnoRot
  2966 00000C63 8A24                    		mov	ah, [si]
  2967                                  		;and	ax, 0F000h
  2968 00000C65 80E4F0                  		and	ah, 0F0h
  2969                                  		;push	ax
  2970                                  		;jmp	short cWendIf
  2971                                  cWnoRot:
  2972                                  		;push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2973 00000C68 50                      		push	ax
  2974                                  cWendIf:
  2975 00000C69 E2F2                    		loop	cWpushLoop
  2976 00000C6B 53                      		push	bx ; arg 1 (addr)
  2977 00000C6C E864FE                  		call	xyzRotate
  2978 00000C6F 61                      		popa
  2979 00000C70 83C30C                  		add	bx, 12 ; 0Ch
  2980 00000C73 E2E3                    		loop	cWrotloop
  2981 00000C75 46                      		inc	si
  2982                                  cWsimpleRoom:
  2983 00000C76 8B1E[68CE]              		mov	bx, [cw.direc]
  2984 00000C7A C1E302                  		shl	bx, 2
  2985 00000C7D B104                    		mov	cl, 4
  2986                                  cWpointCopyLoop:
  2987 00000C7F 60                      		pusha
  2988 00000C80 0FBEB7[740F]            		movsx	si, byte [bx+cube]
  2989 00000C85 89F0                    		mov	ax, si
  2990 00000C87 81C6[87B3]              		add	si, p ; + base address of 'p:'
  2991 00000C8B 80F307                  		xor	bl, 7
  2992 00000C8E 0FBEBF[740F]            		movsx	di, byte [bx+cube]
  2993 00000C93 81C7[87B3]              		add	di, p ; + base address of 'p:'
  2994 00000C97 56                      		push	si 
  2995 00000C98 66A5                    		movsd
  2996 00000C9A 66A5                    		movsd
  2997 00000C9C 5E                      		pop	si
  2998                                  
  2999 00000C9D 89C3                    		mov	bx, ax
  3000 00000C9F D1EB                    		shr	bx, 1
  3001 00000CA1 01C3                    		add	bx, ax
  3002 00000CA3 BF[FFB3]                		mov	di, pr ; + base address of 'pr:'
  3003 00000CA6 B103                    		mov	cl, 3
  3004                                  cWSround:
  3005 00000CA8 D901                    		fld	dword [bx+di]
  3006 00000CAA D885A800                		fadd	dword [di+168]  ; [di+0A8h]
  3007 00000CAE DF1C                    		fistp	word [si] ; world coordinate/dimension
  3008 00000CB0 83C704                  		add	di, 4
  3009 00000CB3 46                      		inc	si
  3010 00000CB4 46                      		inc	si
  3011 00000CB5 E2F1                    		loop	cWSround
  3012 00000CB7 A1[6ACE]                		mov	ax, [cw.shade]
  3013 00000CBA 8904                    		mov	[si], ax ; 4th word
  3014 00000CBC 61                      		popa
  3015 00000CBD 43                      		inc	bx
  3016 00000CBE E2BF                    		loop	cWpointCopyLoop
  3017 00000CC0 E9EBFE                  		jmp	cWmainLoop
  3018                                  cWexit:
  3019 00000CC3 59                      		pop	cx
  3020 00000CC4 49                      		dec	cx
  3021 00000CC5 0F85C0FE                		jnz	cWworldLoop
  3022                                  
  3023 00000CC9 C3                      		retn
  3024                                  
  3025 00000CCA 1111                    dels_pos_w:	dw 1111h
  3026 00000CCC 1111                    ddu_pos_w:	dw 1111h
  3027 00000CCE 1111                    ddv_pos_w:	dw 1111h
  3028                                  
  3029                                  prg_msg:
  3030 00000CD0 4552444F47414E2054-     		db	'ERDOGAN TAN - SNCOMNI.COM'
  3031 00000CD9 414E202D20534E434F-
  3032 00000CE2 4D4E492E434F4D     
  3033 00000CE9 0D0A                    		db	0Dh, 0Ah
  3034 00000CEB 31322F30382F323031-     		db	'12/08/2017'
  3035 00000CF4 37                 
  3036 00000CF5 0D0A                    		db	0Dh, 0Ah
  3037 00000CF7 00                      		db	0 
  3038                                  
  3039                                  ;=============================================================================
  3040                                  ;               preinitialized data
  3041                                  ;=============================================================================
  3042                                  
  3043 00000CF8 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  3044 00000CFC 0D00                    CONST13:	dw 13			; 000Dh			
  3045 00000CFE 6400                    CONST100:	dw CENTERY		; 0064h
  3046 00000D00 A000                    CONST160:	dw CENTERX		; 00A0h
  3047 00000D02 0007                    CONST1792:	dw 1792			; 0700h
  3048 00000D04 00000100                CONST65536:	dd 65536		; 00010000h
  3049 00000D08 05840808                randommul:	dd 134775813		; 08088405h
  3050 00000D0C FB100000                randomseed:	dd 4347			; 000010FBh
  3051                                  credits:
  3052 00000D10 0250FB                  		db	 2, 80,-5
  3053 00000D13 FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  3054 00000D1C 51023E0245024F023E-
  3055 00000D25 024502             
  3056 00000D28 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  3057 00000D31 0200               
  3058 00000D33 FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  3059 00000D3C 51023E0246024F023E-
  3060 00000D45 024602             
  3061 00000D48 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  3062 00000D51 0200               
  3063 00000D53 00                      		db       0
  3064 00000D54 37203820                		db      55,32,56,32			; { pat 10 }
  3065 00000D58 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  3066 00000D5E 39203220                		db      57,32,50,32		 ; { pat 12 }
  3067 00000D62 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  3068 00000D68 3740                    		db      55,64		   ; { pat 14 }
  3069 00000D6A FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  3070 00000D73 00                 
  3071 00000D74 FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  3072 00000D7D 00                 
  3073 00000D7E 00                      		db       0
  3074 00000D7F 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  3075 00000D85 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  3076 00000D8E 083C08             
  3077 00000D91 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  3078 00000D9A 08                 
  3079 00000D9B 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  3080 00000DA3 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  3081 00000DAB 3E80                    		db      62,128		  ;{ pat 8,9 }
  3082 00000DAD 4380                    		db      67,128		  ;{ pat 10,11 }
  3083 00000DAF 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  3084 00000DB8 08                 
  3085 00000DB9 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  3086 00000DBD 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  3087 00000DC1 FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  3088 00000DC7 FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  3089 00000DCD 00                      		db       0
  3090 00000DCE 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  3091 00000DD4 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  3092 00000DDC 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  3093 00000DE5 08                 
  3094 00000DE6 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  3095 00000DEF 18                 
  3096 00000DF0 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  3097 00000DF9 08                 
  3098 00000DFA 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  3099 00000E02 FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  3100 00000E08 FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  3101 00000E0E 00                      		db       0
  3102 00000E0F 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  3103 00000E18 2A012A0100         
  3104 00000E1D F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  3105 00000E26 2A0100             
  3106 00000E29 E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  3107 00000E32 2A012602           
  3108 00000E36 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  3109 00000E3E 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  3110 00000E47 0126022A022E022601-
  3111 00000E50 2A0100             
  3112 00000E53 00                      		db     	 0
  3113 00000E54 00                      		db	 0
  3114                                  
  3115                                  ; colortable 65 bytes
  3116 00000E55 10                      colors 		db	16
  3117 00000E56 1F3F3F3F                                db      31,63,63,63
  3118 00000E5A 01000000                                db	 1, 0, 0, 0
  3119 00000E5E 1F28203F                                db      31,40,32,63
  3120 00000E62 01000000                                db	 1, 0, 0, 0
  3121 00000E66 1F3F0000                                db      31,63, 0, 0
  3122 00000E6A 01060100                                db	 1, 6, 1, 0
  3123 00000E6E 1F3F2914                                db      31,63,41,20
  3124 00000E72 01000000                                db	 1, 0, 0, 0
  3125 00000E76 1F3F3F08                                db      31,63,63, 8
  3126 00000E7A 01000000                                db	 1, 0, 0, 0
  3127 00000E7E 1F38383F                                db	31,56,56,63
  3128 00000E82 013F0000                                db	 1,63, 0, 0
  3129 00000E86 103F3F00                                db      16,63,63, 0
  3130 00000E8A 103F0000                                db      16,63, 0, 0
  3131 00000E8E 01160500                                db	 1,22, 5, 0
  3132 00000E92 073F3811                                db       7,63,56,17
  3133                                  
  3134                                  ; parameter for the texture effects 156 bytes
  3135 00000E96 130F0F31310A            aE              db	013h,15,15,49,49,10
  3136 00000E9C 131010303011                            db      013h,16,16,48,48,17
  3137 00000EA2 1311112F2F18                            db      013h,17,17,47,47,24
  3138 00000EA8 1312122E2EBE                            db      013h,18,18,46,46,190
  3139 00000EAE 1315152B2B1E                            db      013h,21,21,43,43,30
  3140 00000EB4 2500003E1E03                            db      025h,0,0,62,30,3
  3141 00000EBA 2503033E1E07                            db      025h,3,3,62,30,7
  3142 00000EC0 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  3143 00000EC6 2500203E3E03                            db      025h,0,32,62,62,3
  3144 00000ECC 2503233E3E07                            db      025h,3,35,62,62,7
  3145 00000ED2 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  3146 00000ED8 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  3147 00000EDE 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  3148 00000EE4 2C000B3F1004                            db      02Ch,0,11,63,16,4
  3149 00000EEA 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  3150 00000EF0 2C00303F3504                            db      02Ch,0,48,63,53,4
  3151 00000EF6 2E13182C2705                            db      02Eh,19,24,44,39,5
  3152 00000EFC 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  3153 00000F02 2E14192B2607                            db      02Eh,20,25,43,38,7
  3154 00000F08 3E14192B2606                            db      03Eh,20,25,43,38,6
  3155 00000F0E 2F00183F1E06                            db      02Fh,0,24,63,30,6
  3156 00000F14 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  3157 00000F1A 3F00193F1E06                            db      03Fh,0,25,63,30,6
  3158 00000F20 2F00203F2606                            db      02Fh,0,32,63,38,6
  3159 00000F26 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  3160 00000F2C 3F00213F2606                            db      03Fh,0,33,63,38,6
  3161                                  
  3162                                  ; parameter for fractaladd 28 bytes
  3163 00000F32 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  3164 00000F3B 0020202040         
  3165 00000F40 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  3166 00000F49 0024002400         
  3167                                  
  3168                                  ; star bob for the sparcling stars texture 25 bytes
  3169 00000F4E 0000030000              bob:            db	0,0,3,0,0
  3170 00000F53 0002050200                              db	0,2,5,2,0
  3171 00000F58 0305070503                              db	3,5,7,5,3
  3172 00000F5D 0002050200                              db	0,2,5,2,0
  3173 00000F62 0000030000                              db	0,0,3,0,0
  3174                                  
  3175 00000F67 04040C0408              cliptab:	db	4,4,12,4,8
  3176                                  
  3177 00000F6C 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  3178                                  
  3179 00000F74 08283010                cube:		db	1*8,5*8,6*8,2*8
  3180 00000F78 18382000                                db      3*8,7*8,4*8,0*8
  3181 00000F7C 10303818                                db      2*8,6*8,7*8,3*8
  3182 00000F80 00202808                                db      0*8,4*8,5*8,1*8
  3183 00000F84 38302820                        	db	7*8,6*8,5*8,4*8
  3184 00000F88 00081018                                db      0*8,1*8,2*8,3*8
  3185                                  
  3186 00000F8C E0E0E0                  print:		db	-32,-32,-32
  3187 00000F8F 20E0E0                                  db       32,-32,-32
  3188 00000F92 2020E0                                  db   	 32, 32,-32
  3189 00000F95 E020E0                                  db  	-32, 32,-32
  3190 00000F98 E0E020                                  db  	-32,-32, 32
  3191 00000F9B 20E020                                  db       32,-32, 32
  3192 00000F9E 202020                                  db   	 32, 32, 32
  3193 00000FA1 E02020                                  db  	-32, 32, 32
  3194 00000FA4 400000                                  db       64,  0,  0
  3195 00000FA7 C00000                                  db      -64,  0,  0
  3196 00000FAA 004000                                  db        0, 64,  0
  3197 00000FAD 00C000                                  db        0,-64,  0
  3198 00000FB0 000040                                  db        0,  0, 64
  3199 00000FB3 0000C0                                  db        0,  0,-64
  3200 00000FB6 000000                                  db	  0,  0,  0
  3201                                  
  3202                                  ; world contruction data 599 bytes
  3203 00000FB9 71700006                world:		db	071h,070h,000h,006h
  3204 00000FBD 72000006                                db	072h,000h,000h,006h
  3205 00000FC1 71007006                                db	071h,000h,070h,006h
  3206 00000FC5 73077006                                db	073h,007h,070h,006h
  3207 00000FC9 73070006                                db	073h,007h,000h,006h
  3208 00000FCD 70070706                                db	070h,007h,007h,006h
  3209 00000FD1 74000706                                db	074h,000h,007h,006h
  3210 00000FD5 70000740                                db	070h,000h,007h,040h
  3211 00000FD9 72700750                                db	072h,070h,007h,050h
  3212 00000FDD 72700050                                db	072h,070h,000h,050h
  3213 00000FE1 71707050                                db	071h,070h,070h,050h
  3214 00000FE5 73007040                                db	073h,000h,070h,040h
  3215 00000FE9 71000040                                db	071h,000h,000h,040h
  3216 00000FED 72000050                                db	072h,000h,000h,050h
  3217 00000FF1 71007050                                db	071h,000h,070h,050h
  3218 00000FF5 73077046                                db	073h,007h,070h,046h
  3219 00000FF9 73000046                                db	073h,000h,000h,046h
  3220 00000FFD 70070746                                db	070h,007h,007h,046h
  3221 00001001 72000750                                db	072h,000h,007h,050h
  3222 00001005 71000000                                db	071h,000h,000h,000h
  3223 00001009 71000000                                db	071h,000h,000h,000h
  3224 0000100D 7100BB56                                db	071h,000h,0bbh,056h
  3225 00001011 700FBB46                                db	070h,00Fh,0bbh,046h
  3226 00001015 FF                                      db	0FFh
  3227 00001016 33000000                                db	033h,000h,000h,000h
  3228 0000101A F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  3229 0000101F B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  3230 00001024 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  3231 00001029 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  3232 0000102E 3000BB56                                db	030h,000h,0BBh,056h
  3233 00001032 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  3234 00001037 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  3235 0000103C B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  3236 00001041 9000BB5611                              db	090h,000h,0BBh,056h,011h
  3237 00001046 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  3238 0000104B F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  3239 00001050 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  3240 00001055 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  3241 0000105A 3000BB56                                db	030h,000h,0BBh,056h
  3242 0000105E 1000BB56                                db	010h,000h,0BBh,056h
  3243                                  
  3244 00001062 34000000                                db	034h,000h,000h,000h
  3245 00001066 32050080                                db	032h,005h,000h,080h
  3246 0000106A 35058080                                db	035h,005h,080h,080h
  3247 0000106E 35058000                                db	035h,005h,080h,000h
  3248 00001072 33058008                                db	033h,005h,080h,008h
  3249 00001076 33050008                                db	033h,005h,000h,008h
  3250 0000107A 74050808                                db	074h,005h,008h,008h
  3251 0000107E 74050000                                db	074h,005h,000h,000h
  3252 00001082 73050880                                db	073h,005h,008h,080h
  3253 00001086 75000000                                db	075h,000h,000h,000h
  3254 0000108A 75050888                                db	075h,005h,008h,088h
  3255 0000108E 70000000                                db	070h,000h,000h,000h
  3256 00001092 74640808                                db	074h,064h,008h,008h
  3257 00001096 74600800                                db	074h,060h,008h,000h
  3258 0000109A 72640880                                db	072h,064h,008h,080h
  3259 0000109E 05600080                                db	005h,060h,000h,080h
  3260 000010A2 05600000                                db	005h,060h,000h,000h
  3261 000010A6 02600008                                db	002h,060h,000h,008h
  3262 000010AA 34600008                                db	034h,060h,000h,008h
  3263 000010AE 34600000                                db	034h,060h,000h,000h
  3264 000010B2 32600080                                db	032h,060h,000h,080h
  3265 000010B6 35600080                                db	035h,060h,000h,080h
  3266 000010BA 35600000                                db	035h,060h,000h,000h
  3267 000010BE 32600008                                db	032h,060h,000h,008h
  3268 000010C2 34350008                                db	034h,035h,000h,008h
  3269 000010C6 14650000                                db      014h,065h,000h,000h
  3270 000010CA 32350080                                db      032h,035h,000h,080h
  3271 000010CE 35350080                               	db      035h,035h,000h,080h
  3272 000010D2 15650000                               	db      015h,065h,000h,000h
  3273 000010D6 32350008                                db	032h,035h,000h,008h
  3274 000010DA 34358008                                db	034h,035h,080h,008h
  3275 000010DE 14650000                               	db      014h,065h,000h,000h
  3276 000010E2 32358080                               	db      032h,035h,080h,080h
  3277 000010E6 75000000                		db	075h,000h,000h,000h
  3278 000010EA 5265E077                		db	052h,065h,0E0h,077h
  3279 000010EE 32640E77                		db	032h,064h,00Eh,077h
  3280 000010F2 12650077                		db	012h,065h,000h,077h
  3281 000010F6 00650077                		db	000h,065h,000h,077h
  3282 000010FA FF                      		db	0FFh
  3283 000010FB 32000000                		db	032h,000h,000h,000h
  3284 000010FF F000000014              		db	0F0h,000h,000h,000h,014h
  3285 00001104 B000000014              		db	0B0h,000h,000h,000h,014h
  3286 00001109 30000000                		db	030h,000h,000h,000h
  3287 0000110D F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  3288 00001112 F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  3289 00001117 3000DD46                		db	030h,000h,0DDh,046h
  3290 0000111B 3000DD56                		db	030h,000h,0DDh,056h
  3291 0000111F 3000DD56                		db	030h,000h,0DDh,056h
  3292 00001123 32000050                		db	032h,000h,000h,050h
  3293 00001127 300AA050                		db	030h,00Ah,0A0h,050h
  3294 0000112B 3300A050                		db	033h,000h,0A0h,050h
  3295 0000112F 30000050                		db	030h,000h,000h,050h
  3296 00001133 32700050                		db	032h,070h,000h,050h
  3297 00001137 3000A050                		db	030h,000h,0A0h,050h
  3298 0000113B 33A0A750                		db	033h,0A0h,0A7h,050h
  3299 0000113F 33000000                		db	033h,000h,000h,000h
  3300 00001143 31A07A50                		db	031h,0A0h,07Ah,050h
  3301 00001147 31000A50                		db	031h,000h,00Ah,050h
  3302 0000114B 31000A50                		db	031h,000h,00Ah,050h
  3303 0000114F 320A0A50                		db	032h,00Ah,00Ah,050h
  3304 00001153 35000000                		db	035h,000h,000h,000h
  3305 00001157 720A0000                		db	072h,00Ah,000h,000h
  3306 0000115B 700AA000                		db	070h,00Ah,0A0h,000h
  3307 0000115F 7300A000                		db	073h,000h,0A0h,000h
  3308 00001163 70000000                		db	070h,000h,000h,000h
  3309 00001167 72000000                		db	072h,000h,000h,000h
  3310 0000116B 7000A000                		db	070h,000h,0A0h,000h
  3311 0000116F 73A0A000                		db	073h,0A0h,0A0h,000h
  3312 00001173 73A00099                		db	073h,0A0h,000h,099h
  3313 00001177 71A00A00                		db	071h,0A0h,00Ah,000h
  3314 0000117B 71000A00                		db	071h,000h,00Ah,000h
  3315 0000117F 71000A00                                db	071h,000h,00Ah,000h
  3316 00001183 750A0A00                                db	075h,00Ah,00Ah,000h
  3317 00001187 700C0C03                                db	070h,00Ch,00Ch,003h
  3318 0000118B 70000C03                                db	070h,000h,00Ch,003h
  3319 0000118F 70000C03                                db	070h,000h,00Ch,003h
  3320 00001193 72C07C03                                db	072h,0C0h,07Ch,003h
  3321 00001197 72000000                                db	072h,000h,000h,000h
  3322 0000119B 71C0C703                                db	071h,0C0h,0C7h,003h
  3323 0000119F 7300C003                                db	073h,000h,0C0h,003h
  3324 000011A3 71700003                                db	071h,070h,000h,003h
  3325 000011A7 72000003                                db	072h,000h,000h,003h
  3326 000011AB 7100C003                                db	071h,000h,0C0h,003h
  3327 000011AF 730CC003                                db	073h,00Ch,0C0h,003h
  3328 000011B3 71000003                                db	071h,000h,000h,003h
  3329 000011B7 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  3330 000011BB FF                                      db	0FFh
  3331 000011BC 32000000                                db	032h,000h,000h,000h
  3332 000011C0 F000700614                              db	0F0h,000h,070h,006h,014h
  3333 000011C5 B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  3334 000011CA 3000DD56                                db	030h,000h,0DDh,056h
  3335 000011CE B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  3336 000011D3 32DD0056                                db	032h,0DDh,000h,056h
  3337 000011D7 32DD0056                                db	032h,0DDh,000h,056h
  3338 000011DB 32DD0056                                db	032h,0DDh,000h,056h
  3339 000011DF 7000F056                                db	070h,000h,0F0h,056h
  3340 000011E3 7000BB56                                db	070h,000h,0BBh,056h
  3341 000011E7 32B00B46                                db	032h,0B0h,00Bh,046h
  3342 000011EB 72BB0056                                db	072h,0BBh,000h,056h
  3343 000011EF 71B0B056                                db	071h,0B0h,0B0h,056h
  3344 000011F3 71021156                                db	071h,002h,011h,056h
  3345 000011F7 71221156                                db	071h,022h,011h,056h
  3346 000011FB 31201156                                db	031h,020h,011h,056h
  3347 000011FF 730BB056                                db	073h,00Bh,0B0h,056h
  3348 00001203 73BB0056                                db	073h,0BBh,000h,056h
  3349 00001207 300B0B46                                db	030h,00Bh,00Bh,046h
  3350 0000120B 3000BB56                                db	030h,000h,0BBh,056h
  3351 0000120F FF                                      db	0FFh
  3352                                  
  3353                                  ; flying script	126 bytes
  3354                                  script:
  3355                                  ;     7 6 5 4 3 2 1 0
  3356                                  ;	  v v v v v c c c
  3357                                  ;
  3358                                  ;	  v = VALUE
  3359                                  ;	  c = COMMAND
  3360                                  ;
  3361                                  ;	  0 = NOP
  3362                                  ;	  1 = NEG ZSTEP
  3363                                  ;	  2 = INC SPEED
  3364                                  ;	  3 = DEC SPEED
  3365                                  ;	  4 = INC XSTEP
  3366                                  ;	  5 = DEC XSTEP
  3367                                  ;	  6 = INC YSTEP
  3368                                  ;	  7 = INC YSTEP
  3369                                  
  3370 00001210 A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  3371 00001216 F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  3372 0000121C 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  3373 00001222 F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  3374 00001228 F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  3375 0000122E 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  3376 00001234 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  3377 0000123A 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  3378 00001240 F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  3379 00001246 A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  3380 0000124C 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  3381 00001252 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  3382 00001258 A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  3383 0000125E B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  3384 00001264 A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  3385 0000126A 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  3386 00001270 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  3387 00001276 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  3388 0000127C 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  3389 00001282 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  3390 00001288 F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  3391                                  
  3392 0000128D 0100                    zstep:		dw	1			
  3393 0000128F 66EF                    doortimer	dw 	-4250	; 0EF66h
  3394 00001291 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  3395                                  omniend:
  3396 0000129A 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  3397 000012A3 4B9A5050455253     
  3398                                  sancend:
  3399 000012AA 0000A5C3                ob:		dd 	-330.0	; vector.x
  3400 000012AE 00000000                		dd 	   0.0	; vector.y	
  3401 000012B2 00008042                		dd	  64.0	; vector.z	
  3402                                  owmat:
  3403 000012B6 00000000                		dd 	   0.0	; vector.x
  3404 000012BA 000080BF                		dd 	  -1.0	; vector.y
  3405 000012BE 00000000                		dd	   0.0  ; vector.z
  3406                                  ;owmat+12:
  3407 000012C2 00000000                		dd 	   0.0	; vector.x
  3408 000012C6 00000000                		dd 	   0.0	; vector.y
  3409 000012CA 000080BF                		dd	  -1.0  ; vector.z
  3410                                  ;owmat+24:
  3411 000012CE 0000803F                		dd 	   1.0	; vector.x
  3412 000012D2 00000000                		dd 	   0.0	; vector.y
  3413 000012D6 00000000                		dd	   0.0  ; vector.z
  3414                                  
  3415                                  bss_start:
  3416                                  
  3417                                  ABSOLUTE bss_start
  3418                                  
  3419                                  ;=============================================================================
  3420                                  ;        	null-initialized data
  3421                                  ;=============================================================================
  3422                                  
  3423                                  nullstart:
  3424 000012DA <res 00000024>          wmat:           resb	matrix.size  ; 36
  3425 000012FE <res 00000024>          nwmat:		resb	matrix.size  ; 36
  3426 00001322 <res 00000002>          zspeed:		resw	1
  3427 00001324 <res 00000002>          oxw:		resw	1
  3428 00001326 <res 00000002>          oyw:		resw	1
  3429 00001328 <res 00000002>          ozw:		resw	1
  3430 0000132A <res 00000002>          scriptptr:	resw	1
  3431 0000132C <res 00000002>          scriptanz:	resw	1
  3432 0000132E <res 00000001>          scriptins:	resb	1
  3433 0000132F <res 00000001>          once:		resb	1
  3434 00001330 <res 00000002>          ticker:		resw	1
  3435 00001332 <res 00000002>          tracks:		resw	1
  3436 00001334 <res 00000300>          palette:        resb 	768
  3437 00001634 <res 00000060>          channels:       resb	16*6
  3438                                  ;o:		resb	object.size ; 7204
  3439                                  ; 11/08/2017
  3440 00001694 <res 00000002>          object.panz:	resw 1
  3441 00001696 <res 00000002>          object.fanz:	resw 1
  3442 00001698 <res 00000C80>          object.p:	resb point.size*MAXPOINTS
  3443 00002318 <res 00000FA0>          object.f:	resb face.size*MAXFACES
  3444                                  nullend:
  3445                                  
  3446                                  ;=============================================================================
  3447                                  ;       	uninitialized data
  3448                                  ;=============================================================================
  3449 000032B8 <res 00000002>          oldstack        resw	1
  3450                                  Old08IrqPtr:
  3451 000032BA <res 00000002>          Old08Irqofs:	resw	1
  3452 000032BC <res 00000002>          Old08Irqseg:	resw	1
  3453                                  ;Old09IrqPtr:
  3454                                  ;Old09Irqofs:	resw	1
  3455                                  ;Old09Irqseg:	resw	1
  3456                                  ;songdata:	resb	3605
  3457 000032BE <res 00000002>          root:   	resw	1
  3458 000032C0 <res 00000040>          circletab:	resw	32
  3459 00003300 <res 0000005A>          stars:		resb	90
  3460 0000335A <res 00000001>          twice:		resb	1
  3461 0000335B <res 00000002>          vseg:		resw	1
  3462 0000335D <res 00000002>          bseg:		resw    1
  3463 0000335F <res 00000028>          tseg:   	resw	20
  3464 00003387 <res 00008000>          shadetab:	resb	256*128
  3465 0000B387 <res 00000078>          p:		resw	4*15
  3466 0000B3FF <res 000000B4>          pr:		resd	3*15
  3467 0000B4B3 <res 000000B4>          po:		resb	poly.size ; 5*36
  3468 0000B567 <res 000012C0>          rp:		resd	3*MAXPOINTS ; 3*400
  3469 0000C827 <res 00000640>          facei:		resd    MAXFACES ; 400
  3470                                  
  3471 0000CE67 <res 00000001>          alignb 4
  3472                                  
  3473                                  ; 11/08/2017
  3474                                  
  3475 0000CE68 <res 00000002>          cw.direc:	resw	1 ; word
  3476 0000CE6A <res 00000002>          cw.shade:	resw	1 ; word
  3477                                  
  3478                                  alignb 4
  3479                                  
  3480 0000CE6C <res 00000004>          sstp.dy:	resd	1 ; dword
  3481 0000CE70 <res 00000002>          sstp.ddv:	resw	1 ; word
  3482 0000CE72 <res 00000002>          sstp.ddu:	resw	1 ; word
  3483 0000CE74 <res 00000002>          sstp.vv2:	resw	1 ; word
  3484 0000CE76 <res 00000002>          sstp.uu2:	resw	1 ; word
  3485 0000CE78 <res 00000002>          sstp.vv1:	resw	1 ; word
  3486 0000CE7A <res 00000002>          sstp.uu1:	resw	1 ; word
  3487 0000CE7C <res 00000002>          sstp.r:		resw	1 ; word
  3488 0000CE7E <res 00000002>          sstp.l:		resw	1 ; word
  3489 0000CE80 <res 00000002>          sstp.y:		resw	1 ; word
  3490 0000CE82 <res 00000002>          sstp.maxy:	resw	1 ; word
  3491 0000CE84 <res 00000002>          sstp.miny:	resw	1 ; word
  3492 0000CE86 <res 00000002>          sstp.mx2:	resw	1 ; word
  3493 0000CE88 <res 00000002>          sstp.mx1:	resw	1 ; word
  3494 0000CE8A <res 0000003C>          sstp.del:	resb	edges.size * 3 ; 60 bytes 
  3495 0000CEC6 <res 0000003C>          sstp.edg:	resb	edges.size * 3 ; 60 bytes
  3496                                  
  3497 0000CF02 <res 00000002>          alignb 4
  3498                                  
  3499 0000CF04 <res 00000E15>          songdata:	resb	3605
  3500                                  
  3501 0000DD19 <res 00000003>          alignb 4
  3502                                  
  3503                                  bss_end:
