     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                                  
   178                                  		nop
   179                                  %endmacro
   180                                  
   181                                  ;***********************************************
   182                                  ;* descript. : stop keyboard handler           *
   183                                  ;* parameter : none			       *
   184                                  ;* sideeffect: all		               *
   185                                  ;* back      : none		               *
   186                                  ;***********************************************
   187                                  %macro		stopKBDHandler 0
   188                                                  ;push    ds
   189                                                  ;mov     ax,02509h		; restore old IRQ-vector
   190                                                  ;lds     dx, [Old09IrqPtr]	;
   191                                                  ;int     21h
   192                                                  ;pop     ds
   193                                  
   194                                  		nop
   195                                  %endmacro
   196                                  
   197                                  ;***********************************************
   198                                  ;* descript. : zero null-initialized data      *
   199                                  ;* parameter : none			       *
   200                                  ;* sideeffect: all		               *
   201                                  ;* back      : none		               *
   202                                  ;***********************************************
   203                                  %macro		nullData 0
   204                                  		mov	di, nullstart
   205                                  		mov	cx, nullend-nullstart
   206                                  		xor	al, al
   207                                                  rep	stosb
   208                                  %endmacro
   209                                  
   210                                  ;***********************************************
   211                                  ;* descript. : set textmode		       *
   212                                  ;* parameter : none		               *
   213                                  ;* sideeffect: all		               *
   214                                  ;* back      : none		               *
   215                                  ;***********************************************
   216                                  %macro		set80x25 0
   217                                  		mov	ax, 3
   218                                  		int	10h	; - VIDEO - SET	VIDEO MODE
   219                                  				; AL = mode
   220                                  %endmacro
   221                                  
   222                                  ;***********************************************
   223                                  ;* descript. : set gfx-mode 320x200            *
   224                                  ;* parameter : none		               *
   225                                  ;* sideeffect: all		               *
   226                                  ;* back      : none		               *
   227                                  ;***********************************************
   228                                  %macro		set320x200 0
   229                                  		mov	ax, 13h
   230                                  		int	10h		; - VIDEO - SET	VIDEO MODE
   231                                  					; AL = mode
   232                                  %endmacro
   233                                  
   234                                  ;***********************************************
   235                                  ;* descript. : calculate a smooth colorrange   *
   236                                  ;* parameter : none             	       *
   237                                  ;* sideeffect: all              	       *
   238                                  ;* back	     : none                	       *
   239                                  ;***********************************************
   240                                  %macro		makePalette 0
   241                                  		push	ds
   242                                  		pop	es
   243                                  		mov	bx, 3
   244                                  mPcolor:
   245                                  		mov	si, colors
   246                                  		mov	di, palette
   247                                  		xor	dh, dh
   248                                  		lodsb
   249                                  		movzx	cx, al
   250                                  mPouter:
   251                                  		push	cx
   252                                  		mov	cl, byte [si]
   253                                  		mov	ah, byte [bx+si]
   254                                  		sub	ax, dx
   255                                  		push	dx
   256                                  		cwd
   257                                  		idiv	cx
   258                                  		pop	dx
   259                                  mPinner:
   260                                  		add	dx, ax
   261                                  		;mov	byte [es:di+bx-1], dh
   262                                  		mov	byte [di+bx-1], dh
   263                                  		add	di, 3
   264                                  		loop	mPinner
   265                                  		add	si, 4
   266                                  		pop	cx
   267                                  		loop	mPouter
   268                                  		dec	bx
   269                                  		jnz	short mPcolor
   270                                  %endmacro
   271                                  
   272                                  ;***********************************************
   273                                  ;* descript. : reset the GM-Port and switch to *
   274                                  ;*             UART mode.		       *
   275                                  ;* parameter : none			       *
   276                                  ;* sideeffect: dx,al		               *
   277                                  ;* back      : none		               *
   278                                  ;***********************************************
   279                                  %macro		resetGM 0
   280                                  		mov	dx, GMPort
   281                                  		mov	ax, 0FFh
   282                                  		;mov	al, 0FFh
   283                                  		out	dx, al
   284                                  		;sub	cl, cl
   285                                  resGMbusy1:
   286                                  		;dec	cl
   287                                  		dec	ah
   288                                  		jz	short rGMerror	;{ timeout }
   289                                  		in	al, dx		;{ read acknowledge }
   290                                  		
   291                                  		test	al, 80h
   292                                  		jnz	short resGMbusy1
   293                                  		dec	dx
   294                                  		in	al, dx
   295                                  
   296                                  		cmp	al, 0FEh
   297                                  		jne	short rGMerror
   298                                  		inc	dx		;{ switch into UART mode }
   299                                  resGMbusy2:
   300                                  		in	al, dx
   301                                  
   302                                  		test	al, 40h
   303                                  		jnz	short resGMbusy2
   304                                  		mov	al, 3Fh
   305                                  		out	dx, al
   306                                  rGMerror:
   307                                  %endmacro
   308                                  
   309                                  ;***********************************************
   310                                  ;* descript. : mute midi channels 0..15        *
   311                                  ;* parameter : none                	       *
   312                                  ;* sideeffect: ax,cx		               *
   313                                  ;* back		 : none                	       *
   314                                  ;***********************************************
   315                                  %macro		silence 0
   316                                  		mov	cx, 15 ; 0Fh
   317                                  Siloop:	
   318                                  		mov	ax, cx
   319                                  		add	al, CMD_CHANGEPARAM ; 0B0h
   320                                  		call	writeGM
   321                                  		mov	al, MOD_ALLNOTESOFF ; 7Bh
   322                                  		call	writeGM
   323                                  		xor	al, al
   324                                  		call	writeGM
   325                                  		loop	Siloop
   326                                  Sinosound:
   327                                  %endmacro
   328                                  
   329                                  ;***********************************************
   330                                  ;* descript. : create the reactor wall texture *
   331                                  ;* parameter : none		               *
   332                                  ;* sideeffect: ax,bx,cx,di,es                  *
   333                                  ;* back      : none			       *
   334                                  ;* length    : 45 bytes		               *
   335                                  ;***********************************************
   336                                  %macro		reactorWall 0
   337                                  		mov	es, word [tseg]
   338                                  		xor	di, di
   339                                  		mov	cx, 4096 ; 1000h
   340                                  rsmloop:
   341                                  		mov	ax, di
   342                                  		test	al, 8
   343                                  		jle	short rsnonot1
   344                                  		not	al
   345                                  rsnonot1:
   346                                  		and	al, 15 ; 0Fh
   347                                  		mov	bx, ax
   348                                  		mov	ax, di
   349                                  		shr	ax, 6
   350                                  		test	al, 8
   351                                  		jle	short rsnonot2
   352                                  		not	al
   353                                  rsnonot2:
   354                                  		and	al, 15 ; 0Fh
   355                                  		cmp	al, bl
   356                                  		jle	short rstakeal
   357                                  		mov	ax, bx
   358                                  rstakeal:
   359                                  		add	al, 224 ; 0E0h
   360                                  		stosb
   361                                  		loop	rsmloop
   362                                  %endmacro
   363                                  
   364                                  ;***********************************************
   365                                  ;* descript. : calc background-fractal         *
   366                                  ;* parameter : none		               *
   367                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   368                                  ;* back      : none			       *
   369                                  ;***********************************************
   370                                  %macro		createFrac2 0
   371                                  		mov	es, word [tseg+36]
   372                                  		mov	al, 20	; 14h
   373                                  		call	setFrac
   374                                  		mov	di, 64	; 40h
   375                                  		mov	cx, 4096-64
   376                                  		mov	bx, 4
   377                                  cF1loop:
   378                                  		;mov	bx, 4
   379                                  		call	rnd
   380                                  		add	al, byte [es:di-64]
   381                                  		add	al, byte [es:di-63]
   382                                  		dec	ax
   383                                  		shr	ax, 1
   384                                  		stosb
   385                                  		loop	cF1loop
   386                                  %endmacro
   387                                  
   388                                  ;***********************************************
   389                                  ;* descript. : calc random noise fractal       *
   390                                  ;* parameter : none		               *
   391                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   392                                  ;* back      : none			       *
   393                                  ;***********************************************
   394                                  %macro		createFrac3 0
   395                                  		mov	es, word [tseg+38]
   396                                  		mov	al, 3
   397                                  		call	setFrac
   398                                  		mov	cx, 4096 ; 1000h
   399                                  		;mov	bx, cx
   400                                  cF3loop:
   401                                  		mov	bx, 4096 ; 1000h
   402                                  		call	rnd
   403                                  		mov	di, ax 
   404                                  		inc	byte [es:di]
   405                                  		loop	cF3loop
   406                                  %endmacro
   407                                  
   408                                  ;***********************************************
   409                                  ;* descript. : init stars (positions and state)*
   410                                  ;* parameter : none			       *
   411                                  ;* sideeffect: eax,bx,cx,edx,si,di,es          *
   412                                  ;* back      : none		               *
   413                                  ;***********************************************
   414                                  %macro		initStars 0
   415                                  		push	ds
   416                                  		pop	es
   417                                  		mov	cx, 30 ; 1Eh
   418                                  		mov	di, stars
   419                                  iSloop:	
   420                                  		mov	bx, 256 ; 100h
   421                                  		call	rnd
   422                                  		stosb
   423                                  		mov	bx, 4096-(64*5) ; 0EC0h
   424                                  		add	bx, 128 ; 80h
   425                                  		call	rnd
   426                                  		add	ax, 64  ; 40h
   427                                  		stosw
   428                                  		loop	iSloop
   429                                  %endmacro
   430                                  
   431                                  ;***********************************************
   432                                  ;* descript. : add effects to fractals	       *
   433                                  ;* parameter : none		               *
   434                                  ;* sideeffect: ax,bx,cx,di,es		       *
   435                                  ;* back      : none		               *
   436                                  ;***********************************************
   437                                  %macro		effects 0
   438                                  		mov	cx, 26	; 1Ah
   439                                  		mov	si, aE
   440                                  effmloop:
   441                                  		push	cx
   442                                  		mov	bl, byte [si]	; mseg+effect
   443                                  		mov	dl, bl
   444                                  		shr	dl, 4
   445                                  		and	bl, 0Fh ; 15
   446                                  		;add	bx, bx
   447                                  		shl	bl, 1
   448                                  		mov	es, word [bx+tseg]
   449                                  		movzx	cx, byte [si+2] ; y1
   450                                  effyloop:
   451                                  		movzx	bx, byte [si+1] ; x1
   452                                  effxloop:
   453                                  		mov	di, cx
   454                                  		shl	di, 6
   455                                  		add	di, bx
   456                                  		mov	al, dl
   457                                  		dec	al
   458                                  		jz	short effect1
   459                                  		dec	al
   460                                  		jz	short effect2
   461                                  		mov	ax, bx
   462                                  		add	ax, cx
   463                                  		and	al, 4
   464                                  		;jz	short effdonot
   465                                  		jz	short effect1
   466                                  		mov	al, 152 ; 98h
   467                                  effdonot:
   468                                  		jmp	short effect1
   469                                  effect2:
   470                                  		mov	al, byte [es:di]
   471                                  effect1:
   472                                  		add	al, byte [si+5]	; value
   473                                  		mov	byte [es:di], al
   474                                  		inc	bx
   475                                  		cmp	bl, byte [si+3]	; x2
   476                                  		jle	short effxloop
   477                                  		inc	cx
   478                                  		cmp	cl, byte [si+4]	; y2
   479                                  		jle	short effyloop
   480                                  		add	si, 6
   481                                  		pop	cx
   482                                  		loop	effmloop
   483                                  %endmacro
   484                                  
   485                                  ;***********************************************
   486                                  ;* descript. : copy fractals and add value     *
   487                                  ;* parameter : none		               *
   488                                  ;* sideeffect: al,cx,di,es,fs		       *
   489                                  ;* back      : none		               *
   490                                  ;***********************************************
   491                                  %macro		addFractals 0
   492                                  		mov	si, aF
   493                                  		mov	dl, 4
   494                                  aFloop:
   495                                  		movzx	bx, dl
   496                                  		mov	es, word [bx+tseg]
   497                                  		lodsw
   498                                  		mov	bl, al
   499                                  		mov	fs, word [bx+tseg]		
   500                                  		xor	di, di
   501                                  		mov	cx, 4096 ; 1000h
   502                                  aFiloop:
   503                                  		mov	al, byte [fs:di]
   504                                  		add	al, ah
   505                                  		stosb
   506                                  		loop	aFiloop
   507                                  		add	dl, 2
   508                                  		;inc	dx
   509                                  		;inc	dx
   510                                  		cmp	dl, 30
   511                                  		jle	short aFloop
   512                                  %endmacro
   513                                  
   514                                  ;***********************************************
   515                                  ;* descript. : calculate and initalize textures*
   516                                  ;* parameter : none			       *
   517                                  ;* sideeffect: al,cx,di,es,fs		       *
   518                                  ;* back      : none			       *
   519                                  ;***********************************************
   520                                  %macro		addLava 0
   521                                  		mov	es, word [tseg+22]
   522                                  		mov	di, 4095	; 0FFFh
   523                                  		mov	cx, 20		; 14h
   524                                  		mov	al, 94		; 5Eh
   525                                  aLyloop:
   526                                  		push	cx
   527                                  		shl	cx, 3
   528                                  aLxloop:
   529                                  		push	di
   530                                  		push	ax
   531                                  		mov	bx, 64		; 40h
   532                                  		call	rnd
   533                                  		sub	di, ax
   534                                  		pop	ax
   535                                  		;stosb
   536                                  		mov	byte [es:di], al
   537                                  		pop	di
   538                                  		loop	aLxloop
   539                                  		pop	cx
   540                                  		dec	al
   541                                  		sub	di, 64 		; 40h
   542                                  		loop	aLyloop
   543                                  %endmacro
   544                                  
   545                                  ;***********************************************
   546                                  ;* descript. : calculate and initalize textures*
   547                                  ;* parameter : none		               *
   548                                  ;* sideeffect: al,cx,di,es,fs		       *
   549                                  ;* back      : none		               *
   550                                  ;***********************************************
   551                                  %macro		initTextures 0
   552                                  		mov	bx, 34	; 22h
   553                                  		push	800	; 320h
   554                                  		push	5
   555                                  		call	createFrac1
   556                                  		mov	bx, 32	; 20h
   557                                  		push	112	; 70h
   558                                  		push	15	; 0Fh
   559                                  		call	createFrac1
   560                                  		createFrac2
   561                                  		createFrac3
   562                                  		initStars
   563                                  		reactorWall
   564                                  		addFractals
   565                                  		effects
   566                                  		addLava
   567                                  %endmacro
   568                                  
   569                                  ;***********************************************
   570                                  ;* descript. : cycle "range" colors at "base"  *
   571                                  ;* parameter : none		               *
   572                                  ;* sideeffect: ax,(bl),cx,si,di,es             *
   573                                  ;* back      : none			       *
   574                                  ;***********************************************
   575                                  %macro		colorCycle 0
   576                                  		base	equ 6*32
   577                                                  range	equ 32
   578                                  		
   579                                  		push	ds
   580                                  		pop	es
   581                                  		mov	di, palette+(base*3)
   582                                  		mov	si, di
   583                                  		lodsw
   584                                  		;mov	bl, byte [si]  ; works only with fire (no blue)
   585                                  		inc	si
   586                                  		mov	cx, (range*3-3)
   587                                  		rep movsb
   588                                  		stosw
   589                                  		;mov	byte [di], bl  ; works only with fire (no blue)
   590                                  %endmacro
   591                                  
   592                                  ;***********************************************
   593                                  ;* descript. : animate the stars	       *
   594                                  ;* parameter : none			       *
   595                                  ;* sideeffect: ax,bx,cx,dl,si,di,es            *
   596                                  ;* back      : none			       *
   597                                  ;***********************************************
   598                                  %macro		animStars 0
   599                                  		_base	equ 7*32
   600                                  
   601                                  		mov	es, word [tseg+2]
   602                                  		call	clearFrac
   603                                  
   604                                  		mov	cl, 30	; 1Eh
   605                                  		mov	bx, stars
   606                                  aSoloop:
   607                                  		dec	byte [bx]
   608                                  		mov	ah, byte [bx]
   609                                  		and	ah, 63	; 3Fh
   610                                  		cmp	ah, 31	; 1Fh
   611                                  		jbe	short aSnonot
   612                                  		not	ah
   613                                  		and	ah, 31	; 1Fh
   614                                  aSnonot:
   615                                  		shr	ah, 1
   616                                  		mov	di, word [bx+1]
   617                                  		push	cx
   618                                  		push	bx
   619                                  
   620                                  		mov	dx, 64-5 ; 3Bh
   621                                  		mov	cx, _base*256+0 ; 0E000h
   622                                  		call	setstarbob
   623                                  
   624                                  		pop	bx
   625                                  		pop	cx
   626                                  		add	bx, 3
   627                                  		loop	aSoloop
   628                                  %endmacro
   629                                  
   630                                  ;***********************************************
   631                                  ;* descript. : calculate shading tab           *
   632                                  ;* parameter : none		               *
   633                                  ;* sideeffect: ax,bl,cx,di,es                  *
   634                                  ;* back      : none		               *
   635                                  ;***********************************************
   636                                  %macro		calcShadeTab 0
   637                                  		push	ds
   638                                  		pop	es
   639                                  		mov	di, shadetab
   640                                  		xor	bl, bl
   641                                  cSolp:
   642                                  		inc	bl
   643                                  		xor	cx, cx
   644                                  cSilp1:
   645                                  		mov	al, cl
   646                                  		and	al, 31	; 1Fh
   647                                  		mul	bl
   648                                  		add	ax, ax
   649                                  		mov	al, cl
   650                                  		and	al, 224	; 0E0h
   651                                  		add	al, ah
   652                                  		stosb
   653                                  		inc	cl
   654                                  		cmp	cl, 192 ; 0C0h
   655                                  		jne	short cSilp1
   656                                  cSilp2:
   657                                  		mov	al, cl
   658                                  		stosb
   659                                  		inc	cl
   660                                  		jnz	short cSilp2
   661                                  		cmp	bl, 128	; 80h
   662                                  		jne	short cSolp
   663                                  %endmacro
   664                                  
   665                                  ;***********************************************
   666                                  ;* descript. : expand a song       	       *
   667                                  ;* parameter : si:song base adress	       *
   668                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
   669                                  ;* back      : none                	       *
   670                                  ;***********************************************
   671                                  %macro		expandSong 0
   672                                                  mov	si, credits
   673                                                  mov	bx, channels
   674                                                  mov	di, songdata
   675                                  EPSwhile:	lodsw
   676                                                  dec	al
   677                                                  js      short EPSendwhile
   678                                                  mov	byte [bx+channel.trk], al ; [bx+2]
   679                                                  add	al, CMD_CHANGEPRG ; 0C0h
   680                                                  call	setinstr
   681                                                  mov	word [bx+channel.adr], di ; [bx+4]	
   682                                                 	call	expand
   683                                                  xor	al, al
   684                                                  stosb
   685                                                  add	bx, 6
   686                                                  inc	word [tracks]
   687                                                  jmp	short EPSwhile
   688                                  EPSendwhile:
   689                                  %endmacro
   690                                  
   691                                  ;***********************************************
   692                                  ;* descript. : parse the script,rotate and move*
   693                                  ;* parameter : none                	       *
   694                                  ;* sideeffect: all		               *
   695                                  ;* back      : none		               *
   696                                  ;***********************************************
   697                                  %macro		scriptIt 0
   698                                  		mov	cx, word [ticker]
   699                                  		mov	word [ticker], 0
   700                                  		or	cx, cx
   701                                  		jz	sItickerNull
   702                                  sImloop:
   703                                  		push	cx
   704                                  		mov	si, zspeed
   705                                  		;dec	word [si+10]	      ;	scriptanz
   706                                  		dec	word [scriptanz]
   707                                  		jns	short sIwaitTimer
   708                                  		;mov	bx, word [si+8]	      ;	scriptptr
   709                                  		mov	bx, word [scriptptr]
   710                                  		mov	al, byte [bx+script]
   711                                  		or	al, al
   712                                  		jz	_exit_
   713                                  		mov	bx, ax
   714                                  		and	bl, 7
   715                                  		;mov	byte [si+12], bl      ;	scriptins
   716                                  		mov	byte [scriptins], bl
   717                                  		dec	bl
   718                                  		jnz	short sInegateTurn
   719                                  		; (cmd = NEG ZSTEP)  
   720                                  		neg	word [zstep]
   721                                  sInegateTurn:
   722                                  		and	ax, 0F8h
   723                                  		add	ax, ax
   724                                  		;mov	word [si+10], ax      ; scriptanz
   725                                  		mov	word [scriptanz], ax
   726                                  		;inc	word [si+8]	      ; scriptptr
   727                                  		inc	word [scriptptr]
   728                                  sIwaitTimer:
   729                                  		;mov	al, byte [si+12]      ;	scriptins
   730                                  		mov	al, byte [scriptins]
   731                                  		cbw
   732                                  		xor	ch, ch
   733                                  		dec	ax
   734                                  		jnz	short sInoturn
   735                                  		; (cmd = NEG ZSTEP)  
   736                                  		mov	bx, word [zstep]
   737                                  		;add	word [si+6], bx	      ; ozw
   738                                  		add	word [ozw], bx
   739                                  		jmp	short sI_1	
   740                                  sInoturn:
   741                                  		mov	cl, 3
   742                                  		;mov	cx, 3
   743                                  sIrotateLoop:
   744                                  		dec	ax
   745                                  		jnz	short sInoIncrement
   746                                  		; (cmd = INC SPEED or INC XSTEP or INC YSTEP)  
   747                                  		inc	word [si]	      ; zspeed, oxw, oyw
   748                                  		jmp	short sI_1	   	
   749                                  sInoIncrement:
   750                                  		dec	ax
   751                                  		jnz	short sInoDecrement
   752                                  		; (cmd = DEC SPEED or DEC XSTEP or DEC YSTEP)  
   753                                  		dec	word [si]	      ; zspeed, oxw, oyw
   754                                  		jmp	short sI_1
   755                                  sInoDecrement:
   756                                  		inc	si
   757                                  		inc	si
   758                                  		loop	sIrotateLoop
   759                                  sI_1:
   760                                  		;mov	si, zspeed+2	      ; oxw 	
   761                                  		mov	si, oxw	
   762                                  		mov	cl, 3
   763                                  sIpushloop:
   764                                  		lodsw			      ; oxw, oyw, ozw	
   765                                  		sar	ax, 2
   766                                  		push	ax
   767                                  		loop	sIpushloop
   768                                  
   769                                  		imul	ax, word [si-4], 16   ; [oyw]*16 	
   770                                  		push	ax		        	
   771                                  		call	calcRotMat
   772                                  
   773                                  		mov	cl, 3
   774                                  		xor	si, si
   775                                  sImoveLoop:
   776                                  		fld	dword [si+owmat+24]
   777                                  		fimul	word [zspeed]
   778                                  		fidiv	word [CONST1792]
   779                                  		fadd	dword [si+ob]
   780                                  		fstp	dword [si+ob]
   781                                  		add	si, 4
   782                                  		loop	sImoveLoop
   783                                  		pop	cx
   784                                  		dec	cx
   785                                  		jnz	sImloop
   786                                  sItickerNull:
   787                                  %endmacro
   788                                  
   789                                  ;***********************************************
   790                                  ;* descript. : rotate all points from o -> rp  *
   791                                  ;* parameter : none                	       *
   792                                  ;* sideeffect: all		               *
   793                                  ;* back      : none		               *
   794                                  ;***********************************************
   795                                  %macro		rotation 0
   796                                  		mov	cx, word [o+object.panz]
   797                                  		mov	si, o+object.p
   798                                  		mov	di, rp
   799                                  rotmlp:
   800                                  		mov	bx, wmat
   801                                  		mov	dx, 3
   802                                  rotilp:	
   803                                  		fild	word [si+0] ; point.x
   804                                  		fsub	dword [ob+vector.x]
   805                                  		fmul	dword [bx+0]
   806                                  		fild	word [si+2] ; point.y
   807                                  		fsub	dword [ob+vector.y]
   808                                  		fmul	dword [bx+4]
   809                                  		fild	word [si+4] ; point.z
   810                                  		fsub	dword [ob+vector.z]
   811                                  		fmul	dword [bx+8]
   812                                  		;fadd	
   813                                  		;fadd
   814                                  		faddp
   815                                  		faddp
   816                                  		fstp	dword [di]
   817                                  		add	di, 4
   818                                  		add	bx, 12	; 0Ch
   819                                  		dec	dx
   820                                  		jnz	short rotilp
   821                                  		add	si, 8 ; next point
   822                                  		loop	rotmlp
   823                                  %endmacro
   824                                  
   825                                  ;***********************************************
   826                                  ;* descript. : sort faces by z-koord	       *
   827                                  ;* parameter : none		               *
   828                                  ;* sideeffect: ax,bx,cx,dx,si,di,es            *
   829                                  ;* back      : none		               *
   830                                  ;***********************************************
   831                                  %macro		sortFaces 0
   832                                  		push	ds
   833                                  		pop	es
   834                                  		mov	di, facei
   835                                  		push	di ; facei
   836                                  		mov	si, o+object.f
   837                                  		mov	ax, si ; pointer to faces
   838                                  		mov	cx, word [o+object.fanz]
   839                                  sFmloop:
   840                                  		fldz
   841                                  		push	cx
   842                                  		mov	cx, 4
   843                                  sFiloop:
   844                                  		imul	bx, word [si], 12 ; number of points (of face)
   845                                  		inc	si
   846                                  		inc	si
   847                                  		fsub	dword [bx+rp+vector.z]
   848                                  		loop	sFiloop
   849                                  		pop	cx
   850                                  		fistp	word [di] ; z distance (face total)
   851                                  		inc	di
   852                                  		inc	di
   853                                  		stosw		; face address (in 'o+object.f')
   854                                  		add	ax, 10
   855                                  		inc	si
   856                                  		inc	si
   857                                  		loop	sFmloop
   858                                  		push	di	; facei+4*(o+object.fanz-1)
   859                                  		call	qsort
   860                                  %endmacro
   861                                  
   862                                  ;***********************************************
   863                                  ;* descript. : animate the door  	       *
   864                                  ;* parameter : none		               *
   865                                  ;* sideeffect: ax,cx,si,di,es                  *
   866                                  ;* back      : none		               *
   867                                  ;***********************************************
   868                                  %macro		animDoor 0
   869                                  		mov	ax, word [doortimer]
   870                                  		or	ax, ax
   871                                  		jns	short aDnounder
   872                                  		xor	ax, ax
   873                                  		jmp	short alreadydrawed
   874                                  aDnounder:
   875                                  		cmp	byte [once], 0
   876                                  		jne	short alreadydrawed
   877                                  		inc	byte [once]
   878                                  		push	ax
   879                                  		starbackground
   880                                  		pop	ax
   881                                  alreadydrawed:
   882                                  		cmp	ax, 24
   883                                  		jle	short aDnoover
   884                                  		mov	ax, 24
   885                                  aDnoover:
   886                                  		shl	ax, 6
   887                                  		push	ds
   888                                  		mov	es, word [tseg+26]
   889                                  		mov	ds, word [tseg+30]
   890                                  		mov	si, ax
   891                                  		xor	di, di
   892                                  		mov	cx, 1024
   893                                  		rep movsw
   894                                  		mov	si, 2048
   895                                                  sub	si, ax
   896                                  		push	si
   897                                  		mov	ch, 4  ; cx = 1024
   898                                  		rep movsw
   899                                  		pop	di
   900                                  		mov	cx, ax
   901                                  		xor	ax, ax
   902                                  		rep stosw
   903                                  		pop	ds
   904                                  %endmacro
   905                                  
   906                                  ;***********************************************
   907                                  ;* descript. : play a tick of the song	       *
   908                                  ;* parameter : none                	       *
   909                                  ;* sideeffect: ax,bx,cx,dx,si		       *
   910                                  ;* back      : none                	       *
   911                                  ;***********************************************
   912                                  %macro		playsong 0
   913                                  		mov	cx, word [tracks]
   914                                  		mov	si, channels
   915                                  PSmloop:
   916                                  		dec	word [si+channel.del]
   917                                  		jg	short PSdelayed
   918                                  		mov	ax, word [si+channel.trk]
   919                                  		add	al, CMD_NOTEOFF	; 80h
   920                                  		call	setnote
   921                                  		mov	bx, word [si+channel.adr]
   922                                  		mov	ah, 127 	; 7Fh
   923                                  		cmp	byte [bx], 0
   924                                  		jz	short PStrackend
   925                                  		mov	ah, byte [bx]
   926                                  		mov	byte [si+channel.ln], ah
   927                                  		mov	al, byte [si+channel.trk]
   928                                  		add	al, CMD_NOTEON	; 90h
   929                                  		call	setnote
   930                                  		mov	al, byte [bx+1]
   931                                  		mov	bl, SONGSPEED	; 1Dh
   932                                  		mul	bl
   933                                  PStrackend:
   934                                  		mov	word [si+channel.del], ax
   935                                  		add	word [si+channel.adr], 2
   936                                  PSdelayed:
   937                                  		add	si, 6
   938                                  		loop	PSmloop
   939                                  PSnosound:
   940                                  %endmacro
   941                                  
   942                                  ;***********************************************
   943                                  ;* descript. : dump palette to CRT             *
   944                                  ;* parameter : bl:intensity (0..255)           *
   945                                  ;* sideeffect: ax,es,di,cx,dx                  *
   946                                  ;* back      : none		               *
   947                                  ;***********************************************
   948                                  %macro		setPalette2 0
   949                                  		xor	al, al
   950                                  		mov	dx, 3C8h
   951                                  		out	dx, al
   952                                  		inc	dx
   953                                  		mov	si, palette
   954                                  		mov	cx, 768 ; 300h
   955                                  		rep outsb
   956                                  %endmacro
   957                                  
   958                                  ;***********************************************
   959                                  ;* descript. : clear starbackground            *
   960                                  ;* parameter : none		               *
   961                                  ;* sideeffect: ax,es,di,cx,dx                  *
   962                                  ;* back      : none		               *
   963                                  ;***********************************************
   964                                  %macro		cls 0
   965                                  		push	ds
   966                                  		mov	es, word [bseg]
   967                                  		;push	0A000h
   968                                  		;pop	ds
   969                                  		mov	si, 0A000h
   970                                  		mov	ds, si
   971                                  		mov	si, 320*5
   972                                  		xor	di, di
   973                                  		mov	cx, 32000 ; 7D00h
   974                                  clsloop:
   975                                  		lodsb
   976                                  		stosb
   977                                  		stosb
   978                                  		loop	clsloop
   979                                  		pop	ds
   980                                  %endmacro
   981                                  
   982                                  ;***********************************************
   983                                  ;* descript. : draw starbackground             *
   984                                  ;* parameter : none		               *
   985                                  ;* sideeffect: ax,es,di,cx,dx                  *
   986                                  ;* back      : none		               *
   987                                  ;***********************************************
   988                                  %macro		starbackground 0
   989                                  		mov	es, word [bseg]
   990                                  		mov	cx, 100 ; 64h
   991                                  starbackloop:
   992                                  		push	cx
   993                                  		mov	bx, 320*155 ; 0C1C0h
   994                                  		call	rnd
   995                                  		add	ax, 320*20  ; 1900h
   996                                  		mov	di, ax
   997                                  		and	ah, 7
   998                                  		mov	dx, 320-5   ; 13Bh
   999                                  		mov	cx, 2
  1000                                  		call	setstarbob
  1001                                  		pop	cx
  1002                                  		loop	starbackloop
  1003                                  %endmacro
  1004                                  
  1005                                  ;***********************************************
  1006                                  ;* descript. : create identity matrix	       *
  1007                                  ;* parameter : ds:di address                   *
  1008                                  ;* sideeffect: cx,di		   	       *
  1009                                  ;* back      : none			       *
  1010                                  ;***********************************************
  1011                                  %macro		identityMat 0
  1012                                  		mov	ch, 2
  1013                                  iMolp:
  1014                                  		mov	cl, 2
  1015                                  iMilp:
  1016                                  		fldz
  1017                                  		cmp	ch, cl
  1018                                  		jne	short iMwritezero
  1019                                  		fstp	st0
  1020                                  		fld1
  1021                                  iMwritezero:
  1022                                  		fstp	dword [di]
  1023                                  		add	di, 4
  1024                                  		dec	cl
  1025                                  		jns	short iMilp
  1026                                  		dec	ch
  1027                                  		jns	short iMolp
  1028                                  %endmacro
  1029                                  
  1030                                  ;=============================================================================
  1031                                  ;               entry point
  1032                                  ;=============================================================================
  1033                                  ;***********************************************
  1034                                  ;* descript. : entry point		       *
  1035                                  ;* parameter : none		               *
  1036                                  ;* sideeffect: all		               *
  1037                                  ;* back      : none		               *
  1038                                  ;***********************************************
  1039                                  
  1040                                  start:
  1041                                  		;mov	ax, cs
  1042                                  		;mov	ds, ax
  1043                                  		;mov	es, ax
  1044                                  
  1045                                  		;; clear bss
  1046                                  		;mov	di, bss_start
  1047                                  		;mov	cx, (bss_end - bss_start)/4
  1048                                  		;xor	eax, eax
  1049                                  		;rep	stosd
  1050                                  
  1051 00000000 8CC8                    		mov	ax, cs
  1052 00000002 BF[5941]                		mov	di, vseg
  1053 00000005 050010                  		add	ax, 1000h
  1054 00000008 AB                      		stosw			; virtual screen address
  1055 00000009 050010                  		add	ax, 1000h
  1056 0000000C AB                      		stosw			; star background address
  1057 0000000D 050010                  		add	ax, 1000h
  1058 00000010 B91400                  		mov	cx, 20
  1059                                  segloop:				; texture addresses
  1060 00000013 AB                      		stosw
  1061                                  		;add	ax, 100h
  1062 00000014 FEC4                    		inc	ah
  1063 00000016 E2FB                    		loop	segloop
  1064                                  
  1065                                  		;fninit
  1066                                  
  1067                                  		nullData
  1067 00000018 BF[C312]            <1>  mov di, nullstart
  1067 0000001B B9DE1F              <1>  mov cx, nullend-nullstart
  1067 0000001E 30C0                <1>  xor al, al
  1067 00000020 F3AA                <1>  rep stosb
  1068                                  		resetGM
  1068 00000022 BA3103              <1>  mov dx, GMPort
  1068 00000025 B8FF00              <1>  mov ax, 0FFh
  1068                              <1> 
  1068 00000028 EE                  <1>  out dx, al
  1068                              <1> 
  1068                              <1> resGMbusy1:
  1068                              <1> 
  1068 00000029 FECC                <1>  dec ah
  1068 0000002B 7414                <1>  jz short rGMerror
  1068 0000002D EC                  <1>  in al, dx
  1068                              <1> 
  1068 0000002E A880                <1>  test al, 80h
  1068 00000030 75F7                <1>  jnz short resGMbusy1
  1068 00000032 4A                  <1>  dec dx
  1068 00000033 EC                  <1>  in al, dx
  1068                              <1> 
  1068 00000034 3CFE                <1>  cmp al, 0FEh
  1068 00000036 7509                <1>  jne short rGMerror
  1068 00000038 42                  <1>  inc dx
  1068                              <1> resGMbusy2:
  1068 00000039 EC                  <1>  in al, dx
  1068                              <1> 
  1068 0000003A A840                <1>  test al, 40h
  1068 0000003C 75FB                <1>  jnz short resGMbusy2
  1068 0000003E B03F                <1>  mov al, 3Fh
  1068 00000040 EE                  <1>  out dx, al
  1068                              <1> rGMerror:
  1069                                  		expandSong
  1069 00000041 BE[F90C]            <1>  mov si, credits
  1069 00000044 BB[1D16]            <1>  mov bx, channels
  1069 00000047 BF[A732]            <1>  mov di, songdata
  1069 0000004A AD                  <1> EPSwhile: lodsw
  1069 0000004B FEC8                <1>  dec al
  1069 0000004D 781A                <1>  js short EPSendwhile
  1069 0000004F 884702              <1>  mov byte [bx+channel.trk], al
  1069 00000052 04C0                <1>  add al, CMD_CHANGEPRG
  1069 00000054 E86605              <1>  call setinstr
  1069 00000057 897F04              <1>  mov word [bx+channel.adr], di
  1069 0000005A E8C604              <1>  call expand
  1069 0000005D 30C0                <1>  xor al, al
  1069 0000005F AA                  <1>  stosb
  1069 00000060 83C306              <1>  add bx, 6
  1069 00000063 FF06[1B13]          <1>  inc word [tracks]
  1069 00000067 EBE1                <1>  jmp short EPSwhile
  1069                              <1> EPSendwhile:
  1070                                  
  1071 00000069 E8FE0A                  		call	createWorld
  1072                                  
  1073                                  		set320x200
  1073 0000006C B81300              <1>  mov ax, 13h
  1073 0000006F CD10                <1>  int 10h
  1073                              <1> 
  1074                                  
  1075 00000071 86E0                    		xchg	ah, al 		; ah = write string = 13h, 
  1076                                  					; al = write mode = 0
  1077 00000073 BB1C00                  		mov	bx, 1Ch
  1078 00000076 BD[7A12]                		mov	bp, omniscent
  1079 00000079 B90900                  		mov	cx, omniend-omniscent ; 9
  1080 0000007C BA0601                  		mov	dx, 106h
  1081 0000007F CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1082                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1083                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1084                                  					; ES:BP	-> start of string
  1085 00000081 01CD                    		add	bp, cx
  1086 00000083 B110                    		mov	cl, sancend-sanction ; 11h
  1087 00000085 BA010C                  		mov	dx, 0C01h
  1088 00000088 CD10                    		int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1089                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1090                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1091                                  					; ES:BP	-> start of string
  1092                                  		makePalette
  1092 0000008A 1E                  <1>  push ds
  1092 0000008B 07                  <1>  pop es
  1092 0000008C BB0300              <1>  mov bx, 3
  1092                              <1> mPcolor:
  1092 0000008F BE[3E0E]            <1>  mov si, colors
  1092 00000092 BF[1D13]            <1>  mov di, palette
  1092 00000095 30F6                <1>  xor dh, dh
  1092 00000097 AC                  <1>  lodsb
  1092 00000098 0FB6C8              <1>  movzx cx, al
  1092                              <1> mPouter:
  1092 0000009B 51                  <1>  push cx
  1092 0000009C 8A0C                <1>  mov cl, byte [si]
  1092 0000009E 8A20                <1>  mov ah, byte [bx+si]
  1092 000000A0 29D0                <1>  sub ax, dx
  1092 000000A2 52                  <1>  push dx
  1092 000000A3 99                  <1>  cwd
  1092 000000A4 F7F9                <1>  idiv cx
  1092 000000A6 5A                  <1>  pop dx
  1092                              <1> mPinner:
  1092 000000A7 01C2                <1>  add dx, ax
  1092                              <1> 
  1092 000000A9 8871FF              <1>  mov byte [di+bx-1], dh
  1092 000000AC 83C703              <1>  add di, 3
  1092 000000AF E2F6                <1>  loop mPinner
  1092 000000B1 83C604              <1>  add si, 4
  1092 000000B4 59                  <1>  pop cx
  1092 000000B5 E2E4                <1>  loop mPouter
  1092 000000B7 4B                  <1>  dec bx
  1092 000000B8 75D5                <1>  jnz short mPcolor
  1093                                  		
  1094                                  		initTextures
  1094 000000BA BB2200              <1>  mov bx, 34
  1094 000000BD 682003              <1>  push 800
  1094 000000C0 6A05                <1>  push 5
  1094 000000C2 E80B05              <1>  call createFrac1
  1094 000000C5 BB2000              <1>  mov bx, 32
  1094 000000C8 6A70                <1>  push 112
  1094 000000CA 6A0F                <1>  push 15
  1094 000000CC E80105              <1>  call createFrac1
  1094                              <1>  createFrac2
  1094 000000CF 8E06[8141]          <2>  mov es, word [tseg+36]
  1094 000000D3 B014                <2>  mov al, 20
  1094 000000D5 E8F004              <2>  call setFrac
  1094 000000D8 BF4000              <2>  mov di, 64
  1094 000000DB B9C00F              <2>  mov cx, 4096-64
  1094 000000DE BB0400              <2>  mov bx, 4
  1094                              <2> cF1loop:
  1094                              <2> 
  1094 000000E1 E89D04              <2>  call rnd
  1094 000000E4 260245C0            <2>  add al, byte [es:di-64]
  1094 000000E8 260245C1            <2>  add al, byte [es:di-63]
  1094 000000EC 48                  <2>  dec ax
  1094 000000ED D1E8                <2>  shr ax, 1
  1094 000000EF AA                  <2>  stosb
  1094 000000F0 E2EF                <2>  loop cF1loop
  1094                              <1>  createFrac3
  1094 000000F2 8E06[8341]          <2>  mov es, word [tseg+38]
  1094 000000F6 B003                <2>  mov al, 3
  1094 000000F8 E8CD04              <2>  call setFrac
  1094 000000FB B90010              <2>  mov cx, 4096
  1094                              <2> 
  1094                              <2> cF3loop:
  1094 000000FE BB0010              <2>  mov bx, 4096
  1094 00000101 E87D04              <2>  call rnd
  1094 00000104 89C7                <2>  mov di, ax
  1094 00000106 26FE05              <2>  inc byte [es:di]
  1094 00000109 E2F3                <2>  loop cF3loop
  1094                              <1>  initStars
  1094 0000010B 1E                  <2>  push ds
  1094 0000010C 07                  <2>  pop es
  1094 0000010D B91E00              <2>  mov cx, 30
  1094 00000110 BF[FE40]            <2>  mov di, stars
  1094                              <2> iSloop:
  1094 00000113 BB0001              <2>  mov bx, 256
  1094 00000116 E86804              <2>  call rnd
  1094 00000119 AA                  <2>  stosb
  1094 0000011A BBC00E              <2>  mov bx, 4096-(64*5)
  1094 0000011D 81C38000            <2>  add bx, 128
  1094 00000121 E85D04              <2>  call rnd
  1094 00000124 83C040              <2>  add ax, 64
  1094 00000127 AB                  <2>  stosw
  1094 00000128 E2E9                <2>  loop iSloop
  1094                              <1>  reactorWall
  1094 0000012A 8E06[5D41]          <2>  mov es, word [tseg]
  1094 0000012E 31FF                <2>  xor di, di
  1094 00000130 B90010              <2>  mov cx, 4096
  1094                              <2> rsmloop:
  1094 00000133 89F8                <2>  mov ax, di
  1094 00000135 A808                <2>  test al, 8
  1094 00000137 7E02                <2>  jle short rsnonot1
  1094 00000139 F6D0                <2>  not al
  1094                              <2> rsnonot1:
  1094 0000013B 240F                <2>  and al, 15
  1094 0000013D 89C3                <2>  mov bx, ax
  1094 0000013F 89F8                <2>  mov ax, di
  1094 00000141 C1E806              <2>  shr ax, 6
  1094 00000144 A808                <2>  test al, 8
  1094 00000146 7E02                <2>  jle short rsnonot2
  1094 00000148 F6D0                <2>  not al
  1094                              <2> rsnonot2:
  1094 0000014A 240F                <2>  and al, 15
  1094 0000014C 38D8                <2>  cmp al, bl
  1094 0000014E 7E02                <2>  jle short rstakeal
  1094 00000150 89D8                <2>  mov ax, bx
  1094                              <2> rstakeal:
  1094 00000152 04E0                <2>  add al, 224
  1094 00000154 AA                  <2>  stosb
  1094 00000155 E2DC                <2>  loop rsmloop
  1094                              <1>  addFractals
  1094 00000157 BE[1B0F]            <2>  mov si, aF
  1094 0000015A B204                <2>  mov dl, 4
  1094                              <2> aFloop:
  1094 0000015C 0FB6DA              <2>  movzx bx, dl
  1094 0000015F 8E87[5D41]          <2>  mov es, word [bx+tseg]
  1094 00000163 AD                  <2>  lodsw
  1094 00000164 88C3                <2>  mov bl, al
  1094 00000166 8EA7[5D41]          <2>  mov fs, word [bx+tseg]
  1094 0000016A 31FF                <2>  xor di, di
  1094 0000016C B90010              <2>  mov cx, 4096
  1094                              <2> aFiloop:
  1094 0000016F 648A05              <2>  mov al, byte [fs:di]
  1094 00000172 00E0                <2>  add al, ah
  1094 00000174 AA                  <2>  stosb
  1094 00000175 E2F8                <2>  loop aFiloop
  1094 00000177 80C202              <2>  add dl, 2
  1094                              <2> 
  1094                              <2> 
  1094 0000017A 80FA1E              <2>  cmp dl, 30
  1094 0000017D 7EDD                <2>  jle short aFloop
  1094                              <1>  effects
  1094 0000017F B91A00              <2>  mov cx, 26
  1094 00000182 BE[7F0E]            <2>  mov si, aE
  1094                              <2> effmloop:
  1094 00000185 51                  <2>  push cx
  1094 00000186 8A1C                <2>  mov bl, byte [si]
  1094 00000188 88DA                <2>  mov dl, bl
  1094 0000018A C0EA04              <2>  shr dl, 4
  1094 0000018D 80E30F              <2>  and bl, 0Fh
  1094                              <2> 
  1094 00000190 D0E3                <2>  shl bl, 1
  1094 00000192 8E87[5D41]          <2>  mov es, word [bx+tseg]
  1094 00000196 0FB64C02            <2>  movzx cx, byte [si+2]
  1094                              <2> effyloop:
  1094 0000019A 0FB65C01            <2>  movzx bx, byte [si+1]
  1094                              <2> effxloop:
  1094 0000019E 89CF                <2>  mov di, cx
  1094 000001A0 C1E706              <2>  shl di, 6
  1094 000001A3 01DF                <2>  add di, bx
  1094 000001A5 88D0                <2>  mov al, dl
  1094 000001A7 FEC8                <2>  dec al
  1094 000001A9 7413                <2>  jz short effect1
  1094 000001AB FEC8                <2>  dec al
  1094 000001AD 740C                <2>  jz short effect2
  1094 000001AF 89D8                <2>  mov ax, bx
  1094 000001B1 01C8                <2>  add ax, cx
  1094 000001B3 2404                <2>  and al, 4
  1094                              <2> 
  1094 000001B5 7407                <2>  jz short effect1
  1094 000001B7 B098                <2>  mov al, 152
  1094                              <2> effdonot:
  1094 000001B9 EB03                <2>  jmp short effect1
  1094                              <2> effect2:
  1094 000001BB 268A05              <2>  mov al, byte [es:di]
  1094                              <2> effect1:
  1094 000001BE 024405              <2>  add al, byte [si+5]
  1094 000001C1 268805              <2>  mov byte [es:di], al
  1094 000001C4 43                  <2>  inc bx
  1094 000001C5 3A5C03              <2>  cmp bl, byte [si+3]
  1094 000001C8 7ED4                <2>  jle short effxloop
  1094 000001CA 41                  <2>  inc cx
  1094 000001CB 3A4C04              <2>  cmp cl, byte [si+4]
  1094 000001CE 7ECA                <2>  jle short effyloop
  1094 000001D0 83C606              <2>  add si, 6
  1094 000001D3 59                  <2>  pop cx
  1094 000001D4 E2AF                <2>  loop effmloop
  1094                              <1>  addLava
  1094 000001D6 8E06[7341]          <2>  mov es, word [tseg+22]
  1094 000001DA BFFF0F              <2>  mov di, 4095
  1094 000001DD B91400              <2>  mov cx, 20
  1094 000001E0 B05E                <2>  mov al, 94
  1094                              <2> aLyloop:
  1094 000001E2 51                  <2>  push cx
  1094 000001E3 C1E103              <2>  shl cx, 3
  1094                              <2> aLxloop:
  1094 000001E6 57                  <2>  push di
  1094 000001E7 50                  <2>  push ax
  1094 000001E8 BB4000              <2>  mov bx, 64
  1094 000001EB E89303              <2>  call rnd
  1094 000001EE 29C7                <2>  sub di, ax
  1094 000001F0 58                  <2>  pop ax
  1094                              <2> 
  1094 000001F1 268805              <2>  mov byte [es:di], al
  1094 000001F4 5F                  <2>  pop di
  1094 000001F5 E2EF                <2>  loop aLxloop
  1094 000001F7 59                  <2>  pop cx
  1094 000001F8 FEC8                <2>  dec al
  1094 000001FA 83EF40              <2>  sub di, 64
  1094 000001FD E2E3                <2>  loop aLyloop
  1095                                  
  1096                                  		calcShadeTab
  1096 000001FF 1E                  <1>  push ds
  1096 00000200 07                  <1>  pop es
  1096 00000201 BF[8541]            <1>  mov di, shadetab
  1096 00000204 30DB                <1>  xor bl, bl
  1096                              <1> cSolp:
  1096 00000206 FEC3                <1>  inc bl
  1096 00000208 31C9                <1>  xor cx, cx
  1096                              <1> cSilp1:
  1096 0000020A 88C8                <1>  mov al, cl
  1096 0000020C 241F                <1>  and al, 31
  1096 0000020E F6E3                <1>  mul bl
  1096 00000210 01C0                <1>  add ax, ax
  1096 00000212 88C8                <1>  mov al, cl
  1096 00000214 24E0                <1>  and al, 224
  1096 00000216 00E0                <1>  add al, ah
  1096 00000218 AA                  <1>  stosb
  1096 00000219 FEC1                <1>  inc cl
  1096 0000021B 80F9C0              <1>  cmp cl, 192
  1096 0000021E 75EA                <1>  jne short cSilp1
  1096                              <1> cSilp2:
  1096 00000220 88C8                <1>  mov al, cl
  1096 00000222 AA                  <1>  stosb
  1096 00000223 FEC1                <1>  inc cl
  1096 00000225 75F9                <1>  jnz short cSilp2
  1096 00000227 80FB80              <1>  cmp bl, 128
  1096 0000022A 75DA                <1>  jne short cSolp
  1097                                  
  1098 0000022C 8926[A132]              		mov	word [oldstack], sp
  1099                                  
  1100                                  		startTimer
  1100 00000230 B80835              <1>  mov ax, 03508h
  1100 00000233 CD21                <1>  int 21h
  1100 00000235 8C06[A532]          <1>  mov word [Old08Irqseg], es
  1100 00000239 891E[A332]          <1>  mov word [Old08Irqofs], bx
  1100 0000023D B80825              <1>  mov ax, 02508h
  1100 00000240 BA[5A04]            <1>  mov dx, irqHandler08
  1100 00000243 CD21                <1>  int 21h
  1100                              <1> 
  1100 00000245 BB510D              <1>  mov bx, 3409
  1100 00000248 E84903              <1>  call setTimer
  1101                                  		startKBDHandler
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101 0000024B 90                  <1>  nop
  1102                                  		cls
  1102 0000024C 1E                  <1>  push ds
  1102 0000024D 8E06[5B41]          <1>  mov es, word [bseg]
  1102                              <1> 
  1102                              <1> 
  1102 00000251 BE00A0              <1>  mov si, 0A000h
  1102 00000254 8EDE                <1>  mov ds, si
  1102 00000256 BE4006              <1>  mov si, 320*5
  1102 00000259 31FF                <1>  xor di, di
  1102 0000025B B9007D              <1>  mov cx, 32000
  1102                              <1> clsloop:
  1102 0000025E AC                  <1>  lodsb
  1102 0000025F AA                  <1>  stosb
  1102 00000260 AA                  <1>  stosb
  1102 00000261 E2FB                <1>  loop clsloop
  1102 00000263 1F                  <1>  pop ds
  1103                                  mainloop:
  1104 00000264 B401                    		mov	ah, 1	; Check keyboard buffer
  1105 00000266 CD16                    		int	16h	; Keyboard interrupt
  1106 00000268 0F85BB01                		jnz	_exit_  ; exit
  1107                                  
  1108                                  		setPalette2
  1108 0000026C 30C0                <1>  xor al, al
  1108 0000026E BAC803              <1>  mov dx, 3C8h
  1108 00000271 EE                  <1>  out dx, al
  1108 00000272 42                  <1>  inc dx
  1108 00000273 BE[1D13]            <1>  mov si, palette
  1108 00000276 B90003              <1>  mov cx, 768
  1108 00000279 F36E                <1>  rep outsb
  1109                                  
  1110                                  		scriptIt
  1110 0000027B 8B0E[1913]          <1>  mov cx, word [ticker]
  1110 0000027F C706[1913]0000      <1>  mov word [ticker], 0
  1110 00000285 09C9                <1>  or cx, cx
  1110 00000287 0F849300            <1>  jz sItickerNull
  1110                              <1> sImloop:
  1110 0000028B 51                  <1>  push cx
  1110 0000028C BE[0B13]            <1>  mov si, zspeed
  1110                              <1> 
  1110 0000028F FF0E[1513]          <1>  dec word [scriptanz]
  1110 00000293 792B                <1>  jns short sIwaitTimer
  1110                              <1> 
  1110 00000295 8B1E[1313]          <1>  mov bx, word [scriptptr]
  1110 00000299 8A87[F911]          <1>  mov al, byte [bx+script]
  1110 0000029D 08C0                <1>  or al, al
  1110 0000029F 0F848401            <1>  jz _exit_
  1110 000002A3 89C3                <1>  mov bx, ax
  1110 000002A5 80E307              <1>  and bl, 7
  1110                              <1> 
  1110 000002A8 881E[1713]          <1>  mov byte [scriptins], bl
  1110 000002AC FECB                <1>  dec bl
  1110 000002AE 7504                <1>  jnz short sInegateTurn
  1110                              <1> 
  1110 000002B0 F71E[7612]          <1>  neg word [zstep]
  1110                              <1> sInegateTurn:
  1110 000002B4 25F800              <1>  and ax, 0F8h
  1110 000002B7 01C0                <1>  add ax, ax
  1110                              <1> 
  1110 000002B9 A3[1513]            <1>  mov word [scriptanz], ax
  1110                              <1> 
  1110 000002BC FF06[1313]          <1>  inc word [scriptptr]
  1110                              <1> sIwaitTimer:
  1110                              <1> 
  1110 000002C0 A0[1713]            <1>  mov al, byte [scriptins]
  1110 000002C3 98                  <1>  cbw
  1110 000002C4 30ED                <1>  xor ch, ch
  1110 000002C6 48                  <1>  dec ax
  1110 000002C7 750A                <1>  jnz short sInoturn
  1110                              <1> 
  1110 000002C9 8B1E[7612]          <1>  mov bx, word [zstep]
  1110                              <1> 
  1110 000002CD 011E[1113]          <1>  add word [ozw], bx
  1110 000002D1 EB14                <1>  jmp short sI_1
  1110                              <1> sInoturn:
  1110 000002D3 B103                <1>  mov cl, 3
  1110                              <1> 
  1110                              <1> sIrotateLoop:
  1110 000002D5 48                  <1>  dec ax
  1110 000002D6 7504                <1>  jnz short sInoIncrement
  1110                              <1> 
  1110 000002D8 FF04                <1>  inc word [si]
  1110 000002DA EB0B                <1>  jmp short sI_1
  1110                              <1> sInoIncrement:
  1110 000002DC 48                  <1>  dec ax
  1110 000002DD 7504                <1>  jnz short sInoDecrement
  1110                              <1> 
  1110 000002DF FF0C                <1>  dec word [si]
  1110 000002E1 EB04                <1>  jmp short sI_1
  1110                              <1> sInoDecrement:
  1110 000002E3 46                  <1>  inc si
  1110 000002E4 46                  <1>  inc si
  1110 000002E5 E2EE                <1>  loop sIrotateLoop
  1110                              <1> sI_1:
  1110                              <1> 
  1110 000002E7 BE[0D13]            <1>  mov si, oxw
  1110 000002EA B103                <1>  mov cl, 3
  1110                              <1> sIpushloop:
  1110 000002EC AD                  <1>  lodsw
  1110 000002ED C1F802              <1>  sar ax, 2
  1110 000002F0 50                  <1>  push ax
  1110 000002F1 E2F9                <1>  loop sIpushloop
  1110                              <1> 
  1110 000002F3 6B44FC10            <1>  imul ax, word [si-4], 16
  1110 000002F7 50                  <1>  push ax
  1110 000002F8 E8EB07              <1>  call calcRotMat
  1110                              <1> 
  1110 000002FB B103                <1>  mov cl, 3
  1110 000002FD 31F6                <1>  xor si, si
  1110                              <1> sImoveLoop:
  1110 000002FF D984[B712]          <1>  fld dword [si+owmat+24]
  1110 00000303 DE0E[0B13]          <1>  fimul word [zspeed]
  1110 00000307 DE36[EB0C]          <1>  fidiv word [CONST1792]
  1110 0000030B D884[9312]          <1>  fadd dword [si+ob]
  1110 0000030F D99C[9312]          <1>  fstp dword [si+ob]
  1110 00000313 83C604              <1>  add si, 4
  1110 00000316 E2E7                <1>  loop sImoveLoop
  1110 00000318 59                  <1>  pop cx
  1110 00000319 49                  <1>  dec cx
  1110 0000031A 0F856DFF            <1>  jnz sImloop
  1110                              <1> sItickerNull:
  1111                                  
  1112                                  		animDoor
  1112 0000031E A1[7812]            <1>  mov ax, word [doortimer]
  1112 00000321 09C0                <1>  or ax, ax
  1112 00000323 7904                <1>  jns short aDnounder
  1112 00000325 31C0                <1>  xor ax, ax
  1112 00000327 EB2F                <1>  jmp short alreadydrawed
  1112                              <1> aDnounder:
  1112 00000329 803E[1813]00        <1>  cmp byte [once], 0
  1112 0000032E 7528                <1>  jne short alreadydrawed
  1112 00000330 FE06[1813]          <1>  inc byte [once]
  1112 00000334 50                  <1>  push ax
  1112                              <1>  starbackground
  1112 00000335 8E06[5B41]          <2>  mov es, word [bseg]
  1112 00000339 B96400              <2>  mov cx, 100
  1112                              <2> starbackloop:
  1112 0000033C 51                  <2>  push cx
  1112 0000033D BBC0C1              <2>  mov bx, 320*155
  1112 00000340 E83E02              <2>  call rnd
  1112 00000343 050019              <2>  add ax, 320*20
  1112 00000346 89C7                <2>  mov di, ax
  1112 00000348 80E407              <2>  and ah, 7
  1112 0000034B BA3B01              <2>  mov dx, 320-5
  1112 0000034E B90200              <2>  mov cx, 2
  1112 00000351 E8A501              <2>  call setstarbob
  1112 00000354 59                  <2>  pop cx
  1112 00000355 E2E5                <2>  loop starbackloop
  1112 00000357 58                  <1>  pop ax
  1112                              <1> alreadydrawed:
  1112 00000358 83F818              <1>  cmp ax, 24
  1112 0000035B 7E03                <1>  jle short aDnoover
  1112 0000035D B81800              <1>  mov ax, 24
  1112                              <1> aDnoover:
  1112 00000360 C1E006              <1>  shl ax, 6
  1112 00000363 1E                  <1>  push ds
  1112 00000364 8E06[7741]          <1>  mov es, word [tseg+26]
  1112 00000368 8E1E[7B41]          <1>  mov ds, word [tseg+30]
  1112 0000036C 89C6                <1>  mov si, ax
  1112 0000036E 31FF                <1>  xor di, di
  1112 00000370 B90004              <1>  mov cx, 1024
  1112 00000373 F3A5                <1>  rep movsw
  1112 00000375 BE0008              <1>  mov si, 2048
  1112 00000378 29C6                <1>  sub si, ax
  1112 0000037A 56                  <1>  push si
  1112 0000037B B504                <1>  mov ch, 4
  1112 0000037D F3A5                <1>  rep movsw
  1112 0000037F 5F                  <1>  pop di
  1112 00000380 89C1                <1>  mov cx, ax
  1112 00000382 31C0                <1>  xor ax, ax
  1112 00000384 F3AB                <1>  rep stosw
  1112 00000386 1F                  <1>  pop ds
  1113                                  
  1114 00000387 1E                      		push	ds
  1115 00000388 8E06[5941]              		mov	es, word [vseg]
  1116 0000038C 8E1E[5B41]              		mov	ds, word [bseg]
  1117 00000390 E88501                  		call	copyseg
  1118 00000393 1F                      		pop	ds
  1119                                  
  1120                                  		rotation
  1120 00000394 8B0E[7D16]          <1>  mov cx, word [o+object.panz]
  1120 00000398 BE[8116]            <1>  mov si, o+object.p
  1120 0000039B BF[65C3]            <1>  mov di, rp
  1120                              <1> rotmlp:
  1120 0000039E BB[C312]            <1>  mov bx, wmat
  1120 000003A1 BA0300              <1>  mov dx, 3
  1120                              <1> rotilp:
  1120 000003A4 DF04                <1>  fild word [si+0]
  1120 000003A6 D826[9312]          <1>  fsub dword [ob+vector.x]
  1120 000003AA D80F                <1>  fmul dword [bx+0]
  1120 000003AC DF4402              <1>  fild word [si+2]
  1120 000003AF D826[9712]          <1>  fsub dword [ob+vector.y]
  1120 000003B3 D84F04              <1>  fmul dword [bx+4]
  1120 000003B6 DF4404              <1>  fild word [si+4]
  1120 000003B9 D826[9B12]          <1>  fsub dword [ob+vector.z]
  1120 000003BD D84F08              <1>  fmul dword [bx+8]
  1120                              <1> 
  1120                              <1> 
  1120 000003C0 DEC1                <1>  faddp
  1120 000003C2 DEC1                <1>  faddp
  1120 000003C4 D91D                <1>  fstp dword [di]
  1120 000003C6 83C704              <1>  add di, 4
  1120 000003C9 83C30C              <1>  add bx, 12
  1120 000003CC 4A                  <1>  dec dx
  1120 000003CD 75D5                <1>  jnz short rotilp
  1120 000003CF 83C608              <1>  add si, 8
  1120 000003D2 E2CA                <1>  loop rotmlp
  1121                                  		sortFaces
  1121 000003D4 1E                  <1>  push ds
  1121 000003D5 07                  <1>  pop es
  1121 000003D6 BF[25D6]            <1>  mov di, facei
  1121 000003D9 57                  <1>  push di
  1121 000003DA BE[0123]            <1>  mov si, o+object.f
  1121 000003DD 89F0                <1>  mov ax, si
  1121 000003DF 8B0E[7F16]          <1>  mov cx, word [o+object.fanz]
  1121                              <1> sFmloop:
  1121 000003E3 D9EE                <1>  fldz
  1121 000003E5 51                  <1>  push cx
  1121 000003E6 B90400              <1>  mov cx, 4
  1121                              <1> sFiloop:
  1121 000003E9 6B1C0C              <1>  imul bx, word [si], 12
  1121 000003EC 46                  <1>  inc si
  1121 000003ED 46                  <1>  inc si
  1121 000003EE D8A7[6DC3]          <1>  fsub dword [bx+rp+vector.z]
  1121 000003F2 E2F5                <1>  loop sFiloop
  1121 000003F4 59                  <1>  pop cx
  1121 000003F5 DF1D                <1>  fistp word [di]
  1121 000003F7 47                  <1>  inc di
  1121 000003F8 47                  <1>  inc di
  1121 000003F9 AB                  <1>  stosw
  1121 000003FA 83C00A              <1>  add ax, 10
  1121 000003FD 46                  <1>  inc si
  1121 000003FE 46                  <1>  inc si
  1121 000003FF E2E2                <1>  loop sFmloop
  1121 00000401 57                  <1>  push di
  1121 00000402 E83D01              <1>  call qsort
  1122                                  
  1123 00000405 8B0E[7F16]              		mov	cx, word [o+object.fanz]
  1124 00000409 BE[25D6]                		mov	si, facei
  1125                                  drawloop:
  1126 0000040C AD                      		lodsw
  1127 0000040D AD                      		lodsw
  1128 0000040E 89C3                    		mov	bx, ax ; face address in 'o+object.f'
  1129 00000410 60                      		pusha
  1130 00000411 E8E304                  		call	drawclippedface
  1131 00000414 61                      		popa
  1132 00000415 E2F5                    		loop	drawloop
  1133                                  	
  1134 00000417 1E                      		push	ds
  1135 00000418 6800A0                  		push	0A000h
  1136 0000041B 07                      		pop	es
  1137 0000041C 8E1E[5941]              		mov	ds, word [vseg]
  1138 00000420 E8F500                  		call	copyseg
  1139 00000423 1F                      		pop	ds
  1140 00000424 E93DFE                  		jmp	mainloop
  1141                                  loc_err_exit:
  1142                                  _exit_:
  1143 00000427 0E                      		push	cs
  1144 00000428 1F                      		pop	ds
  1145 00000429 8B26[A132]              		mov	sp, word [oldstack]
  1146                                  		silence
  1146 0000042D B90F00              <1>  mov cx, 15
  1146                              <1> Siloop:
  1146 00000430 89C8                <1>  mov ax, cx
  1146 00000432 04B0                <1>  add al, CMD_CHANGEPARAM
  1146 00000434 E86A01              <1>  call writeGM
  1146 00000437 B07B                <1>  mov al, MOD_ALLNOTESOFF
  1146 00000439 E86501              <1>  call writeGM
  1146 0000043C 30C0                <1>  xor al, al
  1146 0000043E E86001              <1>  call writeGM
  1146 00000441 E2ED                <1>  loop Siloop
  1146                              <1> Sinosound:
  1147                                  		stopKBDHandler
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147 00000443 90                  <1>  nop
  1148                                  		stopTimer
  1148 00000444 1E                  <1>  push ds
  1148 00000445 31DB                <1>  xor bx, bx
  1148 00000447 E84A01              <1>  call setTimer
  1148 0000044A B80825              <1>  mov ax, 02508h
  1148 0000044D C516[A332]          <1>  lds dx, [Old08IrqPtr]
  1148 00000451 CD21                <1>  int 21h
  1148 00000453 1F                  <1>  pop ds
  1149                                  		set80x25
  1149 00000454 B80300              <1>  mov ax, 3
  1149 00000457 CD10                <1>  int 10h
  1149                              <1> 
  1150 00000459 C3                      		ret
  1151                                  
  1152                                  ;==============================================================================
  1153                                  ;		interrupt handler
  1154                                  ;==============================================================================
  1155                                  ;***********************************************
  1156                                  ;* descript. : timer routine                   *
  1157                                  ;* parameter : none		               *
  1158                                  ;* sideeffect: none		               *
  1159                                  ;* back      : none		               *
  1160                                  ;***********************************************
  1161                                  
  1162                                  irqHandler08:
  1163 0000045A 60                      		pusha
  1164                                  		
  1165 0000045B 1E                      		push	ds
  1166 0000045C 06                      		push	es
  1167                                  
  1168 0000045D 0E                      		push	cs
  1169 0000045E 1F                      		pop	ds
  1170                                  
  1171                                  		playsong
  1171 0000045F 8B0E[1B13]          <1>  mov cx, word [tracks]
  1171 00000463 BE[1D16]            <1>  mov si, channels
  1171                              <1> PSmloop:
  1171 00000466 FF0C                <1>  dec word [si+channel.del]
  1171 00000468 7F2C                <1>  jg short PSdelayed
  1171 0000046A 8B4402              <1>  mov ax, word [si+channel.trk]
  1171 0000046D 0480                <1>  add al, CMD_NOTEOFF
  1171 0000046F E84201              <1>  call setnote
  1171 00000472 8B5C04              <1>  mov bx, word [si+channel.adr]
  1171 00000475 B47F                <1>  mov ah, 127
  1171 00000477 803F00              <1>  cmp byte [bx], 0
  1171 0000047A 7414                <1>  jz short PStrackend
  1171 0000047C 8A27                <1>  mov ah, byte [bx]
  1171 0000047E 886403              <1>  mov byte [si+channel.ln], ah
  1171 00000481 8A4402              <1>  mov al, byte [si+channel.trk]
  1171 00000484 0490                <1>  add al, CMD_NOTEON
  1171 00000486 E82B01              <1>  call setnote
  1171 00000489 8A4701              <1>  mov al, byte [bx+1]
  1171 0000048C B31D                <1>  mov bl, SONGSPEED
  1171 0000048E F6E3                <1>  mul bl
  1171                              <1> PStrackend:
  1171 00000490 8904                <1>  mov word [si+channel.del], ax
  1171 00000492 83440402            <1>  add word [si+channel.adr], 2
  1171                              <1> PSdelayed:
  1171 00000496 83C606              <1>  add si, 6
  1171 00000499 E2CB                <1>  loop PSmloop
  1171                              <1> PSnosound:
  1172                                  
  1173 0000049B FF06[1913]              		inc	word [ticker]
  1174 0000049F FE06[5841]              		inc	byte [twice]
  1175 000004A3 8026[5841]07            		and	byte [twice], 7
  1176 000004A8 7547                    		jnz	short iH08notyet
  1177                                  
  1178                                  		colorCycle
  1178                              <1>  base equ 6*32
  1178                              <1>  range equ 32
  1178                              <1> 
  1178 000004AA 1E                  <1>  push ds
  1178 000004AB 07                  <1>  pop es
  1178 000004AC BF[5D15]            <1>  mov di, palette+(base*3)
  1178 000004AF 89FE                <1>  mov si, di
  1178 000004B1 AD                  <1>  lodsw
  1178                              <1> 
  1178 000004B2 46                  <1>  inc si
  1178 000004B3 B95D00              <1>  mov cx, (range*3-3)
  1178 000004B6 F3A4                <1>  rep movsb
  1178 000004B8 AB                  <1>  stosw
  1178                              <1> 
  1179                                  		animStars
  1179                              <1>  _base equ 7*32
  1179                              <1> 
  1179 000004B9 8E06[5F41]          <1>  mov es, word [tseg+2]
  1179 000004BD E80601              <1>  call clearFrac
  1179                              <1> 
  1179 000004C0 B11E                <1>  mov cl, 30
  1179 000004C2 BB[FE40]            <1>  mov bx, stars
  1179                              <1> aSoloop:
  1179 000004C5 FE0F                <1>  dec byte [bx]
  1179 000004C7 8A27                <1>  mov ah, byte [bx]
  1179 000004C9 80E43F              <1>  and ah, 63
  1179 000004CC 80FC1F              <1>  cmp ah, 31
  1179 000004CF 7605                <1>  jbe short aSnonot
  1179 000004D1 F6D4                <1>  not ah
  1179 000004D3 80E41F              <1>  and ah, 31
  1179                              <1> aSnonot:
  1179 000004D6 D0EC                <1>  shr ah, 1
  1179 000004D8 8B7F01              <1>  mov di, word [bx+1]
  1179 000004DB 51                  <1>  push cx
  1179 000004DC 53                  <1>  push bx
  1179                              <1> 
  1179 000004DD BA3B00              <1>  mov dx, 64-5
  1179 000004E0 B900E0              <1>  mov cx, _base*256+0
  1179 000004E3 E81300              <1>  call setstarbob
  1179                              <1> 
  1179 000004E6 5B                  <1>  pop bx
  1179 000004E7 59                  <1>  pop cx
  1179 000004E8 83C303              <1>  add bx, 3
  1179 000004EB E2D8                <1>  loop aSoloop
  1180                                  	
  1181 000004ED FF06[7812]              		inc	word [doortimer]
  1182                                  iH08notyet:
  1183 000004F1 B020                    		mov	al, 20h
  1184 000004F3 E620                    		out	20h, al
  1185                                  		
  1186 000004F5 07                      		pop	es
  1187 000004F6 1F                      		pop	ds
  1188 000004F7 61                      		popa
  1189 000004F8 CF                      		iret
  1190                                  
  1191                                  ;***********************************************
  1192                                  ;* descript. : keyboard- / breakhandler	       *
  1193                                  ;* parameter : none		               *
  1194                                  ;* sideeffect: none		               *
  1195                                  ;* back      : none		               *
  1196                                  ;* length    : 12 bytes		               *
  1197                                  ;***********************************************
  1198                                  ;
  1199                                  ;irqHandler09:
  1200                                  		;push    ax
  1201                                  		;mov     al, 20h
  1202                                  		;out     20h, al
  1203                                  		;in      al, 60h
  1204                                  		;dec     al
  1205                                  		;pop     ax
  1206                                  		;je	_exit_
  1207                                  		;iret
  1208                                  	
  1209                                  ;==============================================================================
  1210                                  ;		sub routines
  1211                                  ;==============================================================================
  1212                                  ;***********************************************
  1213                                  ;* descript. : draw a the starbob	       *
  1214                                  ;* parameter : ds,es: source seg,dest seg      *
  1215                                  ;* sideeffect: ax,cx,si,di	               *
  1216                                  ;* back      : none		               *
  1217                                  ;***********************************************
  1218                                  
  1219                                  setstarbob:
  1220 000004F9 BE[370F]                		mov	si, bob
  1221 000004FC B305                    		mov	bl, 5
  1222                                  yloop:
  1223 000004FE B705                    		mov	bh, 5
  1224                                  xloop:
  1225 00000500 AC                      		lodsb
  1226 00000501 28E0                    		sub	al, ah
  1227 00000503 7E07                    		jle	short aSnodraw
  1228 00000505 00E8                    		add	al, ch
  1229 00000507 D2E0                    		shl	al, cl
  1230 00000509 268805                  		mov	byte [es:di], al
  1231                                  		;mov	byte [di], al
  1232                                  aSnodraw:
  1233 0000050C 47                      		inc	di
  1234 0000050D FECF                    		dec	bh
  1235 0000050F 75EF                    		jnz	short xloop
  1236 00000511 01D7                    		add	di, dx
  1237 00000513 FECB                    		dec	bl
  1238 00000515 75E7                    		jnz	short yloop
  1239 00000517 C3                      		retn
  1240                                  
  1241                                  ;***********************************************
  1242                                  ;* descript. : copy 16000 longs ds --> es      *
  1243                                  ;* parameter : ds,es: source seg,dest seg      *
  1244                                  ;* sideeffect: ax,cx,si,di	               *
  1245                                  ;* back      : none		               *
  1246                                  ;***********************************************
  1247                                  
  1248                                  copyseg:
  1249 00000518 31FF                    		xor	di, di
  1250 0000051A 31F6                    		xor	si, si
  1251 0000051C B9803E                  		mov	cx, 16000 ; 3E80h
  1252 0000051F F366A5                  		rep movsd
  1253 00000522 C3                      		retn
  1254                                  
  1255                                  ;***********************************************
  1256                                  ;* descript. : expand a part of the song       *
  1257                                  ;* parameter : si:base adress		       *
  1258                                  ;* sideeffect: si,ax		               *
  1259                                  ;* back      : ax=si:new baseadress            *
  1260                                  ;***********************************************
  1261                                  
  1262                                  expand:
  1263 00000523 8A0C                    EPwhile: 	mov	cl, byte [si]
  1264 00000525 08C9                    		or	cl, cl
  1265 00000527 7415                    		jz	short EPendwhile
  1266 00000529 7910                    		jns	short EPnote
  1267                                  EPcall:
  1268 0000052B 51                      		push	cx
  1269 0000052C 56                      		push	si
  1270 0000052D 46                      		inc	si
  1271 0000052E E8F2FF                  		call	expand
  1272 00000531 5E                      		pop	si
  1273 00000532 59                      		pop	cx
  1274 00000533 FEC1                    		inc	cl
  1275 00000535 75F4                    		jnz	short EPcall
  1276 00000537 89C6                    		mov	si, ax
  1277 00000539 EBE8                    		jmp	short EPwhile 
  1278                                  EPnote:
  1279 0000053B A5                      		movsw
  1280 0000053C EBE5                    		jmp	short EPwhile
  1281                                  EPendwhile:
  1282 0000053E 46                      		inc	si
  1283 0000053F 89F0                    		mov	ax, si
  1284 00000541 C3                      		retn
  1285                                  
  1286                                  ;***********************************************
  1287                                  ;* descript. : recursive index quicksort       *
  1288                                  ;* parameter : l,r:stack left and right border *
  1289                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
  1290                                  ;* back      : none		               *
  1291                                  ;***********************************************
  1292                                  
  1293                                  qsort:
  1294 00000542 58                      		pop	ax 	; get address
  1295 00000543 59                      		pop	cx	; get 2. param r
  1296 00000544 5B                      		pop	bx	; get 1. param l
  1297 00000545 50                      		push	ax	; store address
  1298                                  
  1299 00000546 39D9                    		cmp	cx, bx
  1300 00000548 7E36                    		jle	short QSendrek
  1301 0000054A 89DE                    		mov	si, bx
  1302 0000054C 89CF                    		mov	di, cx  	
  1303 0000054E 8B14                    		mov	dx, word [si]
  1304                                  QSrepeat:
  1305 00000550 3914                    QSwhile1:	cmp	word [si], dx
  1306 00000552 7E05                    		jle	short QSwhile2
  1307 00000554 83C604                  		add	si, 4
  1308 00000557 EBF7                    		jmp	short QSwhile1
  1309                                  QSwhile2:
  1310 00000559 3915                    		cmp	word [di], dx
  1311 0000055B 7D05                    		jnl	short QSwhile2e
  1312 0000055D 83EF04                  		sub	di, 4
  1313 00000560 EBF7                    		jmp	short QSwhile2
  1314                                  QSwhile2e:
  1315 00000562 39FE                    		cmp	si, di
  1316                                  		;jg	short QSnoswap
  1317 00000564 7F10                    		jg	short _QSnoswap
  1318 00000566 66AD                    		lodsd
  1319 00000568 668705                  		xchg	eax, dword [di]
  1320 0000056B 668944FC                		mov	dword [si-4], eax
  1321 0000056F 83EF04                  		sub	di, 4
  1322                                  QSnoswap:
  1323 00000572 39FE                    		cmp	si, di
  1324 00000574 7EDA                    		jle	short QSrepeat
  1325                                  _QSnoswap:
  1326 00000576 56                      		push	si 
  1327 00000577 51                      		push	cx
  1328 00000578 53                      		push	bx
  1329 00000579 57                      		push	di
  1330 0000057A E8C5FF                  		call	qsort
  1331 0000057D E8C2FF                  		call	qsort
  1332                                  QSendrek:
  1333 00000580 C3                      		retn
  1334                                  
  1335                                  ;***********************************************
  1336                                  ;* descript. : returns a pseudo random number  *
  1337                                  ;* parameter : bx=range		               *
  1338                                  ;* sideeffect: eax,edx,si		       *
  1339                                  ;* back      : ax=rnd(range)                   *
  1340                                  ;***********************************************
  1341                                  
  1342                                  rnd:
  1343 00000581 BE[F10C]                		mov	si, randommul
  1344 00000584 66AD                    		lodsd
  1345 00000586 66F724                  		mul	dword [si] ; randomseed
  1346 00000589 6640                    		inc	eax
  1347 0000058B 668904                  		mov	dword [si], eax  ; randomseed
  1348 0000058E AD                      		lodsw
  1349 0000058F AD                      		lodsw
  1350 00000590 F7E3                    		mul	bx
  1351 00000592 92                      		xchg	ax, dx
  1352 00000593 C3                      		retn
  1353                                  
  1354                                  ;***********************************************
  1355                                  ;* descript. : set timer speed to 1193180/AX   *
  1356                                  ;*             interrupts per second           *
  1357                                  ;* parameter : bx		               *
  1358                                  ;* sideeffect: ax		               *
  1359                                  ;* back      : none		               *
  1360                                  ;***********************************************
  1361                                  
  1362                                  setTimer:	; set timer speed to 1193180/BX (TRDOS 386)
  1363 00000594 B036                    		mov	al, 36h
  1364 00000596 E643                    		out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1365 00000598 88D8                    		mov	al, bl
  1366 0000059A E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1367 0000059C 88F8                    		mov	al, bh
  1368 0000059E E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1369 000005A0 C3                      		retn
  1370                                  
  1371                                  ;***********************************************
  1372                                  ;* descript. : send a byte to the GM-Port      *
  1373                                  ;* parameter : al:midi command                 *
  1374                                  ;* sideeffect: dx		               *
  1375                                  ;* back      : none		               *
  1376                                  ;***********************************************
  1377                                  
  1378                                  writeGM:
  1379 000005A1 BA3103                  		mov	dx, GMPort  ; 331h
  1380 000005A4 50                      		push	ax
  1381 000005A5 31C0                    		xor	ax, ax
  1382                                  busy:
  1383 000005A7 FECC                    		dec	ah
  1384 000005A9 7405                    		jz	short timeOut
  1385 000005AB EC                      		in	al, dx
  1386 000005AC A840                    		test	al, 40h
  1387 000005AE 75F7                    		jnz	short busy
  1388                                  timeOut:
  1389 000005B0 58                      		pop	ax
  1390 000005B1 4A                      		dec	dx
  1391 000005B2 EE                      		out	dx, al
  1392 000005B3 C3                      		retn
  1393                                  
  1394                                  ;***********************************************
  1395                                  ;* descript. : send NOTEON command, volume 127 *
  1396                                  ;* parameter : al:channel;ah:note              *
  1397                                  ;* sideeffect: dx,al		               *
  1398                                  ;* back      : none		               *
  1399                                  ;***********************************************
  1400                                  
  1401                                  setnote:
  1402 000005B4 E80600                  		call	setinstr
  1403 000005B7 B07F                    		mov	al, 127	; 7Fh
  1404 000005B9 E8E5FF                  		call	writeGM
  1405 000005BC C3                      		retn
  1406                                  
  1407                                  ;***********************************************
  1408                                  ;* descript. : send CHANGEPRG command	       *
  1409                                  ;* parameter : al:channel;ah:instrument        *
  1410                                  ;* sideeffect: dx,al		               *
  1411                                  ;* back      : none		               *
  1412                                  ;***********************************************
  1413                                  
  1414                                  setinstr:
  1415 000005BD E8E1FF                  		call	writeGM
  1416 000005C0 88E0                    		mov	al, ah
  1417 000005C2 E8DCFF                  		call	writeGM
  1418 000005C5 C3                      		retn
  1419                                  
  1420                                  ;***********************************************
  1421                                  ;* descript. : clear/set the fractal es: to al *
  1422                                  ;* parameter : al,es		               *
  1423                                  ;* sideeffect: ax,cx,di,es  	               *
  1424                                  ;* back      : none			       *
  1425                                  ;***********************************************
  1426                                  
  1427                                  clearFrac:
  1428 000005C6 31C0                    		xor	ax, ax
  1429                                  setFrac:
  1430 000005C8 31FF                    		xor	di, di
  1431 000005CA B90010                  		mov	cx, 4096 ; 1000h
  1432 000005CD F3AA                    		rep stosb
  1433 000005CF C3                      		retn
  1434                                  
  1435                                  ;***********************************************
  1436                                  ;* descript. : calc shade bob fractal          *
  1437                                  ;* parameter : es:seg;num,rad:stack            *
  1438                                  ;* sideeffect: all			       *
  1439                                  ;* back      : none			       *
  1440                                  ;***********************************************
  1441                                  
  1442                                  createFrac1:
  1443                                  		rad	equ 4 ; arg 1 in [sp+2]
  1444                                  		num	equ 6 ; arg 2 in [sp+4]
  1445                                  
  1446 000005D0 55                      		push	bp
  1447 000005D1 89E5                    		mov	bp, sp
  1448                                  
  1449 000005D3 8E87[5D41]              		mov	es, word [bx+tseg]
  1450 000005D7 E8ECFF                  		call	clearFrac
  1451                                  
  1452 000005DA BE[BE40]                		mov	si, circletab
  1453 000005DD 8B5604                  		mov	dx, word [bp+rad]
  1454 000005E0 88D0                    		mov	al, dl
  1455 000005E2 F6EA                    		imul	dl
  1456                                  		;mov	di, ax
  1457 000005E4 89C3                    		mov	bx, ax
  1458 000005E6 89D1                    		mov	cx, dx
  1459 000005E8 01C9                    		add	cx, cx
  1460                                  CCTloop:
  1461 000005EA 88D0                    		mov	al, dl
  1462 000005EC F6EA                    		imul	dl
  1463 000005EE F7D8                    		neg	ax
  1464                                  		;add	ax, di
  1465 000005F0 01D8                    		add	ax, bx
  1466 000005F2 8904                    		mov	word [si], ax
  1467 000005F4 DF04                    		fild	word [si]
  1468 000005F6 D9FA                    		fsqrt
  1469 000005F8 DF1C                    		fistp	word [si]
  1470 000005FA 46                      		inc	si
  1471 000005FB 46                      		inc	si
  1472 000005FC 4A                      		dec	dx
  1473 000005FD E2EB                    		loop	CCTloop
  1474                                  
  1475 000005FF 8B4E06                  		mov	cx, word [bp+num]
  1476                                  SBloop1:
  1477 00000602 51                      		push	cx
  1478 00000603 BB0010                  		mov	bx, 4096 ; 1000h
  1479 00000606 E878FF                  		call	rnd
  1480 00000609 89C7                    		mov	di, ax
  1481 0000060B BE[BE40]                		mov	si, circletab
  1482 0000060E 8B4E04                  		mov	cx, word [bp+rad]
  1483 00000611 01C9                    		add	cx, cx
  1484                                  SBloop2:
  1485 00000613 51                      		push	cx
  1486 00000614 AD                      		lodsw
  1487 00000615 89C1                    		mov	cx, ax
  1488 00000617 01C9                    		add	cx, cx
  1489 00000619 740E                    		jz	short SBskip
  1490 0000061B 57                      		push	di
  1491 0000061C 29C7                    		sub	di, ax
  1492                                  SBloop3:
  1493 0000061E 81E7FF0F                		and	di, 4095  ; 0FFFh
  1494 00000622 26FE05                  		inc	byte [es:di]
  1495 00000625 47                      		inc	di
  1496 00000626 E2F6                    		loop	SBloop3
  1497 00000628 5F                      		pop	di
  1498                                  SBskip:
  1499 00000629 83C740                  		add	di, 64 ; 40h
  1500 0000062C 59                      		pop	cx
  1501 0000062D E2E4                    		loop	SBloop2
  1502 0000062F 59                      		pop	cx
  1503 00000630 E2D0                    		loop	SBloop1
  1504 00000632 5D                      		pop	bp
  1505 00000633 C20400                  		ret	4
  1506                                  
  1507                                  ;***********************************************
  1508                                  ;* descript. : draw a perpective-texturemapped *
  1509                                  ;*	       and g.-shaded n-sided polygon   *
  1510                                  ;* parameter : far ptr to poly, sides, textnum *
  1511                                  ;* sideeffect: all			       *
  1512                                  ;* back      : none			       *
  1513                                  ;* length    : 700 bytes		       *
  1514                                  ;***********************************************
  1515                                  
  1516                                  scansubtextpoly:
  1517                                  		col	equ 4  ; arg 1, [sp+2] ; dcf.col value
  1518                                  		n	equ 6  ; arg 2, [sp+4] ; dcf.j value
  1519                                  		pol	equ 8  ; arg 3, [sp+6] ; dcf.p2 address
  1520                                  
  1521 00000636 C8960000                 		enter	150, 0	; 96h
  1522                                  		;enter	152, 0  ; 98h		
  1523                                  			; push bp ; mov bp, sp ; sub sp, 152
  1524                                  
  1525                                  		; bp - x
  1526                                  		sstp.edg  equ -60   ; 90-150 ; edges * 3
  1527                                  		sstp.del  equ -120  ; 30-150 ; edges * 3 
  1528                                  		sstp.mx1  equ -122  ; 28-150 ; word
  1529                                  		sstp.mx2  equ -124  ; 26-150 ; word	 				
  1530                                  		sstp.miny equ -126  ; 24-150 ; word
  1531                                  		sstp.maxy equ -128  ; 22-150 ; word	
  1532                                  		sstp.y	  equ -130  ; 20-150 ; word
  1533                                  		sstp.l	  equ -132  ; 18-150 ; word	 				
  1534                                  		sstp.r	  equ -134  ; 16-150 ; word
  1535                                  		sstp.uu1  equ -136  ; 14-150 ; word
  1536                                  		sstp.vv1  equ -138  ; 12-150 ; word
  1537                                  		sstp.uu2  equ -140  ; 10-150 ; word	 				
  1538                                  		sstp.vv2  equ -142  ;  8-150 ; word
  1539                                  		sstp.ddu  equ -144  ;  6-150 ; word
  1540                                  		sstp.ddv  equ -146  ;  4-150 ; word
  1541                                  		sstp.dy   equ -150  ;  0-150 ; dword
  1542                                  		; 
  1543                                  		;sstp.pad  equ -152  ; padding (for dword boundary)
  1544                                  
  1545 0000063A B8FF7F                  		mov	ax, 32767
  1546 0000063D 89C2                    		mov	dx, ax
  1547 0000063F 89C3                    		mov	bx, ax
  1548 00000641 F7DB                    		neg	bx	; -32767 ; 8001h
  1549 00000643 89DE                    		mov	si, bx	; -32767
  1550                                  
  1551                                  		; di = dcf.p2 address
  1552 00000645 8B7E08                  		mov	di, word [bp+pol] ; [bp+8] ; dcf.p2 ; face structure
  1553                                  
  1554 00000648 31C9                    		xor	cx, cx
  1555                                  minmax:
  1556 0000064A 3B4512                  		cmp	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1557 0000064D 7E03                    		jle	short noswap1
  1558 0000064F 8B4512                  		mov	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1559                                  noswap1:
  1560 00000652 3B5D12                  		cmp	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1561 00000655 7D03                    		jge	short noswap2
  1562 00000657 8B5D12                  		mov	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1563                                  noswap2:
  1564 0000065A 3B550C                  		cmp	dx, word [di+edge.py]  ; [di+0Ch]
  1565 0000065D 7E0B                    		jle	short noswap3
  1566 0000065F 8B550C                  		mov	dx, word [di+edge.py]  ; [di+0Ch]
  1567 00000662 898E7CFF                		mov	word [bp+sstp.l], cx   ; [bp-84h]
  1568 00000666 898E7AFF                		mov	word [bp+sstp.r], cx   ; [bp-86h]
  1569                                  noswap3:
  1570 0000066A 3B750C                  		cmp	si, word [di+edge.py]  ; [di+0Ch]
  1571 0000066D 7D03                    		jge	short noswap4
  1572 0000066F 8B750C                  		mov	si, word [di+edge.py]  ; [di+0Ch]
  1573                                  noswap4:
  1574 00000672 83C724                  		add	di, 36 ; 24h
  1575 00000675 41                      		inc	cx
  1576 00000676 3B4E06                  		cmp	cx, word [bp+n] ; [bp+6]
  1577                                  				   ; dcf.j ; number of visible edges/points
  1578 00000679 75CF                    		jne	short minmax
  1579                                  
  1580 0000067B 83FB00                  		cmp	bx, 0
  1581 0000067E 0F8C2702                		jl	exitDraw
  1582 00000682 3D4001                  		cmp	ax, XMAX  ; 140h
  1583 00000685 0F8F2002                		jg	exitDraw
  1584                                  
  1585 00000689 83FE15                  		cmp	si, YMIN  ; 15h
  1586 0000068C 0F8C1902                		jl	exitDraw
  1587 00000690 81FAB300                		cmp	dx, YMAX  ; 0B3h
  1588 00000694 0F8F1102                		jg	exitDraw
  1589 00000698 895682                  		mov	word [bp+sstp.miny], dx ; [bp-7Eh]
  1590 0000069B 897680                  		mov	word [bp+sstp.maxy], si ; [bp-80h]
  1591                                  
  1592                                  		;{ down clipping }
  1593 0000069E 817E80B300              		cmp	word [bp+sstp.maxy], YMAX ; 0B3h
  1594 000006A3 7E05                    		jle	short noclipdown
  1595 000006A5 C74680B300              		mov	word [bp+sstp.maxy], YMAX ; 0B3h
  1596                                  noclipdown:
  1597 000006AA 8B4682                  		mov	ax, word [bp+sstp.miny] ; [bp-7Eh]
  1598 000006AD 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1599 000006B0 0F84F501                		je	exitDraw
  1600 000006B4 89867EFF                		mov	word [bp+sstp.y], ax    ; [bp-82h]
  1601 000006B8 8B5E04                  		mov	bx, word [bp+col]	; [bp+4]
  1602                                  					   ; dcf.col ; shade/color value
  1603 000006BB 01DB                    		add	bx, bx
  1604 000006BD 8E06[5941]              		mov	es, word [vseg]
  1605 000006C1 8EA7[5D41]              		mov	fs, word [bx+tseg]
  1606                                  for:
  1607 000006C5 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1608 000006C9 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1609 000006CC 0F8FD901                		jg	exitDraw
  1610 000006D0 745E                    		je	exitwhile2
  1611                                  while1:
  1612                                  		;mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1613                                  		;cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1614                                  		;jge	short while2	
  1615                                  
  1616 000006D2 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1617 000006D5 6B9E7CFF24              		imul	bx, word [bp+sstp.l], 36 ; [bp-84h]
  1618 000006DA 01DE                    		add	si, bx
  1619                                  		;mov	si, bx
  1620                                  		;add	si, word [bp+pol]	; [bp+8]
  1621                                  
  1622 000006DC 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1623 000006DF 751F                    		jne	short while2
  1624                                  
  1625 000006E1 8B9E7CFF                		mov	bx, word [bp+sstp.l]	; [bp-84h]
  1626 000006E5 4B                      		dec	bx
  1627 000006E6 7D04                    		jge	short nounder
  1628 000006E8 8B5E06                  		mov	bx, word [bp+n]		; [bp+6]
  1629                                  					   ; dcf.j ; visible edges/points
  1630 000006EB 4B                      		dec	bx
  1631                                  nounder:
  1632 000006EC 899E7CFF                		mov	word [bp+sstp.l], bx	; [bp-84h]
  1633 000006F0 31FF                    		xor	di, di
  1634 000006F2 E8B801                  		call	calcDeltas
  1635 000006F5 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1636 000006F9 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1637 000006FC 7D32                    		jge	short exitwhile2	
  1638 000006FE EBD2                    		jmp	short while1
  1639                                  while2:
  1640                                  		;mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1641 00000700 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1642 00000703 7D2B                    		jge	short exitwhile2
  1643 00000705 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1644 00000708 6B9E7AFF24              		imul	bx, word [bp+sstp.r], 36 ; [bp-86h]
  1645 0000070D 01DE                    		add	si, bx
  1646                                  		;
  1647                                  		;mov	si, bx
  1648                                  		;add	si, word [bp+pol]	; [bp+8]
  1649                                  
  1650 0000070F 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1651 00000712 751C                    		jne	short exitwhile2
  1652                                  
  1653 00000714 8B9E7AFF                		mov	bx, word [bp+sstp.r]    ; [bp-86h]
  1654 00000718 43                      		inc	bx
  1655 00000719 3B5E06                  		cmp	bx, word [bp+n]		; [bp+6]
  1656 0000071C 7C02                    		jl	short noover
  1657 0000071E 31DB                    		xor	bx, bx
  1658                                  noover:
  1659 00000720 899E7AFF                		mov	word [bp+sstp.r], bx	; [bp-86h]
  1660 00000724 BF1400                  		mov	di, 20  ; 14h
  1661 00000727 E88301                  		call	calcDeltas
  1662                                  		;
  1663 0000072A 8B867EFF                		mov	ax, word [bp+sstp.y]	; [bp-82h]
  1664 0000072E EBD0                    		jmp	short while2
  1665                                  exitwhile2:
  1666                                  		;{ up clipping }
  1667 00000730 83BE7EFF15              		cmp	word [bp+sstp.y], YMIN	; 15h
  1668 00000735 0F8C5901                		jl	clipup
  1669 00000739 6631DB                  		xor	ebx, ebx
  1670 0000073C 6631C9                  		xor	ecx, ecx
  1671 0000073F 8B5EC6                  		mov	bx, word [bp+sstp.edg+2+edges.x] ; [bp-3Ah]
  1672 00000742 895E86                  		mov	word [bp+sstp.mx1], bx  ; [bp-7Ah]
  1673 00000745 8B4EDA                  		mov	cx, word [bp+sstp.edg+20+2+edges.x] ; [bp-26h]
  1674 00000748 894E84                  		mov	word [bp+sstp.mx2], cx  ; [bp-7Ch]
  1675 0000074B 29D9                    		sub	cx, bx
  1676 0000074D 0F844101                		jz	exitol
  1677 00000751 837E8400                		cmp	word [bp+sstp.mx2], 0 ; [bp-7Ch]
  1678 00000755 0F8E3901                		jle	exitol
  1679 00000759 817E864001              		cmp	word [bp+sstp.mx1], XMAX ; 140h
  1680 0000075E 0F8F3001                		jg	exitol
  1681                                  
  1682 00000762 F7DB                    		neg	bx
  1683 00000764 790A                    		jns	short myelse
  1684 00000766 31DB                    		xor	bx, bx
  1685 00000768 EB0B                    		jmp	short myendif
  1686                                  _nodivbyzero:
  1687 0000076A 668B43B0                		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1688 0000076E EB1B                    		jmp	short nodivbyzero
  1689                                  myelse:
  1690 00000770 C746860000              		mov	word [bp+sstp.mx1], 0 ; [bp-7Ah]
  1691                                  myendif:
  1692 00000775 BF1000                  		mov	di, 16 ; 10h
  1693                                  addloop1:
  1694                                  		;{ calculate deltas }
  1695 00000778 668B43D8                		mov	eax, dword [bp+di+sstp.edg+20] ; [bp+di-28h]
  1696 0000077C 662B43C4                		sub	eax, dword [bp+di+sstp.edg]    ; [bp+di-3Ch]
  1697 00000780 6699                    		cdq
  1698                                  		;jcxz	nodivbyzero
  1699 00000782 E3E6                    		jcxz	_nodivbyzero
  1700 00000784 66F7F9                  		idiv	ecx
  1701 00000787 668943B0                		mov	dword [bp+di+sstp.del+40], eax ; [bp+di-50h]
  1702                                  nodivbyzero:
  1703                                  		;{ left clipping }
  1704 0000078B 668B43B0                		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1705 0000078F 66F7EB                  		imul	ebx
  1706 00000792 660343C4                		add	eax, dword [bp+di+sstp.edg]	 ; [bp+di-3Ch]
  1707 00000796 668943EC                		mov	dword [bp+di+sstp.edg+40], eax ; [bp+di-14h]
  1708 0000079A 83EF04                  		sub	di, 4
  1709 0000079D 75D9                    		jnz	short addloop1
  1710                                  
  1711 0000079F 8B46C0                  		mov	ax, word [bp+sstp.del+40+16]   ; [bp-40h]
  1712                                  		;mov	word [cs:dels_pos+1], ax
  1713 000007A2 A3[B30C]                		mov	word [dels_pos_w], ax
  1714                                  
  1715                                  		;{ right clipping }
  1716 000007A5 817E844001              		cmp	word  [bp+sstp.mx2], XMAX  ; [bp-7Ch]
  1717 000007AA 7E05                    		jle	short norightclip
  1718 000007AC C746844001              		mov	word  [bp+sstp.mx2], XMAX  ; 140h
  1719                                  norightclip:
  1720 000007B1 69BE7EFF4001            		imul	di, word [bp+sstp.y], 320  ; [bp-82h]
  1721 000007B7 037E86                  		add	di, word [bp+sstp.mx1]	   ; [bp-7Ah]
  1722                                  		
  1723 000007BA BB0001                  		mov	bx, 256 ; 100h
  1724 000007BD 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1725 000007C1 66F7EB                  		imul	ebx
  1726 000007C4 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1727 000007C8 898674FF                		mov	word [bp+sstp.uu2], ax 	    ; [bp-8Ch]
  1728 000007CC 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1729 000007D0 66F7EB                  		imul	ebx
  1730 000007D3 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1731 000007D7 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1732                                  outloop:
  1733 000007DB 8B4E84                  		mov	cx, word [bp+sstp.mx2]	    ; [bp-7Ch]
  1734 000007DE 2B4E86                  		sub	cx, word [bp+sstp.mx1]	    ; [bp-7Ah]
  1735 000007E1 0F8EAD00                		jle	exitol
  1736 000007E5 83F910                  		cmp	cx, SUBRANGE ; 10h
  1737 000007E8 7E03                    		jle	short lastSeg
  1738 000007EA B91000                  		mov	cx, SUBRANGE ; 10h
  1739                                  lastSeg:
  1740                                  		;{ uu1:=uu2 }
  1741                                  		;{ vv1:=vv2 }
  1742 000007ED 668B8672FF              		mov	eax, dword [bp+sstp.vv2]    ; [bp-8Eh]
  1743 000007F2 66898676FF              		mov	dword [bp+sstp.vv1], eax    ; [bp-8Ah]
  1744                                  
  1745 000007F7 668B46B4                		mov	eax, dword [bp+sstp.del+40+edges.u] ; [bp-4Ch]
  1746 000007FB 66F7E9                  		imul	ecx
  1747 000007FE 660146F0                		add	dword [bp+sstp.edg+40+edges.u], eax ; [bp-10h]
  1748 00000802 668B46B8                		mov	eax, dword [bp+sstp.del+40+edges.v] ; [bp-48h]
  1749 00000806 66F7E9                  		imul	ecx
  1750 00000809 660146F4                		add	dword [bp+sstp.edg+40+edges.v], eax ; [bp-0Ch]
  1751 0000080D 668B46BC                		mov	eax, dword [bp+sstp.del+40+edges.w] ; [bp-44h]
  1752 00000811 66F7E9                  		imul	ecx
  1753 00000814 660146F8                		add	dword [bp+sstp.edg+40+edges.w], eax ; [bp-8]
  1754                                  
  1755 00000818 BB0001                  		mov	bx, 256 ; 100h
  1756 0000081B 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1757 0000081F 66F7EB                  		imul	ebx
  1758 00000822 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1759 00000826 898674FF                		mov	word [bp+sstp.uu2], ax	     ; [bp-8Ch]
  1760 0000082A 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1761 0000082E 66F7EB                  		imul	ebx
  1762 00000831 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1763 00000835 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1764                                  
  1765 00000839 8B8674FF                		mov	ax, word [bp+sstp.uu2]	    ; [bp-8Ch]
  1766 0000083D 2B8678FF                		sub	ax, word [bp+sstp.uu1]	    ; [bp-88h]
  1767 00000841 99                      		cwd
  1768 00000842 F7F9                    		idiv	cx
  1769                                  		;mov	word [cs:ddu_pos+2], ax
  1770 00000844 A3[B50C]                		mov	word [ddu_pos_w], ax
  1771                                  
  1772 00000847 8B8672FF                		mov	ax, word [bp+sstp.vv2]	    ; [bp-8Eh]
  1773 0000084B 2B8676FF                		sub	ax, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1774 0000084F 99                      		cwd
  1775 00000850 F7F9                    		idiv	cx
  1776                                  		;mov	word [cs:ddv_pos+2], ax
  1777 00000852 A3[B70C]                		mov	word [ddv_pos_w], ax
  1778                                  
  1779 00000855 8BB676FF                		mov	si, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1780 00000859 8B9678FF                		mov	dx, word [bp+sstp.uu1]	    ; [bp-88h]
  1781 0000085D 8B46FC                  		mov	ax, word [bp+sstp.edg+40+16] ; [bp-4]
  1782                                  innerloop:
  1783 00000860 89F3                    		mov	bx, si
  1784 00000862 30DB                    		xor	bl, bl
  1785 00000864 C1EB02                  		shr	bx, 2
  1786 00000867 00F3                    		add	bl, dh
  1787 00000869 648A1F                  		mov	bl, byte [fs:bx]
  1788 0000086C 08DB                    		or	bl, bl
  1789 0000086E 7409                    		jz	short dels_pos
  1790 00000870 88E7                    		mov	bh, ah
  1791 00000872 8A9F[8541]              		mov	bl, byte [bx+shadetab]
  1792                                  
  1793 00000876 26881D                  		mov	byte [es:di], bl
  1794                                  
  1795                                  ;dels_pos:	add ax, 1111h ;{word ptr dels}
  1796                                  ;ddu_pos:	add dx, 1111h ;{word ptr ddu }
  1797                                  ;ddv_pos:	add si, 1111h ;{word ptr ddv }
  1798                                  
  1799                                  dels_pos:	
  1800 00000879 0306[B30C]              		add	ax, word [dels_pos_w]
  1801                                  ddu_pos:	
  1802 0000087D 0316[B50C]              		add	dx, word [ddu_pos_w]
  1803                                  ddv_pos:	
  1804 00000881 0336[B70C]              		add	si, word [ddv_pos_w]
  1805                                  
  1806 00000885 47                      		inc	di	
  1807 00000886 E2D8                    		loop	innerloop
  1808                                  
  1809 00000888 8946FC                  		mov	word [bp+sstp.edg+40+16], ax ; [bp-4]
  1810 0000088B 83468610                		add	word [bp+sstp.mx1], SUBRANGE ; [bp-7Ah]
  1811 0000088F E949FF                  		jmp	outloop
  1812                                  exitol:
  1813 00000892 BF2400                  clipup:		mov	di, 36 ; 24h
  1814                                  addloop:
  1815 00000895 668B4388                		mov	eax, dword [bp+di+sstp.del]  ; [bp+di-78h]
  1816 00000899 660143C4                		add	dword [bp+di+sstp.edg], eax  ; [bp+di-3Ch]
  1817 0000089D 83EF04                  		sub	di, 4
  1818 000008A0 79F3                    		jns	short addloop
  1819 000008A2 FF867EFF                		inc	word [bp+sstp.y]	 ; [bp-82h]
  1820 000008A6 E91CFE                  		jmp	for
  1821                                  exitDraw:
  1822 000008A9 C9                      		leave
  1823                                  			; mov sp, bp ; pop bp
  1824 000008AA C20600                  		ret	6
  1825                                  
  1826                                    ;***********************************************
  1827                                    ;* descript. : calc deltas for vertical interp.*
  1828                                    ;* parameter : none			         *
  1829                                    ;* sideeffect: all		 	         *
  1830                                    ;***********************************************
  1831                                  
  1832                                  calcDeltas:
  1833 000008AD 6BD324                  		imul	dx, bx,	36
  1834 000008B0 89F3                    		mov	bx, si
  1835 000008B2 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1836 000008B5 01D6                    		add	si, dx
  1837                                  		;
  1838                                  		;mov	si, dx
  1839                                  		;add	si, word [bp+pol]	; [bp+8]	
  1840 000008B7 8B440C                  		mov	ax, word [si+12]
  1841 000008BA 2B867EFF                		sub	ax, word [bp+sstp.y] ; [bp-82h]
  1842 000008BE 660FBFC0                		movsx	eax, ax
  1843 000008C2 6689866AFF              		mov	dword [bp+sstp.dy], eax ; [bp-96h]
  1844 000008C7 B90500                  		mov	cx, 5
  1845                                  cDloop:
  1846 000008CA 668B5710                		mov	edx, dword [bx+16]
  1847 000008CE 668953C4                		mov	dword [bp+di+sstp.edg], edx ; [bp+di-3Ch]
  1848 000008D2 668B4410                		mov	eax, dword [si+16]
  1849 000008D6 6629D0                  		sub	eax, edx
  1850 000008D9 6699                    		cdq
  1851 000008DB 83BE6AFF00              		cmp	word [bp+sstp.dy], 0  ; [bp-96h]
  1852 000008E0 7409                    		je	short cDskip
  1853 000008E2 66F7BE6AFF              		idiv	dword [bp+sstp.dy]    ; [bp-96h]
  1854 000008E7 66894388                		mov	dword [bp+di+sstp.del], eax ; [bp+di-78h]
  1855                                  cDskip:
  1856 000008EB 83C704                  		add	di, 4
  1857 000008EE 83C604                  		add	si, 4
  1858 000008F1 83C304                  		add	bx, 4
  1859 000008F4 E2D4                    		loop	cDloop
  1860 000008F6 C3                      		retn
  1861                                  
  1862                                  
  1863                                  ;***********************************************
  1864                                  ;* descript. : clip a poly at the viewplane,   *
  1865                                  ;*             project and draw it	       *
  1866                                  ;* parameter : bx:adress of the face	       *
  1867                                  ;* sideeffect: all		 	       *
  1868                                  ;* back      : none			       *
  1869                                  ;***********************************************
  1870                                  
  1871                                  drawclippedface:
  1872                                  
  1873                                  		dcf.d	equ -2	  ; word
  1874                                  		dcf.h	equ -4	  ; word	
  1875                                  		dcf.j	equ -6	  ; word
  1876                                  		dcf.col equ -8	  ; word
  1877                                  		dcf.is_in equ -10 ; byte
  1878                                  		dcf.p0	equ -190  ; poly (5*36 bytes)
  1879                                  		dcf.p2	equ -370  ; poly (5*36 bytes)
  1880                                  		;
  1881                                  		;dcf.pad equ -372  ; padding (for dword boundary)
  1882                                  
  1883 000008F7 C8720100                		enter	370, 0  ; 172h
  1884                                  		;enter	372, 0  ; 174h ; 12/12/2016
  1885                                   			; push bp ; mov bp, sp ; sub sp, 372
  1886 000008FB BE[550F]                		mov	si, uvtab
  1887 000008FE 31FF                    		xor	di, di
  1888 00000900 B90400                  		mov	cx, 4
  1889                                  dCFinitloop:
  1890 00000903 53                      		push	bx	; face addr (in 'o+object.f')(29/01/2017)
  1891 00000904 8B1F                    		mov	bx, word [bx] ; point index into 'rp:' ? (29/01/2017)
  1892                                  
  1893 00000906 53                      		push	bx
  1894 00000907 6BDB0C                  		imul	bx, bx, 12 ; (point vector size = 12 bytes)
  1895 0000090A 81C3[65C3]              		add	bx, rp	  ; addr of rotated point vects (29/01/2017)
  1896 0000090E 668B07                  		mov	eax, dword [bx]
  1897                                  		; vector(4-cx).x
  1898 00000911 66898342FF              		mov	dword [bp+di+dcf.p0+0], eax	; [bp+di-0BEh]
  1899                                  		; vector(4-cx).y
  1900 00000916 668B4704                		mov	eax, dword [bx+4]
  1901 0000091A 66898346FF              		mov	dword [bp+di+dcf.p0+4], eax	; [bp+di-0BAh]
  1902                                  
  1903 0000091F D94708                  		fld	dword [bx+8]
  1904                                  		; vector(4-cx).z
  1905 00000922 D9934AFF                		fst	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  1906 00000926 DF5EFC                  		fistp	word [bp+dcf.h]		; [bp-04h]	
  1907                                  						; dcf.h = z distance
  1908 00000929 5B                      		pop	bx
  1909                                  
  1910 0000092A 8B46FC                  		mov	ax, word [bp+dcf.h]		; [bp-04h]
  1911 0000092D 050002                  		add	ax, 512	; 200h
  1912 00000930 0F881401                		js	dCFbackclip   ; not visible ? (29/01/2017) 
  1913                                  
  1914 00000934 3DFF01                  		cmp	ax, 511 ; 1FFh
  1915 00000937 7E03                    		jle	short intensityOK
  1916 00000939 B8FF01                  		mov	ax, 511 ; 1FFh		; maximum z distance (dept) ?
  1917                                  intensityOK:
  1918 0000093C C1E303                  		shl	bx, 3 ; point index * 8
  1919 0000093F 6631D2                  		xor	edx, edx
  1920 00000942 C1E007                  		shl	ax, 7
  1921 00000945 F7A7[8716]              		mul	word [bx+o+6+object.p]	; [bx+o+6+4]
  1922                                  		; edges(4-cx).s
  1923 00000949 66899362FF              		mov	dword [bp+di+dcf.p0+32], edx	; [bp+di-9Eh]
  1924                                  
  1925 0000094E 30E4                    		xor	ah, ah
  1926 00000950 8A4404                  		mov	al, byte [si+4]
  1927 00000953 66C1E010                		shl	eax, 16	; 10h
  1928                                  		; edges(4-cx).v
  1929 00000957 6689835AFF              		mov	dword [bp+di+dcf.p0+24], eax	; [bp+di-0A6h]
  1930                                  
  1931 0000095C AC                      		lodsb
  1932 0000095D 66C1E010                		shl	eax, 16	; 10h
  1933                                  		; edges(4-cx).u
  1934 00000961 66898356FF              		mov	dword [bp+di+dcf.p0+20], eax	; [bp+di-0AAh]
  1935                                  
  1936 00000966 5B                      		pop	bx
  1937 00000967 43                      		inc	bx
  1938 00000968 43                      		inc	bx
  1939 00000969 83C724                  		add	di, 36	; 24h  ; size of edge
  1940 0000096C E295                    		loop	dCFinitloop
  1941                                  		;dec	cx
  1942                                  		;jnz	dCFinitloop
  1943                                  
  1944                                  		; end of p1, p2, p3, p4 point dimensioning of face
  1945                                  		; 
  1946                                  		; p1 ...... p2
  1947                                  		;  .	    .	
  1948                                  		;  . shade  .
  1949                                  		;  .        .
  1950                                  		; p3 ...... p4
  1951                                  		;
  1952                                  		; p1 (x,y,z) ... p4 (x,y,z)
  1953                                  		;
  1954                                  
  1955 0000096E 8B07                    		mov	ax, word [bx]		; shade
  1956 00000970 8946F8                  		mov	word [bp+dcf.col], ax	; [bp-08h]
  1957                                  
  1958 00000973 31DB                    		xor	bx, bx
  1959 00000975 895EFA                  		mov	word [bp+dcf.j], bx	; [bp-06h]
  1960                                  
  1961                                  		; vector(3).z
  1962 00000978 D946B6                  		fld	dword [bp+dcf.p0+108+8] ; [bp-4Ah]
  1963 0000097B D9E4                    		ftst
  1964                                  		;fstsw	ax
  1965 0000097D DFE0                    		fnstsw	ax
  1966 0000097F DDD8                    		fstp	st0
  1967 00000981 9E                      		sahf
  1968 00000982 7301                    		jae	short isFalse
  1969 00000984 4B                      		dec	bx
  1970                                  isFalse:
  1971 00000985 885EF6                  		mov	byte [bp+dcf.is_in], bl	; [bp-0Ah]
  1972 00000988 31F6                    		xor	si, si
  1973 0000098A 31FF                    		xor	di, di 
  1974                                  forloop:
  1975                                  		; vector(0-3).z
  1976 0000098C D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  1977 00000990 D9E4                    		ftst
  1978                                  		;fstsw	ax
  1979 00000992 DFE0                    		fnstsw	ax
  1980 00000994 DDD8                    		fstp	st0
  1981 00000996 9E                      		sahf
  1982 00000997 732B                    		jae	short elseFall
  1983                                  
  1984 00000999 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; -1 ; true
  1985 0000099D 7406                    		je	short inside
  1986 0000099F E8A800                  		call	clipsub
  1987                                  		; { OUT / IN }
  1988 000009A2 F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  1989                                  inside:
  1990 000009A5 57                      		push	di
  1991 000009A6 56                      		push	si
  1992 000009A7 8DBB8EFE                		lea	di, [bp+di+dcf.p2]	; [bp+di-172h]
  1993 000009AB 8DB242FF                		lea	si, [bp+si+dcf.p0]	; [bp+si-0BEh]
  1994                                  
  1995 000009AF 16                      		push	ss
  1996 000009B0 07                      		pop	es
  1997 000009B1 1E                      		push	ds
  1998 000009B2 16                      		push	ss
  1999 000009B3 1F                      		pop	ds
  2000 000009B4 B91200                  		mov	cx, 18	; 12h
  2001 000009B7 F3A5                    		rep movsw			; { IN / IN }
  2002 000009B9 1F                      		pop	ds
  2003                                  
  2004 000009BA 5E                      		pop	si
  2005 000009BB 5F                      		pop	di
  2006 000009BC 83C724                  		add	di, 36	; 24h
  2007 000009BF FF46FA                  		inc	word [bp+dcf.j]		; [bp-06h]
  2008 000009C2 EB0C                    		jmp	short dCFendif
  2009                                  elseFall:
  2010 000009C4 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; [bp-0Ah]
  2011 000009C8 7506                    		jne	short outside
  2012 000009CA E87D00                  		call	clipsub
  2013                                  		; { IN / OUT }
  2014 000009CD F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  2015                                  outside:
  2016 000009D0 83C624                  dCFendif:	add	si, 36 ; 24h
  2017 000009D3 81FE9000                		cmp	si, 4*36 ; 90h
  2018 000009D7 75B3                    		jne	short forloop
  2019                                  
  2020 000009D9 8B4EFA                  		mov	cx, word [bp+dcf.j]	; [bp-06h]
  2021 000009DC 83F902                  		cmp	cx, 2
  2022 000009DF 7C67                    		jl	dCFnodraw
  2023 000009E1 31FF                    		xor	di, di
  2024                                  dCFloop:
  2025 000009E3 DF06[E50C]              		fild	word [CONST13]
  2026 000009E7 D8A396FE                		fsub	dword [bp+di+dcf.p2+8]	; [bp+di-16Ah]
  2027 000009EB DE36[E90C]              		fidiv	word [CONST160]
  2028                                  		
  2029 000009EF D98392FE                		fld	dword [bp+di+dcf.p2+4]	; [bp+di-16Eh]
  2030 000009F3 D8F1                    		fdiv	st0, st1
  2031 000009F5 DE06[E70C]              		fiadd	word [CONST100]
  2032 000009F9 DB9B9AFE                		fistp	dword [bp+di+dcf.p2+12] ; [bp+di-166h]
  2033                                  		
  2034 000009FD D9838EFE                		fld	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2035 00000A01 D80E[E10C]              		fmul	dword [ASPECT_PLACE]
  2036 00000A05 D8F1                    		fdiv	st0, st1
  2037 00000A07 DE06[E90C]              		fiadd	word [CONST160]
  2038 00000A0B D9FC                    		frndint
  2039 00000A0D DA0E[ED0C]              		fimul	dword [CONST65536]
  2040 00000A11 DB9B9EFE                		fistp	dword [bp+di+dcf.p2+16] ; [bp+di-162h]
  2041                                  
  2042 00000A15 DB83A2FE                		fild	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2043 00000A19 D8F1                    		fdiv	st0, st1
  2044 00000A1B DB9BA2FE                		fistp	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2045                                  		
  2046 00000A1F DB83A6FE                		fild	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2047 00000A23 D8F1                    		fdiv	st0, st1
  2048 00000A25 DB9BA6FE                		fistp	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2049                                  		
  2050 00000A29 DB06[ED0C]              		fild	dword [CONST65536]
  2051 00000A2D D8F1                    		fdiv	st0, st1
  2052 00000A2F DB9BAAFE                		fistp	dword [bp+di+dcf.p2+28] ; [bp+di-156h]
  2053                                  		
  2054 00000A33 DDD8                    		fstp	st0
  2055 00000A35 83C724                  		add	di, 36 ; 24h
  2056 00000A38 E2A9                    		loop	dCFloop
  2057                                  		;dec	cx
  2058                                  		;jnz	dCFloop
  2059                                  
  2060 00000A3A 8DBE8EFE                		lea	di, [bp+dcf.p2]		; [bp-172h]
  2061 00000A3E 57                      		push	di
  2062 00000A3F FF76FA                  		push	word [bp+dcf.j]		; [bp-06h]	 
  2063 00000A42 FF76F8                  		push	word [bp+dcf.col]	; [bp-08h]
  2064 00000A45 E8EEFB                  		call	scansubtextpoly
  2065                                  dCFnodraw:
  2066 00000A48 C9                      dCFbackclip:	leave
  2067                                  			; mov sp, bp ; pop bp
  2068 00000A49 C3                      		retn
  2069                                  
  2070                                  clipsub:
  2071 00000A4A 56                      		push	si
  2072 00000A4B 57                      		push	di
  2073 00000A4C 8D44DC                  		lea	ax, [si-36]		; [si-24h]
  2074 00000A4F 83F800                  		cmp	ax, 0
  2075 00000A52 7D03                    		jge	short cSnounder
  2076 00000A54 B86C00                  		mov	ax, 108 ; 6Ch
  2077                                  cSnounder:
  2078 00000A57 D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  2079 00000A5B D9C0                    		fld	st0
  2080 00000A5D 97                      		xchg	ax, di
  2081 00000A5E D8A34AFF                		fsub	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  2082 00000A62 97                      		xchg	ax, di
  2083 00000A63 DEF9                    		fdivp	st1, st0
  2084                                  		;fdiv
  2085                                  
  2086 00000A65 BB[500F]                		mov	bx, cliptab
  2087 00000A68 B90600                  		mov	cx, 6
  2088                                  dCFclipLoop2:
  2089 00000A6B 97                      		xchg	ax, di
  2090 00000A6C D98342FF                		fld	dword [bp+di+dcf.p0]	; [bp+di-0BEh]
  2091 00000A70 97                      		xchg	ax, di
  2092 00000A71 D8A242FF                		fsub	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2093 00000A75 D8C9                    		fmul	st0, st1
  2094 00000A77 D88242FF                		fadd	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2095 00000A7B D99B8EFE                		fstp	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2096                                  
  2097 00000A7F 8A17                    		mov	dl, byte [bx]
  2098 00000A81 43                      		inc	bx
  2099 00000A82 30F6                    		xor	dh, dh
  2100 00000A84 01D7                    		add	di, dx
  2101 00000A86 01D6                    		add	si, dx
  2102 00000A88 01D0                    		add	ax, dx
  2103 00000A8A E2DF                    		loop	dCFclipLoop2
  2104 00000A8C DDD8                    		fstp	st0
  2105 00000A8E 5F                      		pop	di
  2106 00000A8F 5E                      		pop	si
  2107 00000A90 FF46FA                  		inc	word [bp+dcf.j] 	; [bp-6]
  2108 00000A93 83C724                  		add	di, 36 ; 24h
  2109 00000A96 C3                      		retn
  2110                                  
  2111                                  ;***********************************************
  2112                                  ;* descript. : rotate point over one axis      *
  2113                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2114                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2115                                  ;* sideeffect: empty copro-stack               *
  2116                                  ;* back      : none			       *
  2117                                  ;***********************************************
  2118                                  
  2119                                  rotateAxis:
  2120 00000A97 D9EB                    		fldpi				;{ PI,a}
  2121 00000A99 DEC9                    		fmulp	st1, st0		;{ PI*a}	
  2122                                  		;fmul
  2123 00000A9B DA36[ED0C]              		fidiv	dword [CONST65536]	;{ PI*a/65536}
  2124 00000A9F D9FB                    		fsincos				;{ cos,sin}
  2125 00000AA1 D9C0                    		fld	st0			;{ cos,cos,sin}
  2126 00000AA3 D80C                    		fmul	dword [si] 		;{ y*cos,cos,sin}
  2127 00000AA5 D9C2                    		fld	st2			;{ sin,y*cos,cos,sin}
  2128 00000AA7 D80F                    		fmul	dword [bx]		;{ z*sin,y*cos,cos,sin}
  2129 00000AA9 DEE9                    		fsubp	st1, st0		;{ y*cos-z*sin,cos,sin}
  2130 00000AAB D9CA                    		fxch	st2			;{ sin,cos,y*cos-z*sin}
  2131 00000AAD D80C                    		fmul	dword [si]		;{ y*sin,cos,y*cos-z*sin}
  2132 00000AAF D9C9                    		fxch	st1			;{ cos,y*sin,y*cos-z*sin}
  2133 00000AB1 D80F                    		fmul	dword [bx]		;{ z*cos,y*sin,y*cos-z*sin}
  2134 00000AB3 DEC1                    		faddp	st1, st0		;{ y*sin+z*cos,y*cos-z*sin}
  2135 00000AB5 D91F                    		fstp	dword [bx]		;{ y*cos-z*sin}
  2136 00000AB7 D91C                    		fstp	dword [si]		;{}
  2137 00000AB9 C3                      		retn
  2138                                  
  2139                                  ;***********************************************
  2140                                  ;* descript. : rotate point		       *
  2141                                  ;* parameter : a,b,c:angles,adr:address        *
  2142                                  ;* sideeffect: all		 	       *
  2143                                  ;* back      : none			       *
  2144                                  ;***********************************************
  2145                                  
  2146                                  xyzRotate:
  2147                                  		adr	equ 4	; arg 1, [sp+2]
  2148                                  		c	equ 6	; arg 2, [sp+4]	
  2149                                  		b	equ 8	; arg 3, [sp+6]
  2150                                  		a	equ 10	; arg 4, [sp+8]
  2151                                  
  2152 00000ABA 55                      		push	bp
  2153 00000ABB 89E5                    		mov	bp, sp
  2154                                  	
  2155 00000ABD 8B7E04                  		mov	di, word [bp+adr]
  2156 00000AC0 DF460A                  		fild	word [bp+a]
  2157 00000AC3 8D5D08                  		lea	bx, [di+8]
  2158 00000AC6 8D7504                  		lea	si, [di+4]
  2159 00000AC9 E8CBFF                  		call	rotateAxis
  2160 00000ACC DF4608                  		fild	word [bp+b]
  2161 00000ACF 8D1D                    		lea	bx, [di]
  2162 00000AD1 8D7508                  		lea	si, [di+8]
  2163 00000AD4 E8C0FF                  		call	rotateAxis
  2164 00000AD7 DF4606                  		fild	word [bp+c]
  2165 00000ADA 8D5D04                  		lea	bx, [di+4]
  2166 00000ADD 8D35                    		lea	si, [di]
  2167 00000ADF E8B5FF                  		call	rotateAxis
  2168                                  
  2169 00000AE2 5D                      		pop	bp
  2170 00000AE3 C20800                  		ret	8
  2171                                  
  2172                                  ;***********************************************
  2173                                  ;* descript. : calculate world matrix	       *
  2174                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2175                                  ;* sideeffect: all		 	       *
  2176                                  ;* back      : none			       *
  2177                                  ;***********************************************
  2178                                  
  2179                                  calcRotMat:
  2180                                  		neig	equ 4   ; arg 1, [sp+2]
  2181                                  		zw	equ 6	; arg 2, [sp+4]	
  2182                                  		yw	equ 8	; arg 3, [sp+6]
  2183                                  		xw	equ 10  ; arg 4, [sp+8]
  2184                                  
  2185 00000AE6 55                      		push	bp
  2186 00000AE7 89E5                    		mov	bp, sp
  2187                                  
  2188 00000AE9 BF[E712]                		mov	di, nwmat
  2189                                  		identityMat
  2189 00000AEC B502                <1>  mov ch, 2
  2189                              <1> iMolp:
  2189 00000AEE B102                <1>  mov cl, 2
  2189                              <1> iMilp:
  2189 00000AF0 D9EE                <1>  fldz
  2189 00000AF2 38CD                <1>  cmp ch, cl
  2189 00000AF4 7504                <1>  jne short iMwritezero
  2189 00000AF6 DDD8                <1>  fstp st0
  2189 00000AF8 D9E8                <1>  fld1
  2189                              <1> iMwritezero:
  2189 00000AFA D91D                <1>  fstp dword [di]
  2189 00000AFC 83C704              <1>  add di, 4
  2189 00000AFF FEC9                <1>  dec cl
  2189 00000B01 79ED                <1>  jns short iMilp
  2189 00000B03 FECD                <1>  dec ch
  2189 00000B05 79E7                <1>  jns short iMolp
  2190 00000B07 31FF                    		xor	di, di
  2191                                  cRMolp:
  2192 00000B09 57                      		push	di
  2193 00000B0A FF760A                  		push	word [bp+xw]
  2194 00000B0D FF7608                  		push	word [bp+yw]
  2195 00000B10 FF7606                  		push	word [bp+zw]
  2196 00000B13 81C7[E712]              		add	di, nwmat
  2197 00000B17 57                      		push	di
  2198 00000B18 E89FFF                  		call	xyzRotate
  2199 00000B1B 5F                      		pop	di
  2200 00000B1C 31DB                    		xor	bx, bx
  2201                                  cRMilp:
  2202 00000B1E D985[E712]              		fld	dword [di+nwmat]
  2203 00000B22 D88F[9F12]              		fmul	dword [bx+owmat]
  2204 00000B26 D985[EB12]              		fld	dword [di+nwmat+4]
  2205 00000B2A D88F[AB12]              		fmul	dword [bx+owmat+12]
  2206 00000B2E D985[EF12]              		fld	dword [di+nwmat+8]
  2207 00000B32 D88F[B712]              		fmul	dword [bx+owmat+24]
  2208 00000B36 DEC1                    		fadd
  2209 00000B38 DEC1                    		fadd
  2210 00000B3A D991[9F12]              		fst	dword [bx+di+owmat]
  2211 00000B3E D999[C312]              		fstp	dword [bx+di+wmat]
  2212 00000B42 83C304                  		add	bx, 4
  2213 00000B45 80FB0C                  		cmp	bl, 12
  2214 00000B48 75D4                    		jne	short cRMilp
  2215 00000B4A 83C70C                  		add	di, 12
  2216 00000B4D 83FF24                  		cmp	di, 36
  2217 00000B50 75B7                    		jne	short cRMolp
  2218                                  
  2219 00000B52 BE[C312]                		mov	si, wmat
  2220 00000B55 B90300                  		mov	cx, 3
  2221                                  cRMneigloop:
  2222 00000B58 DF4604                  		fild	word [bp+neig]
  2223 00000B5B 8D5C0C                  		lea	bx, [si+12]
  2224 00000B5E E836FF                  		call	rotateAxis
  2225 00000B61 83C604                  		add	si, 4
  2226 00000B64 E2F2                    		loop	cRMneigloop
  2227                                  
  2228 00000B66 5D                      		pop	bp
  2229 00000B67 C20800                  		ret	8
  2230                                  
  2231                                  ;***********************************************
  2232                                  ;* descript. : create the world		       *
  2233                                  ;* parameter : none			       *
  2234                                  ;* sideeffect: all		               *
  2235                                  ;* back      : none			       *
  2236                                  ;***********************************************
  2237                                  
  2238                                  createWorld:
  2239                                  		cw.direc  equ -2  ; word
  2240                                  		cw.shade  equ -4  ; word	
  2241                                  
  2242 00000B6A C8040000                		enter	4, 0
  2243                                  			; push bp ; mov bp, sp ; sub sp, 4
  2244 00000B6E BE[A20F]                		mov	si, world
  2245 00000B71 B90400                  		mov	cx, 4
  2246                                  cWworldLoop:
  2247 00000B74 51                      		push	cx
  2248 00000B75 56                      		push	si
  2249 00000B76 BF[85C1]                		mov	di, p
  2250 00000B79 BB[FDC1]                		mov	bx, pr
  2251 00000B7C BE[750F]                		mov	si, print
  2252 00000B7F B10F                    		mov	cl, 15 ; 0Fh
  2253                                  cWinitStartRoom:
  2254 00000B81 51                      		push	cx
  2255 00000B82 B103                    		mov	cl, 3
  2256                                  cWinnerLoop:
  2257 00000B84 AC                      		lodsb  ; byte data (to be converted to dword) from the 'print:'
  2258 00000B85 98                      		cbw    ; convert byte to word with sign (0E0h -> FFE0h)	
  2259 00000B86 AB                      		stosw  ; store world coordinate/dimension as integer (word), to 'p:' 
  2260 00000B87 DF45FE                  		fild	word [di-2]
  2261 00000B8A D91F                    		fstp	dword [bx] ; store coordinate as floatpoint
  2262 00000B8C 83C304                  		add	bx, 4 ; next dimension (x,y,z) in 'pr:'
  2263 00000B8F E2F3                    		loop	cWinnerLoop
  2264 00000B91 59                      		pop	cx
  2265 00000B92 B8007F                  		mov	ax, 127*256 ; 7F00h ;  4th dimension in 'p:'
  2266 00000B95 AB                      		stosw
  2267 00000B96 E2E9                    		loop	cWinitStartRoom
  2268 00000B98 5E                      		pop	si
  2269                                  cWmainLoop:
  2270 00000B99 AC                      		lodsb	; the byte from 'world:' for shade and direction
  2271 00000B9A 3CFF                    		cmp	al, 255 ; 0FFh
  2272 00000B9C 0F840B01                		je	cWexit  ; end of stage (1 to 4)
  2273                                  
  2274 00000BA0 88C7                    		mov	bh, al  ; High 4 bits for shading
  2275 00000BA2 81E30070                		and	bx, 7000h
  2276 00000BA6 80C70F                  		add	bh, 15 ; 0Fh
  2277 00000BA9 895EFC                  		mov	word [bp+cw.shade], bx ; [bp-4]
  2278 00000BAC 83E00F                  		and	ax, 0Fh ; 15   ; Low 4 bits for direction
  2279 00000BAF 8946FE                  		mov	word [bp+cw.direc], ax ; [bp-2]
  2280                                  
  2281 00000BB2 31DB                    		xor	bx, bx
  2282                                  cWsideLoop:
  2283 00000BB4 F6C304                  		test	bl, 4
  2284 00000BB7 7405                    		jz	short cWfirstNibble
  2285 00000BB9 AC                      		lodsb
  2286 00000BBA 240F                    		and	al, 0Fh ; 15
  2287 00000BBC EB05                    		jmp	short cWsecondNibble
  2288                                  cWfirstNibble:
  2289 00000BBE 8A04                    		mov	al, byte [si]
  2290 00000BC0 C0E804                  		shr	al, 4
  2291                                  cWsecondNibble:
  2292 00000BC3 30E4                    		xor	ah, ah
  2293 00000BC5 48                      		dec	ax
  2294 00000BC6 7850                    		js	short cWnoWall ; ax = 0 -> ax = 0FFFFh
  2295 00000BC8 6B3E[7F16]0A            		imul	di, word [o+object.fanz], 10 ; 0Ah
  2296 00000BCD 81C7[0123]              		add	di, o+object.f ; base address + offset
  2297 00000BD1 FF06[7F16]              		inc	word [o+object.fanz] ; faces = faces + 1
  2298 00000BD5 894508                  		mov	word [di+8], ax ; 4th word is shading value
  2299                                  
  2300 00000BD8 53                      		push	bx
  2301 00000BD9 56                      		push	si
  2302 00000BDA B104                    		mov	cl, 4
  2303                                  cWaddPointloop:
  2304 00000BDC 0FBEB7[5D0F]            		movsx	si, byte [bx+cube] ; cube coordinate offset
  2305 00000BE1 81C6[85C1]              		add	si, p ; + base address (p:)
  2306                                  
  2307 00000BE5 57                      		push	di
  2308 00000BE6 BF[8116]                		mov	di, o+object.p  ; p area of object structure (in o:)
  2309 00000BE9 51                      		push	cx
  2310 00000BEA 8B0E[7D16]              		mov	cx, word [o+object.panz] ; number of points (for object.p)
  2311 00000BEE 31C0                    		xor	ax, ax
  2312 00000BF0 E316                    		jcxz	cWfirstPoint
  2313                                  cWsearchPointLoop: ; check point coordinates are same or not
  2314 00000BF2 668B14                  		mov	edx, dword [si]
  2315 00000BF5 663B15                  		cmp	edx, dword [di]
  2316 00000BF8 7508                    		jne	short cWdifferent
  2317 00000BFA 8B5404                  		mov	dx, word [si+4]
  2318 00000BFD 3B5504                  		cmp	dx, word [di+4]
  2319 00000C00 740E                    		je	short cWpointExists
  2320                                  cWdifferent:
  2321 00000C02 40                      		inc	ax ; number of different points (of object)
  2322 00000C03 83C708                  		add	di, 8
  2323 00000C06 E2EA                    		loop	cWsearchPointLoop
  2324                                  cWfirstPoint:
  2325 00000C08 66A5                    		movsd
  2326 00000C0A 66A5                    		movsd
  2327 00000C0C FF06[7D16]              		inc	word [o+object.panz] ; points = points + 1
  2328                                  cWpointExists:
  2329 00000C10 59                      		pop	cx
  2330 00000C11 5F                      		pop	di
  2331 00000C12 AB                      		stosw   ; store num of different points
  2332                                  			; in the Xth word of face structure (5 words)
  2333                                  			; (Xth word of 'object.f', X = 4-CL)
  2334 00000C13 43                      		inc	bx
  2335 00000C14 E2C6                    		loop	cWaddPointloop
  2336 00000C16 5E                      		pop	si
  2337 00000C17 5B                      		pop	bx
  2338                                  cWnoWall:
  2339 00000C18 83C304                  		add	bx, 4
  2340 00000C1B 83FB18                  		cmp	bx, 24 ; 18h
  2341 00000C1E 7594                    		jne	short cWsideLoop
  2342                                  
  2343 00000C20 6B7EFE0C                		imul	di, word [bp+cw.direc], 12 ; [bp-2]
  2344                                  		; di will have negative value if 12*[bp-2] > 127
  2345                                  		; max value of [bp-2] = 0Fh
  2346 00000C24 B103                    		mov	cl, 3
  2347 00000C26 BB[5DC2]                		mov	bx, pr+96 ; 24th dword of 'pr:'
  2348                                  cWaddStepLoop:
  2349 00000C29 D94748                  		fld	dword [bx+72] ; [bx+48h]
  2350 00000C2C D801                    		fadd	dword [bx+di]
  2351 00000C2E D95F48                  		fstp	dword [bx+72]
  2352 00000C31 83C304                  		add	bx, 4
  2353 00000C34 E2F3                    		loop	cWaddStepLoop
  2354                                  
  2355 00000C36 807CFC00                		cmp	byte [si-4], 0
  2356 00000C3A 7D23                    		jge	short cWsimpleRoom
  2357                                  
  2358 00000C3C BB[FDC1]                		mov	bx, pr
  2359 00000C3F B10E                    		mov	cl, 14 ; 0Eh
  2360                                  cWrotloop:
  2361 00000C41 60                      		pusha
  2362 00000C42 B103                    		mov	cl, 3
  2363 00000C44 8A14                    		mov	dl, byte [si]
  2364                                  cWpushLoop:
  2365 00000C46 31C0                    		xor	ax, ax
  2366 00000C48 D0EA                    		shr	dl, 1
  2367 00000C4A 7305                    		jnc	short cWnoRot
  2368 00000C4C 8A24                    		mov	ah, byte [si]
  2369                                  		;and	ax, 0F000h
  2370 00000C4E 80E4F0                  		and	ah, 0F0h
  2371                                  		;push	ax
  2372                                  		;jmp	short cWendIf
  2373                                  cWnoRot:
  2374                                  		;push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2375 00000C51 50                      		push	ax
  2376                                  cWendIf:
  2377 00000C52 E2F2                    		loop	cWpushLoop
  2378 00000C54 53                      		push	bx ; arg 1 (addr)
  2379 00000C55 E862FE                  		call	xyzRotate
  2380 00000C58 61                      		popa
  2381 00000C59 83C30C                  		add	bx, 12 ; 0Ch
  2382 00000C5C E2E3                    		loop	cWrotloop
  2383 00000C5E 46                      		inc	si
  2384                                  cWsimpleRoom:
  2385 00000C5F 8B5EFE                  		mov	bx, word [bp+cw.direc]  ; [bp-2]
  2386 00000C62 C1E302                  		shl	bx, 2
  2387 00000C65 B104                    		mov	cl, 4
  2388                                  cWpointCopyLoop:
  2389 00000C67 60                      		pusha
  2390 00000C68 0FBEB7[5D0F]            		movsx	si, byte [bx+cube]
  2391 00000C6D 89F0                    		mov	ax, si
  2392 00000C6F 81C6[85C1]              		add	si, p ; + base address of 'p:'
  2393 00000C73 80F307                  		xor	bl, 7
  2394 00000C76 0FBEBF[5D0F]            		movsx	di, byte [bx+cube]
  2395 00000C7B 81C7[85C1]              		add	di, p ; + base address of 'p:'
  2396 00000C7F 56                      		push	si 
  2397 00000C80 66A5                    		movsd
  2398 00000C82 66A5                    		movsd
  2399 00000C84 5E                      		pop	si
  2400                                  
  2401 00000C85 89C3                    		mov	bx, ax
  2402 00000C87 D1EB                    		shr	bx, 1
  2403 00000C89 01C3                    		add	bx, ax
  2404 00000C8B BF[FDC1]                		mov	di, pr ; + base address of 'pr:'
  2405 00000C8E B103                    		mov	cl, 3
  2406                                  cWSround:
  2407 00000C90 D901                    		fld	dword [bx+di]
  2408 00000C92 D885A800                		fadd	dword [di+168]  ; [di+0A8h]
  2409 00000C96 DF1C                    		fistp	word [si] ; world coordinate/dimension
  2410 00000C98 83C704                  		add	di, 4
  2411 00000C9B 46                      		inc	si
  2412 00000C9C 46                      		inc	si
  2413 00000C9D E2F1                    		loop	cWSround
  2414 00000C9F 8B46FC                  		mov	ax, word [bp+cw.shade]  ; [bp-4]
  2415 00000CA2 8904                    		mov	word [si], ax ; 4th word
  2416 00000CA4 61                      		popa
  2417 00000CA5 43                      		inc	bx
  2418 00000CA6 E2BF                    		loop	cWpointCopyLoop
  2419 00000CA8 E9EEFE                  		jmp	cWmainLoop
  2420                                  cWexit:
  2421 00000CAB 59                      		pop	cx
  2422 00000CAC 49                      		dec	cx
  2423 00000CAD 0F85C3FE                		jnz	cWworldLoop
  2424 00000CB1 C9                      		leave
  2425                                  			; mov sp, bp ; pop bp
  2426 00000CB2 C3                      		retn
  2427                                  
  2428 00000CB3 1111                    dels_pos_w:	dw 1111h
  2429 00000CB5 1111                    ddu_pos_w:	dw 1111h
  2430 00000CB7 1111                    ddv_pos_w:	dw 1111h
  2431                                  
  2432                                  prg_msg:
  2433 00000CB9 4552444F47414E2054-     		db	'ERDOGAN TAN - SNCOMNI.COM'
  2433 00000CC2 414E202D20534E434F-
  2433 00000CCB 4D4E492E434F4D     
  2434 00000CD2 0D0A                    		db	0Dh, 0Ah
  2435 00000CD4 30352F30322F323031-     		db	'05/02/2017'
  2435 00000CDD 37                 
  2436 00000CDE 0D0A                    		db	0Dh, 0Ah
  2437 00000CE0 00                      		db	0 
  2438                                  
  2439                                  ;=============================================================================
  2440                                  ;               preinitialized data
  2441                                  ;=============================================================================
  2442                                  
  2443 00000CE1 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  2444 00000CE5 0D00                    CONST13:	dw 13			; 000Dh			
  2445 00000CE7 6400                    CONST100:	dw CENTERY		; 0064h
  2446 00000CE9 A000                    CONST160:	dw CENTERX		; 00A0h
  2447 00000CEB 0007                    CONST1792:	dw 1792			; 0700h
  2448 00000CED 00000100                CONST65536:	dd 65536		; 00010000h
  2449 00000CF1 05840808                randommul:	dd 134775813		; 08088405h
  2450 00000CF5 FB100000                randomseed:	dd 4347			; 000010FBh
  2451                                  credits:
  2452 00000CF9 0250FB                  		db	 2, 80,-5
  2453 00000CFC FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  2453 00000D05 51023E0245024F023E-
  2453 00000D0E 024502             
  2454 00000D11 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  2454 00000D1A 0200               
  2455 00000D1C FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  2455 00000D25 51023E0246024F023E-
  2455 00000D2E 024602             
  2456 00000D31 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  2456 00000D3A 0200               
  2457 00000D3C 00                      		db       0
  2458 00000D3D 37203820                		db      55,32,56,32			; { pat 10 }
  2459 00000D41 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  2460 00000D47 39203220                		db      57,32,50,32		 ; { pat 12 }
  2461 00000D4B 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  2462 00000D51 3740                    		db      55,64		   ; { pat 14 }
  2463 00000D53 FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  2463 00000D5C 00                 
  2464 00000D5D FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  2464 00000D66 00                 
  2465 00000D67 00                      		db       0
  2466 00000D68 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  2467 00000D6E 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  2467 00000D77 083C08             
  2468 00000D7A 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  2468 00000D83 08                 
  2469 00000D84 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  2470 00000D8C 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  2471 00000D94 3E80                    		db      62,128		  ;{ pat 8,9 }
  2472 00000D96 4380                    		db      67,128		  ;{ pat 10,11 }
  2473 00000D98 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  2473 00000DA1 08                 
  2474 00000DA2 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  2475 00000DA6 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  2476 00000DAA FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  2477 00000DB0 FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  2478 00000DB6 00                      		db       0
  2479 00000DB7 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  2480 00000DBD 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  2481 00000DC5 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  2481 00000DCE 08                 
  2482 00000DCF 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  2482 00000DD8 18                 
  2483 00000DD9 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  2483 00000DE2 08                 
  2484 00000DE3 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  2485 00000DEB FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  2486 00000DF1 FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  2487 00000DF7 00                      		db       0
  2488 00000DF8 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  2488 00000E01 2A012A0100         
  2489 00000E06 F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  2489 00000E0F 2A0100             
  2490 00000E12 E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  2490 00000E1B 2A012602           
  2491 00000E1F 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  2492 00000E27 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  2492 00000E30 0126022A022E022601-
  2492 00000E39 2A0100             
  2493 00000E3C 00                      		db     	 0
  2494 00000E3D 00                      		db	 0
  2495                                  
  2496                                  ; colortable 65 bytes
  2497 00000E3E 10                      colors 		db	16
  2498 00000E3F 1F3F3F3F                                db      31,63,63,63
  2499 00000E43 01000000                                db	 1, 0, 0, 0
  2500 00000E47 1F28203F                                db      31,40,32,63
  2501 00000E4B 01000000                                db	 1, 0, 0, 0
  2502 00000E4F 1F3F0000                                db      31,63, 0, 0
  2503 00000E53 01060100                                db	 1, 6, 1, 0
  2504 00000E57 1F3F2914                                db      31,63,41,20
  2505 00000E5B 01000000                                db	 1, 0, 0, 0
  2506 00000E5F 1F3F3F08                                db      31,63,63, 8
  2507 00000E63 01000000                                db	 1, 0, 0, 0
  2508 00000E67 1F38383F                                db	31,56,56,63
  2509 00000E6B 013F0000                                db	 1,63, 0, 0
  2510 00000E6F 103F3F00                                db      16,63,63, 0
  2511 00000E73 103F0000                                db      16,63, 0, 0
  2512 00000E77 01160500                                db	 1,22, 5, 0
  2513 00000E7B 073F3811                                db       7,63,56,17
  2514                                  
  2515                                  ; parameter for the texture effects 156 bytes
  2516 00000E7F 130F0F31310A            aE              db	013h,15,15,49,49,10
  2517 00000E85 131010303011                            db      013h,16,16,48,48,17
  2518 00000E8B 1311112F2F18                            db      013h,17,17,47,47,24
  2519 00000E91 1312122E2EBE                            db      013h,18,18,46,46,190
  2520 00000E97 1315152B2B1E                            db      013h,21,21,43,43,30
  2521 00000E9D 2500003E1E03                            db      025h,0,0,62,30,3
  2522 00000EA3 2503033E1E07                            db      025h,3,3,62,30,7
  2523 00000EA9 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  2524 00000EAF 2500203E3E03                            db      025h,0,32,62,62,3
  2525 00000EB5 2503233E3E07                            db      025h,3,35,62,62,7
  2526 00000EBB 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  2527 00000EC1 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  2528 00000EC7 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  2529 00000ECD 2C000B3F1004                            db      02Ch,0,11,63,16,4
  2530 00000ED3 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  2531 00000ED9 2C00303F3504                            db      02Ch,0,48,63,53,4
  2532 00000EDF 2E13182C2705                            db      02Eh,19,24,44,39,5
  2533 00000EE5 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  2534 00000EEB 2E14192B2607                            db      02Eh,20,25,43,38,7
  2535 00000EF1 3E14192B2606                            db      03Eh,20,25,43,38,6
  2536 00000EF7 2F00183F1E06                            db      02Fh,0,24,63,30,6
  2537 00000EFD 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  2538 00000F03 3F00193F1E06                            db      03Fh,0,25,63,30,6
  2539 00000F09 2F00203F2606                            db      02Fh,0,32,63,38,6
  2540 00000F0F 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  2541 00000F15 3F00213F2606                            db      03Fh,0,33,63,38,6
  2542                                  
  2543                                  ; parameter for fractaladd 28 bytes
  2544 00000F1B 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  2544 00000F24 0020202040         
  2545 00000F29 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  2545 00000F32 0024002400         
  2546                                  
  2547                                  ; star bob for the sparcling stars texture 25 bytes
  2548 00000F37 0000030000              bob:            db	0,0,3,0,0
  2549 00000F3C 0002050200                              db	0,2,5,2,0
  2550 00000F41 0305070503                              db	3,5,7,5,3
  2551 00000F46 0002050200                              db	0,2,5,2,0
  2552 00000F4B 0000030000                              db	0,0,3,0,0
  2553                                  
  2554 00000F50 04040C0408              cliptab:	db	4,4,12,4,8
  2555                                  
  2556 00000F55 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  2557                                  
  2558 00000F5D 08283010                cube:		db	1*8,5*8,6*8,2*8
  2559 00000F61 18382000                                db      3*8,7*8,4*8,0*8
  2560 00000F65 10303818                                db      2*8,6*8,7*8,3*8
  2561 00000F69 00202808                                db      0*8,4*8,5*8,1*8
  2562 00000F6D 38302820                        	db	7*8,6*8,5*8,4*8
  2563 00000F71 00081018                                db      0*8,1*8,2*8,3*8
  2564                                  
  2565 00000F75 E0E0E0                  print:		db	-32,-32,-32
  2566 00000F78 20E0E0                                  db       32,-32,-32
  2567 00000F7B 2020E0                                  db   	 32, 32,-32
  2568 00000F7E E020E0                                  db  	-32, 32,-32
  2569 00000F81 E0E020                                  db  	-32,-32, 32
  2570 00000F84 20E020                                  db       32,-32, 32
  2571 00000F87 202020                                  db   	 32, 32, 32
  2572 00000F8A E02020                                  db  	-32, 32, 32
  2573 00000F8D 400000                                  db       64,  0,  0
  2574 00000F90 C00000                                  db      -64,  0,  0
  2575 00000F93 004000                                  db        0, 64,  0
  2576 00000F96 00C000                                  db        0,-64,  0
  2577 00000F99 000040                                  db        0,  0, 64
  2578 00000F9C 0000C0                                  db        0,  0,-64
  2579 00000F9F 000000                                  db	  0,  0,  0
  2580                                  
  2581                                  ; world contruction data 599 bytes
  2582 00000FA2 71700006                world:		db	071h,070h,000h,006h
  2583 00000FA6 72000006                                db	072h,000h,000h,006h
  2584 00000FAA 71007006                                db	071h,000h,070h,006h
  2585 00000FAE 73077006                                db	073h,007h,070h,006h
  2586 00000FB2 73070006                                db	073h,007h,000h,006h
  2587 00000FB6 70070706                                db	070h,007h,007h,006h
  2588 00000FBA 74000706                                db	074h,000h,007h,006h
  2589 00000FBE 70000740                                db	070h,000h,007h,040h
  2590 00000FC2 72700750                                db	072h,070h,007h,050h
  2591 00000FC6 72700050                                db	072h,070h,000h,050h
  2592 00000FCA 71707050                                db	071h,070h,070h,050h
  2593 00000FCE 73007040                                db	073h,000h,070h,040h
  2594 00000FD2 71000040                                db	071h,000h,000h,040h
  2595 00000FD6 72000050                                db	072h,000h,000h,050h
  2596 00000FDA 71007050                                db	071h,000h,070h,050h
  2597 00000FDE 73077046                                db	073h,007h,070h,046h
  2598 00000FE2 73000046                                db	073h,000h,000h,046h
  2599 00000FE6 70070746                                db	070h,007h,007h,046h
  2600 00000FEA 72000750                                db	072h,000h,007h,050h
  2601 00000FEE 71000000                                db	071h,000h,000h,000h
  2602 00000FF2 71000000                                db	071h,000h,000h,000h
  2603 00000FF6 7100BB56                                db	071h,000h,0bbh,056h
  2604 00000FFA 700FBB46                                db	070h,00Fh,0bbh,046h
  2605 00000FFE FF                                      db	0FFh
  2606 00000FFF 33000000                                db	033h,000h,000h,000h
  2607 00001003 F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  2608 00001008 B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  2609 0000100D 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2610 00001012 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2611 00001017 3000BB56                                db	030h,000h,0BBh,056h
  2612 0000101B F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2613 00001020 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2614 00001025 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2615 0000102A 9000BB5611                              db	090h,000h,0BBh,056h,011h
  2616 0000102F B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2617 00001034 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2618 00001039 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2619 0000103E B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2620 00001043 3000BB56                                db	030h,000h,0BBh,056h
  2621 00001047 1000BB56                                db	010h,000h,0BBh,056h
  2622                                  
  2623 0000104B 34000000                                db	034h,000h,000h,000h
  2624 0000104F 32050080                                db	032h,005h,000h,080h
  2625 00001053 35058080                                db	035h,005h,080h,080h
  2626 00001057 35058000                                db	035h,005h,080h,000h
  2627 0000105B 33058008                                db	033h,005h,080h,008h
  2628 0000105F 33050008                                db	033h,005h,000h,008h
  2629 00001063 74050808                                db	074h,005h,008h,008h
  2630 00001067 74050000                                db	074h,005h,000h,000h
  2631 0000106B 73050880                                db	073h,005h,008h,080h
  2632 0000106F 75000000                                db	075h,000h,000h,000h
  2633 00001073 75050888                                db	075h,005h,008h,088h
  2634 00001077 70000000                                db	070h,000h,000h,000h
  2635 0000107B 74640808                                db	074h,064h,008h,008h
  2636 0000107F 74600800                                db	074h,060h,008h,000h
  2637 00001083 72640880                                db	072h,064h,008h,080h
  2638 00001087 05600080                                db	005h,060h,000h,080h
  2639 0000108B 05600000                                db	005h,060h,000h,000h
  2640 0000108F 02600008                                db	002h,060h,000h,008h
  2641 00001093 34600008                                db	034h,060h,000h,008h
  2642 00001097 34600000                                db	034h,060h,000h,000h
  2643 0000109B 32600080                                db	032h,060h,000h,080h
  2644 0000109F 35600080                                db	035h,060h,000h,080h
  2645 000010A3 35600000                                db	035h,060h,000h,000h
  2646 000010A7 32600008                                db	032h,060h,000h,008h
  2647 000010AB 34350008                                db	034h,035h,000h,008h
  2648 000010AF 14650000                                db      014h,065h,000h,000h
  2649 000010B3 32350080                                db      032h,035h,000h,080h
  2650 000010B7 35350080                               	db      035h,035h,000h,080h
  2651 000010BB 15650000                               	db      015h,065h,000h,000h
  2652 000010BF 32350008                                db	032h,035h,000h,008h
  2653 000010C3 34358008                                db	034h,035h,080h,008h
  2654 000010C7 14650000                               	db      014h,065h,000h,000h
  2655 000010CB 32358080                               	db      032h,035h,080h,080h
  2656 000010CF 75000000                		db	075h,000h,000h,000h
  2657 000010D3 5265E077                		db	052h,065h,0E0h,077h
  2658 000010D7 32640E77                		db	032h,064h,00Eh,077h
  2659 000010DB 12650077                		db	012h,065h,000h,077h
  2660 000010DF 00650077                		db	000h,065h,000h,077h
  2661 000010E3 FF                      		db	0FFh
  2662 000010E4 32000000                		db	032h,000h,000h,000h
  2663 000010E8 F000000014              		db	0F0h,000h,000h,000h,014h
  2664 000010ED B000000014              		db	0B0h,000h,000h,000h,014h
  2665 000010F2 30000000                		db	030h,000h,000h,000h
  2666 000010F6 F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  2667 000010FB F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  2668 00001100 3000DD46                		db	030h,000h,0DDh,046h
  2669 00001104 3000DD56                		db	030h,000h,0DDh,056h
  2670 00001108 3000DD56                		db	030h,000h,0DDh,056h
  2671 0000110C 32000050                		db	032h,000h,000h,050h
  2672 00001110 300AA050                		db	030h,00Ah,0A0h,050h
  2673 00001114 3300A050                		db	033h,000h,0A0h,050h
  2674 00001118 30000050                		db	030h,000h,000h,050h
  2675 0000111C 32700050                		db	032h,070h,000h,050h
  2676 00001120 3000A050                		db	030h,000h,0A0h,050h
  2677 00001124 33A0A750                		db	033h,0A0h,0A7h,050h
  2678 00001128 33000000                		db	033h,000h,000h,000h
  2679 0000112C 31A07A50                		db	031h,0A0h,07Ah,050h
  2680 00001130 31000A50                		db	031h,000h,00Ah,050h
  2681 00001134 31000A50                		db	031h,000h,00Ah,050h
  2682 00001138 320A0A50                		db	032h,00Ah,00Ah,050h
  2683 0000113C 35000000                		db	035h,000h,000h,000h
  2684 00001140 720A0000                		db	072h,00Ah,000h,000h
  2685 00001144 700AA000                		db	070h,00Ah,0A0h,000h
  2686 00001148 7300A000                		db	073h,000h,0A0h,000h
  2687 0000114C 70000000                		db	070h,000h,000h,000h
  2688 00001150 72000000                		db	072h,000h,000h,000h
  2689 00001154 7000A000                		db	070h,000h,0A0h,000h
  2690 00001158 73A0A000                		db	073h,0A0h,0A0h,000h
  2691 0000115C 73A00099                		db	073h,0A0h,000h,099h
  2692 00001160 71A00A00                		db	071h,0A0h,00Ah,000h
  2693 00001164 71000A00                		db	071h,000h,00Ah,000h
  2694 00001168 71000A00                                db	071h,000h,00Ah,000h
  2695 0000116C 750A0A00                                db	075h,00Ah,00Ah,000h
  2696 00001170 700C0C03                                db	070h,00Ch,00Ch,003h
  2697 00001174 70000C03                                db	070h,000h,00Ch,003h
  2698 00001178 70000C03                                db	070h,000h,00Ch,003h
  2699 0000117C 72C07C03                                db	072h,0C0h,07Ch,003h
  2700 00001180 72000000                                db	072h,000h,000h,000h
  2701 00001184 71C0C703                                db	071h,0C0h,0C7h,003h
  2702 00001188 7300C003                                db	073h,000h,0C0h,003h
  2703 0000118C 71700003                                db	071h,070h,000h,003h
  2704 00001190 72000003                                db	072h,000h,000h,003h
  2705 00001194 7100C003                                db	071h,000h,0C0h,003h
  2706 00001198 730CC003                                db	073h,00Ch,0C0h,003h
  2707 0000119C 71000003                                db	071h,000h,000h,003h
  2708 000011A0 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  2709 000011A4 FF                                      db	0FFh
  2710 000011A5 32000000                                db	032h,000h,000h,000h
  2711 000011A9 F000700614                              db	0F0h,000h,070h,006h,014h
  2712 000011AE B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  2713 000011B3 3000DD56                                db	030h,000h,0DDh,056h
  2714 000011B7 B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  2715 000011BC 32DD0056                                db	032h,0DDh,000h,056h
  2716 000011C0 32DD0056                                db	032h,0DDh,000h,056h
  2717 000011C4 32DD0056                                db	032h,0DDh,000h,056h
  2718 000011C8 7000F056                                db	070h,000h,0F0h,056h
  2719 000011CC 7000BB56                                db	070h,000h,0BBh,056h
  2720 000011D0 32B00B46                                db	032h,0B0h,00Bh,046h
  2721 000011D4 72BB0056                                db	072h,0BBh,000h,056h
  2722 000011D8 71B0B056                                db	071h,0B0h,0B0h,056h
  2723 000011DC 71021156                                db	071h,002h,011h,056h
  2724 000011E0 71221156                                db	071h,022h,011h,056h
  2725 000011E4 31201156                                db	031h,020h,011h,056h
  2726 000011E8 730BB056                                db	073h,00Bh,0B0h,056h
  2727 000011EC 73BB0056                                db	073h,0BBh,000h,056h
  2728 000011F0 300B0B46                                db	030h,00Bh,00Bh,046h
  2729 000011F4 3000BB56                                db	030h,000h,0BBh,056h
  2730 000011F8 FF                                      db	0FFh
  2731                                  
  2732                                  ; flying script	126 bytes
  2733                                  script:
  2734                                  ;     7 6 5 4 3 2 1 0
  2735                                  ;	  v v v v v c c c
  2736                                  ;
  2737                                  ;	  v = VALUE
  2738                                  ;	  c = COMMAND
  2739                                  ;
  2740                                  ;	  0 = NOP
  2741                                  ;	  1 = NEG ZSTEP
  2742                                  ;	  2 = INC SPEED
  2743                                  ;	  3 = DEC SPEED
  2744                                  ;	  4 = INC XSTEP
  2745                                  ;	  5 = DEC XSTEP
  2746                                  ;	  6 = INC YSTEP
  2747                                  ;	  7 = INC YSTEP
  2748                                  
  2749 000011F9 A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  2750 000011FF F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  2751 00001205 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  2752 0000120B F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  2753 00001211 F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  2754 00001217 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  2755 0000121D 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  2756 00001223 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  2757 00001229 F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  2758 0000122F A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  2759 00001235 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  2760 0000123B 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  2761 00001241 A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  2762 00001247 B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  2763 0000124D A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  2764 00001253 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  2765 00001259 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  2766 0000125F 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  2767 00001265 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  2768 0000126B 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  2769 00001271 F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  2770                                  
  2771 00001276 0100                    zstep:		dw	1			
  2772 00001278 66EF                    doortimer	dw 	-4250	; 0EF66h
  2773 0000127A 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  2774                                  omniend:
  2775 00001283 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  2775 0000128C 4B9A5050455253     
  2776                                  sancend:
  2777 00001293 0000A5C3                ob:		dd 	-330.0	; vector.x
  2778 00001297 00000000                		dd 	   0.0	; vector.y	
  2779 0000129B 00008042                		dd	  64.0	; vector.z	
  2780                                  owmat:
  2781 0000129F 00000000                		dd 	   0.0	; vector.x
  2782 000012A3 000080BF                		dd 	  -1.0	; vector.y
  2783 000012A7 00000000                		dd	   0.0  ; vector.z
  2784                                  ;owmat+12:
  2785 000012AB 00000000                		dd 	   0.0	; vector.x
  2786 000012AF 00000000                		dd 	   0.0	; vector.y
  2787 000012B3 000080BF                		dd	  -1.0  ; vector.z
  2788                                  ;owmat+24:
  2789 000012B7 0000803F                		dd 	   1.0	; vector.x
  2790 000012BB 00000000                		dd 	   0.0	; vector.y
  2791 000012BF 00000000                		dd	   0.0  ; vector.z
  2792                                  
  2793                                  bss_start:
  2794                                  
  2795                                  ABSOLUTE bss_start
  2796                                  
  2797                                  ;=============================================================================
  2798                                  ;        	null-initialized data
  2799                                  ;=============================================================================
  2800                                  
  2801                                  nullstart:
  2802 000012C3 <res 00000024>          wmat:           resb	matrix.size  ; 36
  2803 000012E7 <res 00000024>          nwmat:		resb	matrix.size  ; 36
  2804 0000130B <res 00000002>          zspeed:		resw	1
  2805 0000130D <res 00000002>          oxw:		resw	1
  2806 0000130F <res 00000002>          oyw:		resw	1
  2807 00001311 <res 00000002>          ozw:		resw	1
  2808 00001313 <res 00000002>          scriptptr:	resw	1
  2809 00001315 <res 00000002>          scriptanz:	resw	1
  2810 00001317 <res 00000001>          scriptins:	resb	1
  2811 00001318 <res 00000001>          once:		resb	1
  2812 00001319 <res 00000002>          ticker:		resw	1
  2813 0000131B <res 00000002>          tracks:		resw	1
  2814 0000131D <res 00000300>          palette:        resb 	768
  2815 0000161D <res 00000060>          channels:       resb	16*6
  2816 0000167D <res 00001C24>          o:		resb	object.size ; 7204
  2817                                  nullend:
  2818                                  
  2819                                  ;=============================================================================
  2820                                  ;       	uninitialized data
  2821                                  ;=============================================================================
  2822 000032A1 <res 00000002>          oldstack        resw	1
  2823                                  Old08IrqPtr:
  2824 000032A3 <res 00000002>          Old08Irqofs:	resw	1
  2825 000032A5 <res 00000002>          Old08Irqseg:	resw	1
  2826                                  ;Old09IrqPtr:
  2827                                  ;Old09Irqofs:	resw	1
  2828                                  ;Old09Irqseg:	resw	1
  2829 000032A7 <res 00000E15>          songdata:	resb	3605
  2830 000040BC <res 00000002>          root:   	resw	1
  2831 000040BE <res 00000040>          circletab:	resw	32
  2832 000040FE <res 0000005A>          stars:		resb	90
  2833 00004158 <res 00000001>          twice:		resb	1
  2834 00004159 <res 00000002>          vseg:		resw	1
  2835 0000415B <res 00000002>          bseg:		resw    1
  2836 0000415D <res 00000028>          tseg:   	resw	20
  2837 00004185 <res 00008000>          shadetab:	resb	256*128
  2838 0000C185 <res 00000078>          p:		resw	4*15
  2839 0000C1FD <res 000000B4>          pr:		resd	3*15
  2840 0000C2B1 <res 000000B4>          po:		resb	poly.size ; 5*36
  2841 0000C365 <res 000012C0>          rp:		resd	3*MAXPOINTS ; 3*400
  2842 0000D625 <res 00000640>          facei:		resd    MAXFACES ; 400
  2843                                  
  2844 0000DC65 <res 00000003>          alignb 4
  2845                                  
  2846                                  bss_end:
