     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: 05/02/2017 ]
     9                                  ;
    10                                  ; Derived from source code of 'OMNISCENT.ASM' by Dirk Kppers
    11                                  ;          SNC_OMNI.COM	 (MSDOS) intro file, 1997
    12                                  ;
    13                                  ; Assembler: NASM 2.11
    14                                  ; ****************************************************************************
    15                                  
    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 00000000 <res 00000002>           .panz:	resw 1
    98 00000002 <res 00000002>           .fanz:	resw 1
    99 00000004 <res 00000C80>           .p:	resb point.size*MAXPOINTS
   100 00000C84 <res 00000FA0>           .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     word [Old08Irqseg], es
   138                                                  mov     word [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     word [Old09Irqseg], es
   173                                                  mov     word [Old09Irqofs], bx
   174                                                  mov     ax, 02509h
   175                                                  mov     dx, irqHandler09
   176                                                  int     21h
   177                                  %endmacro
   178                                  
   179                                  ;***********************************************
   180                                  ;* descript. : stop keyboard handler           *
   181                                  ;* parameter : none			       *
   182                                  ;* sideeffect: all		               *
   183                                  ;* back      : none		               *
   184                                  ;***********************************************
   185                                  %macro		stopKBDHandler 0
   186                                                  push    ds
   187                                                  mov     ax,02509h		; restore old IRQ-vector
   188                                                  lds     dx, [Old09IrqPtr]	;
   189                                                  int     21h
   190                                                  pop     ds
   191                                  %endmacro
   192                                  
   193                                  ;***********************************************
   194                                  ;* descript. : zero null-initialized data      *
   195                                  ;* parameter : none			       *
   196                                  ;* sideeffect: all		               *
   197                                  ;* back      : none		               *
   198                                  ;***********************************************
   199                                  %macro		nullData 0
   200                                  		mov	di, nullstart
   201                                  		mov	cx, nullend-nullstart
   202                                  		xor	al, al
   203                                                  rep	stosb
   204                                  %endmacro
   205                                  
   206                                  ;***********************************************
   207                                  ;* descript. : set textmode		       *
   208                                  ;* parameter : none		               *
   209                                  ;* sideeffect: all		               *
   210                                  ;* back      : none		               *
   211                                  ;***********************************************
   212                                  %macro		set80x25 0
   213                                  		mov	ax, 3
   214                                  		int	10h	; - VIDEO - SET	VIDEO MODE
   215                                  				; AL = mode
   216                                  %endmacro
   217                                  
   218                                  ;***********************************************
   219                                  ;* descript. : set gfx-mode 320x200            *
   220                                  ;* parameter : none		               *
   221                                  ;* sideeffect: all		               *
   222                                  ;* back      : none		               *
   223                                  ;***********************************************
   224                                  %macro		set320x200 0
   225                                  		mov	ax, 13h
   226                                  		int	10h		; - VIDEO - SET	VIDEO MODE
   227                                  					; AL = mode
   228                                  %endmacro
   229                                  
   230                                  ;***********************************************
   231                                  ;* descript. : calculate a smooth colorrange   *
   232                                  ;* parameter : none             	       *
   233                                  ;* sideeffect: all              	       *
   234                                  ;* back	     : none                	       *
   235                                  ;***********************************************
   236                                  %macro		makePalette 0
   237                                  		push	ds
   238                                  		pop	es
   239                                  		mov	bx, 3
   240                                  mPcolor:
   241                                  		mov	si, colors
   242                                  		mov	di, palette
   243                                  		xor	dh, dh
   244                                  		lodsb
   245                                  		movzx	cx, al
   246                                  mPouter:
   247                                  		push	cx
   248                                  		mov	cl, byte [si]
   249                                  		mov	ah, byte [bx+si]
   250                                  		sub	ax, dx
   251                                  		push	dx
   252                                  		cwd
   253                                  		idiv	cx
   254                                  		pop	dx
   255                                  mPinner:
   256                                  		add	dx, ax
   257                                  		mov	byte [es:di+bx-1], dh
   258                                  		;mov	byte [di+bx-1], dh
   259                                  		add	di, 3
   260                                  		loop	mPinner
   261                                  		add	si, 4
   262                                  		pop	cx
   263                                  		loop	mPouter
   264                                  		dec	bx
   265                                  		jnz	short mPcolor
   266                                  %endmacro
   267                                  
   268                                  ;***********************************************
   269                                  ;* descript. : reset the GM-Port and switch to *
   270                                  ;*             UART mode.		       *
   271                                  ;* parameter : none			       *
   272                                  ;* sideeffect: dx,al		               *
   273                                  ;* back      : none		               *
   274                                  ;***********************************************
   275                                  %macro		resetGM 0
   276                                  		mov	dx, GMPort
   277                                  		mov	ax, 0FFh
   278                                  		;mov	al, 0FFh
   279                                  		out	dx, al
   280                                  		;sub	cl, cl
   281                                  resGMbusy1:
   282                                  		;dec	cl
   283                                  		dec	ah
   284                                  		jz	short rGMerror	;{ timeout }
   285                                  		in	al, dx		;{ read acknowledge }
   286                                  		
   287                                  		test	al, 80h
   288                                  		jnz	short resGMbusy1
   289                                  		dec	dx
   290                                  		in	al, dx
   291                                  
   292                                  		cmp	al, 0FEh
   293                                  		jne	short rGMerror
   294                                  		inc	dx		;{ switch into UART mode }
   295                                  resGMbusy2:
   296                                  		in	al, dx
   297                                  
   298                                  		test	al, 40h
   299                                  		jnz	short resGMbusy2
   300                                  		mov	al, 3Fh
   301                                  		out	dx, al
   302                                  rGMerror:
   303                                  %endmacro
   304                                  
   305                                  ;***********************************************
   306                                  ;* descript. : mute midi channels 0..15        *
   307                                  ;* parameter : none                	       *
   308                                  ;* sideeffect: ax,cx		               *
   309                                  ;* back		 : none                	       *
   310                                  ;***********************************************
   311                                  %macro		silence 0
   312                                  		mov	cx, 15 ; 0Fh
   313                                  Siloop:	
   314                                  		mov	ax, cx
   315                                  		add	al, CMD_CHANGEPARAM ; 0B0h
   316                                  		call	writeGM
   317                                  		mov	al, MOD_ALLNOTESOFF ; 7Bh
   318                                  		call	writeGM
   319                                  		xor	al, al
   320                                  		call	writeGM
   321                                  		loop	Siloop
   322                                  Sinosound:
   323                                  %endmacro
   324                                  
   325                                  ;***********************************************
   326                                  ;* descript. : create the reactor wall texture *
   327                                  ;* parameter : none		               *
   328                                  ;* sideeffect: ax,bx,cx,di,es                  *
   329                                  ;* back      : none			       *
   330                                  ;* length    : 45 bytes		               *
   331                                  ;***********************************************
   332                                  %macro		reactorWall 0
   333                                  		mov	es, word [tseg]
   334                                  		xor	di, di
   335                                  		mov	cx, 4096 ; 1000h
   336                                  rsmloop:
   337                                  		mov	ax, di
   338                                  		test	al, 8
   339                                  		jle	short rsnonot1
   340                                  		not	al
   341                                  rsnonot1:
   342                                  		and	al, 15 ; 0Fh
   343                                  		mov	bx, ax
   344                                  		mov	ax, di
   345                                  		shr	ax, 6
   346                                  		test	al, 8
   347                                  		jle	short rsnonot2
   348                                  		not	al
   349                                  rsnonot2:
   350                                  		and	al, 15 ; 0Fh
   351                                  		cmp	al, bl
   352                                  		jle	short rstakeal
   353                                  		mov	ax, bx
   354                                  rstakeal:
   355                                  		add	al, 224 ; 0E0h
   356                                  		stosb
   357                                  		loop	rsmloop
   358                                  %endmacro
   359                                  
   360                                  ;***********************************************
   361                                  ;* descript. : calc background-fractal         *
   362                                  ;* parameter : none		               *
   363                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   364                                  ;* back      : none			       *
   365                                  ;***********************************************
   366                                  %macro		createFrac2 0
   367                                  		mov	es, word [tseg+36]
   368                                  		mov	al, 20	; 14h
   369                                  		call	setFrac
   370                                  		mov	di, 64	; 40h
   371                                  		mov	cx, 4096-64
   372                                  		;mov	bx, 4
   373                                  cF1loop:
   374                                  		mov	bx, 4
   375                                  		call	rnd
   376                                  		add	al, byte [es:di-64]
   377                                  		add	al, byte [es:di-63]
   378                                  		dec	ax
   379                                  		shr	ax, 1
   380                                  		stosb
   381                                  		loop	cF1loop
   382                                  %endmacro
   383                                  
   384                                  ;***********************************************
   385                                  ;* descript. : calc random noise fractal       *
   386                                  ;* parameter : none		               *
   387                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   388                                  ;* back      : none			       *
   389                                  ;***********************************************
   390                                  %macro		createFrac3 0
   391                                  		mov	es, word [tseg+38]
   392                                  		mov	al, 3
   393                                  		call	setFrac
   394                                  		mov	cx, 4096 ; 1000h
   395                                  		;mov	bx, cx
   396                                  cF3loop:
   397                                  		mov	bx, 4096 ; 1000h
   398                                  		call	rnd
   399                                  		mov	di, ax 
   400                                  		inc	byte [es:di]
   401                                  		loop	cF3loop
   402                                  %endmacro
   403                                  
   404                                  ;***********************************************
   405                                  ;* descript. : init stars (positions and state)*
   406                                  ;* parameter : none			       *
   407                                  ;* sideeffect: eax,bx,cx,edx,si,di,es          *
   408                                  ;* back      : none		               *
   409                                  ;***********************************************
   410                                  %macro		initStars 0
   411                                  		push	ds
   412                                  		pop	es
   413                                  		mov	cx, 30 ; 1Eh
   414                                  		mov	di, stars
   415                                  iSloop:	
   416                                  		mov	bx, 256 ; 100h
   417                                  		call	rnd
   418                                  		stosb
   419                                  		mov	bx, 4096-(64*5) ; 0EC0h
   420                                  		add	bx, 128 ; 80h
   421                                  		call	rnd
   422                                  		add	ax, 64  ; 40h
   423                                  		stosw
   424                                  		loop	iSloop
   425                                  %endmacro
   426                                  
   427                                  ;***********************************************
   428                                  ;* descript. : add effects to fractals	       *
   429                                  ;* parameter : none		               *
   430                                  ;* sideeffect: ax,bx,cx,di,es		       *
   431                                  ;* back      : none		               *
   432                                  ;***********************************************
   433                                  %macro		effects 0
   434                                  		mov	cx, 26	; 1Ah
   435                                  		mov	si, aE
   436                                  effmloop:
   437                                  		push	cx
   438                                  		mov	bl, byte [si]	; mseg+effect
   439                                  		mov	dl, bl
   440                                  		shr	dl, 4
   441                                  		and	bl, 0Fh ; 15
   442                                  		add	bx, bx
   443                                  		;shl	bl, 1
   444                                  		mov	es, word [bx+tseg]
   445                                  		movzx	cx, byte [si+2] ; y1
   446                                  effyloop:
   447                                  		movzx	bx, byte [si+1] ; x1
   448                                  effxloop:
   449                                  		mov	di, cx
   450                                  		shl	di, 6
   451                                  		add	di, bx
   452                                  		mov	al, dl
   453                                  		dec	al
   454                                  		jz	short effect1
   455                                  		dec	al
   456                                  		jz	short effect2
   457                                  		mov	ax, bx
   458                                  		add	ax, cx
   459                                  		and	al, 4
   460                                  		jz	short effdonot
   461                                  		;jz	short effect1
   462                                  		mov	al, 152 ; 98h
   463                                  effdonot:
   464                                  		jmp	short effect1
   465                                  effect2:
   466                                  		mov	al, byte [es:di]
   467                                  effect1:
   468                                  		add	al, byte [si+5]	; value
   469                                  		mov	byte [es:di], al
   470                                  		inc	bx
   471                                  		cmp	bl, byte [si+3]	; x2
   472                                  		jle	short effxloop
   473                                  		inc	cx
   474                                  		cmp	cl, byte [si+4]	; y2
   475                                  		jle	short effyloop
   476                                  		add	si, 6
   477                                  		pop	cx
   478                                  		loop	effmloop
   479                                  %endmacro
   480                                  
   481                                  ;***********************************************
   482                                  ;* descript. : copy fractals and add value     *
   483                                  ;* parameter : none		               *
   484                                  ;* sideeffect: al,cx,di,es,fs		       *
   485                                  ;* back      : none		               *
   486                                  ;***********************************************
   487                                  %macro		addFractals 0
   488                                  		mov	si, aF
   489                                  		mov	dl, 4
   490                                  aFloop:
   491                                  		movzx	bx, dl
   492                                  		mov	es, word [bx+tseg]
   493                                  		lodsw
   494                                  		mov	bl, al
   495                                  		mov	fs, word [bx+tseg]		
   496                                  		xor	di, di
   497                                  		mov	cx, 4096 ; 1000h
   498                                  aFiloop:
   499                                  		mov	al, byte [fs:di]
   500                                  		add	al, ah
   501                                  		stosb
   502                                  		loop	aFiloop
   503                                  		;add	dl, 2
   504                                  		inc	dx
   505                                  		inc	dx
   506                                  		cmp	dl, 30
   507                                  		jle	short aFloop
   508                                  %endmacro
   509                                  
   510                                  ;***********************************************
   511                                  ;* descript. : calculate and initalize textures*
   512                                  ;* parameter : none			       *
   513                                  ;* sideeffect: al,cx,di,es,fs		       *
   514                                  ;* back      : none			       *
   515                                  ;***********************************************
   516                                  %macro		addLava 0
   517                                  		mov	es, word [tseg+22]
   518                                  		mov	di, 4095	; 0FFFh
   519                                  		mov	cx, 20		; 14h
   520                                  		mov	al, 94		; 5Eh
   521                                  aLyloop:
   522                                  		push	cx
   523                                  		shl	cx, 3
   524                                  aLxloop:
   525                                  		push	di
   526                                  		push	ax
   527                                  		mov	bx, 64		; 40h
   528                                  		call	rnd
   529                                  		sub	di, ax
   530                                  		pop	ax
   531                                  		stosb
   532                                  		;mov	byte [es:di], al
   533                                  		pop	di
   534                                  		loop	aLxloop
   535                                  		pop	cx
   536                                  		dec	al
   537                                  		sub	di, 64 		; 40h
   538                                  		loop	aLyloop
   539                                  %endmacro
   540                                  
   541                                  ;***********************************************
   542                                  ;* descript. : calculate and initalize textures*
   543                                  ;* parameter : none		               *
   544                                  ;* sideeffect: al,cx,di,es,fs		       *
   545                                  ;* back      : none		               *
   546                                  ;***********************************************
   547                                  %macro		initTextures 0
   548                                  		mov	bx, 34	; 22h
   549                                  		push	800	; 320h
   550                                  		push	5
   551                                  		call	createFrac1
   552                                  		mov	bx, 32	; 20h
   553                                  		push	112	; 70h
   554                                  		push	15	; 0Fh
   555                                  		call	createFrac1
   556                                  		createFrac2
   557                                  		createFrac3
   558                                  		initStars
   559                                  		reactorWall
   560                                  		addFractals
   561                                  		effects
   562                                  		addLava
   563                                  %endmacro
   564                                  
   565                                  ;***********************************************
   566                                  ;* descript. : cycle "range" colors at "base"  *
   567                                  ;* parameter : none		               *
   568                                  ;* sideeffect: ax,(bl),cx,si,di,es             *
   569                                  ;* back      : none			       *
   570                                  ;***********************************************
   571                                  %macro		colorCycle 0
   572                                  		base	equ 6*32
   573                                                  range	equ 32
   574                                  		
   575                                  		push	ds
   576                                  		pop	es
   577                                  		mov	di, palette+(base*3)
   578                                  		mov	si, di
   579                                  		lodsw
   580                                  		;mov	bl, byte [si]  ; works only with fire (no blue)
   581                                  		inc	si
   582                                  		mov	cx, (range*3-3)
   583                                  		rep movsb
   584                                  		stosw
   585                                  		;mov	byte [di], bl  ; works only with fire (no blue)
   586                                  %endmacro
   587                                  
   588                                  ;***********************************************
   589                                  ;* descript. : animate the stars	       *
   590                                  ;* parameter : none			       *
   591                                  ;* sideeffect: ax,bx,cx,dl,si,di,es            *
   592                                  ;* back      : none			       *
   593                                  ;***********************************************
   594                                  %macro		animStars 0
   595                                  		_base	equ 7*32
   596                                  
   597                                  		mov	es, word [tseg+2]
   598                                  		call	clearFrac
   599                                  
   600                                  		mov	cl, 30	; 1Eh
   601                                  		mov	bx, stars
   602                                  aSoloop:
   603                                  		dec	byte [bx]
   604                                  		mov	ah, byte [bx]
   605                                  		and	ah, 63	; 3Fh
   606                                  		cmp	ah, 31	; 1Fh
   607                                  		jbe	short aSnonot
   608                                  		not	ah
   609                                  		and	ah, 31	; 1Fh
   610                                  aSnonot:
   611                                  		shr	ah, 1
   612                                  		mov	di, word [bx+1]
   613                                  		push	cx
   614                                  		push	bx
   615                                  
   616                                  		mov	dx, 64-5 ; 3Bh
   617                                  		mov	cx, _base*256+0 ; 0E000h
   618                                  		call	setstarbob
   619                                  
   620                                  		pop	bx
   621                                  		pop	cx
   622                                  		add	bx, 3
   623                                  		loop	aSoloop
   624                                  %endmacro
   625                                  
   626                                  ;***********************************************
   627                                  ;* descript. : calculate shading tab           *
   628                                  ;* parameter : none		               *
   629                                  ;* sideeffect: ax,bl,cx,di,es                  *
   630                                  ;* back      : none		               *
   631                                  ;***********************************************
   632                                  %macro		calcShadeTab 0
   633                                  		push	ds
   634                                  		pop	es
   635                                  		mov	di, shadetab
   636                                  		xor	bl, bl
   637                                  cSolp:
   638                                  		inc	bl
   639                                  		xor	cx, cx
   640                                  cSilp1:
   641                                  		mov	al, cl
   642                                  		and	al, 31	; 1Fh
   643                                  		mul	bl
   644                                  		add	ax, ax
   645                                  		mov	al, cl
   646                                  		and	al, 224	; 0E0h
   647                                  		add	al, ah
   648                                  		stosb
   649                                  		inc	cl
   650                                  		cmp	cl, 192 ; 0C0h
   651                                  		jne	short cSilp1
   652                                  cSilp2:
   653                                  		mov	al, cl
   654                                  		stosb
   655                                  		inc	cl
   656                                  		jnz	short cSilp2
   657                                  		cmp	bl, 128	; 80h
   658                                  		jne	short cSolp
   659                                  %endmacro
   660                                  
   661                                  ;***********************************************
   662                                  ;* descript. : expand a song       	       *
   663                                  ;* parameter : si:song base adress	       *
   664                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
   665                                  ;* back      : none                	       *
   666                                  ;***********************************************
   667                                  %macro		expandSong 0
   668                                                  mov	si, credits
   669                                                  mov	bx, channels
   670                                                  mov	di, songdata
   671                                  EPSwhile:	lodsw
   672                                                  dec	al
   673                                                  js      short EPSendwhile
   674                                                  mov	byte [bx+channel.trk], al ; [bx+2]
   675                                                  add	al, CMD_CHANGEPRG ; 0C0h
   676                                                  call	setinstr
   677                                                  mov	word [bx+channel.adr], di ; [bx+4]	
   678                                                 	call	expand
   679                                                  xor	al, al
   680                                                  stosb
   681                                                  add	bx, 6
   682                                                  inc	word [tracks]
   683                                                  jmp	short EPSwhile
   684                                  EPSendwhile:
   685                                  %endmacro
   686                                  
   687                                  ;***********************************************
   688                                  ;* descript. : parse the script,rotate and move*
   689                                  ;* parameter : none                	       *
   690                                  ;* sideeffect: all		               *
   691                                  ;* back      : none		               *
   692                                  ;***********************************************
   693                                  %macro		scriptIt 0
   694                                  		mov	cx, word [ticker]
   695                                  		mov	word [ticker], 0
   696                                  		or	cx, cx
   697                                  		jz	sItickerNull
   698                                  sImloop:
   699                                  		push	cx
   700                                  		mov	si, zspeed
   701                                  		dec	word [si+10]	      ;	scriptanz
   702                                  		;dec	word [scriptanz]
   703                                  		jns	short sIwaitTimer
   704                                  		mov	bx, word [si+8]	      ;	scriptptr
   705                                  		;mov	bx, word [scriptptr]
   706                                  		mov	al, byte [bx+script]
   707                                  		or	al, al
   708                                  		jz	_exit_
   709                                  		mov	bx, ax
   710                                  		and	bl, 7
   711                                  		mov	byte [si+12], bl      ;	scriptins
   712                                  		;mov	byte [scriptins], bl
   713                                  		dec	bl
   714                                  		jnz	short sInegateTurn
   715                                  		; (cmd = NEG ZSTEP)  
   716                                  		neg	word [zstep]
   717                                  sInegateTurn:
   718                                  		and	ax, 0F8h
   719                                  		add	ax, ax
   720                                  		mov	word [si+10], ax      ; scriptanz
   721                                  		;mov	word [scriptanz], ax
   722                                  		inc	word [si+8]	      ; scriptptr
   723                                  		;inc	word [scriptptr]
   724                                  sIwaitTimer:
   725                                  		mov	al, byte [si+12]      ;	scriptins
   726                                  		;mov	al, byte [scriptins]
   727                                  		cbw
   728                                  		;xor	ch, ch
   729                                  		dec	ax
   730                                  		jnz	short sInoturn
   731                                  		; (cmd = NEG ZSTEP)  
   732                                  		mov	bx, word [zstep]
   733                                  		add	word [si+6], bx	      ; ozw
   734                                  		;add	word [ozw], bx
   735                                  		;jmp	short sI_1	
   736                                  sInoturn:
   737                                  		;mov	cl, 3
   738                                  		mov	cx, 3
   739                                  sIrotateLoop:
   740                                  		dec	ax
   741                                  		jnz	short sInoIncrement
   742                                  		; (cmd = INC SPEED or INC XSTEP or INC YSTEP)  
   743                                  		inc	word [si]	      ; zspeed, oxw, oyw
   744                                  		;jmp	short sI_1	   	
   745                                  sInoIncrement:
   746                                  		dec	ax
   747                                  		jnz	short sInoDecrement
   748                                  		; (cmd = DEC SPEED or DEC XSTEP or DEC YSTEP)  
   749                                  		dec	word [si]	      ; zspeed, oxw, oyw
   750                                  		;jmp	short sI_1
   751                                  sInoDecrement:
   752                                  		inc	si
   753                                  		inc	si
   754                                  		loop	sIrotateLoop
   755                                  ;sI_1:
   756                                  		mov	si, zspeed+2	      ; oxw 	
   757                                  		;mov	si, oxw	
   758                                  		mov	cl, 3
   759                                  sIpushloop:
   760                                  		lodsw			      ; oxw, oyw, ozw	
   761                                  		sar	ax, 2
   762                                  		push	ax
   763                                  		loop	sIpushloop
   764                                  
   765                                  		imul	ax, word [si-4], 16   ; [oyw]*16 	
   766                                  		push	ax		        	
   767                                  		call	calcRotMat
   768                                  
   769                                  		mov	cl, 3
   770                                  		xor	si, si
   771                                  sImoveLoop:
   772                                  		fld	dword [si+owmat+24]
   773                                  		fimul	word [zspeed]
   774                                  		fidiv	word [CONST1792]
   775                                  		fadd	dword [si+ob]
   776                                  		fstp	dword [si+ob]
   777                                  		add	si, 4
   778                                  		loop	sImoveLoop
   779                                  		pop	cx
   780                                  		dec	cx
   781                                  		jnz	sImloop
   782                                  sItickerNull:
   783                                  %endmacro
   784                                  
   785                                  ;***********************************************
   786                                  ;* descript. : rotate all points from o -> rp  *
   787                                  ;* parameter : none                	       *
   788                                  ;* sideeffect: all		               *
   789                                  ;* back      : none		               *
   790                                  ;***********************************************
   791                                  %macro		rotation 0
   792                                  		mov	cx, word [o+object.panz]
   793                                  		mov	si, o+object.p
   794                                  		mov	di, rp
   795                                  rotmlp:
   796                                  		mov	bx, wmat
   797                                  		mov	dx, 3
   798                                  rotilp:	
   799                                  		fild	word [si+0] ; point.x
   800                                  		fsub	dword [ob+vector.x]
   801                                  		fmul	dword [bx+0]
   802                                  		fild	word [si+2] ; point.y
   803                                  		fsub	dword [ob+vector.y]
   804                                  		fmul	dword [bx+4]
   805                                  		fild	word [si+4] ; point.z
   806                                  		fsub	dword [ob+vector.z]
   807                                  		fmul	dword [bx+8]
   808                                  		;fadd	
   809                                  		;fadd
   810                                  		faddp
   811                                  		faddp
   812                                  		fstp	dword [di]
   813                                  		add	di, 4
   814                                  		add	bx, 12	; 0Ch
   815                                  		dec	dx
   816                                  		jnz	short rotilp
   817                                  		add	si, 8 ; next point
   818                                  		loop	rotmlp
   819                                  %endmacro
   820                                  
   821                                  ;***********************************************
   822                                  ;* descript. : sort faces by z-koord	       *
   823                                  ;* parameter : none		               *
   824                                  ;* sideeffect: ax,bx,cx,dx,si,di,es            *
   825                                  ;* back      : none		               *
   826                                  ;***********************************************
   827                                  %macro		sortFaces 0
   828                                  		push	ds
   829                                  		pop	es
   830                                  		mov	di, facei
   831                                  		push	di ; facei
   832                                  		mov	si, o+object.f
   833                                  		mov	ax, si ; pointer to faces
   834                                  		mov	cx, word [o+object.fanz]
   835                                  sFmloop:
   836                                  		fldz
   837                                  		push	cx
   838                                  		mov	cx, 4
   839                                  sFiloop:
   840                                  		imul	bx, word [si], 12 ; number of points (of face)
   841                                  		inc	si
   842                                  		inc	si
   843                                  		fsub	dword [bx+rp+vector.z]
   844                                  		loop	sFiloop
   845                                  		pop	cx
   846                                  		fistp	word [di] ; z distance (face total)
   847                                  		inc	di
   848                                  		inc	di
   849                                  		stosw		; face address (in 'o+object.f')
   850                                  		add	ax, 10
   851                                  		inc	si
   852                                  		inc	si
   853                                  		loop	sFmloop
   854                                  		push	di	; facei+4*(o+object.fanz-1)
   855                                  		call	qsort
   856                                  %endmacro
   857                                  
   858                                  ;***********************************************
   859                                  ;* descript. : animate the door  	       *
   860                                  ;* parameter : none		               *
   861                                  ;* sideeffect: ax,cx,si,di,es                  *
   862                                  ;* back      : none		               *
   863                                  ;***********************************************
   864                                  %macro		animDoor 0
   865                                  		mov	ax, word [doortimer]
   866                                  		or	ax, ax
   867                                  		jns	short aDnounder
   868                                  		xor	ax, ax
   869                                  		jmp	short alreadydrawed
   870                                  aDnounder:
   871                                  		cmp	byte [once], 0
   872                                  		jne	short alreadydrawed
   873                                  		inc	byte [once]
   874                                  		push	ax
   875                                  		starbackground
   876                                  		pop	ax
   877                                  alreadydrawed:
   878                                  		cmp	ax, 24
   879                                  		jle	short aDnoover
   880                                  		mov	ax, 24
   881                                  aDnoover:
   882                                  		shl	ax, 6
   883                                  		push	ds
   884                                  		mov	es, word [tseg+26]
   885                                  		mov	ds, word [tseg+30]
   886                                  		mov	si, ax
   887                                  		xor	di, di
   888                                  		mov	cx, 1024
   889                                  		rep movsw
   890                                  		mov	si, 2048
   891                                                  sub	si, ax
   892                                  		push	si
   893                                  		mov	ch, 4  ; cx = 1024
   894                                  		rep movsw
   895                                  		pop	di
   896                                  		mov	cx, ax
   897                                  		xor	ax, ax
   898                                  		rep stosw
   899                                  		pop	ds
   900                                  %endmacro
   901                                  
   902                                  ;***********************************************
   903                                  ;* descript. : play a tick of the song	       *
   904                                  ;* parameter : none                	       *
   905                                  ;* sideeffect: ax,bx,cx,dx,si		       *
   906                                  ;* back      : none                	       *
   907                                  ;***********************************************
   908                                  %macro		playsong 0
   909                                  		mov	cx, word [tracks]
   910                                  		mov	si, channels
   911                                  PSmloop:
   912                                  		dec	word [si+channel.del]
   913                                  		jg	short PSdelayed
   914                                  		mov	ax, word [si+channel.trk]
   915                                  		add	al, CMD_NOTEOFF	; 80h
   916                                  		call	setnote
   917                                  		mov	bx, word [si+channel.adr]
   918                                  		mov	ah, 127 	; 7Fh
   919                                  		cmp	byte [bx], 0
   920                                  		jz	short PStrackend
   921                                  		mov	ah, byte [bx]
   922                                  		mov	byte [si+channel.ln], ah
   923                                  		mov	al, byte [si+channel.trk]
   924                                  		add	al, CMD_NOTEON	; 90h
   925                                  		call	setnote
   926                                  		mov	al, byte [bx+1]
   927                                  		mov	bl, SONGSPEED	; 1Dh
   928                                  		mul	bl
   929                                  PStrackend:
   930                                  		mov	word [si+channel.del], ax
   931                                  		add	word [si+channel.adr], 2
   932                                  PSdelayed:
   933                                  		add	si, 6
   934                                  		loop	PSmloop
   935                                  PSnosound:
   936                                  %endmacro
   937                                  
   938                                  ;***********************************************
   939                                  ;* descript. : dump palette to CRT             *
   940                                  ;* parameter : bl:intensity (0..255)           *
   941                                  ;* sideeffect: ax,es,di,cx,dx                  *
   942                                  ;* back      : none		               *
   943                                  ;***********************************************
   944                                  %macro		setPalette2 0
   945                                  		xor	al, al
   946                                  		mov	dx, 3C8h
   947                                  		out	dx, al
   948                                  		inc	dx
   949                                  		mov	si, palette
   950                                  		mov	cx, 768 ; 300h
   951                                  		rep outsb
   952                                  %endmacro
   953                                  
   954                                  ;***********************************************
   955                                  ;* descript. : clear starbackground            *
   956                                  ;* parameter : none		               *
   957                                  ;* sideeffect: ax,es,di,cx,dx                  *
   958                                  ;* back      : none		               *
   959                                  ;***********************************************
   960                                  %macro		cls 0
   961                                  		push	ds
   962                                  		mov	es, word [bseg]
   963                                  		push	0A000h
   964                                  		pop	ds
   965                                  		;mov	si, 0A000h
   966                                  		;mov	ds, si
   967                                  		mov	si, 320*5
   968                                  		xor	di, di
   969                                  		mov	cx, 32000 ; 7D00h
   970                                  clsloop:
   971                                  		lodsb
   972                                  		stosb
   973                                  		stosb
   974                                  		loop	clsloop
   975                                  		pop	ds
   976                                  %endmacro
   977                                  
   978                                  ;***********************************************
   979                                  ;* descript. : draw starbackground             *
   980                                  ;* parameter : none		               *
   981                                  ;* sideeffect: ax,es,di,cx,dx                  *
   982                                  ;* back      : none		               *
   983                                  ;***********************************************
   984                                  %macro		starbackground 0
   985                                  		mov	es, word [bseg]
   986                                  		mov	cx, 100 ; 64h
   987                                  starbackloop:
   988                                  		push	cx
   989                                  		mov	bx, 320*155 ; 0C1C0h
   990                                  		call	rnd
   991                                  		add	ax, 320*20  ; 1900h
   992                                  		mov	di, ax
   993                                  		and	ah, 7
   994                                  		mov	dx, 320-5   ; 13Bh
   995                                  		mov	cx, 2
   996                                  		call	setstarbob
   997                                  		pop	cx
   998                                  		loop	starbackloop
   999                                  %endmacro
  1000                                  
  1001                                  ;***********************************************
  1002                                  ;* descript. : create identity matrix	       *
  1003                                  ;* parameter : ds:di address                   *
  1004                                  ;* sideeffect: cx,di		   	       *
  1005                                  ;* back      : none			       *
  1006                                  ;***********************************************
  1007                                  %macro		identityMat 0
  1008                                  		mov	ch, 2
  1009                                  iMolp:
  1010                                  		mov	cl, 2
  1011                                  iMilp:
  1012                                  		fldz
  1013                                  		cmp	ch, cl
  1014                                  		jne	short iMwritezero
  1015                                  		fstp	st0
  1016                                  		fld1
  1017                                  iMwritezero:
  1018                                  		fstp	dword [di]
  1019                                  		add	di, 4
  1020                                  		dec	cl
  1021                                  		jns	short iMilp
  1022                                  		dec	ch
  1023                                  		jns	short iMolp
  1024                                  %endmacro
  1025                                  
  1026                                  ;=============================================================================
  1027                                  ;               entry point
  1028                                  ;=============================================================================
  1029                                  ;***********************************************
  1030                                  ;* descript. : entry point		       *
  1031                                  ;* parameter : none		               *
  1032                                  ;* sideeffect: all		               *
  1033                                  ;* back      : none		               *
  1034                                  ;***********************************************
  1035                                  
  1036                                  start:
  1037 00000000 8CC8                    		mov	ax, cs
  1038 00000002 8ED8                    		mov	ds, ax
  1039                                  		;mov	es, ax
  1040                                  
  1041                                  		;; clear bss
  1042                                  		;mov	di, bss_start
  1043                                  		;mov	cx, (bss_end - bss_start)/4
  1044                                  		;xor	eax, eax
  1045                                  		;rep	stosd
  1046                                  
  1047                                  		;mov	ax, cs
  1048 00000004 BF[6D41]                		mov	di, vseg
  1049 00000007 050010                  		add	ax, 1000h
  1050 0000000A AB                      		stosw			; virtual screen address
  1051 0000000B 050010                  		add	ax, 1000h
  1052 0000000E AB                      		stosw			; star background address
  1053 0000000F 050010                  		add	ax, 1000h
  1054 00000012 B91400                  		mov	cx, 20
  1055                                  segloop:				; texture addresses
  1056 00000015 AB                      		stosw
  1057                                  		;add	ax, 100h
  1058 00000016 FEC4                    		inc	ah
  1059 00000018 E2FB                    		loop	segloop
  1060                                  
  1061                                  		;fninit
  1062                                  
  1063                                  		nullData
  1063 0000001A BF[D312]            <1>  mov di, nullstart
  1063 0000001D B9DE1F              <1>  mov cx, nullend-nullstart
  1063 00000020 30C0                <1>  xor al, al
  1063 00000022 F3AA                <1>  rep stosb
  1064                                  		resetGM
  1064 00000024 BA3103              <1>  mov dx, GMPort
  1064 00000027 B8FF00              <1>  mov ax, 0FFh
  1064                              <1> 
  1064 0000002A EE                  <1>  out dx, al
  1064                              <1> 
  1064                              <1> resGMbusy1:
  1064                              <1> 
  1064 0000002B FECC                <1>  dec ah
  1064 0000002D 7414                <1>  jz short rGMerror
  1064 0000002F EC                  <1>  in al, dx
  1064                              <1> 
  1064 00000030 A880                <1>  test al, 80h
  1064 00000032 75F7                <1>  jnz short resGMbusy1
  1064 00000034 4A                  <1>  dec dx
  1064 00000035 EC                  <1>  in al, dx
  1064                              <1> 
  1064 00000036 3CFE                <1>  cmp al, 0FEh
  1064 00000038 7509                <1>  jne short rGMerror
  1064 0000003A 42                  <1>  inc dx
  1064                              <1> resGMbusy2:
  1064 0000003B EC                  <1>  in al, dx
  1064                              <1> 
  1064 0000003C A840                <1>  test al, 40h
  1064 0000003E 75FB                <1>  jnz short resGMbusy2
  1064 00000040 B03F                <1>  mov al, 3Fh
  1064 00000042 EE                  <1>  out dx, al
  1064                              <1> rGMerror:
  1065                                  		expandSong
  1065 00000043 BE[090D]            <1>  mov si, credits
  1065 00000046 BB[2D16]            <1>  mov bx, channels
  1065 00000049 BF[BB32]            <1>  mov di, songdata
  1065 0000004C AD                  <1> EPSwhile: lodsw
  1065 0000004D FEC8                <1>  dec al
  1065 0000004F 781A                <1>  js short EPSendwhile
  1065 00000051 884702              <1>  mov byte [bx+channel.trk], al
  1065 00000054 04C0                <1>  add al, CMD_CHANGEPRG
  1065 00000056 E87C05              <1>  call setinstr
  1065 00000059 897F04              <1>  mov word [bx+channel.adr], di
  1065 0000005C E8DC04              <1>  call expand
  1065 0000005F 30C0                <1>  xor al, al
  1065 00000061 AA                  <1>  stosb
  1065 00000062 83C306              <1>  add bx, 6
  1065 00000065 FF06[2B13]          <1>  inc word [tracks]
  1065 00000069 EBE1                <1>  jmp short EPSwhile
  1065                              <1> EPSendwhile:
  1066                                  
  1067 0000006B E8100B                  		call	createWorld
  1068                                  
  1069                                  		set320x200
  1069 0000006E B81300              <1>  mov ax, 13h
  1069 00000071 CD10                <1>  int 10h
  1069                              <1> 
  1070                                  
  1071 00000073 86E0                    		xchg	ah, al 		; ah = write string = 13h, 
  1072                                  					; al = write mode = 0
  1073 00000075 BB1C00                  		mov	bx, 1Ch
  1074 00000078 BD[8A12]                		mov	bp, omniscent
  1075 0000007B B90900                  		mov	cx, omniend-omniscent ; 9
  1076 0000007E BA0601                  		mov	dx, 106h
  1077 00000081 CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1078                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1079                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1080                                  					; ES:BP	-> start of string
  1081 00000083 01CD                    		add	bp, cx
  1082 00000085 B110                    		mov	cl, sancend-sanction ; 11h
  1083 00000087 BA010C                  		mov	dx, 0C01h
  1084 0000008A CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1085                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1086                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1087                                  					; ES:BP	-> start of string
  1088                                  		makePalette
  1088 0000008C 1E                  <1>  push ds
  1088 0000008D 07                  <1>  pop es
  1088 0000008E BB0300              <1>  mov bx, 3
  1088                              <1> mPcolor:
  1088 00000091 BE[4E0E]            <1>  mov si, colors
  1088 00000094 BF[2D13]            <1>  mov di, palette
  1088 00000097 30F6                <1>  xor dh, dh
  1088 00000099 AC                  <1>  lodsb
  1088 0000009A 0FB6C8              <1>  movzx cx, al
  1088                              <1> mPouter:
  1088 0000009D 51                  <1>  push cx
  1088 0000009E 8A0C                <1>  mov cl, byte [si]
  1088 000000A0 8A20                <1>  mov ah, byte [bx+si]
  1088 000000A2 29D0                <1>  sub ax, dx
  1088 000000A4 52                  <1>  push dx
  1088 000000A5 99                  <1>  cwd
  1088 000000A6 F7F9                <1>  idiv cx
  1088 000000A8 5A                  <1>  pop dx
  1088                              <1> mPinner:
  1088 000000A9 01C2                <1>  add dx, ax
  1088 000000AB 268871FF            <1>  mov byte [es:di+bx-1], dh
  1088                              <1> 
  1088 000000AF 83C703              <1>  add di, 3
  1088 000000B2 E2F5                <1>  loop mPinner
  1088 000000B4 83C604              <1>  add si, 4
  1088 000000B7 59                  <1>  pop cx
  1088 000000B8 E2E3                <1>  loop mPouter
  1088 000000BA 4B                  <1>  dec bx
  1088 000000BB 75D4                <1>  jnz short mPcolor
  1089                                  		
  1090                                  		initTextures
  1090 000000BD BB2200              <1>  mov bx, 34
  1090 000000C0 682003              <1>  push 800
  1090 000000C3 6A05                <1>  push 5
  1090 000000C5 E82005              <1>  call createFrac1
  1090 000000C8 BB2000              <1>  mov bx, 32
  1090 000000CB 6A70                <1>  push 112
  1090 000000CD 6A0F                <1>  push 15
  1090 000000CF E81605              <1>  call createFrac1
  1090                              <1>  createFrac2
  1090 000000D2 8E06[9541]          <2>  mov es, word [tseg+36]
  1090 000000D6 B014                <2>  mov al, 20
  1090 000000D8 E80505              <2>  call setFrac
  1090 000000DB BF4000              <2>  mov di, 64
  1090 000000DE B9C00F              <2>  mov cx, 4096-64
  1090                              <2> 
  1090                              <2> cF1loop:
  1090 000000E1 BB0400              <2>  mov bx, 4
  1090 000000E4 E8B204              <2>  call rnd
  1090 000000E7 260245C0            <2>  add al, byte [es:di-64]
  1090 000000EB 260245C1            <2>  add al, byte [es:di-63]
  1090 000000EF 48                  <2>  dec ax
  1090 000000F0 D1E8                <2>  shr ax, 1
  1090 000000F2 AA                  <2>  stosb
  1090 000000F3 E2EC                <2>  loop cF1loop
  1090                              <1>  createFrac3
  1090 000000F5 8E06[9741]          <2>  mov es, word [tseg+38]
  1090 000000F9 B003                <2>  mov al, 3
  1090 000000FB E8E204              <2>  call setFrac
  1090 000000FE B90010              <2>  mov cx, 4096
  1090                              <2> 
  1090                              <2> cF3loop:
  1090 00000101 BB0010              <2>  mov bx, 4096
  1090 00000104 E89204              <2>  call rnd
  1090 00000107 89C7                <2>  mov di, ax
  1090 00000109 26FE05              <2>  inc byte [es:di]
  1090 0000010C E2F3                <2>  loop cF3loop
  1090                              <1>  initStars
  1090 0000010E 1E                  <2>  push ds
  1090 0000010F 07                  <2>  pop es
  1090 00000110 B91E00              <2>  mov cx, 30
  1090 00000113 BF[1241]            <2>  mov di, stars
  1090                              <2> iSloop:
  1090 00000116 BB0001              <2>  mov bx, 256
  1090 00000119 E87D04              <2>  call rnd
  1090 0000011C AA                  <2>  stosb
  1090 0000011D BBC00E              <2>  mov bx, 4096-(64*5)
  1090 00000120 81C38000            <2>  add bx, 128
  1090 00000124 E87204              <2>  call rnd
  1090 00000127 83C040              <2>  add ax, 64
  1090 0000012A AB                  <2>  stosw
  1090 0000012B E2E9                <2>  loop iSloop
  1090                              <1>  reactorWall
  1090 0000012D 8E06[7141]          <2>  mov es, word [tseg]
  1090 00000131 31FF                <2>  xor di, di
  1090 00000133 B90010              <2>  mov cx, 4096
  1090                              <2> rsmloop:
  1090 00000136 89F8                <2>  mov ax, di
  1090 00000138 A808                <2>  test al, 8
  1090 0000013A 7E02                <2>  jle short rsnonot1
  1090 0000013C F6D0                <2>  not al
  1090                              <2> rsnonot1:
  1090 0000013E 240F                <2>  and al, 15
  1090 00000140 89C3                <2>  mov bx, ax
  1090 00000142 89F8                <2>  mov ax, di
  1090 00000144 C1E806              <2>  shr ax, 6
  1090 00000147 A808                <2>  test al, 8
  1090 00000149 7E02                <2>  jle short rsnonot2
  1090 0000014B F6D0                <2>  not al
  1090                              <2> rsnonot2:
  1090 0000014D 240F                <2>  and al, 15
  1090 0000014F 38D8                <2>  cmp al, bl
  1090 00000151 7E02                <2>  jle short rstakeal
  1090 00000153 89D8                <2>  mov ax, bx
  1090                              <2> rstakeal:
  1090 00000155 04E0                <2>  add al, 224
  1090 00000157 AA                  <2>  stosb
  1090 00000158 E2DC                <2>  loop rsmloop
  1090                              <1>  addFractals
  1090 0000015A BE[2B0F]            <2>  mov si, aF
  1090 0000015D B204                <2>  mov dl, 4
  1090                              <2> aFloop:
  1090 0000015F 0FB6DA              <2>  movzx bx, dl
  1090 00000162 8E87[7141]          <2>  mov es, word [bx+tseg]
  1090 00000166 AD                  <2>  lodsw
  1090 00000167 88C3                <2>  mov bl, al
  1090 00000169 8EA7[7141]          <2>  mov fs, word [bx+tseg]
  1090 0000016D 31FF                <2>  xor di, di
  1090 0000016F B90010              <2>  mov cx, 4096
  1090                              <2> aFiloop:
  1090 00000172 648A05              <2>  mov al, byte [fs:di]
  1090 00000175 00E0                <2>  add al, ah
  1090 00000177 AA                  <2>  stosb
  1090 00000178 E2F8                <2>  loop aFiloop
  1090                              <2> 
  1090 0000017A 42                  <2>  inc dx
  1090 0000017B 42                  <2>  inc dx
  1090 0000017C 80FA1E              <2>  cmp dl, 30
  1090 0000017F 7EDE                <2>  jle short aFloop
  1090                              <1>  effects
  1090 00000181 B91A00              <2>  mov cx, 26
  1090 00000184 BE[8F0E]            <2>  mov si, aE
  1090                              <2> effmloop:
  1090 00000187 51                  <2>  push cx
  1090 00000188 8A1C                <2>  mov bl, byte [si]
  1090 0000018A 88DA                <2>  mov dl, bl
  1090 0000018C C0EA04              <2>  shr dl, 4
  1090 0000018F 80E30F              <2>  and bl, 0Fh
  1090 00000192 01DB                <2>  add bx, bx
  1090                              <2> 
  1090 00000194 8E87[7141]          <2>  mov es, word [bx+tseg]
  1090 00000198 0FB64C02            <2>  movzx cx, byte [si+2]
  1090                              <2> effyloop:
  1090 0000019C 0FB65C01            <2>  movzx bx, byte [si+1]
  1090                              <2> effxloop:
  1090 000001A0 89CF                <2>  mov di, cx
  1090 000001A2 C1E706              <2>  shl di, 6
  1090 000001A5 01DF                <2>  add di, bx
  1090 000001A7 88D0                <2>  mov al, dl
  1090 000001A9 FEC8                <2>  dec al
  1090 000001AB 7413                <2>  jz short effect1
  1090 000001AD FEC8                <2>  dec al
  1090 000001AF 740C                <2>  jz short effect2
  1090 000001B1 89D8                <2>  mov ax, bx
  1090 000001B3 01C8                <2>  add ax, cx
  1090 000001B5 2404                <2>  and al, 4
  1090 000001B7 7402                <2>  jz short effdonot
  1090                              <2> 
  1090 000001B9 B098                <2>  mov al, 152
  1090                              <2> effdonot:
  1090 000001BB EB03                <2>  jmp short effect1
  1090                              <2> effect2:
  1090 000001BD 268A05              <2>  mov al, byte [es:di]
  1090                              <2> effect1:
  1090 000001C0 024405              <2>  add al, byte [si+5]
  1090 000001C3 268805              <2>  mov byte [es:di], al
  1090 000001C6 43                  <2>  inc bx
  1090 000001C7 3A5C03              <2>  cmp bl, byte [si+3]
  1090 000001CA 7ED4                <2>  jle short effxloop
  1090 000001CC 41                  <2>  inc cx
  1090 000001CD 3A4C04              <2>  cmp cl, byte [si+4]
  1090 000001D0 7ECA                <2>  jle short effyloop
  1090 000001D2 83C606              <2>  add si, 6
  1090 000001D5 59                  <2>  pop cx
  1090 000001D6 E2AF                <2>  loop effmloop
  1090                              <1>  addLava
  1090 000001D8 8E06[8741]          <2>  mov es, word [tseg+22]
  1090 000001DC BFFF0F              <2>  mov di, 4095
  1090 000001DF B91400              <2>  mov cx, 20
  1090 000001E2 B05E                <2>  mov al, 94
  1090                              <2> aLyloop:
  1090 000001E4 51                  <2>  push cx
  1090 000001E5 C1E103              <2>  shl cx, 3
  1090                              <2> aLxloop:
  1090 000001E8 57                  <2>  push di
  1090 000001E9 50                  <2>  push ax
  1090 000001EA BB4000              <2>  mov bx, 64
  1090 000001ED E8A903              <2>  call rnd
  1090 000001F0 29C7                <2>  sub di, ax
  1090 000001F2 58                  <2>  pop ax
  1090 000001F3 AA                  <2>  stosb
  1090                              <2> 
  1090 000001F4 5F                  <2>  pop di
  1090 000001F5 E2F1                <2>  loop aLxloop
  1090 000001F7 59                  <2>  pop cx
  1090 000001F8 FEC8                <2>  dec al
  1090 000001FA 83EF40              <2>  sub di, 64
  1090 000001FD E2E5                <2>  loop aLyloop
  1091                                  
  1092                                  		calcShadeTab
  1092 000001FF 1E                  <1>  push ds
  1092 00000200 07                  <1>  pop es
  1092 00000201 BF[9941]            <1>  mov di, shadetab
  1092 00000204 30DB                <1>  xor bl, bl
  1092                              <1> cSolp:
  1092 00000206 FEC3                <1>  inc bl
  1092 00000208 31C9                <1>  xor cx, cx
  1092                              <1> cSilp1:
  1092 0000020A 88C8                <1>  mov al, cl
  1092 0000020C 241F                <1>  and al, 31
  1092 0000020E F6E3                <1>  mul bl
  1092 00000210 01C0                <1>  add ax, ax
  1092 00000212 88C8                <1>  mov al, cl
  1092 00000214 24E0                <1>  and al, 224
  1092 00000216 00E0                <1>  add al, ah
  1092 00000218 AA                  <1>  stosb
  1092 00000219 FEC1                <1>  inc cl
  1092 0000021B 80F9C0              <1>  cmp cl, 192
  1092 0000021E 75EA                <1>  jne short cSilp1
  1092                              <1> cSilp2:
  1092 00000220 88C8                <1>  mov al, cl
  1092 00000222 AA                  <1>  stosb
  1092 00000223 FEC1                <1>  inc cl
  1092 00000225 75F9                <1>  jnz short cSilp2
  1092 00000227 80FB80              <1>  cmp bl, 128
  1092 0000022A 75DA                <1>  jne short cSolp
  1093                                  
  1094 0000022C 8926[B132]              		mov	word [oldstack], sp
  1095                                  
  1096                                  		startTimer
  1096 00000230 B80835              <1>  mov ax, 03508h
  1096 00000233 CD21                <1>  int 21h
  1096 00000235 8C06[B532]          <1>  mov word [Old08Irqseg], es
  1096 00000239 891E[B332]          <1>  mov word [Old08Irqofs], bx
  1096 0000023D B80825              <1>  mov ax, 02508h
  1096 00000240 BA[6304]            <1>  mov dx, irqHandler08
  1096 00000243 CD21                <1>  int 21h
  1096                              <1> 
  1096 00000245 BB510D              <1>  mov bx, 3409
  1096 00000248 E86103              <1>  call setTimer
  1097                                  		startKBDHandler
  1097 0000024B B80935              <1>  mov ax, 03509h
  1097 0000024E CD21                <1>  int 21h
  1097 00000250 8C06[B932]          <1>  mov word [Old09Irqseg], es
  1097 00000254 891E[B732]          <1>  mov word [Old09Irqofs], bx
  1097 00000258 B80925              <1>  mov ax, 02509h
  1097 0000025B BA[0205]            <1>  mov dx, irqHandler09
  1097 0000025E CD21                <1>  int 21h
  1098                                  		cls
  1098 00000260 1E                  <1>  push ds
  1098 00000261 8E06[6F41]          <1>  mov es, word [bseg]
  1098 00000265 6800A0              <1>  push 0A000h
  1098 00000268 1F                  <1>  pop ds
  1098                              <1> 
  1098                              <1> 
  1098 00000269 BE4006              <1>  mov si, 320*5
  1098 0000026C 31FF                <1>  xor di, di
  1098 0000026E B9007D              <1>  mov cx, 32000
  1098                              <1> clsloop:
  1098 00000271 AC                  <1>  lodsb
  1098 00000272 AA                  <1>  stosb
  1098 00000273 AA                  <1>  stosb
  1098 00000274 E2FB                <1>  loop clsloop
  1098 00000276 1F                  <1>  pop ds
  1099                                  mainloop:
  1100                                  		;mov	ah, 1	; Check keyboard buffer
  1101                                  		;int	16h	; Keyboard interrupt
  1102                                  		;jnz	_exit_  ; exit
  1103                                  
  1104                                  		setPalette2
  1104 00000277 30C0                <1>  xor al, al
  1104 00000279 BAC803              <1>  mov dx, 3C8h
  1104 0000027C EE                  <1>  out dx, al
  1104 0000027D 42                  <1>  inc dx
  1104 0000027E BE[2D13]            <1>  mov si, palette
  1104 00000281 B90003              <1>  mov cx, 768
  1104 00000284 F36E                <1>  rep outsb
  1105                                  
  1106                                  		scriptIt
  1106 00000286 8B0E[2913]          <1>  mov cx, word [ticker]
  1106 0000028A C706[2913]0000      <1>  mov word [ticker], 0
  1106 00000290 09C9                <1>  or cx, cx
  1106 00000292 0F848700            <1>  jz sItickerNull
  1106                              <1> sImloop:
  1106 00000296 51                  <1>  push cx
  1106 00000297 BE[1B13]            <1>  mov si, zspeed
  1106 0000029A FF4C0A              <1>  dec word [si+10]
  1106                              <1> 
  1106 0000029D 7928                <1>  jns short sIwaitTimer
  1106 0000029F 8B5C08              <1>  mov bx, word [si+8]
  1106                              <1> 
  1106 000002A2 8A87[0912]          <1>  mov al, byte [bx+script]
  1106 000002A6 08C0                <1>  or al, al
  1106 000002A8 0F847A01            <1>  jz _exit_
  1106 000002AC 89C3                <1>  mov bx, ax
  1106 000002AE 80E307              <1>  and bl, 7
  1106 000002B1 885C0C              <1>  mov byte [si+12], bl
  1106                              <1> 
  1106 000002B4 FECB                <1>  dec bl
  1106 000002B6 7504                <1>  jnz short sInegateTurn
  1106                              <1> 
  1106 000002B8 F71E[8612]          <1>  neg word [zstep]
  1106                              <1> sInegateTurn:
  1106 000002BC 25F800              <1>  and ax, 0F8h
  1106 000002BF 01C0                <1>  add ax, ax
  1106 000002C1 89440A              <1>  mov word [si+10], ax
  1106                              <1> 
  1106 000002C4 FF4408              <1>  inc word [si+8]
  1106                              <1> 
  1106                              <1> sIwaitTimer:
  1106 000002C7 8A440C              <1>  mov al, byte [si+12]
  1106                              <1> 
  1106 000002CA 98                  <1>  cbw
  1106                              <1> 
  1106 000002CB 48                  <1>  dec ax
  1106 000002CC 7507                <1>  jnz short sInoturn
  1106                              <1> 
  1106 000002CE 8B1E[8612]          <1>  mov bx, word [zstep]
  1106 000002D2 015C06              <1>  add word [si+6], bx
  1106                              <1> 
  1106                              <1> 
  1106                              <1> sInoturn:
  1106                              <1> 
  1106 000002D5 B90300              <1>  mov cx, 3
  1106                              <1> sIrotateLoop:
  1106 000002D8 48                  <1>  dec ax
  1106 000002D9 7502                <1>  jnz short sInoIncrement
  1106                              <1> 
  1106 000002DB FF04                <1>  inc word [si]
  1106                              <1> 
  1106                              <1> sInoIncrement:
  1106 000002DD 48                  <1>  dec ax
  1106 000002DE 7502                <1>  jnz short sInoDecrement
  1106                              <1> 
  1106 000002E0 FF0C                <1>  dec word [si]
  1106                              <1> 
  1106                              <1> sInoDecrement:
  1106 000002E2 46                  <1>  inc si
  1106 000002E3 46                  <1>  inc si
  1106 000002E4 E2F2                <1>  loop sIrotateLoop
  1106                              <1> 
  1106 000002E6 BE[1D13]            <1>  mov si, zspeed+2
  1106                              <1> 
  1106 000002E9 B103                <1>  mov cl, 3
  1106                              <1> sIpushloop:
  1106 000002EB AD                  <1>  lodsw
  1106 000002EC C1F802              <1>  sar ax, 2
  1106 000002EF 50                  <1>  push ax
  1106 000002F0 E2F9                <1>  loop sIpushloop
  1106                              <1> 
  1106 000002F2 6B44FC10            <1>  imul ax, word [si-4], 16
  1106 000002F6 50                  <1>  push ax
  1106 000002F7 E80008              <1>  call calcRotMat
  1106                              <1> 
  1106 000002FA B103                <1>  mov cl, 3
  1106 000002FC 31F6                <1>  xor si, si
  1106                              <1> sImoveLoop:
  1106 000002FE D984[C712]          <1>  fld dword [si+owmat+24]
  1106 00000302 DE0E[1B13]          <1>  fimul word [zspeed]
  1106 00000306 DE36[FB0C]          <1>  fidiv word [CONST1792]
  1106 0000030A D884[A312]          <1>  fadd dword [si+ob]
  1106 0000030E D99C[A312]          <1>  fstp dword [si+ob]
  1106 00000312 83C604              <1>  add si, 4
  1106 00000315 E2E7                <1>  loop sImoveLoop
  1106 00000317 59                  <1>  pop cx
  1106 00000318 49                  <1>  dec cx
  1106 00000319 0F8579FF            <1>  jnz sImloop
  1106                              <1> sItickerNull:
  1107                                  
  1108                                  		animDoor
  1108 0000031D A1[8812]            <1>  mov ax, word [doortimer]
  1108 00000320 09C0                <1>  or ax, ax
  1108 00000322 7904                <1>  jns short aDnounder
  1108 00000324 31C0                <1>  xor ax, ax
  1108 00000326 EB2F                <1>  jmp short alreadydrawed
  1108                              <1> aDnounder:
  1108 00000328 803E[2813]00        <1>  cmp byte [once], 0
  1108 0000032D 7528                <1>  jne short alreadydrawed
  1108 0000032F FE06[2813]          <1>  inc byte [once]
  1108 00000333 50                  <1>  push ax
  1108                              <1>  starbackground
  1108 00000334 8E06[6F41]          <2>  mov es, word [bseg]
  1108 00000338 B96400              <2>  mov cx, 100
  1108                              <2> starbackloop:
  1108 0000033B 51                  <2>  push cx
  1108 0000033C BBC0C1              <2>  mov bx, 320*155
  1108 0000033F E85702              <2>  call rnd
  1108 00000342 050019              <2>  add ax, 320*20
  1108 00000345 89C7                <2>  mov di, ax
  1108 00000347 80E407              <2>  and ah, 7
  1108 0000034A BA3B01              <2>  mov dx, 320-5
  1108 0000034D B90200              <2>  mov cx, 2
  1108 00000350 E8BE01              <2>  call setstarbob
  1108 00000353 59                  <2>  pop cx
  1108 00000354 E2E5                <2>  loop starbackloop
  1108 00000356 58                  <1>  pop ax
  1108                              <1> alreadydrawed:
  1108 00000357 83F818              <1>  cmp ax, 24
  1108 0000035A 7E03                <1>  jle short aDnoover
  1108 0000035C B81800              <1>  mov ax, 24
  1108                              <1> aDnoover:
  1108 0000035F C1E006              <1>  shl ax, 6
  1108 00000362 1E                  <1>  push ds
  1108 00000363 8E06[8B41]          <1>  mov es, word [tseg+26]
  1108 00000367 8E1E[8F41]          <1>  mov ds, word [tseg+30]
  1108 0000036B 89C6                <1>  mov si, ax
  1108 0000036D 31FF                <1>  xor di, di
  1108 0000036F B90004              <1>  mov cx, 1024
  1108 00000372 F3A5                <1>  rep movsw
  1108 00000374 BE0008              <1>  mov si, 2048
  1108 00000377 29C6                <1>  sub si, ax
  1108 00000379 56                  <1>  push si
  1108 0000037A B504                <1>  mov ch, 4
  1108 0000037C F3A5                <1>  rep movsw
  1108 0000037E 5F                  <1>  pop di
  1108 0000037F 89C1                <1>  mov cx, ax
  1108 00000381 31C0                <1>  xor ax, ax
  1108 00000383 F3AB                <1>  rep stosw
  1108 00000385 1F                  <1>  pop ds
  1109                                  
  1110 00000386 1E                      		push	ds
  1111 00000387 8E06[6D41]              		mov	es, word [vseg]
  1112 0000038B 8E1E[6F41]              		mov	ds, word [bseg]
  1113 0000038F E89E01                  		call	copyseg
  1114 00000392 1F                      		pop	ds
  1115                                  
  1116                                  		rotation
  1116 00000393 8B0E[8D16]          <1>  mov cx, word [o+object.panz]
  1116 00000397 BE[9116]            <1>  mov si, o+object.p
  1116 0000039A BF[79C3]            <1>  mov di, rp
  1116                              <1> rotmlp:
  1116 0000039D BB[D312]            <1>  mov bx, wmat
  1116 000003A0 BA0300              <1>  mov dx, 3
  1116                              <1> rotilp:
  1116 000003A3 DF04                <1>  fild word [si+0]
  1116 000003A5 D826[A312]          <1>  fsub dword [ob+vector.x]
  1116 000003A9 D80F                <1>  fmul dword [bx+0]
  1116 000003AB DF4402              <1>  fild word [si+2]
  1116 000003AE D826[A712]          <1>  fsub dword [ob+vector.y]
  1116 000003B2 D84F04              <1>  fmul dword [bx+4]
  1116 000003B5 DF4404              <1>  fild word [si+4]
  1116 000003B8 D826[AB12]          <1>  fsub dword [ob+vector.z]
  1116 000003BC D84F08              <1>  fmul dword [bx+8]
  1116                              <1> 
  1116                              <1> 
  1116 000003BF DEC1                <1>  faddp
  1116 000003C1 DEC1                <1>  faddp
  1116 000003C3 D91D                <1>  fstp dword [di]
  1116 000003C5 83C704              <1>  add di, 4
  1116 000003C8 83C30C              <1>  add bx, 12
  1116 000003CB 4A                  <1>  dec dx
  1116 000003CC 75D5                <1>  jnz short rotilp
  1116 000003CE 83C608              <1>  add si, 8
  1116 000003D1 E2CA                <1>  loop rotmlp
  1117                                  		sortFaces
  1117 000003D3 1E                  <1>  push ds
  1117 000003D4 07                  <1>  pop es
  1117 000003D5 BF[39D6]            <1>  mov di, facei
  1117 000003D8 57                  <1>  push di
  1117 000003D9 BE[1123]            <1>  mov si, o+object.f
  1117 000003DC 89F0                <1>  mov ax, si
  1117 000003DE 8B0E[8F16]          <1>  mov cx, word [o+object.fanz]
  1117                              <1> sFmloop:
  1117 000003E2 D9EE                <1>  fldz
  1117 000003E4 51                  <1>  push cx
  1117 000003E5 B90400              <1>  mov cx, 4
  1117                              <1> sFiloop:
  1117 000003E8 6B1C0C              <1>  imul bx, word [si], 12
  1117 000003EB 46                  <1>  inc si
  1117 000003EC 46                  <1>  inc si
  1117 000003ED D8A7[81C3]          <1>  fsub dword [bx+rp+vector.z]
  1117 000003F1 E2F5                <1>  loop sFiloop
  1117 000003F3 59                  <1>  pop cx
  1117 000003F4 DF1D                <1>  fistp word [di]
  1117 000003F6 47                  <1>  inc di
  1117 000003F7 47                  <1>  inc di
  1117 000003F8 AB                  <1>  stosw
  1117 000003F9 83C00A              <1>  add ax, 10
  1117 000003FC 46                  <1>  inc si
  1117 000003FD 46                  <1>  inc si
  1117 000003FE E2E2                <1>  loop sFmloop
  1117 00000400 57                  <1>  push di
  1117 00000401 E85601              <1>  call qsort
  1118                                  
  1119 00000404 8B0E[8F16]              		mov	cx, word [o+object.fanz]
  1120 00000408 BE[39D6]                		mov	si, facei
  1121                                  drawloop:
  1122 0000040B AD                      		lodsw
  1123 0000040C AD                      		lodsw
  1124 0000040D 89C3                    		mov	bx, ax ; face address in 'o+object.f'
  1125 0000040F 60                      		pusha
  1126 00000410 E8F604                  		call	drawclippedface
  1127 00000413 61                      		popa
  1128 00000414 E2F5                    		loop	drawloop
  1129                                  	
  1130 00000416 1E                      		push	ds
  1131 00000417 6800A0                  		push	0A000h
  1132 0000041A 07                      		pop	es
  1133 0000041B 8E1E[6D41]              		mov	ds, word [vseg]
  1134 0000041F E80E01                  		call	copyseg
  1135 00000422 1F                      		pop	ds
  1136 00000423 E951FE                  		jmp	mainloop
  1137                                  loc_err_exit:
  1138                                  _exit_:
  1139 00000426 0E                      		push	cs
  1140 00000427 1F                      		pop	ds
  1141 00000428 8B26[B132]              		mov	sp, word [oldstack]
  1142                                  		silence
  1142 0000042C B90F00              <1>  mov cx, 15
  1142                              <1> Siloop:
  1142 0000042F 89C8                <1>  mov ax, cx
  1142 00000431 04B0                <1>  add al, CMD_CHANGEPARAM
  1142 00000433 E88301              <1>  call writeGM
  1142 00000436 B07B                <1>  mov al, MOD_ALLNOTESOFF
  1142 00000438 E87E01              <1>  call writeGM
  1142 0000043B 30C0                <1>  xor al, al
  1142 0000043D E87901              <1>  call writeGM
  1142 00000440 E2ED                <1>  loop Siloop
  1142                              <1> Sinosound:
  1143                                  		stopKBDHandler
  1143 00000442 1E                  <1>  push ds
  1143 00000443 B80925              <1>  mov ax,02509h
  1143 00000446 C516[B732]          <1>  lds dx, [Old09IrqPtr]
  1143 0000044A CD21                <1>  int 21h
  1143 0000044C 1F                  <1>  pop ds
  1144                                  		stopTimer
  1144 0000044D 1E                  <1>  push ds
  1144 0000044E 31DB                <1>  xor bx, bx
  1144 00000450 E85901              <1>  call setTimer
  1144 00000453 B80825              <1>  mov ax, 02508h
  1144 00000456 C516[B332]          <1>  lds dx, [Old08IrqPtr]
  1144 0000045A CD21                <1>  int 21h
  1144 0000045C 1F                  <1>  pop ds
  1145                                  		set80x25
  1145 0000045D B80300              <1>  mov ax, 3
  1145 00000460 CD10                <1>  int 10h
  1145                              <1> 
  1146 00000462 C3                      		ret
  1147                                  
  1148                                  ;==============================================================================
  1149                                  ;		interrupt handler
  1150                                  ;==============================================================================
  1151                                  ;***********************************************
  1152                                  ;* descript. : timer routine                   *
  1153                                  ;* parameter : none		               *
  1154                                  ;* sideeffect: none		               *
  1155                                  ;* back      : none		               *
  1156                                  ;***********************************************
  1157                                  
  1158                                  irqHandler08:
  1159 00000463 60                      		pusha
  1160                                  		
  1161 00000464 1E                      		push	ds
  1162 00000465 06                      		push	es
  1163                                  
  1164 00000466 0E                      		push	cs
  1165 00000467 1F                      		pop	ds
  1166                                  
  1167                                  		playsong
  1167 00000468 8B0E[2B13]          <1>  mov cx, word [tracks]
  1167 0000046C BE[2D16]            <1>  mov si, channels
  1167                              <1> PSmloop:
  1167 0000046F FF0C                <1>  dec word [si+channel.del]
  1167 00000471 7F2C                <1>  jg short PSdelayed
  1167 00000473 8B4402              <1>  mov ax, word [si+channel.trk]
  1167 00000476 0480                <1>  add al, CMD_NOTEOFF
  1167 00000478 E85101              <1>  call setnote
  1167 0000047B 8B5C04              <1>  mov bx, word [si+channel.adr]
  1167 0000047E B47F                <1>  mov ah, 127
  1167 00000480 803F00              <1>  cmp byte [bx], 0
  1167 00000483 7414                <1>  jz short PStrackend
  1167 00000485 8A27                <1>  mov ah, byte [bx]
  1167 00000487 886403              <1>  mov byte [si+channel.ln], ah
  1167 0000048A 8A4402              <1>  mov al, byte [si+channel.trk]
  1167 0000048D 0490                <1>  add al, CMD_NOTEON
  1167 0000048F E83A01              <1>  call setnote
  1167 00000492 8A4701              <1>  mov al, byte [bx+1]
  1167 00000495 B31D                <1>  mov bl, SONGSPEED
  1167 00000497 F6E3                <1>  mul bl
  1167                              <1> PStrackend:
  1167 00000499 8904                <1>  mov word [si+channel.del], ax
  1167 0000049B 83440402            <1>  add word [si+channel.adr], 2
  1167                              <1> PSdelayed:
  1167 0000049F 83C606              <1>  add si, 6
  1167 000004A2 E2CB                <1>  loop PSmloop
  1167                              <1> PSnosound:
  1168                                  
  1169 000004A4 FF06[2913]              		inc	word [ticker]
  1170 000004A8 FE06[6C41]              		inc	byte [twice]
  1171 000004AC 8026[6C41]07            		and	byte [twice], 7
  1172 000004B1 7547                    		jnz	short iH08notyet
  1173                                  
  1174                                  		colorCycle
  1174                              <1>  base equ 6*32
  1174                              <1>  range equ 32
  1174                              <1> 
  1174 000004B3 1E                  <1>  push ds
  1174 000004B4 07                  <1>  pop es
  1174 000004B5 BF[6D15]            <1>  mov di, palette+(base*3)
  1174 000004B8 89FE                <1>  mov si, di
  1174 000004BA AD                  <1>  lodsw
  1174                              <1> 
  1174 000004BB 46                  <1>  inc si
  1174 000004BC B95D00              <1>  mov cx, (range*3-3)
  1174 000004BF F3A4                <1>  rep movsb
  1174 000004C1 AB                  <1>  stosw
  1174                              <1> 
  1175                                  		animStars
  1175                              <1>  _base equ 7*32
  1175                              <1> 
  1175 000004C2 8E06[7341]          <1>  mov es, word [tseg+2]
  1175 000004C6 E81501              <1>  call clearFrac
  1175                              <1> 
  1175 000004C9 B11E                <1>  mov cl, 30
  1175 000004CB BB[1241]            <1>  mov bx, stars
  1175                              <1> aSoloop:
  1175 000004CE FE0F                <1>  dec byte [bx]
  1175 000004D0 8A27                <1>  mov ah, byte [bx]
  1175 000004D2 80E43F              <1>  and ah, 63
  1175 000004D5 80FC1F              <1>  cmp ah, 31
  1175 000004D8 7605                <1>  jbe short aSnonot
  1175 000004DA F6D4                <1>  not ah
  1175 000004DC 80E41F              <1>  and ah, 31
  1175                              <1> aSnonot:
  1175 000004DF D0EC                <1>  shr ah, 1
  1175 000004E1 8B7F01              <1>  mov di, word [bx+1]
  1175 000004E4 51                  <1>  push cx
  1175 000004E5 53                  <1>  push bx
  1175                              <1> 
  1175 000004E6 BA3B00              <1>  mov dx, 64-5
  1175 000004E9 B900E0              <1>  mov cx, _base*256+0
  1175 000004EC E82200              <1>  call setstarbob
  1175                              <1> 
  1175 000004EF 5B                  <1>  pop bx
  1175 000004F0 59                  <1>  pop cx
  1175 000004F1 83C303              <1>  add bx, 3
  1175 000004F4 E2D8                <1>  loop aSoloop
  1176                                  	
  1177 000004F6 FF06[8812]              		inc	word [doortimer]
  1178                                  iH08notyet:
  1179 000004FA B020                    		mov	al, 20h
  1180 000004FC E620                    		out	20h, al
  1181                                  		
  1182 000004FE 07                      		pop	es
  1183 000004FF 1F                      		pop	ds
  1184 00000500 61                      		popa
  1185 00000501 CF                      		iret
  1186                                  
  1187                                  ;***********************************************
  1188                                  ;* descript. : keyboard- / breakhandler	       *
  1189                                  ;* parameter : none		               *
  1190                                  ;* sideeffect: none		               *
  1191                                  ;* back      : none		               *
  1192                                  ;* length    : 12 bytes		               *
  1193                                  ;***********************************************
  1194                                  ;
  1195                                  irqHandler09:
  1196 00000502 50                      		push    ax
  1197 00000503 B020                    		mov     al, 20h
  1198 00000505 E620                    		out     20h, al
  1199 00000507 E460                    		in      al, 60h
  1200 00000509 FEC8                    		dec     al
  1201 0000050B 58                      		pop     ax
  1202 0000050C 0F8416FF                		je	_exit_
  1203 00000510 CF                      		iret
  1204                                  	
  1205                                  ;==============================================================================
  1206                                  ;		sub routines
  1207                                  ;==============================================================================
  1208                                  ;***********************************************
  1209                                  ;* descript. : draw a the starbob	       *
  1210                                  ;* parameter : ds,es: source seg,dest seg      *
  1211                                  ;* sideeffect: ax,cx,si,di	               *
  1212                                  ;* back      : none		               *
  1213                                  ;***********************************************
  1214                                  
  1215                                  setstarbob:
  1216 00000511 BE[470F]                		mov	si, bob
  1217 00000514 B305                    		mov	bl, 5
  1218                                  yloop:
  1219 00000516 B705                    		mov	bh, 5
  1220                                  xloop:
  1221 00000518 AC                      		lodsb
  1222 00000519 28E0                    		sub	al, ah
  1223 0000051B 7E07                    		jle	short aSnodraw
  1224 0000051D 00E8                    		add	al, ch
  1225 0000051F D2E0                    		shl	al, cl
  1226 00000521 268805                  		mov	byte [es:di], al
  1227                                  		;mov	byte [di], al
  1228                                  aSnodraw:
  1229 00000524 47                      		inc	di
  1230 00000525 FECF                    		dec	bh
  1231 00000527 75EF                    		jnz	short xloop
  1232 00000529 01D7                    		add	di, dx
  1233 0000052B FECB                    		dec	bl
  1234 0000052D 75E7                    		jnz	short yloop
  1235 0000052F C3                      		retn
  1236                                  
  1237                                  ;***********************************************
  1238                                  ;* descript. : copy 16000 longs ds --> es      *
  1239                                  ;* parameter : ds,es: source seg,dest seg      *
  1240                                  ;* sideeffect: ax,cx,si,di	               *
  1241                                  ;* back      : none		               *
  1242                                  ;***********************************************
  1243                                  
  1244                                  copyseg:
  1245 00000530 31FF                    		xor	di, di
  1246 00000532 31F6                    		xor	si, si
  1247 00000534 B9803E                  		mov	cx, 16000 ; 3E80h
  1248 00000537 F366A5                  		rep movsd
  1249 0000053A C3                      		retn
  1250                                  
  1251                                  ;***********************************************
  1252                                  ;* descript. : expand a part of the song       *
  1253                                  ;* parameter : si:base adress		       *
  1254                                  ;* sideeffect: si,ax		               *
  1255                                  ;* back      : ax=si:new baseadress            *
  1256                                  ;***********************************************
  1257                                  
  1258                                  expand:
  1259 0000053B 8A0C                    EPwhile: 	mov	cl, byte [si]
  1260 0000053D 08C9                    		or	cl, cl
  1261 0000053F 7415                    		jz	short EPendwhile
  1262 00000541 7910                    		jns	short EPnote
  1263                                  EPcall:
  1264 00000543 51                      		push	cx
  1265 00000544 56                      		push	si
  1266 00000545 46                      		inc	si
  1267 00000546 E8F2FF                  		call	expand
  1268 00000549 5E                      		pop	si
  1269 0000054A 59                      		pop	cx
  1270 0000054B FEC1                    		inc	cl
  1271 0000054D 75F4                    		jnz	short EPcall
  1272 0000054F 89C6                    		mov	si, ax
  1273 00000551 EBE8                    		jmp	short EPwhile 
  1274                                  EPnote:
  1275 00000553 A5                      		movsw
  1276 00000554 EBE5                    		jmp	short EPwhile
  1277                                  EPendwhile:
  1278 00000556 46                      		inc	si
  1279 00000557 89F0                    		mov	ax, si
  1280 00000559 C3                      		retn
  1281                                  
  1282                                  ;***********************************************
  1283                                  ;* descript. : recursive index quicksort       *
  1284                                  ;* parameter : l,r:stack left and right border *
  1285                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
  1286                                  ;* back      : none		               *
  1287                                  ;***********************************************
  1288                                  
  1289                                  qsort:
  1290 0000055A 58                      		pop	ax 	; get address
  1291 0000055B 59                      		pop	cx	; get 2. param r
  1292 0000055C 5B                      		pop	bx	; get 1. param l
  1293 0000055D 50                      		push	ax	; store address
  1294                                  
  1295 0000055E 39D9                    		cmp	cx, bx
  1296 00000560 7E36                    		jle	short QSendrek
  1297 00000562 89DE                    		mov	si, bx
  1298 00000564 89CF                    		mov	di, cx  	
  1299 00000566 8B14                    		mov	dx, word [si]
  1300                                  QSrepeat:
  1301 00000568 3914                    QSwhile1:	cmp	word [si], dx
  1302 0000056A 7E05                    		jle	short QSwhile2
  1303 0000056C 83C604                  		add	si, 4
  1304 0000056F EBF7                    		jmp	short QSwhile1
  1305                                  QSwhile2:
  1306 00000571 3915                    		cmp	word [di], dx
  1307 00000573 7D05                    		jnl	short QSwhile2e
  1308 00000575 83EF04                  		sub	di, 4
  1309 00000578 EBF7                    		jmp	short QSwhile2
  1310                                  QSwhile2e:
  1311 0000057A 39FE                    		cmp	si, di
  1312 0000057C 7F0C                    		jg	short QSnoswap
  1313                                  		;jg	short _QSnoswap
  1314 0000057E 66AD                    		lodsd
  1315 00000580 668705                  		xchg	eax, dword [di]
  1316 00000583 668944FC                		mov	dword [si-4], eax
  1317 00000587 83EF04                  		sub	di, 4
  1318                                  QSnoswap:
  1319 0000058A 39FE                    		cmp	si, di
  1320 0000058C 7EDA                    		jle	short QSrepeat
  1321                                  ;_QSnoswap:
  1322 0000058E 56                      		push	si 
  1323 0000058F 51                      		push	cx
  1324 00000590 53                      		push	bx
  1325 00000591 57                      		push	di
  1326 00000592 E8C5FF                  		call	qsort
  1327 00000595 E8C2FF                  		call	qsort
  1328                                  QSendrek:
  1329 00000598 C3                      		retn
  1330                                  
  1331                                  ;***********************************************
  1332                                  ;* descript. : returns a pseudo random number  *
  1333                                  ;* parameter : bx=range		               *
  1334                                  ;* sideeffect: eax,edx,si		       *
  1335                                  ;* back      : ax=rnd(range)                   *
  1336                                  ;***********************************************
  1337                                  
  1338                                  rnd:
  1339 00000599 BE[010D]                		mov	si, randommul
  1340 0000059C 66AD                    		lodsd
  1341 0000059E 66F724                  		mul	dword [si] ; randomseed
  1342 000005A1 6640                    		inc	eax
  1343 000005A3 668904                  		mov	dword [si], eax  ; randomseed
  1344 000005A6 AD                      		lodsw
  1345 000005A7 AD                      		lodsw
  1346 000005A8 F7E3                    		mul	bx
  1347 000005AA 92                      		xchg	ax, dx
  1348 000005AB C3                      		retn
  1349                                  
  1350                                  ;***********************************************
  1351                                  ;* descript. : set timer speed to 1193180/AX   *
  1352                                  ;*             interrupts per second           *
  1353                                  ;* parameter : bx		               *
  1354                                  ;* sideeffect: ax		               *
  1355                                  ;* back      : none		               *
  1356                                  ;***********************************************
  1357                                  
  1358                                  setTimer:	; set timer speed to 1193180/BX (TRDOS 386)
  1359 000005AC B036                    		mov	al, 36h
  1360 000005AE E643                    		out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1361 000005B0 88D8                    		mov	al, bl
  1362 000005B2 E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1363 000005B4 88F8                    		mov	al, bh
  1364 000005B6 E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1365 000005B8 C3                      		retn
  1366                                  
  1367                                  ;***********************************************
  1368                                  ;* descript. : send a byte to the GM-Port      *
  1369                                  ;* parameter : al:midi command                 *
  1370                                  ;* sideeffect: dx		               *
  1371                                  ;* back      : none		               *
  1372                                  ;***********************************************
  1373                                  
  1374                                  writeGM:
  1375 000005B9 BA3103                  		mov	dx, GMPort  ; 331h
  1376 000005BC 50                      		push	ax
  1377 000005BD 31C0                    		xor	ax, ax
  1378                                  busy:
  1379 000005BF FECC                    		dec	ah
  1380 000005C1 7405                    		jz	short timeOut
  1381 000005C3 EC                      		in	al, dx
  1382 000005C4 A840                    		test	al, 40h
  1383 000005C6 75F7                    		jnz	short busy
  1384                                  timeOut:
  1385 000005C8 58                      		pop	ax
  1386 000005C9 4A                      		dec	dx
  1387 000005CA EE                      		out	dx, al
  1388 000005CB C3                      		retn
  1389                                  
  1390                                  ;***********************************************
  1391                                  ;* descript. : send NOTEON command, volume 127 *
  1392                                  ;* parameter : al:channel;ah:note              *
  1393                                  ;* sideeffect: dx,al		               *
  1394                                  ;* back      : none		               *
  1395                                  ;***********************************************
  1396                                  
  1397                                  setnote:
  1398 000005CC E80600                  		call	setinstr
  1399 000005CF B07F                    		mov	al, 127	; 7Fh
  1400 000005D1 E8E5FF                  		call	writeGM
  1401 000005D4 C3                      		retn
  1402                                  
  1403                                  ;***********************************************
  1404                                  ;* descript. : send CHANGEPRG command	       *
  1405                                  ;* parameter : al:channel;ah:instrument        *
  1406                                  ;* sideeffect: dx,al		               *
  1407                                  ;* back      : none		               *
  1408                                  ;***********************************************
  1409                                  
  1410                                  setinstr:
  1411 000005D5 E8E1FF                  		call	writeGM
  1412 000005D8 88E0                    		mov	al, ah
  1413 000005DA E8DCFF                  		call	writeGM
  1414 000005DD C3                      		retn
  1415                                  
  1416                                  ;***********************************************
  1417                                  ;* descript. : clear/set the fractal es: to al *
  1418                                  ;* parameter : al,es		               *
  1419                                  ;* sideeffect: ax,cx,di,es  	               *
  1420                                  ;* back      : none			       *
  1421                                  ;***********************************************
  1422                                  
  1423                                  clearFrac:
  1424 000005DE 31C0                    		xor	ax, ax
  1425                                  setFrac:
  1426 000005E0 31FF                    		xor	di, di
  1427 000005E2 B90010                  		mov	cx, 4096 ; 1000h
  1428 000005E5 F3AA                    		rep stosb
  1429 000005E7 C3                      		retn
  1430                                  
  1431                                  ;***********************************************
  1432                                  ;* descript. : calc shade bob fractal          *
  1433                                  ;* parameter : es:seg;num,rad:stack            *
  1434                                  ;* sideeffect: all			       *
  1435                                  ;* back      : none			       *
  1436                                  ;***********************************************
  1437                                  
  1438                                  createFrac1:
  1439                                  		rad	equ 4 ; arg 1 in [sp+2]
  1440                                  		num	equ 6 ; arg 2 in [sp+4]
  1441                                  
  1442 000005E8 55                      		push	bp
  1443 000005E9 89E5                    		mov	bp, sp
  1444                                  
  1445 000005EB 8E87[7141]              		mov	es, word [bx+tseg]
  1446 000005EF E8ECFF                  		call	clearFrac
  1447                                  
  1448 000005F2 BE[D240]                		mov	si, circletab
  1449 000005F5 8B5604                  		mov	dx, word [bp+rad]
  1450 000005F8 88D0                    		mov	al, dl
  1451 000005FA F6EA                    		imul	dl
  1452 000005FC 89C7                    		mov	di, ax
  1453                                  		;mov	bx, ax
  1454 000005FE 89D1                    		mov	cx, dx
  1455 00000600 01C9                    		add	cx, cx
  1456                                  CCTloop:
  1457 00000602 88D0                    		mov	al, dl
  1458 00000604 F6EA                    		imul	dl
  1459 00000606 F7D8                    		neg	ax
  1460 00000608 01F8                    		add	ax, di
  1461                                  		;add	ax, bx
  1462 0000060A 8904                    		mov	word [si], ax
  1463 0000060C DF04                    		fild	word [si]
  1464 0000060E D9FA                    		fsqrt
  1465 00000610 DF1C                    		fistp	word [si]
  1466 00000612 46                      		inc	si
  1467 00000613 46                      		inc	si
  1468 00000614 4A                      		dec	dx
  1469 00000615 E2EB                    		loop	CCTloop
  1470                                  
  1471 00000617 8B4E06                  		mov	cx, word [bp+num]
  1472                                  SBloop1:
  1473 0000061A 51                      		push	cx
  1474 0000061B BB0010                  		mov	bx, 4096 ; 1000h
  1475 0000061E E878FF                  		call	rnd
  1476 00000621 89C7                    		mov	di, ax
  1477 00000623 BE[D240]                		mov	si, circletab
  1478 00000626 8B4E04                  		mov	cx, word [bp+rad]
  1479 00000629 01C9                    		add	cx, cx
  1480                                  SBloop2:
  1481 0000062B 51                      		push	cx
  1482 0000062C AD                      		lodsw
  1483 0000062D 89C1                    		mov	cx, ax
  1484 0000062F 01C9                    		add	cx, cx
  1485 00000631 740E                    		jz	short SBskip
  1486 00000633 57                      		push	di
  1487 00000634 29C7                    		sub	di, ax
  1488                                  SBloop3:
  1489 00000636 81E7FF0F                		and	di, 4095  ; 0FFFh
  1490 0000063A 26FE05                  		inc	byte [es:di]
  1491 0000063D 47                      		inc	di
  1492 0000063E E2F6                    		loop	SBloop3
  1493 00000640 5F                      		pop	di
  1494                                  SBskip:
  1495 00000641 83C740                  		add	di, 64 ; 40h
  1496 00000644 59                      		pop	cx
  1497 00000645 E2E4                    		loop	SBloop2
  1498 00000647 59                      		pop	cx
  1499 00000648 E2D0                    		loop	SBloop1
  1500 0000064A 5D                      		pop	bp
  1501 0000064B C20400                  		ret	4
  1502                                  
  1503                                  ;***********************************************
  1504                                  ;* descript. : draw a perpective-texturemapped *
  1505                                  ;*	       and g.-shaded n-sided polygon   *
  1506                                  ;* parameter : far ptr to poly, sides, textnum *
  1507                                  ;* sideeffect: all			       *
  1508                                  ;* back      : none			       *
  1509                                  ;* length    : 700 bytes		       *
  1510                                  ;***********************************************
  1511                                  
  1512                                  scansubtextpoly:
  1513                                  		col	equ 4  ; arg 1, [sp+2] ; dcf.col value
  1514                                  		n	equ 6  ; arg 2, [sp+4] ; dcf.j value
  1515                                  		pol	equ 8  ; arg 3, [sp+6] ; dcf.p2 address
  1516                                  
  1517 0000064E C8960000                 		enter	150, 0	; 96h
  1518                                  		;enter	152, 0  ; 98h		
  1519                                  			; push bp ; mov bp, sp ; sub sp, 152
  1520                                  
  1521                                  		; bp - x
  1522                                  		sstp.edg  equ -60   ; 90-150 ; edges * 3
  1523                                  		sstp.del  equ -120  ; 30-150 ; edges * 3 
  1524                                  		sstp.mx1  equ -122  ; 28-150 ; word
  1525                                  		sstp.mx2  equ -124  ; 26-150 ; word	 				
  1526                                  		sstp.miny equ -126  ; 24-150 ; word
  1527                                  		sstp.maxy equ -128  ; 22-150 ; word	
  1528                                  		sstp.y	  equ -130  ; 20-150 ; word
  1529                                  		sstp.l	  equ -132  ; 18-150 ; word	 				
  1530                                  		sstp.r	  equ -134  ; 16-150 ; word
  1531                                  		sstp.uu1  equ -136  ; 14-150 ; word
  1532                                  		sstp.vv1  equ -138  ; 12-150 ; word
  1533                                  		sstp.uu2  equ -140  ; 10-150 ; word	 				
  1534                                  		sstp.vv2  equ -142  ;  8-150 ; word
  1535                                  		sstp.ddu  equ -144  ;  6-150 ; word
  1536                                  		sstp.ddv  equ -146  ;  4-150 ; word
  1537                                  		sstp.dy   equ -150  ;  0-150 ; dword
  1538                                  		; 
  1539                                  		;sstp.pad  equ -152  ; padding (for dword boundary)
  1540                                  
  1541                                  		;mov	ax, 32767
  1542                                  		;mov	dx, ax
  1543                                  		;mov	bx, ax
  1544                                  		;neg	bx	; -32767 ; 8001h
  1545                                  		;mov	si, bx	; -32767
  1546                                  
  1547 00000652 B80180                                  mov	ax,-32767
  1548 00000655 89C3                                    mov	bx,ax
  1549 00000657 89C6                                    mov	si,ax
  1550 00000659 F7D8                                    neg	ax
  1551 0000065B 89C2                                    mov	dx,ax
  1552                                  		
  1553                                  		; di = dcf.p2 address
  1554 0000065D 8B7E08                  		mov	di, word [bp+pol] ; [bp+8] ; dcf.p2 ; face structure
  1555                                  
  1556 00000660 31C9                    		xor	cx, cx
  1557                                  minmax:
  1558 00000662 3B4512                  		cmp	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1559 00000665 7E03                    		jle	short noswap1
  1560 00000667 8B4512                  		mov	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1561                                  noswap1:
  1562 0000066A 3B5D12                  		cmp	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1563 0000066D 7D03                    		jge	short noswap2
  1564 0000066F 8B5D12                  		mov	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1565                                  noswap2:
  1566 00000672 3B550C                  		cmp	dx, word [di+edge.py]  ; [di+0Ch]
  1567 00000675 7E0B                    		jle	short noswap3
  1568 00000677 8B550C                  		mov	dx, word [di+edge.py]  ; [di+0Ch]
  1569 0000067A 898E7CFF                		mov	word [bp+sstp.l], cx   ; [bp-84h]
  1570 0000067E 898E7AFF                		mov	word [bp+sstp.r], cx   ; [bp-86h]
  1571                                  noswap3:
  1572 00000682 3B750C                  		cmp	si, word [di+edge.py]  ; [di+0Ch]
  1573 00000685 7D03                    		jge	short noswap4
  1574 00000687 8B750C                  		mov	si, word [di+edge.py]  ; [di+0Ch]
  1575                                  noswap4:
  1576 0000068A 83C724                  		add	di, 36 ; 24h
  1577 0000068D 41                      		inc	cx
  1578 0000068E 3B4E06                  		cmp	cx, word [bp+n] ; [bp+6]
  1579                                  				   ; dcf.j ; number of visible edges/points
  1580 00000691 75CF                    		jne	short minmax
  1581                                  
  1582 00000693 83FB00                  		cmp	bx, 0
  1583 00000696 0F8C2102                		jl	exitDraw
  1584 0000069A 3D4001                  		cmp	ax, XMAX  ; 140h
  1585 0000069D 0F8F1A02                		jg	exitDraw
  1586                                  
  1587 000006A1 83FE15                  		cmp	si, YMIN  ; 15h
  1588 000006A4 0F8C1302                		jl	exitDraw
  1589 000006A8 81FAB300                		cmp	dx, YMAX  ; 0B3h
  1590 000006AC 0F8F0B02                		jg	exitDraw
  1591 000006B0 895682                  		mov	word [bp+sstp.miny], dx ; [bp-7Eh]
  1592 000006B3 897680                  		mov	word [bp+sstp.maxy], si ; [bp-80h]
  1593                                  
  1594                                  		;{ down clipping }
  1595 000006B6 817E80B300              		cmp	word [bp+sstp.maxy], YMAX ; 0B3h
  1596 000006BB 7E05                    		jle	short noclipdown
  1597 000006BD C74680B300              		mov	word [bp+sstp.maxy], YMAX ; 0B3h
  1598                                  noclipdown:
  1599 000006C2 8B4682                  		mov	ax, word [bp+sstp.miny] ; [bp-7Eh]
  1600 000006C5 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1601 000006C8 0F84EF01                		je	exitDraw
  1602 000006CC 89867EFF                		mov	word [bp+sstp.y], ax    ; [bp-82h]
  1603 000006D0 8B5E04                  		mov	bx, word [bp+col]	; [bp+4]
  1604                                  					   ; dcf.col ; shade/color value
  1605 000006D3 01DB                    		add	bx, bx
  1606 000006D5 8E06[6D41]              		mov	es, word [vseg]
  1607 000006D9 8EA7[7141]              		mov	fs, word [bx+tseg]
  1608                                  for:
  1609 000006DD 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1610 000006E1 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1611 000006E4 0F8FD301                		jg	exitDraw
  1612                                  		;je	exitwhile2
  1613                                  while1:
  1614 000006E8 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1615 000006EC 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1616 000006EF 7D25                    		jge	short while2	
  1617                                  
  1618 000006F1 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1619 000006F4 6B9E7CFF24              		imul	bx, word [bp+sstp.l], 36 ; [bp-84h]
  1620 000006F9 01DE                    		add	si, bx
  1621                                  		;mov	si, bx
  1622                                  		;add	si, word [bp+pol]	; [bp+8]
  1623                                  
  1624 000006FB 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1625 000006FE 7516                    		jne	short while2
  1626                                  
  1627 00000700 8B9E7CFF                		mov	bx, word [bp+sstp.l]	; [bp-84h]
  1628 00000704 4B                      		dec	bx
  1629 00000705 7D04                    		jge	short nounder
  1630 00000707 8B5E06                  		mov	bx, word [bp+n]		; [bp+6]
  1631                                  					   ; dcf.j ; visible edges/points
  1632 0000070A 4B                      		dec	bx
  1633                                  nounder:
  1634 0000070B 899E7CFF                		mov	word [bp+sstp.l], bx	; [bp-84h]
  1635 0000070F 31FF                    		xor	di, di
  1636 00000711 E8AB01                  		call	calcDeltas
  1637                                  		;mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1638                                  		;cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1639                                  		;jge	short exitwhile2	
  1640 00000714 EBD2                    		jmp	short while1
  1641                                  while2:
  1642 00000716 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1643 0000071A 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1644 0000071D 7D27                    		jge	short exitwhile2
  1645 0000071F 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1646 00000722 6B9E7AFF24              		imul	bx, word [bp+sstp.r], 36 ; [bp-86h]
  1647 00000727 01DE                    		add	si, bx
  1648                                  		;
  1649                                  		;mov	si, bx
  1650                                  		;add	si, word [bp+pol]	; [bp+8]
  1651                                  
  1652 00000729 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1653 0000072C 7518                    		jne	short exitwhile2
  1654                                  
  1655 0000072E 8B9E7AFF                		mov	bx, word [bp+sstp.r]    ; [bp-86h]
  1656 00000732 43                      		inc	bx
  1657 00000733 3B5E06                  		cmp	bx, word [bp+n]		; [bp+6]
  1658 00000736 7C02                    		jl	short noover
  1659 00000738 31DB                    		xor	bx, bx
  1660                                  noover:
  1661 0000073A 899E7AFF                		mov	word [bp+sstp.r], bx	; [bp-86h]
  1662 0000073E BF1400                  		mov	di, 20  ; 14h
  1663 00000741 E87B01                  		call	calcDeltas
  1664                                  		;
  1665                                  		;mov	ax, word [bp+sstp.y]	; [bp-82h]
  1666 00000744 EBD0                    		jmp	short while2
  1667                                  exitwhile2:
  1668                                  		;{ up clipping }
  1669 00000746 83BE7EFF15              		cmp	word [bp+sstp.y], YMIN	; 15h
  1670 0000074B 0F8C5501                		jl	clipup
  1671 0000074F 6631DB                  		xor	ebx, ebx
  1672 00000752 6631C9                  		xor	ecx, ecx
  1673 00000755 8B5EC6                  		mov	bx, word [bp+sstp.edg+2+edges.x] ; [bp-3Ah]
  1674 00000758 895E86                  		mov	word [bp+sstp.mx1], bx  ; [bp-7Ah]
  1675 0000075B 8B4EDA                  		mov	cx, word [bp+sstp.edg+20+2+edges.x] ; [bp-26h]
  1676 0000075E 894E84                  		mov	word [bp+sstp.mx2], cx  ; [bp-7Ch]
  1677 00000761 29D9                    		sub	cx, bx
  1678 00000763 0F843D01                		jz	exitol
  1679 00000767 837E8400                		cmp	word [bp+sstp.mx2], 0 ; [bp-7Ch]
  1680 0000076B 0F8E3501                		jle	exitol
  1681 0000076F 817E864001              		cmp	word [bp+sstp.mx1], XMAX ; 140h
  1682 00000774 0F8F2C01                		jg	exitol
  1683                                  
  1684 00000778 F7DB                    		neg	bx
  1685 0000077A 7904                    		jns	short myelse
  1686 0000077C 31DB                    		xor	bx, bx
  1687 0000077E EB05                    		jmp	short myendif
  1688                                  ;_nodivbyzero:
  1689                                  ;		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1690                                  ;		jmp	short nodivbyzero
  1691                                  myelse:
  1692 00000780 C746860000              		mov	word [bp+sstp.mx1], 0 ; [bp-7Ah]
  1693                                  myendif:
  1694 00000785 BF1000                  		mov	di, 16 ; 10h
  1695                                  addloop1:
  1696                                  		;{ calculate deltas }
  1697 00000788 668B43D8                		mov	eax, dword [bp+di+sstp.edg+20] ; [bp+di-28h]
  1698 0000078C 662B43C4                		sub	eax, dword [bp+di+sstp.edg]    ; [bp+di-3Ch]
  1699 00000790 6699                    		cdq
  1700 00000792 E307                    		jcxz	nodivbyzero
  1701                                  		;jcxz	_nodivbyzero
  1702 00000794 66F7F9                  		idiv	ecx
  1703 00000797 668943B0                		mov	dword [bp+di+sstp.del+40], eax ; [bp+di-50h]
  1704                                  nodivbyzero:
  1705                                  		;{ left clipping }
  1706 0000079B 668B43B0                		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1707 0000079F 66F7EB                  		imul	ebx
  1708 000007A2 660343C4                		add	eax, dword [bp+di+sstp.edg]	 ; [bp+di-3Ch]
  1709 000007A6 668943EC                		mov	dword [bp+di+sstp.edg+40], eax ; [bp+di-14h]
  1710 000007AA 83EF04                  		sub	di, 4
  1711 000007AD 75D9                    		jnz	short addloop1
  1712                                  
  1713 000007AF 8B46C0                  		mov	ax, word [bp+sstp.del+40+16]   ; [bp-40h]
  1714 000007B2 2EA3[8D08]              		mov	word [cs:dels_pos+1], ax
  1715                                  		;mov	word [cs:dels_pos_w], ax
  1716                                  
  1717                                  		;{ right clipping }
  1718 000007B6 817E844001              		cmp	word  [bp+sstp.mx2], XMAX  ; [bp-7Ch]
  1719 000007BB 7E05                    		jle	short norightclip
  1720 000007BD C746844001              		mov	word  [bp+sstp.mx2], XMAX  ; 140h
  1721                                  norightclip:
  1722 000007C2 69BE7EFF4001            		imul	di, word [bp+sstp.y], 320  ; [bp-82h]
  1723 000007C8 037E86                  		add	di, word [bp+sstp.mx1]	   ; [bp-7Ah]
  1724                                  		
  1725 000007CB BB0001                  		mov	bx, 256 ; 100h
  1726 000007CE 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1727 000007D2 66F7EB                  		imul	ebx
  1728 000007D5 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1729 000007D9 898674FF                		mov	word [bp+sstp.uu2], ax 	    ; [bp-8Ch]
  1730 000007DD 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1731 000007E1 66F7EB                  		imul	ebx
  1732 000007E4 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1733 000007E8 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1734                                  outloop:
  1735 000007EC 8B4E84                  		mov	cx, word [bp+sstp.mx2]	    ; [bp-7Ch]
  1736 000007EF 2B4E86                  		sub	cx, word [bp+sstp.mx1]	    ; [bp-7Ah]
  1737 000007F2 0F8EAE00                		jle	exitol
  1738 000007F6 83F910                  		cmp	cx, SUBRANGE ; 10h
  1739 000007F9 7E03                    		jle	short lastSeg
  1740 000007FB B91000                  		mov	cx, SUBRANGE ; 10h
  1741                                  lastSeg:
  1742                                  		;{ uu1:=uu2 }
  1743                                  		;{ vv1:=vv2 }
  1744 000007FE 668B8672FF              		mov	eax, dword [bp+sstp.vv2]    ; [bp-8Eh]
  1745 00000803 66898676FF              		mov	dword [bp+sstp.vv1], eax    ; [bp-8Ah]
  1746                                  
  1747 00000808 668B46B4                		mov	eax, dword [bp+sstp.del+40+edges.u] ; [bp-4Ch]
  1748 0000080C 66F7E9                  		imul	ecx
  1749 0000080F 660146F0                		add	dword [bp+sstp.edg+40+edges.u], eax ; [bp-10h]
  1750 00000813 668B46B8                		mov	eax, dword [bp+sstp.del+40+edges.v] ; [bp-48h]
  1751 00000817 66F7E9                  		imul	ecx
  1752 0000081A 660146F4                		add	dword [bp+sstp.edg+40+edges.v], eax ; [bp-0Ch]
  1753 0000081E 668B46BC                		mov	eax, dword [bp+sstp.del+40+edges.w] ; [bp-44h]
  1754 00000822 66F7E9                  		imul	ecx
  1755 00000825 660146F8                		add	dword [bp+sstp.edg+40+edges.w], eax ; [bp-8]
  1756                                  
  1757 00000829 BB0001                  		mov	bx, 256 ; 100h
  1758 0000082C 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1759 00000830 66F7EB                  		imul	ebx
  1760 00000833 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1761 00000837 898674FF                		mov	word [bp+sstp.uu2], ax	     ; [bp-8Ch]
  1762 0000083B 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1763 0000083F 66F7EB                  		imul	ebx
  1764 00000842 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1765 00000846 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1766                                  
  1767 0000084A 8B8674FF                		mov	ax, word [bp+sstp.uu2]	    ; [bp-8Ch]
  1768 0000084E 2B8678FF                		sub	ax, word [bp+sstp.uu1]	    ; [bp-88h]
  1769 00000852 99                      		cwd
  1770 00000853 F7F9                    		idiv	cx
  1771 00000855 2EA3[9108]              		mov	word [cs:ddu_pos+2], ax
  1772                                  		;mov	word [cs:ddu_pos_w], ax
  1773                                  
  1774 00000859 8B8672FF                		mov	ax, word [bp+sstp.vv2]	    ; [bp-8Eh]
  1775 0000085D 2B8676FF                		sub	ax, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1776 00000861 99                      		cwd
  1777 00000862 F7F9                    		idiv	cx
  1778 00000864 2EA3[9508]              		mov	word [cs:ddv_pos+2], ax
  1779                                  		;mov	word [cs:ddv_pos_w], ax
  1780                                  
  1781 00000868 8BB676FF                		mov	si, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1782 0000086C 8B9678FF                		mov	dx, word [bp+sstp.uu1]	    ; [bp-88h]
  1783 00000870 8B46FC                  		mov	ax, word [bp+sstp.edg+40+16] ; [bp-4]
  1784                                  innerloop:
  1785 00000873 89F3                    		mov	bx, si
  1786 00000875 30DB                    		xor	bl, bl
  1787 00000877 C1EB02                  		shr	bx, 2
  1788 0000087A 00F3                    		add	bl, dh
  1789 0000087C 648A1F                  		mov	bl, byte [fs:bx]
  1790 0000087F 08DB                    		or	bl, bl
  1791 00000881 7409                    		jz	short dels_pos
  1792 00000883 88E7                    		mov	bh, ah
  1793 00000885 8A9F[9941]              		mov	bl, byte [bx+shadetab]
  1794                                  
  1795 00000889 26881D                  		mov	byte [es:di], bl
  1796                                  
  1797 0000088C 051111                  dels_pos:	add ax, 1111h ;{word ptr dels}
  1798 0000088F 81C21111                ddu_pos:	add dx, 1111h ;{word ptr ddu }
  1799 00000893 81C61111                ddv_pos:	add si, 1111h ;{word ptr ddv }
  1800                                  
  1801                                  ;dels_pos:	
  1802                                  		;add	ax, word [cs:dels_pos_w]
  1803                                  ;ddu_pos:	
  1804                                  		;add	dx, word [cs:ddu_pos_w]
  1805                                  ;ddv_pos:	
  1806                                  		;add	si, word [cs:ddv_pos_w]
  1807                                  
  1808 00000897 47                      		inc	di	
  1809 00000898 E2D9                    		loop	innerloop
  1810                                  
  1811 0000089A 8946FC                  		mov	word [bp+sstp.edg+40+16], ax ; [bp-4]
  1812 0000089D 83468610                		add	word [bp+sstp.mx1], SUBRANGE ; [bp-7Ah]
  1813 000008A1 E948FF                  		jmp	outloop
  1814                                  exitol:
  1815 000008A4 BF2400                  clipup:		mov	di, 36 ; 24h
  1816                                  addloop:
  1817 000008A7 668B4388                		mov	eax, dword [bp+di+sstp.del]  ; [bp+di-78h]
  1818 000008AB 660143C4                		add	dword [bp+di+sstp.edg], eax  ; [bp+di-3Ch]
  1819 000008AF 83EF04                  		sub	di, 4
  1820 000008B2 79F3                    		jns	short addloop
  1821 000008B4 FF867EFF                		inc	word [bp+sstp.y]	 ; [bp-82h]
  1822 000008B8 E922FE                  		jmp	for
  1823                                  exitDraw:
  1824 000008BB C9                      		leave
  1825                                  			; mov sp, bp ; pop bp
  1826 000008BC C20600                  		ret	6
  1827                                  
  1828                                    ;***********************************************
  1829                                    ;* descript. : calc deltas for vertical interp.*
  1830                                    ;* parameter : none			         *
  1831                                    ;* sideeffect: all		 	         *
  1832                                    ;***********************************************
  1833                                  
  1834                                  calcDeltas:
  1835 000008BF 6BD324                  		imul	dx, bx,	36
  1836 000008C2 89F3                    		mov	bx, si
  1837 000008C4 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1838 000008C7 01D6                    		add	si, dx
  1839                                  		;
  1840                                  		;mov	si, dx
  1841                                  		;add	si, word [bp+pol]	; [bp+8]	
  1842 000008C9 8B440C                  		mov	ax, word [si+12]
  1843 000008CC 2B867EFF                		sub	ax, word [bp+sstp.y] ; [bp-82h]
  1844 000008D0 660FBFC0                		movsx	eax, ax
  1845 000008D4 6689866AFF              		mov	dword [bp+sstp.dy], eax ; [bp-96h]
  1846 000008D9 B90500                  		mov	cx, 5
  1847                                  cDloop:
  1848 000008DC 668B5710                		mov	edx, dword [bx+16]
  1849 000008E0 668953C4                		mov	dword [bp+di+sstp.edg], edx ; [bp+di-3Ch]
  1850 000008E4 668B4410                		mov	eax, dword [si+16]
  1851 000008E8 6629D0                  		sub	eax, edx
  1852 000008EB 6699                    		cdq
  1853 000008ED 83BE6AFF00              		cmp	word [bp+sstp.dy], 0  ; [bp-96h]
  1854 000008F2 7409                    		je	short cDskip
  1855 000008F4 66F7BE6AFF              		idiv	dword [bp+sstp.dy]    ; [bp-96h]
  1856 000008F9 66894388                		mov	dword [bp+di+sstp.del], eax ; [bp+di-78h]
  1857                                  cDskip:
  1858 000008FD 83C704                  		add	di, 4
  1859 00000900 83C604                  		add	si, 4
  1860 00000903 83C304                  		add	bx, 4
  1861 00000906 E2D4                    		loop	cDloop
  1862 00000908 C3                      		retn
  1863                                  
  1864                                  
  1865                                  ;***********************************************
  1866                                  ;* descript. : clip a poly at the viewplane,   *
  1867                                  ;*             project and draw it	       *
  1868                                  ;* parameter : bx:adress of the face	       *
  1869                                  ;* sideeffect: all		 	       *
  1870                                  ;* back      : none			       *
  1871                                  ;***********************************************
  1872                                  
  1873                                  drawclippedface:
  1874                                  
  1875                                  		dcf.d	equ -2	  ; word
  1876                                  		dcf.h	equ -4	  ; word	
  1877                                  		dcf.j	equ -6	  ; word
  1878                                  		dcf.col equ -8	  ; word
  1879                                  		dcf.is_in equ -10 ; byte
  1880                                  		dcf.p0	equ -190  ; poly (5*36 bytes)
  1881                                  		dcf.p2	equ -370  ; poly (5*36 bytes)
  1882                                  		;
  1883                                  		;dcf.pad equ -372  ; padding (for dword boundary)
  1884                                  
  1885 00000909 C8720100                		enter	370, 0  ; 172h
  1886                                  		;enter	372, 0  ; 174h ; 12/12/2016
  1887                                   			; push bp ; mov bp, sp ; sub sp, 372
  1888 0000090D BE[650F]                		mov	si, uvtab
  1889 00000910 31FF                    		xor	di, di
  1890 00000912 B90400                  		mov	cx, 4
  1891                                  dCFinitloop:
  1892 00000915 53                      		push	bx	; face addr (in 'o+object.f')(29/01/2017)
  1893 00000916 8B1F                    		mov	bx, word [bx] ; point index into 'rp:' ? (29/01/2017)
  1894                                  
  1895 00000918 53                      		push	bx
  1896 00000919 6BDB0C                  		imul	bx, bx, 12 ; (point vector size = 12 bytes)
  1897 0000091C 81C3[79C3]              		add	bx, rp	  ; addr of rotated point vects (29/01/2017)
  1898 00000920 668B07                  		mov	eax, dword [bx]
  1899                                  		; vector(4-cx).x
  1900 00000923 66898342FF              		mov	dword [bp+di+dcf.p0+0], eax	; [bp+di-0BEh]
  1901                                  		; vector(4-cx).y
  1902 00000928 668B4704                		mov	eax, dword [bx+4]
  1903 0000092C 66898346FF              		mov	dword [bp+di+dcf.p0+4], eax	; [bp+di-0BAh]
  1904                                  
  1905 00000931 D94708                  		fld	dword [bx+8]
  1906                                  		; vector(4-cx).z
  1907 00000934 D9934AFF                		fst	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  1908 00000938 DF5EFC                  		fistp	word [bp+dcf.h]		; [bp-04h]	
  1909                                  						; dcf.h = z distance
  1910 0000093B 5B                      		pop	bx
  1911                                  
  1912 0000093C 8B46FC                  		mov	ax, word [bp+dcf.h]		; [bp-04h]
  1913 0000093F 050002                  		add	ax, 512	; 200h
  1914 00000942 0F881601                		js	dCFbackclip   ; not visible ? (29/01/2017) 
  1915                                  
  1916 00000946 3DFF01                  		cmp	ax, 511 ; 1FFh
  1917 00000949 7E03                    		jle	short intensityOK
  1918 0000094B B8FF01                  		mov	ax, 511 ; 1FFh		; maximum z distance (dept) ?
  1919                                  intensityOK:
  1920 0000094E C1E303                  		shl	bx, 3 ; point index * 8
  1921 00000951 6631D2                  		xor	edx, edx
  1922 00000954 C1E007                  		shl	ax, 7
  1923 00000957 F7A7[9716]              		mul	word [bx+o+6+object.p]	; [bx+o+6+4]
  1924                                  		; edges(4-cx).s
  1925 0000095B 66899362FF              		mov	dword [bp+di+dcf.p0+32], edx	; [bp+di-9Eh]
  1926                                  
  1927 00000960 30E4                    		xor	ah, ah
  1928 00000962 8A4404                  		mov	al, byte [si+4]
  1929 00000965 66C1E010                		shl	eax, 16	; 10h
  1930                                  		; edges(4-cx).v
  1931 00000969 6689835AFF              		mov	dword [bp+di+dcf.p0+24], eax	; [bp+di-0A6h]
  1932                                  
  1933 0000096E AC                      		lodsb
  1934 0000096F 66C1E010                		shl	eax, 16	; 10h
  1935                                  		; edges(4-cx).u
  1936 00000973 66898356FF              		mov	dword [bp+di+dcf.p0+20], eax	; [bp+di-0AAh]
  1937                                  
  1938 00000978 5B                      		pop	bx
  1939 00000979 43                      		inc	bx
  1940 0000097A 43                      		inc	bx
  1941 0000097B 83C724                  		add	di, 36	; 24h  ; size of edge
  1942 0000097E E295                    		loop	dCFinitloop
  1943                                  		;dec	cx
  1944                                  		;jnz	dCFinitloop
  1945                                  
  1946                                  		; end of p1, p2, p3, p4 point dimensioning of face
  1947                                  		; 
  1948                                  		; p1 ...... p2
  1949                                  		;  .	    .	
  1950                                  		;  . shade  .
  1951                                  		;  .        .
  1952                                  		; p3 ...... p4
  1953                                  		;
  1954                                  		; p1 (x,y,z) ... p4 (x,y,z)
  1955                                  		;
  1956                                  
  1957 00000980 8B07                    		mov	ax, word [bx]		; shade
  1958 00000982 8946F8                  		mov	word [bp+dcf.col], ax	; [bp-08h]
  1959                                  
  1960 00000985 31DB                    		xor	bx, bx
  1961 00000987 895EFA                  		mov	word [bp+dcf.j], bx	; [bp-06h]
  1962                                  
  1963                                  		; vector(3).z
  1964 0000098A D946B6                  		fld	dword [bp+dcf.p0+108+8] ; [bp-4Ah]
  1965 0000098D D9E4                    		ftst
  1966 0000098F 9BDFE0                  		fstsw	ax
  1967                                  		;fnstsw	ax
  1968 00000992 DDD8                    		fstp	st0
  1969 00000994 9E                      		sahf
  1970 00000995 7301                    		jae	short isFalse
  1971 00000997 4B                      		dec	bx
  1972                                  isFalse:
  1973 00000998 885EF6                  		mov	byte [bp+dcf.is_in], bl	; [bp-0Ah]
  1974 0000099B 31F6                    		xor	si, si
  1975 0000099D 31FF                    		xor	di, di 
  1976                                  forloop:
  1977                                  		; vector(0-3).z
  1978 0000099F D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  1979 000009A3 D9E4                    		ftst
  1980 000009A5 9BDFE0                  		fstsw	ax
  1981                                  		;fnstsw	ax
  1982 000009A8 DDD8                    		fstp	st0
  1983 000009AA 9E                      		sahf
  1984 000009AB 732B                    		jae	short elseFall
  1985                                  
  1986 000009AD 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; -1 ; true
  1987 000009B1 7406                    		je	short inside
  1988 000009B3 E8A800                  		call	clipsub
  1989                                  		; { OUT / IN }
  1990 000009B6 F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  1991                                  inside:
  1992 000009B9 57                      		push	di
  1993 000009BA 56                      		push	si
  1994 000009BB 8DBB8EFE                		lea	di, [bp+di+dcf.p2]	; [bp+di-172h]
  1995 000009BF 8DB242FF                		lea	si, [bp+si+dcf.p0]	; [bp+si-0BEh]
  1996                                  
  1997 000009C3 16                      		push	ss
  1998 000009C4 07                      		pop	es
  1999 000009C5 1E                      		push	ds
  2000 000009C6 16                      		push	ss
  2001 000009C7 1F                      		pop	ds
  2002 000009C8 B91200                  		mov	cx, 18	; 12h
  2003 000009CB F3A5                    		rep movsw			; { IN / IN }
  2004 000009CD 1F                      		pop	ds
  2005                                  
  2006 000009CE 5E                      		pop	si
  2007 000009CF 5F                      		pop	di
  2008 000009D0 83C724                  		add	di, 36	; 24h
  2009 000009D3 FF46FA                  		inc	word [bp+dcf.j]		; [bp-06h]
  2010 000009D6 EB0C                    		jmp	short dCFendif
  2011                                  elseFall:
  2012 000009D8 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; [bp-0Ah]
  2013 000009DC 7506                    		jne	short outside
  2014 000009DE E87D00                  		call	clipsub
  2015                                  		; { IN / OUT }
  2016 000009E1 F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  2017                                  outside:
  2018 000009E4 83C624                  dCFendif:	add	si, 36 ; 24h
  2019 000009E7 81FE9000                		cmp	si, 4*36 ; 90h
  2020 000009EB 75B2                    		jne	short forloop
  2021                                  
  2022 000009ED 8B4EFA                  		mov	cx, word [bp+dcf.j]	; [bp-06h]
  2023 000009F0 83F902                  		cmp	cx, 2
  2024 000009F3 7C67                    		jl	dCFnodraw
  2025 000009F5 31FF                    		xor	di, di
  2026                                  dCFloop:
  2027 000009F7 DF06[F50C]              		fild	word [CONST13]
  2028 000009FB D8A396FE                		fsub	dword [bp+di+dcf.p2+8]	; [bp+di-16Ah]
  2029 000009FF DE36[F90C]              		fidiv	word [CONST160]
  2030                                  		
  2031 00000A03 D98392FE                		fld	dword [bp+di+dcf.p2+4]	; [bp+di-16Eh]
  2032 00000A07 D8F1                    		fdiv	st0, st1
  2033 00000A09 DE06[F70C]              		fiadd	word [CONST100]
  2034 00000A0D DB9B9AFE                		fistp	dword [bp+di+dcf.p2+12] ; [bp+di-166h]
  2035                                  		
  2036 00000A11 D9838EFE                		fld	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2037 00000A15 D80E[F10C]              		fmul	dword [ASPECT_PLACE]
  2038 00000A19 D8F1                    		fdiv	st0, st1
  2039 00000A1B DE06[F90C]              		fiadd	word [CONST160]
  2040 00000A1F D9FC                    		frndint
  2041 00000A21 DA0E[FD0C]              		fimul	dword [CONST65536]
  2042 00000A25 DB9B9EFE                		fistp	dword [bp+di+dcf.p2+16] ; [bp+di-162h]
  2043                                  
  2044 00000A29 DB83A2FE                		fild	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2045 00000A2D D8F1                    		fdiv	st0, st1
  2046 00000A2F DB9BA2FE                		fistp	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2047                                  		
  2048 00000A33 DB83A6FE                		fild	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2049 00000A37 D8F1                    		fdiv	st0, st1
  2050 00000A39 DB9BA6FE                		fistp	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2051                                  		
  2052 00000A3D DB06[FD0C]              		fild	dword [CONST65536]
  2053 00000A41 D8F1                    		fdiv	st0, st1
  2054 00000A43 DB9BAAFE                		fistp	dword [bp+di+dcf.p2+28] ; [bp+di-156h]
  2055                                  		
  2056 00000A47 DDD8                    		fstp	st0
  2057 00000A49 83C724                  		add	di, 36 ; 24h
  2058 00000A4C E2A9                    		loop	dCFloop
  2059                                  		;dec	cx
  2060                                  		;jnz	dCFloop
  2061                                  
  2062 00000A4E 8DBE8EFE                		lea	di, [bp+dcf.p2]		; [bp-172h]
  2063 00000A52 57                      		push	di
  2064 00000A53 FF76FA                  		push	word [bp+dcf.j]		; [bp-06h]	 
  2065 00000A56 FF76F8                  		push	word [bp+dcf.col]	; [bp-08h]
  2066 00000A59 E8F2FB                  		call	scansubtextpoly
  2067                                  dCFnodraw:
  2068 00000A5C C9                      dCFbackclip:	leave
  2069                                  			; mov sp, bp ; pop bp
  2070 00000A5D C3                      		retn
  2071                                  
  2072                                  clipsub:
  2073 00000A5E 56                      		push	si
  2074 00000A5F 57                      		push	di
  2075 00000A60 8D44DC                  		lea	ax, [si-36]		; [si-24h]
  2076 00000A63 83F800                  		cmp	ax, 0
  2077 00000A66 7D03                    		jge	short cSnounder
  2078 00000A68 B86C00                  		mov	ax, 108 ; 6Ch
  2079                                  cSnounder:
  2080 00000A6B D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  2081 00000A6F D9C0                    		fld	st0
  2082 00000A71 97                      		xchg	ax, di
  2083 00000A72 D8A34AFF                		fsub	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  2084 00000A76 97                      		xchg	ax, di
  2085                                  		;fdivp	st1, st0
  2086 00000A77 DEF9                    		fdiv
  2087                                  
  2088 00000A79 BB[600F]                		mov	bx, cliptab
  2089 00000A7C B90600                  		mov	cx, 6
  2090                                  dCFclipLoop2:
  2091 00000A7F 97                      		xchg	ax, di
  2092 00000A80 D98342FF                		fld	dword [bp+di+dcf.p0]	; [bp+di-0BEh]
  2093 00000A84 97                      		xchg	ax, di
  2094 00000A85 D8A242FF                		fsub	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2095 00000A89 D8C9                    		fmul	st0, st1
  2096 00000A8B D88242FF                		fadd	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2097 00000A8F D99B8EFE                		fstp	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2098                                  
  2099 00000A93 8A17                    		mov	dl, byte [bx]
  2100 00000A95 43                      		inc	bx
  2101 00000A96 30F6                    		xor	dh, dh
  2102 00000A98 01D7                    		add	di, dx
  2103 00000A9A 01D6                    		add	si, dx
  2104 00000A9C 01D0                    		add	ax, dx
  2105 00000A9E E2DF                    		loop	dCFclipLoop2
  2106 00000AA0 DDD8                    		fstp	st0
  2107 00000AA2 5F                      		pop	di
  2108 00000AA3 5E                      		pop	si
  2109 00000AA4 FF46FA                  		inc	word [bp+dcf.j] 	; [bp-6]
  2110 00000AA7 83C724                  		add	di, 36 ; 24h
  2111 00000AAA C3                      		retn
  2112                                  
  2113                                  ;***********************************************
  2114                                  ;* descript. : rotate point over one axis      *
  2115                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2116                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2117                                  ;* sideeffect: empty copro-stack               *
  2118                                  ;* back      : none			       *
  2119                                  ;***********************************************
  2120                                  
  2121                                  rotateAxis:
  2122 00000AAB D9EB                    		fldpi				;{ PI,a}
  2123                                  		;fmulp	st1, st0		;{ PI*a}	
  2124 00000AAD DEC9                    		fmul
  2125 00000AAF DA36[FD0C]              		fidiv	dword [CONST65536]	;{ PI*a/65536}
  2126 00000AB3 D9FB                    		fsincos				;{ cos,sin}
  2127 00000AB5 D9C0                    		fld	st0			;{ cos,cos,sin}
  2128 00000AB7 D80C                    		fmul	dword [si] 		;{ y*cos,cos,sin}
  2129 00000AB9 D9C2                    		fld	st2			;{ sin,y*cos,cos,sin}
  2130 00000ABB D80F                    		fmul	dword [bx]		;{ z*sin,y*cos,cos,sin}
  2131 00000ABD DEE9                    		fsubp	st1, st0		;{ y*cos-z*sin,cos,sin}
  2132 00000ABF D9CA                    		fxch	st2			;{ sin,cos,y*cos-z*sin}
  2133 00000AC1 D80C                    		fmul	dword [si]		;{ y*sin,cos,y*cos-z*sin}
  2134 00000AC3 D9C9                    		fxch	st1			;{ cos,y*sin,y*cos-z*sin}
  2135 00000AC5 D80F                    		fmul	dword [bx]		;{ z*cos,y*sin,y*cos-z*sin}
  2136 00000AC7 DEC1                    		faddp	st1, st0		;{ y*sin+z*cos,y*cos-z*sin}
  2137 00000AC9 D91F                    		fstp	dword [bx]		;{ y*cos-z*sin}
  2138 00000ACB D91C                    		fstp	dword [si]		;{}
  2139 00000ACD C3                      		retn
  2140                                  
  2141                                  ;***********************************************
  2142                                  ;* descript. : rotate point		       *
  2143                                  ;* parameter : a,b,c:angles,adr:address        *
  2144                                  ;* sideeffect: all		 	       *
  2145                                  ;* back      : none			       *
  2146                                  ;***********************************************
  2147                                  
  2148                                  xyzRotate:
  2149                                  		adr	equ 4	; arg 1, [sp+2]
  2150                                  		c	equ 6	; arg 2, [sp+4]	
  2151                                  		b	equ 8	; arg 3, [sp+6]
  2152                                  		a	equ 10	; arg 4, [sp+8]
  2153                                  
  2154 00000ACE 55                      		push	bp
  2155 00000ACF 89E5                    		mov	bp, sp
  2156                                  	
  2157 00000AD1 8B7E04                  		mov	di, word [bp+adr]
  2158 00000AD4 DF460A                  		fild	word [bp+a]
  2159 00000AD7 8D5D08                  		lea	bx, [di+8]
  2160 00000ADA 8D7504                  		lea	si, [di+4]
  2161 00000ADD E8CBFF                  		call	rotateAxis
  2162 00000AE0 DF4608                  		fild	word [bp+b]
  2163 00000AE3 8D1D                    		lea	bx, [di]
  2164 00000AE5 8D7508                  		lea	si, [di+8]
  2165 00000AE8 E8C0FF                  		call	rotateAxis
  2166 00000AEB DF4606                  		fild	word [bp+c]
  2167 00000AEE 8D5D04                  		lea	bx, [di+4]
  2168 00000AF1 8D35                    		lea	si, [di]
  2169 00000AF3 E8B5FF                  		call	rotateAxis
  2170                                  
  2171 00000AF6 5D                      		pop	bp
  2172 00000AF7 C20800                  		ret	8
  2173                                  
  2174                                  ;***********************************************
  2175                                  ;* descript. : calculate world matrix	       *
  2176                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2177                                  ;* sideeffect: all		 	       *
  2178                                  ;* back      : none			       *
  2179                                  ;***********************************************
  2180                                  
  2181                                  calcRotMat:
  2182                                  		neig	equ 4   ; arg 1, [sp+2]
  2183                                  		zw	equ 6	; arg 2, [sp+4]	
  2184                                  		yw	equ 8	; arg 3, [sp+6]
  2185                                  		xw	equ 10  ; arg 4, [sp+8]
  2186                                  
  2187 00000AFA 55                      		push	bp
  2188 00000AFB 89E5                    		mov	bp, sp
  2189                                  
  2190 00000AFD BF[F712]                		mov	di, nwmat
  2191                                  		identityMat
  2191 00000B00 B502                <1>  mov ch, 2
  2191                              <1> iMolp:
  2191 00000B02 B102                <1>  mov cl, 2
  2191                              <1> iMilp:
  2191 00000B04 D9EE                <1>  fldz
  2191 00000B06 38CD                <1>  cmp ch, cl
  2191 00000B08 7504                <1>  jne short iMwritezero
  2191 00000B0A DDD8                <1>  fstp st0
  2191 00000B0C D9E8                <1>  fld1
  2191                              <1> iMwritezero:
  2191 00000B0E D91D                <1>  fstp dword [di]
  2191 00000B10 83C704              <1>  add di, 4
  2191 00000B13 FEC9                <1>  dec cl
  2191 00000B15 79ED                <1>  jns short iMilp
  2191 00000B17 FECD                <1>  dec ch
  2191 00000B19 79E7                <1>  jns short iMolp
  2192 00000B1B 31FF                    		xor	di, di
  2193                                  cRMolp:
  2194 00000B1D 57                      		push	di
  2195 00000B1E FF760A                  		push	word [bp+xw]
  2196 00000B21 FF7608                  		push	word [bp+yw]
  2197 00000B24 FF7606                  		push	word [bp+zw]
  2198 00000B27 81C7[F712]              		add	di, nwmat
  2199 00000B2B 57                      		push	di
  2200 00000B2C E89FFF                  		call	xyzRotate
  2201 00000B2F 5F                      		pop	di
  2202 00000B30 31DB                    		xor	bx, bx
  2203                                  cRMilp:
  2204 00000B32 D985[F712]              		fld	dword [di+nwmat]
  2205 00000B36 D88F[AF12]              		fmul	dword [bx+owmat]
  2206 00000B3A D985[FB12]              		fld	dword [di+nwmat+4]
  2207 00000B3E D88F[BB12]              		fmul	dword [bx+owmat+12]
  2208 00000B42 D985[FF12]              		fld	dword [di+nwmat+8]
  2209 00000B46 D88F[C712]              		fmul	dword [bx+owmat+24]
  2210 00000B4A DEC1                    		fadd
  2211 00000B4C DEC1                    		fadd
  2212 00000B4E D991[AF12]              		fst	dword [bx+di+owmat]
  2213 00000B52 D999[D312]              		fstp	dword [bx+di+wmat]
  2214 00000B56 83C304                  		add	bx, 4
  2215 00000B59 80FB0C                  		cmp	bl, 12
  2216 00000B5C 75D4                    		jne	short cRMilp
  2217 00000B5E 83C70C                  		add	di, 12
  2218 00000B61 83FF24                  		cmp	di, 36
  2219 00000B64 75B7                    		jne	short cRMolp
  2220                                  
  2221 00000B66 BE[D312]                		mov	si, wmat
  2222 00000B69 B90300                  		mov	cx, 3
  2223                                  cRMneigloop:
  2224 00000B6C DF4604                  		fild	word [bp+neig]
  2225 00000B6F 8D5C0C                  		lea	bx, [si+12]
  2226 00000B72 E836FF                  		call	rotateAxis
  2227 00000B75 83C604                  		add	si, 4
  2228 00000B78 E2F2                    		loop	cRMneigloop
  2229                                  
  2230 00000B7A 5D                      		pop	bp
  2231 00000B7B C20800                  		ret	8
  2232                                  
  2233                                  ;***********************************************
  2234                                  ;* descript. : create the world		       *
  2235                                  ;* parameter : none			       *
  2236                                  ;* sideeffect: all		               *
  2237                                  ;* back      : none			       *
  2238                                  ;***********************************************
  2239                                  
  2240                                  createWorld:
  2241                                  		cw.direc  equ -2  ; word
  2242                                  		cw.shade  equ -4  ; word	
  2243                                  
  2244 00000B7E C8040000                		enter	4, 0
  2245                                  			; push bp ; mov bp, sp ; sub sp, 4
  2246 00000B82 BE[B20F]                		mov	si, world
  2247 00000B85 B90400                  		mov	cx, 4
  2248                                  cWworldLoop:
  2249 00000B88 51                      		push	cx
  2250 00000B89 56                      		push	si
  2251 00000B8A BF[99C1]                		mov	di, p
  2252 00000B8D BB[11C2]                		mov	bx, pr
  2253 00000B90 BE[850F]                		mov	si, print
  2254 00000B93 B10F                    		mov	cl, 15 ; 0Fh
  2255                                  cWinitStartRoom:
  2256 00000B95 51                      		push	cx
  2257 00000B96 B103                    		mov	cl, 3
  2258                                  cWinnerLoop:
  2259 00000B98 AC                      		lodsb  ; byte data (to be converted to dword) from the 'print:'
  2260 00000B99 98                      		cbw    ; convert byte to word with sign (0E0h -> FFE0h)	
  2261 00000B9A AB                      		stosw  ; store world coordinate/dimension as integer (word), to 'p:' 
  2262 00000B9B DF45FE                  		fild	word [di-2]
  2263 00000B9E D91F                    		fstp	dword [bx] ; store coordinate as floatpoint
  2264 00000BA0 83C304                  		add	bx, 4 ; next dimension (x,y,z) in 'pr:'
  2265 00000BA3 E2F3                    		loop	cWinnerLoop
  2266 00000BA5 59                      		pop	cx
  2267 00000BA6 B8007F                  		mov	ax, 127*256 ; 7F00h ;  4th dimension in 'p:'
  2268 00000BA9 AB                      		stosw
  2269 00000BAA E2E9                    		loop	cWinitStartRoom
  2270 00000BAC 5E                      		pop	si
  2271                                  cWmainLoop:
  2272 00000BAD AC                      		lodsb	; the byte from 'world:' for shade and direction
  2273 00000BAE 3CFF                    		cmp	al, 255 ; 0FFh
  2274 00000BB0 0F840D01                		je	cWexit  ; end of stage (1 to 4)
  2275                                  
  2276 00000BB4 88C7                    		mov	bh, al  ; High 4 bits for shading
  2277 00000BB6 81E30070                		and	bx, 7000h
  2278 00000BBA 80C70F                  		add	bh, 15 ; 0Fh
  2279 00000BBD 895EFC                  		mov	word [bp+cw.shade], bx ; [bp-4]
  2280 00000BC0 83E00F                  		and	ax, 0Fh ; 15   ; Low 4 bits for direction
  2281 00000BC3 8946FE                  		mov	word [bp+cw.direc], ax ; [bp-2]
  2282                                  
  2283 00000BC6 31DB                    		xor	bx, bx
  2284                                  cWsideLoop:
  2285 00000BC8 F6C304                  		test	bl, 4
  2286 00000BCB 7405                    		jz	short cWfirstNibble
  2287 00000BCD AC                      		lodsb
  2288 00000BCE 240F                    		and	al, 0Fh ; 15
  2289 00000BD0 EB05                    		jmp	short cWsecondNibble
  2290                                  cWfirstNibble:
  2291 00000BD2 8A04                    		mov	al, byte [si]
  2292 00000BD4 C0E804                  		shr	al, 4
  2293                                  cWsecondNibble:
  2294 00000BD7 30E4                    		xor	ah, ah
  2295 00000BD9 48                      		dec	ax
  2296 00000BDA 7850                    		js	short cWnoWall ; ax = 0 -> ax = 0FFFFh
  2297 00000BDC 6B3E[8F16]0A            		imul	di, word [o+object.fanz], 10 ; 0Ah
  2298 00000BE1 81C7[1123]              		add	di, o+object.f ; base address + offset
  2299 00000BE5 FF06[8F16]              		inc	word [o+object.fanz] ; faces = faces + 1
  2300 00000BE9 894508                  		mov	word [di+8], ax ; 4th word is shading value
  2301                                  
  2302 00000BEC 53                      		push	bx
  2303 00000BED 56                      		push	si
  2304 00000BEE B104                    		mov	cl, 4
  2305                                  cWaddPointloop:
  2306 00000BF0 0FBEB7[6D0F]            		movsx	si, byte [bx+cube] ; cube coordinate offset
  2307 00000BF5 81C6[99C1]              		add	si, p ; + base address (p:)
  2308                                  
  2309 00000BF9 57                      		push	di
  2310 00000BFA BF[9116]                		mov	di, o+object.p  ; p area of object structure (in o:)
  2311 00000BFD 51                      		push	cx
  2312 00000BFE 8B0E[8D16]              		mov	cx, word [o+object.panz] ; number of points (for object.p)
  2313 00000C02 31C0                    		xor	ax, ax
  2314 00000C04 E316                    		jcxz	cWfirstPoint
  2315                                  cWsearchPointLoop: ; check point coordinates are same or not
  2316 00000C06 668B14                  		mov	edx, dword [si]
  2317 00000C09 663B15                  		cmp	edx, dword [di]
  2318 00000C0C 7508                    		jne	short cWdifferent
  2319 00000C0E 8B5404                  		mov	dx, word [si+4]
  2320 00000C11 3B5504                  		cmp	dx, word [di+4]
  2321 00000C14 740E                    		je	short cWpointExists
  2322                                  cWdifferent:
  2323 00000C16 40                      		inc	ax ; number of different points (of object)
  2324 00000C17 83C708                  		add	di, 8
  2325 00000C1A E2EA                    		loop	cWsearchPointLoop
  2326                                  cWfirstPoint:
  2327 00000C1C 66A5                    		movsd
  2328 00000C1E 66A5                    		movsd
  2329 00000C20 FF06[8D16]              		inc	word [o+object.panz] ; points = points + 1
  2330                                  cWpointExists:
  2331 00000C24 59                      		pop	cx
  2332 00000C25 5F                      		pop	di
  2333 00000C26 AB                      		stosw   ; store num of different points
  2334                                  			; in the Xth word of face structure (5 words)
  2335                                  			; (Xth word of 'object.f', X = 4-CL)
  2336 00000C27 43                      		inc	bx
  2337 00000C28 E2C6                    		loop	cWaddPointloop
  2338 00000C2A 5E                      		pop	si
  2339 00000C2B 5B                      		pop	bx
  2340                                  cWnoWall:
  2341 00000C2C 83C304                  		add	bx, 4
  2342 00000C2F 83FB18                  		cmp	bx, 24 ; 18h
  2343 00000C32 7594                    		jne	short cWsideLoop
  2344                                  
  2345 00000C34 6B7EFE0C                		imul	di, word [bp+cw.direc], 12 ; [bp-2]
  2346                                  		; di will have negative value if 12*[bp-2] > 127
  2347                                  		; max value of [bp-2] = 0Fh
  2348 00000C38 B103                    		mov	cl, 3
  2349 00000C3A BB[71C2]                		mov	bx, pr+96 ; 24th dword of 'pr:'
  2350                                  cWaddStepLoop:
  2351 00000C3D D94748                  		fld	dword [bx+72] ; [bx+48h]
  2352 00000C40 D801                    		fadd	dword [bx+di]
  2353 00000C42 D95F48                  		fstp	dword [bx+72]
  2354 00000C45 83C304                  		add	bx, 4
  2355 00000C48 E2F3                    		loop	cWaddStepLoop
  2356                                  
  2357 00000C4A 807CFC00                		cmp	byte [si-4], 0
  2358 00000C4E 7D25                    		jge	short cWsimpleRoom
  2359                                  
  2360 00000C50 BB[11C2]                		mov	bx, pr
  2361 00000C53 B10E                    		mov	cl, 14 ; 0Eh
  2362                                  cWrotloop:
  2363 00000C55 60                      		pusha
  2364 00000C56 B103                    		mov	cl, 3
  2365 00000C58 8A14                    		mov	dl, byte [si]
  2366                                  cWpushLoop:
  2367                                  		;xor	ax, ax
  2368 00000C5A D0EA                    		shr	dl, 1
  2369 00000C5C 7308                    		jnc	short cWnoRot
  2370 00000C5E 8A24                    		mov	ah, byte [si]
  2371 00000C60 2500F0                  		and	ax, 0F000h
  2372                                  		;and	ah, 0F0h
  2373 00000C63 50                      		push	ax
  2374 00000C64 EB02                    		jmp	short cWendIf
  2375                                  cWnoRot:
  2376 00000C66 6A00                    		push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2377                                  		;push	ax
  2378                                  cWendIf:
  2379 00000C68 E2F0                    		loop	cWpushLoop
  2380 00000C6A 53                      		push	bx ; arg 1 (addr)
  2381 00000C6B E860FE                  		call	xyzRotate
  2382 00000C6E 61                      		popa
  2383 00000C6F 83C30C                  		add	bx, 12 ; 0Ch
  2384 00000C72 E2E1                    		loop	cWrotloop
  2385 00000C74 46                      		inc	si
  2386                                  cWsimpleRoom:
  2387 00000C75 8B5EFE                  		mov	bx, word [bp+cw.direc]  ; [bp-2]
  2388 00000C78 C1E302                  		shl	bx, 2
  2389 00000C7B B104                    		mov	cl, 4
  2390                                  cWpointCopyLoop:
  2391 00000C7D 60                      		pusha
  2392 00000C7E 0FBEB7[6D0F]            		movsx	si, byte [bx+cube]
  2393 00000C83 89F0                    		mov	ax, si
  2394 00000C85 81C6[99C1]              		add	si, p ; + base address of 'p:'
  2395 00000C89 80F307                  		xor	bl, 7
  2396 00000C8C 0FBEBF[6D0F]            		movsx	di, byte [bx+cube]
  2397 00000C91 81C7[99C1]              		add	di, p ; + base address of 'p:'
  2398 00000C95 56                      		push	si 
  2399 00000C96 66A5                    		movsd
  2400 00000C98 66A5                    		movsd
  2401 00000C9A 5E                      		pop	si
  2402                                  
  2403 00000C9B 89C3                    		mov	bx, ax
  2404 00000C9D D1EB                    		shr	bx, 1
  2405 00000C9F 01C3                    		add	bx, ax
  2406 00000CA1 BF[11C2]                		mov	di, pr ; + base address of 'pr:'
  2407 00000CA4 B103                    		mov	cl, 3
  2408                                  cWSround:
  2409 00000CA6 D901                    		fld	dword [bx+di]
  2410 00000CA8 D885A800                		fadd	dword [di+168]  ; [di+0A8h]
  2411 00000CAC DF1C                    		fistp	word [si] ; world coordinate/dimension
  2412 00000CAE 83C704                  		add	di, 4
  2413 00000CB1 46                      		inc	si
  2414 00000CB2 46                      		inc	si
  2415 00000CB3 E2F1                    		loop	cWSround
  2416 00000CB5 8B46FC                  		mov	ax, word [bp+cw.shade]  ; [bp-4]
  2417 00000CB8 8904                    		mov	word [si], ax ; 4th word
  2418 00000CBA 61                      		popa
  2419 00000CBB 43                      		inc	bx
  2420 00000CBC E2BF                    		loop	cWpointCopyLoop
  2421 00000CBE E9ECFE                  		jmp	cWmainLoop
  2422                                  cWexit:
  2423 00000CC1 59                      		pop	cx
  2424 00000CC2 49                      		dec	cx
  2425 00000CC3 0F85C1FE                		jnz	cWworldLoop
  2426 00000CC7 C9                      		leave
  2427                                  			; mov sp, bp ; pop bp
  2428 00000CC8 C3                      		retn
  2429                                  
  2430                                  ;dels_pos_w:	dw 1111h
  2431                                  ;ddu_pos_w:	dw 1111h
  2432                                  ;ddv_pos_w:	dw 1111h
  2433                                  
  2434                                  prg_msg:
  2435 00000CC9 4552444F47414E2054-     		db	'ERDOGAN TAN - SNCOMNI.COM'
  2435 00000CD2 414E202D20534E434F-
  2435 00000CDB 4D4E492E434F4D     
  2436 00000CE2 0D0A                    		db	0Dh, 0Ah
  2437 00000CE4 30352F30322F323031-     		db	'05/02/2017'
  2437 00000CED 37                 
  2438 00000CEE 0D0A                    		db	0Dh, 0Ah
  2439 00000CF0 00                      		db	0 
  2440                                  
  2441                                  ;=============================================================================
  2442                                  ;               preinitialized data
  2443                                  ;=============================================================================
  2444                                  
  2445 00000CF1 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  2446 00000CF5 0D00                    CONST13:	dw 13			; 000Dh			
  2447 00000CF7 6400                    CONST100:	dw CENTERY		; 0064h
  2448 00000CF9 A000                    CONST160:	dw CENTERX		; 00A0h
  2449 00000CFB 0007                    CONST1792:	dw 1792			; 0700h
  2450 00000CFD 00000100                CONST65536:	dd 65536		; 00010000h
  2451 00000D01 05840808                randommul:	dd 134775813		; 08088405h
  2452 00000D05 FB100000                randomseed:	dd 4347			; 000010FBh
  2453                                  credits:
  2454 00000D09 0250FB                  		db	 2, 80,-5
  2455 00000D0C FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  2455 00000D15 51023E0245024F023E-
  2455 00000D1E 024502             
  2456 00000D21 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  2456 00000D2A 0200               
  2457 00000D2C FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  2457 00000D35 51023E0246024F023E-
  2457 00000D3E 024602             
  2458 00000D41 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  2458 00000D4A 0200               
  2459 00000D4C 00                      		db       0
  2460 00000D4D 37203820                		db      55,32,56,32			; { pat 10 }
  2461 00000D51 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  2462 00000D57 39203220                		db      57,32,50,32		 ; { pat 12 }
  2463 00000D5B 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  2464 00000D61 3740                    		db      55,64		   ; { pat 14 }
  2465 00000D63 FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  2465 00000D6C 00                 
  2466 00000D6D FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  2466 00000D76 00                 
  2467 00000D77 00                      		db       0
  2468 00000D78 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  2469 00000D7E 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  2469 00000D87 083C08             
  2470 00000D8A 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  2470 00000D93 08                 
  2471 00000D94 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  2472 00000D9C 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  2473 00000DA4 3E80                    		db      62,128		  ;{ pat 8,9 }
  2474 00000DA6 4380                    		db      67,128		  ;{ pat 10,11 }
  2475 00000DA8 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  2475 00000DB1 08                 
  2476 00000DB2 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  2477 00000DB6 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  2478 00000DBA FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  2479 00000DC0 FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  2480 00000DC6 00                      		db       0
  2481 00000DC7 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  2482 00000DCD 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  2483 00000DD5 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  2483 00000DDE 08                 
  2484 00000DDF 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  2484 00000DE8 18                 
  2485 00000DE9 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  2485 00000DF2 08                 
  2486 00000DF3 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  2487 00000DFB FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  2488 00000E01 FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  2489 00000E07 00                      		db       0
  2490 00000E08 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  2490 00000E11 2A012A0100         
  2491 00000E16 F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  2491 00000E1F 2A0100             
  2492 00000E22 E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  2492 00000E2B 2A012602           
  2493 00000E2F 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  2494 00000E37 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  2494 00000E40 0126022A022E022601-
  2494 00000E49 2A0100             
  2495 00000E4C 00                      		db     	 0
  2496 00000E4D 00                      		db	 0
  2497                                  
  2498                                  ; colortable 65 bytes
  2499 00000E4E 10                      colors 		db	16
  2500 00000E4F 1F3F3F3F                                db      31,63,63,63
  2501 00000E53 01000000                                db	 1, 0, 0, 0
  2502 00000E57 1F28203F                                db      31,40,32,63
  2503 00000E5B 01000000                                db	 1, 0, 0, 0
  2504 00000E5F 1F3F0000                                db      31,63, 0, 0
  2505 00000E63 01060100                                db	 1, 6, 1, 0
  2506 00000E67 1F3F2914                                db      31,63,41,20
  2507 00000E6B 01000000                                db	 1, 0, 0, 0
  2508 00000E6F 1F3F3F08                                db      31,63,63, 8
  2509 00000E73 01000000                                db	 1, 0, 0, 0
  2510 00000E77 1F38383F                                db	31,56,56,63
  2511 00000E7B 013F0000                                db	 1,63, 0, 0
  2512 00000E7F 103F3F00                                db      16,63,63, 0
  2513 00000E83 103F0000                                db      16,63, 0, 0
  2514 00000E87 01160500                                db	 1,22, 5, 0
  2515 00000E8B 073F3811                                db       7,63,56,17
  2516                                  
  2517                                  ; parameter for the texture effects 156 bytes
  2518 00000E8F 130F0F31310A            aE              db	013h,15,15,49,49,10
  2519 00000E95 131010303011                            db      013h,16,16,48,48,17
  2520 00000E9B 1311112F2F18                            db      013h,17,17,47,47,24
  2521 00000EA1 1312122E2EBE                            db      013h,18,18,46,46,190
  2522 00000EA7 1315152B2B1E                            db      013h,21,21,43,43,30
  2523 00000EAD 2500003E1E03                            db      025h,0,0,62,30,3
  2524 00000EB3 2503033E1E07                            db      025h,3,3,62,30,7
  2525 00000EB9 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  2526 00000EBF 2500203E3E03                            db      025h,0,32,62,62,3
  2527 00000EC5 2503233E3E07                            db      025h,3,35,62,62,7
  2528 00000ECB 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  2529 00000ED1 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  2530 00000ED7 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  2531 00000EDD 2C000B3F1004                            db      02Ch,0,11,63,16,4
  2532 00000EE3 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  2533 00000EE9 2C00303F3504                            db      02Ch,0,48,63,53,4
  2534 00000EEF 2E13182C2705                            db      02Eh,19,24,44,39,5
  2535 00000EF5 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  2536 00000EFB 2E14192B2607                            db      02Eh,20,25,43,38,7
  2537 00000F01 3E14192B2606                            db      03Eh,20,25,43,38,6
  2538 00000F07 2F00183F1E06                            db      02Fh,0,24,63,30,6
  2539 00000F0D 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  2540 00000F13 3F00193F1E06                            db      03Fh,0,25,63,30,6
  2541 00000F19 2F00203F2606                            db      02Fh,0,32,63,38,6
  2542 00000F1F 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  2543 00000F25 3F00213F2606                            db      03Fh,0,33,63,38,6
  2544                                  
  2545                                  ; parameter for fractaladd 28 bytes
  2546 00000F2B 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  2546 00000F34 0020202040         
  2547 00000F39 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  2547 00000F42 0024002400         
  2548                                  
  2549                                  ; star bob for the sparcling stars texture 25 bytes
  2550 00000F47 0000030000              bob:            db	0,0,3,0,0
  2551 00000F4C 0002050200                              db	0,2,5,2,0
  2552 00000F51 0305070503                              db	3,5,7,5,3
  2553 00000F56 0002050200                              db	0,2,5,2,0
  2554 00000F5B 0000030000                              db	0,0,3,0,0
  2555                                  
  2556 00000F60 04040C0408              cliptab:	db	4,4,12,4,8
  2557                                  
  2558 00000F65 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  2559                                  
  2560 00000F6D 08283010                cube:		db	1*8,5*8,6*8,2*8
  2561 00000F71 18382000                                db      3*8,7*8,4*8,0*8
  2562 00000F75 10303818                                db      2*8,6*8,7*8,3*8
  2563 00000F79 00202808                                db      0*8,4*8,5*8,1*8
  2564 00000F7D 38302820                        	db	7*8,6*8,5*8,4*8
  2565 00000F81 00081018                                db      0*8,1*8,2*8,3*8
  2566                                  
  2567 00000F85 E0E0E0                  print:		db	-32,-32,-32
  2568 00000F88 20E0E0                                  db       32,-32,-32
  2569 00000F8B 2020E0                                  db   	 32, 32,-32
  2570 00000F8E E020E0                                  db  	-32, 32,-32
  2571 00000F91 E0E020                                  db  	-32,-32, 32
  2572 00000F94 20E020                                  db       32,-32, 32
  2573 00000F97 202020                                  db   	 32, 32, 32
  2574 00000F9A E02020                                  db  	-32, 32, 32
  2575 00000F9D 400000                                  db       64,  0,  0
  2576 00000FA0 C00000                                  db      -64,  0,  0
  2577 00000FA3 004000                                  db        0, 64,  0
  2578 00000FA6 00C000                                  db        0,-64,  0
  2579 00000FA9 000040                                  db        0,  0, 64
  2580 00000FAC 0000C0                                  db        0,  0,-64
  2581 00000FAF 000000                                  db	  0,  0,  0
  2582                                  
  2583                                  ; world contruction data 599 bytes
  2584 00000FB2 71700006                world:		db	071h,070h,000h,006h
  2585 00000FB6 72000006                                db	072h,000h,000h,006h
  2586 00000FBA 71007006                                db	071h,000h,070h,006h
  2587 00000FBE 73077006                                db	073h,007h,070h,006h
  2588 00000FC2 73070006                                db	073h,007h,000h,006h
  2589 00000FC6 70070706                                db	070h,007h,007h,006h
  2590 00000FCA 74000706                                db	074h,000h,007h,006h
  2591 00000FCE 70000740                                db	070h,000h,007h,040h
  2592 00000FD2 72700750                                db	072h,070h,007h,050h
  2593 00000FD6 72700050                                db	072h,070h,000h,050h
  2594 00000FDA 71707050                                db	071h,070h,070h,050h
  2595 00000FDE 73007040                                db	073h,000h,070h,040h
  2596 00000FE2 71000040                                db	071h,000h,000h,040h
  2597 00000FE6 72000050                                db	072h,000h,000h,050h
  2598 00000FEA 71007050                                db	071h,000h,070h,050h
  2599 00000FEE 73077046                                db	073h,007h,070h,046h
  2600 00000FF2 73000046                                db	073h,000h,000h,046h
  2601 00000FF6 70070746                                db	070h,007h,007h,046h
  2602 00000FFA 72000750                                db	072h,000h,007h,050h
  2603 00000FFE 71000000                                db	071h,000h,000h,000h
  2604 00001002 71000000                                db	071h,000h,000h,000h
  2605 00001006 7100BB56                                db	071h,000h,0bbh,056h
  2606 0000100A 700FBB46                                db	070h,00Fh,0bbh,046h
  2607 0000100E FF                                      db	0FFh
  2608 0000100F 33000000                                db	033h,000h,000h,000h
  2609 00001013 F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  2610 00001018 B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  2611 0000101D 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2612 00001022 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2613 00001027 3000BB56                                db	030h,000h,0BBh,056h
  2614 0000102B F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2615 00001030 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2616 00001035 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2617 0000103A 9000BB5611                              db	090h,000h,0BBh,056h,011h
  2618 0000103F B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2619 00001044 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2620 00001049 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2621 0000104E B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2622 00001053 3000BB56                                db	030h,000h,0BBh,056h
  2623 00001057 1000BB56                                db	010h,000h,0BBh,056h
  2624                                  
  2625 0000105B 34000000                                db	034h,000h,000h,000h
  2626 0000105F 32050080                                db	032h,005h,000h,080h
  2627 00001063 35058080                                db	035h,005h,080h,080h
  2628 00001067 35058000                                db	035h,005h,080h,000h
  2629 0000106B 33058008                                db	033h,005h,080h,008h
  2630 0000106F 33050008                                db	033h,005h,000h,008h
  2631 00001073 74050808                                db	074h,005h,008h,008h
  2632 00001077 74050000                                db	074h,005h,000h,000h
  2633 0000107B 73050880                                db	073h,005h,008h,080h
  2634 0000107F 75000000                                db	075h,000h,000h,000h
  2635 00001083 75050888                                db	075h,005h,008h,088h
  2636 00001087 70000000                                db	070h,000h,000h,000h
  2637 0000108B 74640808                                db	074h,064h,008h,008h
  2638 0000108F 74600800                                db	074h,060h,008h,000h
  2639 00001093 72640880                                db	072h,064h,008h,080h
  2640 00001097 05600080                                db	005h,060h,000h,080h
  2641 0000109B 05600000                                db	005h,060h,000h,000h
  2642 0000109F 02600008                                db	002h,060h,000h,008h
  2643 000010A3 34600008                                db	034h,060h,000h,008h
  2644 000010A7 34600000                                db	034h,060h,000h,000h
  2645 000010AB 32600080                                db	032h,060h,000h,080h
  2646 000010AF 35600080                                db	035h,060h,000h,080h
  2647 000010B3 35600000                                db	035h,060h,000h,000h
  2648 000010B7 32600008                                db	032h,060h,000h,008h
  2649 000010BB 34350008                                db	034h,035h,000h,008h
  2650 000010BF 14650000                                db      014h,065h,000h,000h
  2651 000010C3 32350080                                db      032h,035h,000h,080h
  2652 000010C7 35350080                               	db      035h,035h,000h,080h
  2653 000010CB 15650000                               	db      015h,065h,000h,000h
  2654 000010CF 32350008                                db	032h,035h,000h,008h
  2655 000010D3 34358008                                db	034h,035h,080h,008h
  2656 000010D7 14650000                               	db      014h,065h,000h,000h
  2657 000010DB 32358080                               	db      032h,035h,080h,080h
  2658 000010DF 75000000                		db	075h,000h,000h,000h
  2659 000010E3 5265E077                		db	052h,065h,0E0h,077h
  2660 000010E7 32640E77                		db	032h,064h,00Eh,077h
  2661 000010EB 12650077                		db	012h,065h,000h,077h
  2662 000010EF 00650077                		db	000h,065h,000h,077h
  2663 000010F3 FF                      		db	0FFh
  2664 000010F4 32000000                		db	032h,000h,000h,000h
  2665 000010F8 F000000014              		db	0F0h,000h,000h,000h,014h
  2666 000010FD B000000014              		db	0B0h,000h,000h,000h,014h
  2667 00001102 30000000                		db	030h,000h,000h,000h
  2668 00001106 F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  2669 0000110B F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  2670 00001110 3000DD46                		db	030h,000h,0DDh,046h
  2671 00001114 3000DD56                		db	030h,000h,0DDh,056h
  2672 00001118 3000DD56                		db	030h,000h,0DDh,056h
  2673 0000111C 32000050                		db	032h,000h,000h,050h
  2674 00001120 300AA050                		db	030h,00Ah,0A0h,050h
  2675 00001124 3300A050                		db	033h,000h,0A0h,050h
  2676 00001128 30000050                		db	030h,000h,000h,050h
  2677 0000112C 32700050                		db	032h,070h,000h,050h
  2678 00001130 3000A050                		db	030h,000h,0A0h,050h
  2679 00001134 33A0A750                		db	033h,0A0h,0A7h,050h
  2680 00001138 33000000                		db	033h,000h,000h,000h
  2681 0000113C 31A07A50                		db	031h,0A0h,07Ah,050h
  2682 00001140 31000A50                		db	031h,000h,00Ah,050h
  2683 00001144 31000A50                		db	031h,000h,00Ah,050h
  2684 00001148 320A0A50                		db	032h,00Ah,00Ah,050h
  2685 0000114C 35000000                		db	035h,000h,000h,000h
  2686 00001150 720A0000                		db	072h,00Ah,000h,000h
  2687 00001154 700AA000                		db	070h,00Ah,0A0h,000h
  2688 00001158 7300A000                		db	073h,000h,0A0h,000h
  2689 0000115C 70000000                		db	070h,000h,000h,000h
  2690 00001160 72000000                		db	072h,000h,000h,000h
  2691 00001164 7000A000                		db	070h,000h,0A0h,000h
  2692 00001168 73A0A000                		db	073h,0A0h,0A0h,000h
  2693 0000116C 73A00099                		db	073h,0A0h,000h,099h
  2694 00001170 71A00A00                		db	071h,0A0h,00Ah,000h
  2695 00001174 71000A00                		db	071h,000h,00Ah,000h
  2696 00001178 71000A00                                db	071h,000h,00Ah,000h
  2697 0000117C 750A0A00                                db	075h,00Ah,00Ah,000h
  2698 00001180 700C0C03                                db	070h,00Ch,00Ch,003h
  2699 00001184 70000C03                                db	070h,000h,00Ch,003h
  2700 00001188 70000C03                                db	070h,000h,00Ch,003h
  2701 0000118C 72C07C03                                db	072h,0C0h,07Ch,003h
  2702 00001190 72000000                                db	072h,000h,000h,000h
  2703 00001194 71C0C703                                db	071h,0C0h,0C7h,003h
  2704 00001198 7300C003                                db	073h,000h,0C0h,003h
  2705 0000119C 71700003                                db	071h,070h,000h,003h
  2706 000011A0 72000003                                db	072h,000h,000h,003h
  2707 000011A4 7100C003                                db	071h,000h,0C0h,003h
  2708 000011A8 730CC003                                db	073h,00Ch,0C0h,003h
  2709 000011AC 71000003                                db	071h,000h,000h,003h
  2710 000011B0 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  2711 000011B4 FF                                      db	0FFh
  2712 000011B5 32000000                                db	032h,000h,000h,000h
  2713 000011B9 F000700614                              db	0F0h,000h,070h,006h,014h
  2714 000011BE B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  2715 000011C3 3000DD56                                db	030h,000h,0DDh,056h
  2716 000011C7 B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  2717 000011CC 32DD0056                                db	032h,0DDh,000h,056h
  2718 000011D0 32DD0056                                db	032h,0DDh,000h,056h
  2719 000011D4 32DD0056                                db	032h,0DDh,000h,056h
  2720 000011D8 7000F056                                db	070h,000h,0F0h,056h
  2721 000011DC 7000BB56                                db	070h,000h,0BBh,056h
  2722 000011E0 32B00B46                                db	032h,0B0h,00Bh,046h
  2723 000011E4 72BB0056                                db	072h,0BBh,000h,056h
  2724 000011E8 71B0B056                                db	071h,0B0h,0B0h,056h
  2725 000011EC 71021156                                db	071h,002h,011h,056h
  2726 000011F0 71221156                                db	071h,022h,011h,056h
  2727 000011F4 31201156                                db	031h,020h,011h,056h
  2728 000011F8 730BB056                                db	073h,00Bh,0B0h,056h
  2729 000011FC 73BB0056                                db	073h,0BBh,000h,056h
  2730 00001200 300B0B46                                db	030h,00Bh,00Bh,046h
  2731 00001204 3000BB56                                db	030h,000h,0BBh,056h
  2732 00001208 FF                                      db	0FFh
  2733                                  
  2734                                  ; flying script	126 bytes
  2735                                  script:
  2736                                  ;     7 6 5 4 3 2 1 0
  2737                                  ;	  v v v v v c c c
  2738                                  ;
  2739                                  ;	  v = VALUE
  2740                                  ;	  c = COMMAND
  2741                                  ;
  2742                                  ;	  0 = NOP
  2743                                  ;	  1 = NEG ZSTEP
  2744                                  ;	  2 = INC SPEED
  2745                                  ;	  3 = DEC SPEED
  2746                                  ;	  4 = INC XSTEP
  2747                                  ;	  5 = DEC XSTEP
  2748                                  ;	  6 = INC YSTEP
  2749                                  ;	  7 = INC YSTEP
  2750                                  
  2751 00001209 A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  2752 0000120F F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  2753 00001215 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  2754 0000121B F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  2755 00001221 F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  2756 00001227 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  2757 0000122D 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  2758 00001233 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  2759 00001239 F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  2760 0000123F A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  2761 00001245 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  2762 0000124B 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  2763 00001251 A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  2764 00001257 B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  2765 0000125D A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  2766 00001263 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  2767 00001269 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  2768 0000126F 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  2769 00001275 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  2770 0000127B 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  2771 00001281 F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  2772                                  
  2773 00001286 0100                    zstep:		dw	1			
  2774 00001288 66EF                    doortimer	dw 	-4250	; 0EF66h
  2775 0000128A 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  2776                                  omniend:
  2777 00001293 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  2777 0000129C 4B9A5050455253     
  2778                                  sancend:
  2779 000012A3 0000A5C3                ob:		dd 	-330.0	; vector.x
  2780 000012A7 00000000                		dd 	   0.0	; vector.y	
  2781 000012AB 00008042                		dd	  64.0	; vector.z	
  2782                                  owmat:
  2783 000012AF 00000000                		dd 	   0.0	; vector.x
  2784 000012B3 000080BF                		dd 	  -1.0	; vector.y
  2785 000012B7 00000000                		dd	   0.0  ; vector.z
  2786                                  ;owmat+12:
  2787 000012BB 00000000                		dd 	   0.0	; vector.x
  2788 000012BF 00000000                		dd 	   0.0	; vector.y
  2789 000012C3 000080BF                		dd	  -1.0  ; vector.z
  2790                                  ;owmat+24:
  2791 000012C7 0000803F                		dd 	   1.0	; vector.x
  2792 000012CB 00000000                		dd 	   0.0	; vector.y
  2793 000012CF 00000000                		dd	   0.0  ; vector.z
  2794                                  
  2795                                  bss_start:
  2796                                  
  2797                                  ABSOLUTE bss_start
  2798                                  
  2799                                  ;=============================================================================
  2800                                  ;        	null-initialized data
  2801                                  ;=============================================================================
  2802                                  
  2803                                  nullstart:
  2804 000012D3 <res 00000024>          wmat:           resb	matrix.size  ; 36
  2805 000012F7 <res 00000024>          nwmat:		resb	matrix.size  ; 36
  2806 0000131B <res 00000002>          zspeed:		resw	1
  2807 0000131D <res 00000002>          oxw:		resw	1
  2808 0000131F <res 00000002>          oyw:		resw	1
  2809 00001321 <res 00000002>          ozw:		resw	1
  2810 00001323 <res 00000002>          scriptptr:	resw	1
  2811 00001325 <res 00000002>          scriptanz:	resw	1
  2812 00001327 <res 00000001>          scriptins:	resb	1
  2813 00001328 <res 00000001>          once:		resb	1
  2814 00001329 <res 00000002>          ticker:		resw	1
  2815 0000132B <res 00000002>          tracks:		resw	1
  2816 0000132D <res 00000300>          palette:        resb 	768
  2817 0000162D <res 00000060>          channels:       resb	16*6
  2818 0000168D <res 00001C24>          o:		resb	object.size ; 7204
  2819                                  nullend:
  2820                                  
  2821                                  ;=============================================================================
  2822                                  ;       	uninitialized data
  2823                                  ;=============================================================================
  2824 000032B1 <res 00000002>          oldstack        resw	1
  2825                                  Old08IrqPtr:
  2826 000032B3 <res 00000002>          Old08Irqofs:	resw	1
  2827 000032B5 <res 00000002>          Old08Irqseg:	resw	1
  2828                                  Old09IrqPtr:
  2829 000032B7 <res 00000002>          Old09Irqofs:	resw	1
  2830 000032B9 <res 00000002>          Old09Irqseg:	resw	1
  2831 000032BB <res 00000E15>          songdata:	resb	3605
  2832 000040D0 <res 00000002>          root:   	resw	1
  2833 000040D2 <res 00000040>          circletab:	resw	32
  2834 00004112 <res 0000005A>          stars:		resb	90
  2835 0000416C <res 00000001>          twice:		resb	1
  2836 0000416D <res 00000002>          vseg:		resw	1
  2837 0000416F <res 00000002>          bseg:		resw    1
  2838 00004171 <res 00000028>          tseg:   	resw	20
  2839 00004199 <res 00008000>          shadetab:	resb	256*128
  2840 0000C199 <res 00000078>          p:		resw	4*15
  2841 0000C211 <res 000000B4>          pr:		resd	3*15
  2842 0000C2C5 <res 000000B4>          po:		resb	poly.size ; 5*36
  2843 0000C379 <res 000012C0>          rp:		resd	3*MAXPOINTS ; 3*400
  2844 0000D639 <res 00000640>          facei:		resd    MAXFACES ; 400
  2845                                  
  2846 0000DC79 <res 00000003>          alignb 4
  2847                                  
  2848                                  bss_end:
