     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[4641]                		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[B012]            <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[E60C]            <1>  mov si, credits
  1069 00000044 BB[0A16]            <1>  mov bx, channels
  1069 00000047 BF[9432]            <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 E85705              <1>  call setinstr
  1069 00000057 897F04              <1>  mov word [bx+channel.adr], di
  1069 0000005A E8B704              <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[0813]          <1>  inc word [tracks]
  1069 00000067 EBE1                <1>  jmp short EPSwhile
  1069                              <1> EPSendwhile:
  1070                                  
  1071 00000069 E8E90A                  		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[6712]                		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[2B0E]            <1>  mov si, colors
  1092 00000092 BF[0A13]            <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 000000A9 268871FF            <1>  mov byte [es:di+bx-1], dh
  1092                              <1> 
  1092 000000AD 83C703              <1>  add di, 3
  1092 000000B0 E2F5                <1>  loop mPinner
  1092 000000B2 83C604              <1>  add si, 4
  1092 000000B5 59                  <1>  pop cx
  1092 000000B6 E2E3                <1>  loop mPouter
  1092 000000B8 4B                  <1>  dec bx
  1092 000000B9 75D4                <1>  jnz short mPcolor
  1093                                  		
  1094                                  		initTextures
  1094 000000BB BB2200              <1>  mov bx, 34
  1094 000000BE 682003              <1>  push 800
  1094 000000C1 6A05                <1>  push 5
  1094 000000C3 E8FB04              <1>  call createFrac1
  1094 000000C6 BB2000              <1>  mov bx, 32
  1094 000000C9 6A70                <1>  push 112
  1094 000000CB 6A0F                <1>  push 15
  1094 000000CD E8F104              <1>  call createFrac1
  1094                              <1>  createFrac2
  1094 000000D0 8E06[6E41]          <2>  mov es, word [tseg+36]
  1094 000000D4 B014                <2>  mov al, 20
  1094 000000D6 E8E004              <2>  call setFrac
  1094 000000D9 BF4000              <2>  mov di, 64
  1094 000000DC B9C00F              <2>  mov cx, 4096-64
  1094                              <2> 
  1094                              <2> cF1loop:
  1094 000000DF BB0400              <2>  mov bx, 4
  1094 000000E2 E88D04              <2>  call rnd
  1094 000000E5 260245C0            <2>  add al, byte [es:di-64]
  1094 000000E9 260245C1            <2>  add al, byte [es:di-63]
  1094 000000ED 48                  <2>  dec ax
  1094 000000EE D1E8                <2>  shr ax, 1
  1094 000000F0 AA                  <2>  stosb
  1094 000000F1 E2EC                <2>  loop cF1loop
  1094                              <1>  createFrac3
  1094 000000F3 8E06[7041]          <2>  mov es, word [tseg+38]
  1094 000000F7 B003                <2>  mov al, 3
  1094 000000F9 E8BD04              <2>  call setFrac
  1094 000000FC B90010              <2>  mov cx, 4096
  1094                              <2> 
  1094                              <2> cF3loop:
  1094 000000FF BB0010              <2>  mov bx, 4096
  1094 00000102 E86D04              <2>  call rnd
  1094 00000105 89C7                <2>  mov di, ax
  1094 00000107 26FE05              <2>  inc byte [es:di]
  1094 0000010A E2F3                <2>  loop cF3loop
  1094                              <1>  initStars
  1094 0000010C 1E                  <2>  push ds
  1094 0000010D 07                  <2>  pop es
  1094 0000010E B91E00              <2>  mov cx, 30
  1094 00000111 BF[EB40]            <2>  mov di, stars
  1094                              <2> iSloop:
  1094 00000114 BB0001              <2>  mov bx, 256
  1094 00000117 E85804              <2>  call rnd
  1094 0000011A AA                  <2>  stosb
  1094 0000011B BBC00E              <2>  mov bx, 4096-(64*5)
  1094 0000011E 81C38000            <2>  add bx, 128
  1094 00000122 E84D04              <2>  call rnd
  1094 00000125 83C040              <2>  add ax, 64
  1094 00000128 AB                  <2>  stosw
  1094 00000129 E2E9                <2>  loop iSloop
  1094                              <1>  reactorWall
  1094 0000012B 8E06[4A41]          <2>  mov es, word [tseg]
  1094 0000012F 31FF                <2>  xor di, di
  1094 00000131 B90010              <2>  mov cx, 4096
  1094                              <2> rsmloop:
  1094 00000134 89F8                <2>  mov ax, di
  1094 00000136 A808                <2>  test al, 8
  1094 00000138 7E02                <2>  jle short rsnonot1
  1094 0000013A F6D0                <2>  not al
  1094                              <2> rsnonot1:
  1094 0000013C 240F                <2>  and al, 15
  1094 0000013E 89C3                <2>  mov bx, ax
  1094 00000140 89F8                <2>  mov ax, di
  1094 00000142 C1E806              <2>  shr ax, 6
  1094 00000145 A808                <2>  test al, 8
  1094 00000147 7E02                <2>  jle short rsnonot2
  1094 00000149 F6D0                <2>  not al
  1094                              <2> rsnonot2:
  1094 0000014B 240F                <2>  and al, 15
  1094 0000014D 38D8                <2>  cmp al, bl
  1094 0000014F 7E02                <2>  jle short rstakeal
  1094 00000151 89D8                <2>  mov ax, bx
  1094                              <2> rstakeal:
  1094 00000153 04E0                <2>  add al, 224
  1094 00000155 AA                  <2>  stosb
  1094 00000156 E2DC                <2>  loop rsmloop
  1094                              <1>  addFractals
  1094 00000158 BE[080F]            <2>  mov si, aF
  1094 0000015B B204                <2>  mov dl, 4
  1094                              <2> aFloop:
  1094 0000015D 0FB6DA              <2>  movzx bx, dl
  1094 00000160 8E87[4A41]          <2>  mov es, word [bx+tseg]
  1094 00000164 AD                  <2>  lodsw
  1094 00000165 88C3                <2>  mov bl, al
  1094 00000167 8EA7[4A41]          <2>  mov fs, word [bx+tseg]
  1094 0000016B 31FF                <2>  xor di, di
  1094 0000016D B90010              <2>  mov cx, 4096
  1094                              <2> aFiloop:
  1094 00000170 648A05              <2>  mov al, byte [fs:di]
  1094 00000173 00E0                <2>  add al, ah
  1094 00000175 AA                  <2>  stosb
  1094 00000176 E2F8                <2>  loop aFiloop
  1094                              <2> 
  1094 00000178 42                  <2>  inc dx
  1094 00000179 42                  <2>  inc dx
  1094 0000017A 80FA1E              <2>  cmp dl, 30
  1094 0000017D 7EDE                <2>  jle short aFloop
  1094                              <1>  effects
  1094 0000017F B91A00              <2>  mov cx, 26
  1094 00000182 BE[6C0E]            <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 00000190 01DB                <2>  add bx, bx
  1094                              <2> 
  1094 00000192 8E87[4A41]          <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 000001B5 7402                <2>  jz short effdonot
  1094                              <2> 
  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[6041]          <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 E88403              <2>  call rnd
  1094 000001EE 29C7                <2>  sub di, ax
  1094 000001F0 58                  <2>  pop ax
  1094 000001F1 AA                  <2>  stosb
  1094                              <2> 
  1094 000001F2 5F                  <2>  pop di
  1094 000001F3 E2F1                <2>  loop aLxloop
  1094 000001F5 59                  <2>  pop cx
  1094 000001F6 FEC8                <2>  dec al
  1094 000001F8 83EF40              <2>  sub di, 64
  1094 000001FB E2E5                <2>  loop aLyloop
  1095                                  
  1096                                  		calcShadeTab
  1096 000001FD 1E                  <1>  push ds
  1096 000001FE 07                  <1>  pop es
  1096 000001FF BF[7241]            <1>  mov di, shadetab
  1096 00000202 30DB                <1>  xor bl, bl
  1096                              <1> cSolp:
  1096 00000204 FEC3                <1>  inc bl
  1096 00000206 31C9                <1>  xor cx, cx
  1096                              <1> cSilp1:
  1096 00000208 88C8                <1>  mov al, cl
  1096 0000020A 241F                <1>  and al, 31
  1096 0000020C F6E3                <1>  mul bl
  1096 0000020E 01C0                <1>  add ax, ax
  1096 00000210 88C8                <1>  mov al, cl
  1096 00000212 24E0                <1>  and al, 224
  1096 00000214 00E0                <1>  add al, ah
  1096 00000216 AA                  <1>  stosb
  1096 00000217 FEC1                <1>  inc cl
  1096 00000219 80F9C0              <1>  cmp cl, 192
  1096 0000021C 75EA                <1>  jne short cSilp1
  1096                              <1> cSilp2:
  1096 0000021E 88C8                <1>  mov al, cl
  1096 00000220 AA                  <1>  stosb
  1096 00000221 FEC1                <1>  inc cl
  1096 00000223 75F9                <1>  jnz short cSilp2
  1096 00000225 80FB80              <1>  cmp bl, 128
  1096 00000228 75DA                <1>  jne short cSolp
  1097                                  
  1098 0000022A 8926[8E32]              		mov	word [oldstack], sp
  1099                                  
  1100                                  		startTimer
  1100 0000022E B80835              <1>  mov ax, 03508h
  1100 00000231 CD21                <1>  int 21h
  1100 00000233 8C06[9232]          <1>  mov word [Old08Irqseg], es
  1100 00000237 891E[9032]          <1>  mov word [Old08Irqofs], bx
  1100 0000023B B80825              <1>  mov ax, 02508h
  1100 0000023E BA[4B04]            <1>  mov dx, irqHandler08
  1100 00000241 CD21                <1>  int 21h
  1100                              <1> 
  1100 00000243 BB510D              <1>  mov bx, 3409
  1100 00000246 E83C03              <1>  call setTimer
  1101                                  		startKBDHandler
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101                              <1> 
  1101 00000249 90                  <1>  nop
  1102                                  		cls
  1102 0000024A 1E                  <1>  push ds
  1102 0000024B 8E06[4841]          <1>  mov es, word [bseg]
  1102 0000024F 6800A0              <1>  push 0A000h
  1102 00000252 1F                  <1>  pop ds
  1102                              <1> 
  1102                              <1> 
  1102 00000253 BE4006              <1>  mov si, 320*5
  1102 00000256 31FF                <1>  xor di, di
  1102 00000258 B9007D              <1>  mov cx, 32000
  1102                              <1> clsloop:
  1102 0000025B AC                  <1>  lodsb
  1102 0000025C AA                  <1>  stosb
  1102 0000025D AA                  <1>  stosb
  1102 0000025E E2FB                <1>  loop clsloop
  1102 00000260 1F                  <1>  pop ds
  1103                                  mainloop:
  1104 00000261 B401                    		mov	ah, 1	; Check keyboard buffer
  1105 00000263 CD16                    		int	16h	; Keyboard interrupt
  1106 00000265 0F85AF01                		jnz	_exit_  ; exit
  1107                                  
  1108                                  		setPalette2
  1108 00000269 30C0                <1>  xor al, al
  1108 0000026B BAC803              <1>  mov dx, 3C8h
  1108 0000026E EE                  <1>  out dx, al
  1108 0000026F 42                  <1>  inc dx
  1108 00000270 BE[0A13]            <1>  mov si, palette
  1108 00000273 B90003              <1>  mov cx, 768
  1108 00000276 F36E                <1>  rep outsb
  1109                                  
  1110                                  		scriptIt
  1110 00000278 8B0E[0613]          <1>  mov cx, word [ticker]
  1110 0000027C C706[0613]0000      <1>  mov word [ticker], 0
  1110 00000282 09C9                <1>  or cx, cx
  1110 00000284 0F848700            <1>  jz sItickerNull
  1110                              <1> sImloop:
  1110 00000288 51                  <1>  push cx
  1110 00000289 BE[F812]            <1>  mov si, zspeed
  1110 0000028C FF4C0A              <1>  dec word [si+10]
  1110                              <1> 
  1110 0000028F 7928                <1>  jns short sIwaitTimer
  1110 00000291 8B5C08              <1>  mov bx, word [si+8]
  1110                              <1> 
  1110 00000294 8A87[E611]          <1>  mov al, byte [bx+script]
  1110 00000298 08C0                <1>  or al, al
  1110 0000029A 0F847A01            <1>  jz _exit_
  1110 0000029E 89C3                <1>  mov bx, ax
  1110 000002A0 80E307              <1>  and bl, 7
  1110 000002A3 885C0C              <1>  mov byte [si+12], bl
  1110                              <1> 
  1110 000002A6 FECB                <1>  dec bl
  1110 000002A8 7504                <1>  jnz short sInegateTurn
  1110                              <1> 
  1110 000002AA F71E[6312]          <1>  neg word [zstep]
  1110                              <1> sInegateTurn:
  1110 000002AE 25F800              <1>  and ax, 0F8h
  1110 000002B1 01C0                <1>  add ax, ax
  1110 000002B3 89440A              <1>  mov word [si+10], ax
  1110                              <1> 
  1110 000002B6 FF4408              <1>  inc word [si+8]
  1110                              <1> 
  1110                              <1> sIwaitTimer:
  1110 000002B9 8A440C              <1>  mov al, byte [si+12]
  1110                              <1> 
  1110 000002BC 98                  <1>  cbw
  1110                              <1> 
  1110 000002BD 48                  <1>  dec ax
  1110 000002BE 7507                <1>  jnz short sInoturn
  1110                              <1> 
  1110 000002C0 8B1E[6312]          <1>  mov bx, word [zstep]
  1110 000002C4 015C06              <1>  add word [si+6], bx
  1110                              <1> 
  1110                              <1> 
  1110                              <1> sInoturn:
  1110                              <1> 
  1110 000002C7 B90300              <1>  mov cx, 3
  1110                              <1> sIrotateLoop:
  1110 000002CA 48                  <1>  dec ax
  1110 000002CB 7502                <1>  jnz short sInoIncrement
  1110                              <1> 
  1110 000002CD FF04                <1>  inc word [si]
  1110                              <1> 
  1110                              <1> sInoIncrement:
  1110 000002CF 48                  <1>  dec ax
  1110 000002D0 7502                <1>  jnz short sInoDecrement
  1110                              <1> 
  1110 000002D2 FF0C                <1>  dec word [si]
  1110                              <1> 
  1110                              <1> sInoDecrement:
  1110 000002D4 46                  <1>  inc si
  1110 000002D5 46                  <1>  inc si
  1110 000002D6 E2F2                <1>  loop sIrotateLoop
  1110                              <1> 
  1110 000002D8 BE[FA12]            <1>  mov si, zspeed+2
  1110                              <1> 
  1110 000002DB B103                <1>  mov cl, 3
  1110                              <1> sIpushloop:
  1110 000002DD AD                  <1>  lodsw
  1110 000002DE C1F802              <1>  sar ax, 2
  1110 000002E1 50                  <1>  push ax
  1110 000002E2 E2F9                <1>  loop sIpushloop
  1110                              <1> 
  1110 000002E4 6B44FC10            <1>  imul ax, word [si-4], 16
  1110 000002E8 50                  <1>  push ax
  1110 000002E9 E8E507              <1>  call calcRotMat
  1110                              <1> 
  1110 000002EC B103                <1>  mov cl, 3
  1110 000002EE 31F6                <1>  xor si, si
  1110                              <1> sImoveLoop:
  1110 000002F0 D984[A412]          <1>  fld dword [si+owmat+24]
  1110 000002F4 DE0E[F812]          <1>  fimul word [zspeed]
  1110 000002F8 DE36[D80C]          <1>  fidiv word [CONST1792]
  1110 000002FC D884[8012]          <1>  fadd dword [si+ob]
  1110 00000300 D99C[8012]          <1>  fstp dword [si+ob]
  1110 00000304 83C604              <1>  add si, 4
  1110 00000307 E2E7                <1>  loop sImoveLoop
  1110 00000309 59                  <1>  pop cx
  1110 0000030A 49                  <1>  dec cx
  1110 0000030B 0F8579FF            <1>  jnz sImloop
  1110                              <1> sItickerNull:
  1111                                  
  1112                                  		animDoor
  1112 0000030F A1[6512]            <1>  mov ax, word [doortimer]
  1112 00000312 09C0                <1>  or ax, ax
  1112 00000314 7904                <1>  jns short aDnounder
  1112 00000316 31C0                <1>  xor ax, ax
  1112 00000318 EB2F                <1>  jmp short alreadydrawed
  1112                              <1> aDnounder:
  1112 0000031A 803E[0513]00        <1>  cmp byte [once], 0
  1112 0000031F 7528                <1>  jne short alreadydrawed
  1112 00000321 FE06[0513]          <1>  inc byte [once]
  1112 00000325 50                  <1>  push ax
  1112                              <1>  starbackground
  1112 00000326 8E06[4841]          <2>  mov es, word [bseg]
  1112 0000032A B96400              <2>  mov cx, 100
  1112                              <2> starbackloop:
  1112 0000032D 51                  <2>  push cx
  1112 0000032E BBC0C1              <2>  mov bx, 320*155
  1112 00000331 E83E02              <2>  call rnd
  1112 00000334 050019              <2>  add ax, 320*20
  1112 00000337 89C7                <2>  mov di, ax
  1112 00000339 80E407              <2>  and ah, 7
  1112 0000033C BA3B01              <2>  mov dx, 320-5
  1112 0000033F B90200              <2>  mov cx, 2
  1112 00000342 E8A501              <2>  call setstarbob
  1112 00000345 59                  <2>  pop cx
  1112 00000346 E2E5                <2>  loop starbackloop
  1112 00000348 58                  <1>  pop ax
  1112                              <1> alreadydrawed:
  1112 00000349 83F818              <1>  cmp ax, 24
  1112 0000034C 7E03                <1>  jle short aDnoover
  1112 0000034E B81800              <1>  mov ax, 24
  1112                              <1> aDnoover:
  1112 00000351 C1E006              <1>  shl ax, 6
  1112 00000354 1E                  <1>  push ds
  1112 00000355 8E06[6441]          <1>  mov es, word [tseg+26]
  1112 00000359 8E1E[6841]          <1>  mov ds, word [tseg+30]
  1112 0000035D 89C6                <1>  mov si, ax
  1112 0000035F 31FF                <1>  xor di, di
  1112 00000361 B90004              <1>  mov cx, 1024
  1112 00000364 F3A5                <1>  rep movsw
  1112 00000366 BE0008              <1>  mov si, 2048
  1112 00000369 29C6                <1>  sub si, ax
  1112 0000036B 56                  <1>  push si
  1112 0000036C B504                <1>  mov ch, 4
  1112 0000036E F3A5                <1>  rep movsw
  1112 00000370 5F                  <1>  pop di
  1112 00000371 89C1                <1>  mov cx, ax
  1112 00000373 31C0                <1>  xor ax, ax
  1112 00000375 F3AB                <1>  rep stosw
  1112 00000377 1F                  <1>  pop ds
  1113                                  
  1114 00000378 1E                      		push	ds
  1115 00000379 8E06[4641]              		mov	es, word [vseg]
  1116 0000037D 8E1E[4841]              		mov	ds, word [bseg]
  1117 00000381 E88501                  		call	copyseg
  1118 00000384 1F                      		pop	ds
  1119                                  
  1120                                  		rotation
  1120 00000385 8B0E[6A16]          <1>  mov cx, word [o+object.panz]
  1120 00000389 BE[6E16]            <1>  mov si, o+object.p
  1120 0000038C BF[52C3]            <1>  mov di, rp
  1120                              <1> rotmlp:
  1120 0000038F BB[B012]            <1>  mov bx, wmat
  1120 00000392 BA0300              <1>  mov dx, 3
  1120                              <1> rotilp:
  1120 00000395 DF04                <1>  fild word [si+0]
  1120 00000397 D826[8012]          <1>  fsub dword [ob+vector.x]
  1120 0000039B D80F                <1>  fmul dword [bx+0]
  1120 0000039D DF4402              <1>  fild word [si+2]
  1120 000003A0 D826[8412]          <1>  fsub dword [ob+vector.y]
  1120 000003A4 D84F04              <1>  fmul dword [bx+4]
  1120 000003A7 DF4404              <1>  fild word [si+4]
  1120 000003AA D826[8812]          <1>  fsub dword [ob+vector.z]
  1120 000003AE D84F08              <1>  fmul dword [bx+8]
  1120                              <1> 
  1120                              <1> 
  1120 000003B1 DEC1                <1>  faddp
  1120 000003B3 DEC1                <1>  faddp
  1120 000003B5 D91D                <1>  fstp dword [di]
  1120 000003B7 83C704              <1>  add di, 4
  1120 000003BA 83C30C              <1>  add bx, 12
  1120 000003BD 4A                  <1>  dec dx
  1120 000003BE 75D5                <1>  jnz short rotilp
  1120 000003C0 83C608              <1>  add si, 8
  1120 000003C3 E2CA                <1>  loop rotmlp
  1121                                  		sortFaces
  1121 000003C5 1E                  <1>  push ds
  1121 000003C6 07                  <1>  pop es
  1121 000003C7 BF[12D6]            <1>  mov di, facei
  1121 000003CA 57                  <1>  push di
  1121 000003CB BE[EE22]            <1>  mov si, o+object.f
  1121 000003CE 89F0                <1>  mov ax, si
  1121 000003D0 8B0E[6C16]          <1>  mov cx, word [o+object.fanz]
  1121                              <1> sFmloop:
  1121 000003D4 D9EE                <1>  fldz
  1121 000003D6 51                  <1>  push cx
  1121 000003D7 B90400              <1>  mov cx, 4
  1121                              <1> sFiloop:
  1121 000003DA 6B1C0C              <1>  imul bx, word [si], 12
  1121 000003DD 46                  <1>  inc si
  1121 000003DE 46                  <1>  inc si
  1121 000003DF D8A7[5AC3]          <1>  fsub dword [bx+rp+vector.z]
  1121 000003E3 E2F5                <1>  loop sFiloop
  1121 000003E5 59                  <1>  pop cx
  1121 000003E6 DF1D                <1>  fistp word [di]
  1121 000003E8 47                  <1>  inc di
  1121 000003E9 47                  <1>  inc di
  1121 000003EA AB                  <1>  stosw
  1121 000003EB 83C00A              <1>  add ax, 10
  1121 000003EE 46                  <1>  inc si
  1121 000003EF 46                  <1>  inc si
  1121 000003F0 E2E2                <1>  loop sFmloop
  1121 000003F2 57                  <1>  push di
  1121 000003F3 E83D01              <1>  call qsort
  1122                                  
  1123 000003F6 8B0E[6C16]              		mov	cx, word [o+object.fanz]
  1124 000003FA BE[12D6]                		mov	si, facei
  1125                                  drawloop:
  1126 000003FD AD                      		lodsw
  1127 000003FE AD                      		lodsw
  1128 000003FF 89C3                    		mov	bx, ax ; face address in 'o+object.f'
  1129 00000401 60                      		pusha
  1130 00000402 E8DB04                  		call	drawclippedface
  1131 00000405 61                      		popa
  1132 00000406 E2F5                    		loop	drawloop
  1133                                  	
  1134 00000408 1E                      		push	ds
  1135 00000409 6800A0                  		push	0A000h
  1136 0000040C 07                      		pop	es
  1137 0000040D 8E1E[4641]              		mov	ds, word [vseg]
  1138 00000411 E8F500                  		call	copyseg
  1139 00000414 1F                      		pop	ds
  1140 00000415 E949FE                  		jmp	mainloop
  1141                                  loc_err_exit:
  1142                                  _exit_:
  1143 00000418 0E                      		push	cs
  1144 00000419 1F                      		pop	ds
  1145 0000041A 8B26[8E32]              		mov	sp, word [oldstack]
  1146                                  		silence
  1146 0000041E B90F00              <1>  mov cx, 15
  1146                              <1> Siloop:
  1146 00000421 89C8                <1>  mov ax, cx
  1146 00000423 04B0                <1>  add al, CMD_CHANGEPARAM
  1146 00000425 E86A01              <1>  call writeGM
  1146 00000428 B07B                <1>  mov al, MOD_ALLNOTESOFF
  1146 0000042A E86501              <1>  call writeGM
  1146 0000042D 30C0                <1>  xor al, al
  1146 0000042F E86001              <1>  call writeGM
  1146 00000432 E2ED                <1>  loop Siloop
  1146                              <1> Sinosound:
  1147                                  		stopKBDHandler
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147                              <1> 
  1147 00000434 90                  <1>  nop
  1148                                  		stopTimer
  1148 00000435 1E                  <1>  push ds
  1148 00000436 31DB                <1>  xor bx, bx
  1148 00000438 E84A01              <1>  call setTimer
  1148 0000043B B80825              <1>  mov ax, 02508h
  1148 0000043E C516[9032]          <1>  lds dx, [Old08IrqPtr]
  1148 00000442 CD21                <1>  int 21h
  1148 00000444 1F                  <1>  pop ds
  1149                                  		set80x25
  1149 00000445 B80300              <1>  mov ax, 3
  1149 00000448 CD10                <1>  int 10h
  1149                              <1> 
  1150 0000044A 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 0000044B 60                      		pusha
  1164                                  		
  1165 0000044C 1E                      		push	ds
  1166 0000044D 06                      		push	es
  1167                                  
  1168 0000044E 0E                      		push	cs
  1169 0000044F 1F                      		pop	ds
  1170                                  
  1171                                  		playsong
  1171 00000450 8B0E[0813]          <1>  mov cx, word [tracks]
  1171 00000454 BE[0A16]            <1>  mov si, channels
  1171                              <1> PSmloop:
  1171 00000457 FF0C                <1>  dec word [si+channel.del]
  1171 00000459 7F2C                <1>  jg short PSdelayed
  1171 0000045B 8B4402              <1>  mov ax, word [si+channel.trk]
  1171 0000045E 0480                <1>  add al, CMD_NOTEOFF
  1171 00000460 E84201              <1>  call setnote
  1171 00000463 8B5C04              <1>  mov bx, word [si+channel.adr]
  1171 00000466 B47F                <1>  mov ah, 127
  1171 00000468 803F00              <1>  cmp byte [bx], 0
  1171 0000046B 7414                <1>  jz short PStrackend
  1171 0000046D 8A27                <1>  mov ah, byte [bx]
  1171 0000046F 886403              <1>  mov byte [si+channel.ln], ah
  1171 00000472 8A4402              <1>  mov al, byte [si+channel.trk]
  1171 00000475 0490                <1>  add al, CMD_NOTEON
  1171 00000477 E82B01              <1>  call setnote
  1171 0000047A 8A4701              <1>  mov al, byte [bx+1]
  1171 0000047D B31D                <1>  mov bl, SONGSPEED
  1171 0000047F F6E3                <1>  mul bl
  1171                              <1> PStrackend:
  1171 00000481 8904                <1>  mov word [si+channel.del], ax
  1171 00000483 83440402            <1>  add word [si+channel.adr], 2
  1171                              <1> PSdelayed:
  1171 00000487 83C606              <1>  add si, 6
  1171 0000048A E2CB                <1>  loop PSmloop
  1171                              <1> PSnosound:
  1172                                  
  1173 0000048C FF06[0613]              		inc	word [ticker]
  1174 00000490 FE06[4541]              		inc	byte [twice]
  1175 00000494 8026[4541]07            		and	byte [twice], 7
  1176 00000499 7547                    		jnz	short iH08notyet
  1177                                  
  1178                                  		colorCycle
  1178                              <1>  base equ 6*32
  1178                              <1>  range equ 32
  1178                              <1> 
  1178 0000049B 1E                  <1>  push ds
  1178 0000049C 07                  <1>  pop es
  1178 0000049D BF[4A15]            <1>  mov di, palette+(base*3)
  1178 000004A0 89FE                <1>  mov si, di
  1178 000004A2 AD                  <1>  lodsw
  1178                              <1> 
  1178 000004A3 46                  <1>  inc si
  1178 000004A4 B95D00              <1>  mov cx, (range*3-3)
  1178 000004A7 F3A4                <1>  rep movsb
  1178 000004A9 AB                  <1>  stosw
  1178                              <1> 
  1179                                  		animStars
  1179                              <1>  _base equ 7*32
  1179                              <1> 
  1179 000004AA 8E06[4C41]          <1>  mov es, word [tseg+2]
  1179 000004AE E80601              <1>  call clearFrac
  1179                              <1> 
  1179 000004B1 B11E                <1>  mov cl, 30
  1179 000004B3 BB[EB40]            <1>  mov bx, stars
  1179                              <1> aSoloop:
  1179 000004B6 FE0F                <1>  dec byte [bx]
  1179 000004B8 8A27                <1>  mov ah, byte [bx]
  1179 000004BA 80E43F              <1>  and ah, 63
  1179 000004BD 80FC1F              <1>  cmp ah, 31
  1179 000004C0 7605                <1>  jbe short aSnonot
  1179 000004C2 F6D4                <1>  not ah
  1179 000004C4 80E41F              <1>  and ah, 31
  1179                              <1> aSnonot:
  1179 000004C7 D0EC                <1>  shr ah, 1
  1179 000004C9 8B7F01              <1>  mov di, word [bx+1]
  1179 000004CC 51                  <1>  push cx
  1179 000004CD 53                  <1>  push bx
  1179                              <1> 
  1179 000004CE BA3B00              <1>  mov dx, 64-5
  1179 000004D1 B900E0              <1>  mov cx, _base*256+0
  1179 000004D4 E81300              <1>  call setstarbob
  1179                              <1> 
  1179 000004D7 5B                  <1>  pop bx
  1179 000004D8 59                  <1>  pop cx
  1179 000004D9 83C303              <1>  add bx, 3
  1179 000004DC E2D8                <1>  loop aSoloop
  1180                                  	
  1181 000004DE FF06[6512]              		inc	word [doortimer]
  1182                                  iH08notyet:
  1183 000004E2 B020                    		mov	al, 20h
  1184 000004E4 E620                    		out	20h, al
  1185                                  		
  1186 000004E6 07                      		pop	es
  1187 000004E7 1F                      		pop	ds
  1188 000004E8 61                      		popa
  1189 000004E9 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 000004EA BE[240F]                		mov	si, bob
  1221 000004ED B305                    		mov	bl, 5
  1222                                  yloop:
  1223 000004EF B705                    		mov	bh, 5
  1224                                  xloop:
  1225 000004F1 AC                      		lodsb
  1226 000004F2 28E0                    		sub	al, ah
  1227 000004F4 7E07                    		jle	short aSnodraw
  1228 000004F6 00E8                    		add	al, ch
  1229 000004F8 D2E0                    		shl	al, cl
  1230 000004FA 268805                  		mov	byte [es:di], al
  1231                                  		;mov	byte [di], al
  1232                                  aSnodraw:
  1233 000004FD 47                      		inc	di
  1234 000004FE FECF                    		dec	bh
  1235 00000500 75EF                    		jnz	short xloop
  1236 00000502 01D7                    		add	di, dx
  1237 00000504 FECB                    		dec	bl
  1238 00000506 75E7                    		jnz	short yloop
  1239 00000508 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 00000509 31FF                    		xor	di, di
  1250 0000050B 31F6                    		xor	si, si
  1251 0000050D B9803E                  		mov	cx, 16000 ; 3E80h
  1252 00000510 F366A5                  		rep movsd
  1253 00000513 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 00000514 8A0C                    EPwhile: 	mov	cl, byte [si]
  1264 00000516 08C9                    		or	cl, cl
  1265 00000518 7415                    		jz	short EPendwhile
  1266 0000051A 7910                    		jns	short EPnote
  1267                                  EPcall:
  1268 0000051C 51                      		push	cx
  1269 0000051D 56                      		push	si
  1270 0000051E 46                      		inc	si
  1271 0000051F E8F2FF                  		call	expand
  1272 00000522 5E                      		pop	si
  1273 00000523 59                      		pop	cx
  1274 00000524 FEC1                    		inc	cl
  1275 00000526 75F4                    		jnz	short EPcall
  1276 00000528 89C6                    		mov	si, ax
  1277 0000052A EBE8                    		jmp	short EPwhile 
  1278                                  EPnote:
  1279 0000052C A5                      		movsw
  1280 0000052D EBE5                    		jmp	short EPwhile
  1281                                  EPendwhile:
  1282 0000052F 46                      		inc	si
  1283 00000530 89F0                    		mov	ax, si
  1284 00000532 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 00000533 58                      		pop	ax 	; get address
  1295 00000534 59                      		pop	cx	; get 2. param r
  1296 00000535 5B                      		pop	bx	; get 1. param l
  1297 00000536 50                      		push	ax	; store address
  1298                                  
  1299 00000537 39D9                    		cmp	cx, bx
  1300 00000539 7E36                    		jle	short QSendrek
  1301 0000053B 89DE                    		mov	si, bx
  1302 0000053D 89CF                    		mov	di, cx  	
  1303 0000053F 8B14                    		mov	dx, word [si]
  1304                                  QSrepeat:
  1305 00000541 3914                    QSwhile1:	cmp	word [si], dx
  1306 00000543 7E05                    		jle	short QSwhile2
  1307 00000545 83C604                  		add	si, 4
  1308 00000548 EBF7                    		jmp	short QSwhile1
  1309                                  QSwhile2:
  1310 0000054A 3915                    		cmp	word [di], dx
  1311 0000054C 7D05                    		jnl	short QSwhile2e
  1312 0000054E 83EF04                  		sub	di, 4
  1313 00000551 EBF7                    		jmp	short QSwhile2
  1314                                  QSwhile2e:
  1315 00000553 39FE                    		cmp	si, di
  1316 00000555 7F0C                    		jg	short QSnoswap
  1317                                  		;jg	short _QSnoswap
  1318 00000557 66AD                    		lodsd
  1319 00000559 668705                  		xchg	eax, dword [di]
  1320 0000055C 668944FC                		mov	dword [si-4], eax
  1321 00000560 83EF04                  		sub	di, 4
  1322                                  QSnoswap:
  1323 00000563 39FE                    		cmp	si, di
  1324 00000565 7EDA                    		jle	short QSrepeat
  1325                                  ;_QSnoswap:
  1326 00000567 56                      		push	si 
  1327 00000568 51                      		push	cx
  1328 00000569 53                      		push	bx
  1329 0000056A 57                      		push	di
  1330 0000056B E8C5FF                  		call	qsort
  1331 0000056E E8C2FF                  		call	qsort
  1332                                  QSendrek:
  1333 00000571 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 00000572 BE[DE0C]                		mov	si, randommul
  1344 00000575 66AD                    		lodsd
  1345 00000577 66F724                  		mul	dword [si] ; randomseed
  1346 0000057A 6640                    		inc	eax
  1347 0000057C 668904                  		mov	dword [si], eax  ; randomseed
  1348 0000057F AD                      		lodsw
  1349 00000580 AD                      		lodsw
  1350 00000581 F7E3                    		mul	bx
  1351 00000583 92                      		xchg	ax, dx
  1352 00000584 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 00000585 B036                    		mov	al, 36h
  1364 00000587 E643                    		out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1365 00000589 88D8                    		mov	al, bl
  1366 0000058B E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1367 0000058D 88F8                    		mov	al, bh
  1368 0000058F E640                    		out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1369 00000591 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 00000592 BA3103                  		mov	dx, GMPort  ; 331h
  1380 00000595 50                      		push	ax
  1381 00000596 31C0                    		xor	ax, ax
  1382                                  busy:
  1383 00000598 FECC                    		dec	ah
  1384 0000059A 7405                    		jz	short timeOut
  1385 0000059C EC                      		in	al, dx
  1386 0000059D A840                    		test	al, 40h
  1387 0000059F 75F7                    		jnz	short busy
  1388                                  timeOut:
  1389 000005A1 58                      		pop	ax
  1390 000005A2 4A                      		dec	dx
  1391 000005A3 EE                      		out	dx, al
  1392 000005A4 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 000005A5 E80600                  		call	setinstr
  1403 000005A8 B07F                    		mov	al, 127	; 7Fh
  1404 000005AA E8E5FF                  		call	writeGM
  1405 000005AD 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 000005AE E8E1FF                  		call	writeGM
  1416 000005B1 88E0                    		mov	al, ah
  1417 000005B3 E8DCFF                  		call	writeGM
  1418 000005B6 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 000005B7 31C0                    		xor	ax, ax
  1429                                  setFrac:
  1430 000005B9 31FF                    		xor	di, di
  1431 000005BB B90010                  		mov	cx, 4096 ; 1000h
  1432 000005BE F3AA                    		rep stosb
  1433 000005C0 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 000005C1 55                      		push	bp
  1447 000005C2 89E5                    		mov	bp, sp
  1448                                  
  1449 000005C4 8E87[4A41]              		mov	es, word [bx+tseg]
  1450 000005C8 E8ECFF                  		call	clearFrac
  1451                                  
  1452 000005CB BE[AB40]                		mov	si, circletab
  1453 000005CE 8B5604                  		mov	dx, word [bp+rad]
  1454 000005D1 88D0                    		mov	al, dl
  1455 000005D3 F6EA                    		imul	dl
  1456 000005D5 89C7                    		mov	di, ax
  1457                                  		;mov	bx, ax
  1458 000005D7 89D1                    		mov	cx, dx
  1459 000005D9 01C9                    		add	cx, cx
  1460                                  CCTloop:
  1461 000005DB 88D0                    		mov	al, dl
  1462 000005DD F6EA                    		imul	dl
  1463 000005DF F7D8                    		neg	ax
  1464 000005E1 01F8                    		add	ax, di
  1465                                  		;add	ax, bx
  1466 000005E3 8904                    		mov	word [si], ax
  1467 000005E5 DF04                    		fild	word [si]
  1468 000005E7 D9FA                    		fsqrt
  1469 000005E9 DF1C                    		fistp	word [si]
  1470 000005EB 46                      		inc	si
  1471 000005EC 46                      		inc	si
  1472 000005ED 4A                      		dec	dx
  1473 000005EE E2EB                    		loop	CCTloop
  1474                                  
  1475 000005F0 8B4E06                  		mov	cx, word [bp+num]
  1476                                  SBloop1:
  1477 000005F3 51                      		push	cx
  1478 000005F4 BB0010                  		mov	bx, 4096 ; 1000h
  1479 000005F7 E878FF                  		call	rnd
  1480 000005FA 89C7                    		mov	di, ax
  1481 000005FC BE[AB40]                		mov	si, circletab
  1482 000005FF 8B4E04                  		mov	cx, word [bp+rad]
  1483 00000602 01C9                    		add	cx, cx
  1484                                  SBloop2:
  1485 00000604 51                      		push	cx
  1486 00000605 AD                      		lodsw
  1487 00000606 89C1                    		mov	cx, ax
  1488 00000608 01C9                    		add	cx, cx
  1489 0000060A 740E                    		jz	short SBskip
  1490 0000060C 57                      		push	di
  1491 0000060D 29C7                    		sub	di, ax
  1492                                  SBloop3:
  1493 0000060F 81E7FF0F                		and	di, 4095  ; 0FFFh
  1494 00000613 26FE05                  		inc	byte [es:di]
  1495 00000616 47                      		inc	di
  1496 00000617 E2F6                    		loop	SBloop3
  1497 00000619 5F                      		pop	di
  1498                                  SBskip:
  1499 0000061A 83C740                  		add	di, 64 ; 40h
  1500 0000061D 59                      		pop	cx
  1501 0000061E E2E4                    		loop	SBloop2
  1502 00000620 59                      		pop	cx
  1503 00000621 E2D0                    		loop	SBloop1
  1504 00000623 5D                      		pop	bp
  1505 00000624 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 00000627 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                                  		;mov	ax, 32767
  1546                                  		;mov	dx, ax
  1547                                  		;mov	bx, ax
  1548                                  		;neg	bx	; -32767 ; 8001h
  1549                                  		;mov	si, bx	; -32767
  1550                                  
  1551 0000062B B80180                                  mov	ax,-32767
  1552 0000062E 89C3                                    mov	bx,ax
  1553 00000630 89C6                                    mov	si,ax
  1554 00000632 F7D8                                    neg	ax
  1555 00000634 89C2                                    mov	dx,ax
  1556                                  		
  1557                                  		; di = dcf.p2 address
  1558 00000636 8B7E08                  		mov	di, word [bp+pol] ; [bp+8] ; dcf.p2 ; face structure
  1559                                  
  1560 00000639 31C9                    		xor	cx, cx
  1561                                  minmax:
  1562 0000063B 3B4512                  		cmp	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1563 0000063E 7E03                    		jle	short noswap1
  1564 00000640 8B4512                  		mov	ax, word [di+2+edge.e+edges.x] ; [di+12h]
  1565                                  noswap1:
  1566 00000643 3B5D12                  		cmp	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1567 00000646 7D03                    		jge	short noswap2
  1568 00000648 8B5D12                  		mov	bx, word [di+2+edge.e+edges.x] ; [di+12h]
  1569                                  noswap2:
  1570 0000064B 3B550C                  		cmp	dx, word [di+edge.py]  ; [di+0Ch]
  1571 0000064E 7E0B                    		jle	short noswap3
  1572 00000650 8B550C                  		mov	dx, word [di+edge.py]  ; [di+0Ch]
  1573 00000653 898E7CFF                		mov	word [bp+sstp.l], cx   ; [bp-84h]
  1574 00000657 898E7AFF                		mov	word [bp+sstp.r], cx   ; [bp-86h]
  1575                                  noswap3:
  1576 0000065B 3B750C                  		cmp	si, word [di+edge.py]  ; [di+0Ch]
  1577 0000065E 7D03                    		jge	short noswap4
  1578 00000660 8B750C                  		mov	si, word [di+edge.py]  ; [di+0Ch]
  1579                                  noswap4:
  1580 00000663 83C724                  		add	di, 36 ; 24h
  1581 00000666 41                      		inc	cx
  1582 00000667 3B4E06                  		cmp	cx, word [bp+n] ; [bp+6]
  1583                                  				   ; dcf.j ; number of visible edges/points
  1584 0000066A 75CF                    		jne	short minmax
  1585                                  
  1586 0000066C 83FB00                  		cmp	bx, 0
  1587 0000066F 0F8C1F02                		jl	exitDraw
  1588 00000673 3D4001                  		cmp	ax, XMAX  ; 140h
  1589 00000676 0F8F1802                		jg	exitDraw
  1590                                  
  1591 0000067A 83FE15                  		cmp	si, YMIN  ; 15h
  1592 0000067D 0F8C1102                		jl	exitDraw
  1593 00000681 81FAB300                		cmp	dx, YMAX  ; 0B3h
  1594 00000685 0F8F0902                		jg	exitDraw
  1595 00000689 895682                  		mov	word [bp+sstp.miny], dx ; [bp-7Eh]
  1596 0000068C 897680                  		mov	word [bp+sstp.maxy], si ; [bp-80h]
  1597                                  
  1598                                  		;{ down clipping }
  1599 0000068F 817E80B300              		cmp	word [bp+sstp.maxy], YMAX ; 0B3h
  1600 00000694 7E05                    		jle	short noclipdown
  1601 00000696 C74680B300              		mov	word [bp+sstp.maxy], YMAX ; 0B3h
  1602                                  noclipdown:
  1603 0000069B 8B4682                  		mov	ax, word [bp+sstp.miny] ; [bp-7Eh]
  1604 0000069E 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1605 000006A1 0F84ED01                		je	exitDraw
  1606 000006A5 89867EFF                		mov	word [bp+sstp.y], ax    ; [bp-82h]
  1607 000006A9 8B5E04                  		mov	bx, word [bp+col]	; [bp+4]
  1608                                  					   ; dcf.col ; shade/color value
  1609 000006AC 01DB                    		add	bx, bx
  1610 000006AE 8E06[4641]              		mov	es, word [vseg]
  1611 000006B2 8EA7[4A41]              		mov	fs, word [bx+tseg]
  1612                                  for:
  1613 000006B6 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1614 000006BA 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1615 000006BD 0F8FD101                		jg	exitDraw
  1616                                  		;je	exitwhile2
  1617                                  while1:
  1618 000006C1 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1619 000006C5 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1620 000006C8 7D25                    		jge	short while2	
  1621                                  
  1622 000006CA 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1623 000006CD 6B9E7CFF24              		imul	bx, word [bp+sstp.l], 36 ; [bp-84h]
  1624 000006D2 01DE                    		add	si, bx
  1625                                  		;mov	si, bx
  1626                                  		;add	si, word [bp+pol]	; [bp+8]
  1627                                  
  1628 000006D4 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1629 000006D7 7516                    		jne	short while2
  1630                                  
  1631 000006D9 8B9E7CFF                		mov	bx, word [bp+sstp.l]	; [bp-84h]
  1632 000006DD 4B                      		dec	bx
  1633 000006DE 7D04                    		jge	short nounder
  1634 000006E0 8B5E06                  		mov	bx, word [bp+n]		; [bp+6]
  1635                                  					   ; dcf.j ; visible edges/points
  1636 000006E3 4B                      		dec	bx
  1637                                  nounder:
  1638 000006E4 899E7CFF                		mov	word [bp+sstp.l], bx	; [bp-84h]
  1639 000006E8 31FF                    		xor	di, di
  1640 000006EA E8A901                  		call	calcDeltas
  1641                                  		;mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1642                                  		;cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1643                                  		;jge	short exitwhile2	
  1644 000006ED EBD2                    		jmp	short while1
  1645                                  while2:
  1646 000006EF 8B867EFF                		mov	ax, word [bp+sstp.y]    ; [bp-82h]
  1647 000006F3 3B4680                  		cmp	ax, word [bp+sstp.maxy] ; [bp-80h]
  1648 000006F6 7D27                    		jge	short exitwhile2
  1649 000006F8 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1650 000006FB 6B9E7AFF24              		imul	bx, word [bp+sstp.r], 36 ; [bp-86h]
  1651 00000700 01DE                    		add	si, bx
  1652                                  		;
  1653                                  		;mov	si, bx
  1654                                  		;add	si, word [bp+pol]	; [bp+8]
  1655                                  
  1656 00000702 3B440C                  		cmp	ax, word [si+edge.py]	; [si+0Ch]
  1657 00000705 7518                    		jne	short exitwhile2
  1658                                  
  1659 00000707 8B9E7AFF                		mov	bx, word [bp+sstp.r]    ; [bp-86h]
  1660 0000070B 43                      		inc	bx
  1661 0000070C 3B5E06                  		cmp	bx, word [bp+n]		; [bp+6]
  1662 0000070F 7C02                    		jl	short noover
  1663 00000711 31DB                    		xor	bx, bx
  1664                                  noover:
  1665 00000713 899E7AFF                		mov	word [bp+sstp.r], bx	; [bp-86h]
  1666 00000717 BF1400                  		mov	di, 20  ; 14h
  1667 0000071A E87901                  		call	calcDeltas
  1668                                  		;
  1669                                  		;mov	ax, word [bp+sstp.y]	; [bp-82h]
  1670 0000071D EBD0                    		jmp	short while2
  1671                                  exitwhile2:
  1672                                  		;{ up clipping }
  1673 0000071F 83BE7EFF15              		cmp	word [bp+sstp.y], YMIN	; 15h
  1674 00000724 0F8C5301                		jl	clipup
  1675 00000728 6631DB                  		xor	ebx, ebx
  1676 0000072B 6631C9                  		xor	ecx, ecx
  1677 0000072E 8B5EC6                  		mov	bx, word [bp+sstp.edg+2+edges.x] ; [bp-3Ah]
  1678 00000731 895E86                  		mov	word [bp+sstp.mx1], bx  ; [bp-7Ah]
  1679 00000734 8B4EDA                  		mov	cx, word [bp+sstp.edg+20+2+edges.x] ; [bp-26h]
  1680 00000737 894E84                  		mov	word [bp+sstp.mx2], cx  ; [bp-7Ch]
  1681 0000073A 29D9                    		sub	cx, bx
  1682 0000073C 0F843B01                		jz	exitol
  1683 00000740 837E8400                		cmp	word [bp+sstp.mx2], 0 ; [bp-7Ch]
  1684 00000744 0F8E3301                		jle	exitol
  1685 00000748 817E864001              		cmp	word [bp+sstp.mx1], XMAX ; 140h
  1686 0000074D 0F8F2A01                		jg	exitol
  1687                                  
  1688 00000751 F7DB                    		neg	bx
  1689 00000753 7904                    		jns	short myelse
  1690 00000755 31DB                    		xor	bx, bx
  1691 00000757 EB05                    		jmp	short myendif
  1692                                  ;_nodivbyzero:
  1693                                  ;		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1694                                  ;		jmp	short nodivbyzero
  1695                                  myelse:
  1696 00000759 C746860000              		mov	word [bp+sstp.mx1], 0 ; [bp-7Ah]
  1697                                  myendif:
  1698 0000075E BF1000                  		mov	di, 16 ; 10h
  1699                                  addloop1:
  1700                                  		;{ calculate deltas }
  1701 00000761 668B43D8                		mov	eax, dword [bp+di+sstp.edg+20] ; [bp+di-28h]
  1702 00000765 662B43C4                		sub	eax, dword [bp+di+sstp.edg]    ; [bp+di-3Ch]
  1703 00000769 6699                    		cdq
  1704 0000076B E307                    		jcxz	nodivbyzero
  1705                                  		;jcxz	_nodivbyzero
  1706 0000076D 66F7F9                  		idiv	ecx
  1707 00000770 668943B0                		mov	dword [bp+di+sstp.del+40], eax ; [bp+di-50h]
  1708                                  nodivbyzero:
  1709                                  		;{ left clipping }
  1710 00000774 668B43B0                		mov	eax, dword [bp+di+sstp.del+40] ; [bp+di-50h]
  1711 00000778 66F7EB                  		imul	ebx
  1712 0000077B 660343C4                		add	eax, dword [bp+di+sstp.edg]	 ; [bp+di-3Ch]
  1713 0000077F 668943EC                		mov	dword [bp+di+sstp.edg+40], eax ; [bp+di-14h]
  1714 00000783 83EF04                  		sub	di, 4
  1715 00000786 75D9                    		jnz	short addloop1
  1716                                  
  1717 00000788 8B46C0                  		mov	ax, word [bp+sstp.del+40+16]   ; [bp-40h]
  1718                                  		;mov	word [cs:dels_pos+1], ax
  1719 0000078B A3[A00C]                		mov	word [dels_pos_w], ax
  1720                                  
  1721                                  		;{ right clipping }
  1722 0000078E 817E844001              		cmp	word  [bp+sstp.mx2], XMAX  ; [bp-7Ch]
  1723 00000793 7E05                    		jle	short norightclip
  1724 00000795 C746844001              		mov	word  [bp+sstp.mx2], XMAX  ; 140h
  1725                                  norightclip:
  1726 0000079A 69BE7EFF4001            		imul	di, word [bp+sstp.y], 320  ; [bp-82h]
  1727 000007A0 037E86                  		add	di, word [bp+sstp.mx1]	   ; [bp-7Ah]
  1728                                  		
  1729 000007A3 BB0001                  		mov	bx, 256 ; 100h
  1730 000007A6 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1731 000007AA 66F7EB                  		imul	ebx
  1732 000007AD 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1733 000007B1 898674FF                		mov	word [bp+sstp.uu2], ax 	    ; [bp-8Ch]
  1734 000007B5 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1735 000007B9 66F7EB                  		imul	ebx
  1736 000007BC 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1737 000007C0 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1738                                  outloop:
  1739 000007C4 8B4E84                  		mov	cx, word [bp+sstp.mx2]	    ; [bp-7Ch]
  1740 000007C7 2B4E86                  		sub	cx, word [bp+sstp.mx1]	    ; [bp-7Ah]
  1741 000007CA 0F8EAD00                		jle	exitol
  1742 000007CE 83F910                  		cmp	cx, SUBRANGE ; 10h
  1743 000007D1 7E03                    		jle	short lastSeg
  1744 000007D3 B91000                  		mov	cx, SUBRANGE ; 10h
  1745                                  lastSeg:
  1746                                  		;{ uu1:=uu2 }
  1747                                  		;{ vv1:=vv2 }
  1748 000007D6 668B8672FF              		mov	eax, dword [bp+sstp.vv2]    ; [bp-8Eh]
  1749 000007DB 66898676FF              		mov	dword [bp+sstp.vv1], eax    ; [bp-8Ah]
  1750                                  
  1751 000007E0 668B46B4                		mov	eax, dword [bp+sstp.del+40+edges.u] ; [bp-4Ch]
  1752 000007E4 66F7E9                  		imul	ecx
  1753 000007E7 660146F0                		add	dword [bp+sstp.edg+40+edges.u], eax ; [bp-10h]
  1754 000007EB 668B46B8                		mov	eax, dword [bp+sstp.del+40+edges.v] ; [bp-48h]
  1755 000007EF 66F7E9                  		imul	ecx
  1756 000007F2 660146F4                		add	dword [bp+sstp.edg+40+edges.v], eax ; [bp-0Ch]
  1757 000007F6 668B46BC                		mov	eax, dword [bp+sstp.del+40+edges.w] ; [bp-44h]
  1758 000007FA 66F7E9                  		imul	ecx
  1759 000007FD 660146F8                		add	dword [bp+sstp.edg+40+edges.w], eax ; [bp-8]
  1760                                  
  1761 00000801 BB0001                  		mov	bx, 256 ; 100h
  1762 00000804 668B46F0                		mov	eax, dword [bp+sstp.edg+40+edges.u] ; [bp-10h]
  1763 00000808 66F7EB                  		imul	ebx
  1764 0000080B 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1765 0000080F 898674FF                		mov	word [bp+sstp.uu2], ax	     ; [bp-8Ch]
  1766 00000813 668B46F4                		mov	eax, dword [bp+sstp.edg+40+edges.v] ; [bp-0Ch]
  1767 00000817 66F7EB                  		imul	ebx
  1768 0000081A 66F77EF8                		idiv	dword [bp+sstp.edg+40+edges.w] ; [bp-8]
  1769 0000081E 898672FF                		mov	word [bp+sstp.vv2], ax	    ; [bp-8Eh]
  1770                                  
  1771 00000822 8B8674FF                		mov	ax, word [bp+sstp.uu2]	    ; [bp-8Ch]
  1772 00000826 2B8678FF                		sub	ax, word [bp+sstp.uu1]	    ; [bp-88h]
  1773 0000082A 99                      		cwd
  1774 0000082B F7F9                    		idiv	cx
  1775                                  		;mov	word [cs:ddu_pos+2], ax
  1776 0000082D A3[A20C]                		mov	word [ddu_pos_w], ax
  1777                                  
  1778 00000830 8B8672FF                		mov	ax, word [bp+sstp.vv2]	    ; [bp-8Eh]
  1779 00000834 2B8676FF                		sub	ax, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1780 00000838 99                      		cwd
  1781 00000839 F7F9                    		idiv	cx
  1782                                  		;mov	word [cs:ddv_pos+2], ax
  1783 0000083B A3[A40C]                		mov	word [ddv_pos_w], ax
  1784                                  
  1785 0000083E 8BB676FF                		mov	si, word [bp+sstp.vv1]	    ; [bp-8Ah]
  1786 00000842 8B9678FF                		mov	dx, word [bp+sstp.uu1]	    ; [bp-88h]
  1787 00000846 8B46FC                  		mov	ax, word [bp+sstp.edg+40+16] ; [bp-4]
  1788                                  innerloop:
  1789 00000849 89F3                    		mov	bx, si
  1790 0000084B 30DB                    		xor	bl, bl
  1791 0000084D C1EB02                  		shr	bx, 2
  1792 00000850 00F3                    		add	bl, dh
  1793 00000852 648A1F                  		mov	bl, byte [fs:bx]
  1794 00000855 08DB                    		or	bl, bl
  1795 00000857 7409                    		jz	short dels_pos
  1796 00000859 88E7                    		mov	bh, ah
  1797 0000085B 8A9F[7241]              		mov	bl, byte [bx+shadetab]
  1798                                  
  1799 0000085F 26881D                  		mov	byte [es:di], bl
  1800                                  
  1801                                  ;dels_pos:	add ax, 1111h ;{word ptr dels}
  1802                                  ;ddu_pos:	add dx, 1111h ;{word ptr ddu }
  1803                                  ;ddv_pos:	add si, 1111h ;{word ptr ddv }
  1804                                  
  1805                                  dels_pos:	
  1806 00000862 0306[A00C]              		add	ax, word [dels_pos_w]
  1807                                  ddu_pos:	
  1808 00000866 0316[A20C]              		add	dx, word [ddu_pos_w]
  1809                                  ddv_pos:	
  1810 0000086A 0336[A40C]              		add	si, word [ddv_pos_w]
  1811                                  
  1812 0000086E 47                      		inc	di	
  1813 0000086F E2D8                    		loop	innerloop
  1814                                  
  1815 00000871 8946FC                  		mov	word [bp+sstp.edg+40+16], ax ; [bp-4]
  1816 00000874 83468610                		add	word [bp+sstp.mx1], SUBRANGE ; [bp-7Ah]
  1817 00000878 E949FF                  		jmp	outloop
  1818                                  exitol:
  1819 0000087B BF2400                  clipup:		mov	di, 36 ; 24h
  1820                                  addloop:
  1821 0000087E 668B4388                		mov	eax, dword [bp+di+sstp.del]  ; [bp+di-78h]
  1822 00000882 660143C4                		add	dword [bp+di+sstp.edg], eax  ; [bp+di-3Ch]
  1823 00000886 83EF04                  		sub	di, 4
  1824 00000889 79F3                    		jns	short addloop
  1825 0000088B FF867EFF                		inc	word [bp+sstp.y]	 ; [bp-82h]
  1826 0000088F E924FE                  		jmp	for
  1827                                  exitDraw:
  1828 00000892 C9                      		leave
  1829                                  			; mov sp, bp ; pop bp
  1830 00000893 C20600                  		ret	6
  1831                                  
  1832                                    ;***********************************************
  1833                                    ;* descript. : calc deltas for vertical interp.*
  1834                                    ;* parameter : none			         *
  1835                                    ;* sideeffect: all		 	         *
  1836                                    ;***********************************************
  1837                                  
  1838                                  calcDeltas:
  1839 00000896 6BD324                  		imul	dx, bx,	36
  1840 00000899 89F3                    		mov	bx, si
  1841 0000089B 8B7608                  		mov	si, word [bp+pol]	; [bp+8]
  1842 0000089E 01D6                    		add	si, dx
  1843                                  		;
  1844                                  		;mov	si, dx
  1845                                  		;add	si, word [bp+pol]	; [bp+8]	
  1846 000008A0 8B440C                  		mov	ax, word [si+12]
  1847 000008A3 2B867EFF                		sub	ax, word [bp+sstp.y] ; [bp-82h]
  1848 000008A7 660FBFC0                		movsx	eax, ax
  1849 000008AB 6689866AFF              		mov	dword [bp+sstp.dy], eax ; [bp-96h]
  1850 000008B0 B90500                  		mov	cx, 5
  1851                                  cDloop:
  1852 000008B3 668B5710                		mov	edx, dword [bx+16]
  1853 000008B7 668953C4                		mov	dword [bp+di+sstp.edg], edx ; [bp+di-3Ch]
  1854 000008BB 668B4410                		mov	eax, dword [si+16]
  1855 000008BF 6629D0                  		sub	eax, edx
  1856 000008C2 6699                    		cdq
  1857 000008C4 83BE6AFF00              		cmp	word [bp+sstp.dy], 0  ; [bp-96h]
  1858 000008C9 7409                    		je	short cDskip
  1859 000008CB 66F7BE6AFF              		idiv	dword [bp+sstp.dy]    ; [bp-96h]
  1860 000008D0 66894388                		mov	dword [bp+di+sstp.del], eax ; [bp+di-78h]
  1861                                  cDskip:
  1862 000008D4 83C704                  		add	di, 4
  1863 000008D7 83C604                  		add	si, 4
  1864 000008DA 83C304                  		add	bx, 4
  1865 000008DD E2D4                    		loop	cDloop
  1866 000008DF C3                      		retn
  1867                                  
  1868                                  
  1869                                  ;***********************************************
  1870                                  ;* descript. : clip a poly at the viewplane,   *
  1871                                  ;*             project and draw it	       *
  1872                                  ;* parameter : bx:adress of the face	       *
  1873                                  ;* sideeffect: all		 	       *
  1874                                  ;* back      : none			       *
  1875                                  ;***********************************************
  1876                                  
  1877                                  drawclippedface:
  1878                                  
  1879                                  		dcf.d	equ -2	  ; word
  1880                                  		dcf.h	equ -4	  ; word	
  1881                                  		dcf.j	equ -6	  ; word
  1882                                  		dcf.col equ -8	  ; word
  1883                                  		dcf.is_in equ -10 ; byte
  1884                                  		dcf.p0	equ -190  ; poly (5*36 bytes)
  1885                                  		dcf.p2	equ -370  ; poly (5*36 bytes)
  1886                                  		;
  1887                                  		;dcf.pad equ -372  ; padding (for dword boundary)
  1888                                  
  1889 000008E0 C8720100                		enter	370, 0  ; 172h
  1890                                  		;enter	372, 0  ; 174h ; 12/12/2016
  1891                                   			; push bp ; mov bp, sp ; sub sp, 372
  1892 000008E4 BE[420F]                		mov	si, uvtab
  1893 000008E7 31FF                    		xor	di, di
  1894 000008E9 B90400                  		mov	cx, 4
  1895                                  dCFinitloop:
  1896 000008EC 53                      		push	bx	; face addr (in 'o+object.f')(29/01/2017)
  1897 000008ED 8B1F                    		mov	bx, word [bx] ; point index into 'rp:' ? (29/01/2017)
  1898                                  
  1899 000008EF 53                      		push	bx
  1900 000008F0 6BDB0C                  		imul	bx, bx, 12 ; (point vector size = 12 bytes)
  1901 000008F3 81C3[52C3]              		add	bx, rp	  ; addr of rotated point vects (29/01/2017)
  1902 000008F7 668B07                  		mov	eax, dword [bx]
  1903                                  		; vector(4-cx).x
  1904 000008FA 66898342FF              		mov	dword [bp+di+dcf.p0+0], eax	; [bp+di-0BEh]
  1905                                  		; vector(4-cx).y
  1906 000008FF 668B4704                		mov	eax, dword [bx+4]
  1907 00000903 66898346FF              		mov	dword [bp+di+dcf.p0+4], eax	; [bp+di-0BAh]
  1908                                  
  1909 00000908 D94708                  		fld	dword [bx+8]
  1910                                  		; vector(4-cx).z
  1911 0000090B D9934AFF                		fst	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  1912 0000090F DF5EFC                  		fistp	word [bp+dcf.h]		; [bp-04h]	
  1913                                  						; dcf.h = z distance
  1914 00000912 5B                      		pop	bx
  1915                                  
  1916 00000913 8B46FC                  		mov	ax, word [bp+dcf.h]		; [bp-04h]
  1917 00000916 050002                  		add	ax, 512	; 200h
  1918 00000919 0F881601                		js	dCFbackclip   ; not visible ? (29/01/2017) 
  1919                                  
  1920 0000091D 3DFF01                  		cmp	ax, 511 ; 1FFh
  1921 00000920 7E03                    		jle	short intensityOK
  1922 00000922 B8FF01                  		mov	ax, 511 ; 1FFh		; maximum z distance (dept) ?
  1923                                  intensityOK:
  1924 00000925 C1E303                  		shl	bx, 3 ; point index * 8
  1925 00000928 6631D2                  		xor	edx, edx
  1926 0000092B C1E007                  		shl	ax, 7
  1927 0000092E F7A7[7416]              		mul	word [bx+o+6+object.p]	; [bx+o+6+4]
  1928                                  		; edges(4-cx).s
  1929 00000932 66899362FF              		mov	dword [bp+di+dcf.p0+32], edx	; [bp+di-9Eh]
  1930                                  
  1931 00000937 30E4                    		xor	ah, ah
  1932 00000939 8A4404                  		mov	al, byte [si+4]
  1933 0000093C 66C1E010                		shl	eax, 16	; 10h
  1934                                  		; edges(4-cx).v
  1935 00000940 6689835AFF              		mov	dword [bp+di+dcf.p0+24], eax	; [bp+di-0A6h]
  1936                                  
  1937 00000945 AC                      		lodsb
  1938 00000946 66C1E010                		shl	eax, 16	; 10h
  1939                                  		; edges(4-cx).u
  1940 0000094A 66898356FF              		mov	dword [bp+di+dcf.p0+20], eax	; [bp+di-0AAh]
  1941                                  
  1942 0000094F 5B                      		pop	bx
  1943 00000950 43                      		inc	bx
  1944 00000951 43                      		inc	bx
  1945 00000952 83C724                  		add	di, 36	; 24h  ; size of edge
  1946 00000955 E295                    		loop	dCFinitloop
  1947                                  		;dec	cx
  1948                                  		;jnz	dCFinitloop
  1949                                  
  1950                                  		; end of p1, p2, p3, p4 point dimensioning of face
  1951                                  		; 
  1952                                  		; p1 ...... p2
  1953                                  		;  .	    .	
  1954                                  		;  . shade  .
  1955                                  		;  .        .
  1956                                  		; p3 ...... p4
  1957                                  		;
  1958                                  		; p1 (x,y,z) ... p4 (x,y,z)
  1959                                  		;
  1960                                  
  1961 00000957 8B07                    		mov	ax, word [bx]		; shade
  1962 00000959 8946F8                  		mov	word [bp+dcf.col], ax	; [bp-08h]
  1963                                  
  1964 0000095C 31DB                    		xor	bx, bx
  1965 0000095E 895EFA                  		mov	word [bp+dcf.j], bx	; [bp-06h]
  1966                                  
  1967                                  		; vector(3).z
  1968 00000961 D946B6                  		fld	dword [bp+dcf.p0+108+8] ; [bp-4Ah]
  1969 00000964 D9E4                    		ftst
  1970 00000966 9BDFE0                  		fstsw	ax
  1971                                  		;fnstsw	ax
  1972 00000969 DDD8                    		fstp	st0
  1973 0000096B 9E                      		sahf
  1974 0000096C 7301                    		jae	short isFalse
  1975 0000096E 4B                      		dec	bx
  1976                                  isFalse:
  1977 0000096F 885EF6                  		mov	byte [bp+dcf.is_in], bl	; [bp-0Ah]
  1978 00000972 31F6                    		xor	si, si
  1979 00000974 31FF                    		xor	di, di 
  1980                                  forloop:
  1981                                  		; vector(0-3).z
  1982 00000976 D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  1983 0000097A D9E4                    		ftst
  1984 0000097C 9BDFE0                  		fstsw	ax
  1985                                  		;fnstsw	ax
  1986 0000097F DDD8                    		fstp	st0
  1987 00000981 9E                      		sahf
  1988 00000982 732B                    		jae	short elseFall
  1989                                  
  1990 00000984 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; -1 ; true
  1991 00000988 7406                    		je	short inside
  1992 0000098A E8A800                  		call	clipsub
  1993                                  		; { OUT / IN }
  1994 0000098D F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  1995                                  inside:
  1996 00000990 57                      		push	di
  1997 00000991 56                      		push	si
  1998 00000992 8DBB8EFE                		lea	di, [bp+di+dcf.p2]	; [bp+di-172h]
  1999 00000996 8DB242FF                		lea	si, [bp+si+dcf.p0]	; [bp+si-0BEh]
  2000                                  
  2001 0000099A 16                      		push	ss
  2002 0000099B 07                      		pop	es
  2003 0000099C 1E                      		push	ds
  2004 0000099D 16                      		push	ss
  2005 0000099E 1F                      		pop	ds
  2006 0000099F B91200                  		mov	cx, 18	; 12h
  2007 000009A2 F3A5                    		rep movsw			; { IN / IN }
  2008 000009A4 1F                      		pop	ds
  2009                                  
  2010 000009A5 5E                      		pop	si
  2011 000009A6 5F                      		pop	di
  2012 000009A7 83C724                  		add	di, 36	; 24h
  2013 000009AA FF46FA                  		inc	word [bp+dcf.j]		; [bp-06h]
  2014 000009AD EB0C                    		jmp	short dCFendif
  2015                                  elseFall:
  2016 000009AF 807EF6FF                		cmp	byte [bp+dcf.is_in], 0FFh ; [bp-0Ah]
  2017 000009B3 7506                    		jne	short outside
  2018 000009B5 E87D00                  		call	clipsub
  2019                                  		; { IN / OUT }
  2020 000009B8 F656F6                  		not	byte [bp+dcf.is_in]	; [bp-0Ah]
  2021                                  outside:
  2022 000009BB 83C624                  dCFendif:	add	si, 36 ; 24h
  2023 000009BE 81FE9000                		cmp	si, 4*36 ; 90h
  2024 000009C2 75B2                    		jne	short forloop
  2025                                  
  2026 000009C4 8B4EFA                  		mov	cx, word [bp+dcf.j]	; [bp-06h]
  2027 000009C7 83F902                  		cmp	cx, 2
  2028 000009CA 7C67                    		jl	dCFnodraw
  2029 000009CC 31FF                    		xor	di, di
  2030                                  dCFloop:
  2031 000009CE DF06[D20C]              		fild	word [CONST13]
  2032 000009D2 D8A396FE                		fsub	dword [bp+di+dcf.p2+8]	; [bp+di-16Ah]
  2033 000009D6 DE36[D60C]              		fidiv	word [CONST160]
  2034                                  		
  2035 000009DA D98392FE                		fld	dword [bp+di+dcf.p2+4]	; [bp+di-16Eh]
  2036 000009DE D8F1                    		fdiv	st0, st1
  2037 000009E0 DE06[D40C]              		fiadd	word [CONST100]
  2038 000009E4 DB9B9AFE                		fistp	dword [bp+di+dcf.p2+12] ; [bp+di-166h]
  2039                                  		
  2040 000009E8 D9838EFE                		fld	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2041 000009EC D80E[CE0C]              		fmul	dword [ASPECT_PLACE]
  2042 000009F0 D8F1                    		fdiv	st0, st1
  2043 000009F2 DE06[D60C]              		fiadd	word [CONST160]
  2044 000009F6 D9FC                    		frndint
  2045 000009F8 DA0E[DA0C]              		fimul	dword [CONST65536]
  2046 000009FC DB9B9EFE                		fistp	dword [bp+di+dcf.p2+16] ; [bp+di-162h]
  2047                                  
  2048 00000A00 DB83A2FE                		fild	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2049 00000A04 D8F1                    		fdiv	st0, st1
  2050 00000A06 DB9BA2FE                		fistp	dword [bp+di+dcf.p2+20] ; [bp+di-15Eh]
  2051                                  		
  2052 00000A0A DB83A6FE                		fild	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2053 00000A0E D8F1                    		fdiv	st0, st1
  2054 00000A10 DB9BA6FE                		fistp	dword [bp+di+dcf.p2+24] ; [bp+di-15Ah]
  2055                                  		
  2056 00000A14 DB06[DA0C]              		fild	dword [CONST65536]
  2057 00000A18 D8F1                    		fdiv	st0, st1
  2058 00000A1A DB9BAAFE                		fistp	dword [bp+di+dcf.p2+28] ; [bp+di-156h]
  2059                                  		
  2060 00000A1E DDD8                    		fstp	st0
  2061 00000A20 83C724                  		add	di, 36 ; 24h
  2062 00000A23 E2A9                    		loop	dCFloop
  2063                                  		;dec	cx
  2064                                  		;jnz	dCFloop
  2065                                  
  2066 00000A25 8DBE8EFE                		lea	di, [bp+dcf.p2]		; [bp-172h]
  2067 00000A29 57                      		push	di
  2068 00000A2A FF76FA                  		push	word [bp+dcf.j]		; [bp-06h]	 
  2069 00000A2D FF76F8                  		push	word [bp+dcf.col]	; [bp-08h]
  2070 00000A30 E8F4FB                  		call	scansubtextpoly
  2071                                  dCFnodraw:
  2072 00000A33 C9                      dCFbackclip:	leave
  2073                                  			; mov sp, bp ; pop bp
  2074 00000A34 C3                      		retn
  2075                                  
  2076                                  clipsub:
  2077 00000A35 56                      		push	si
  2078 00000A36 57                      		push	di
  2079 00000A37 8D44DC                  		lea	ax, [si-36]		; [si-24h]
  2080 00000A3A 83F800                  		cmp	ax, 0
  2081 00000A3D 7D03                    		jge	short cSnounder
  2082 00000A3F B86C00                  		mov	ax, 108 ; 6Ch
  2083                                  cSnounder:
  2084 00000A42 D9824AFF                		fld	dword [bp+si+dcf.p0+8]	; [bp+si-0B6h]
  2085 00000A46 D9C0                    		fld	st0
  2086 00000A48 97                      		xchg	ax, di
  2087 00000A49 D8A34AFF                		fsub	dword [bp+di+dcf.p0+8]	; [bp+di-0B6h]
  2088 00000A4D 97                      		xchg	ax, di
  2089                                  		;fdivp	st1, st0
  2090 00000A4E DEF9                    		fdiv
  2091                                  
  2092 00000A50 BB[3D0F]                		mov	bx, cliptab
  2093 00000A53 B90600                  		mov	cx, 6
  2094                                  dCFclipLoop2:
  2095 00000A56 97                      		xchg	ax, di
  2096 00000A57 D98342FF                		fld	dword [bp+di+dcf.p0]	; [bp+di-0BEh]
  2097 00000A5B 97                      		xchg	ax, di
  2098 00000A5C D8A242FF                		fsub	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2099 00000A60 D8C9                    		fmul	st0, st1
  2100 00000A62 D88242FF                		fadd	dword [bp+si+dcf.p0]	; [bp+si-0BEh]
  2101 00000A66 D99B8EFE                		fstp	dword [bp+di+dcf.p2]	; [bp+di-172h]
  2102                                  
  2103 00000A6A 8A17                    		mov	dl, byte [bx]
  2104 00000A6C 43                      		inc	bx
  2105 00000A6D 30F6                    		xor	dh, dh
  2106 00000A6F 01D7                    		add	di, dx
  2107 00000A71 01D6                    		add	si, dx
  2108 00000A73 01D0                    		add	ax, dx
  2109 00000A75 E2DF                    		loop	dCFclipLoop2
  2110 00000A77 DDD8                    		fstp	st0
  2111 00000A79 5F                      		pop	di
  2112 00000A7A 5E                      		pop	si
  2113 00000A7B FF46FA                  		inc	word [bp+dcf.j] 	; [bp-6]
  2114 00000A7E 83C724                  		add	di, 36 ; 24h
  2115 00000A81 C3                      		retn
  2116                                  
  2117                                  ;***********************************************
  2118                                  ;* descript. : rotate point over one axis      *
  2119                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2120                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2121                                  ;* sideeffect: empty copro-stack               *
  2122                                  ;* back      : none			       *
  2123                                  ;***********************************************
  2124                                  
  2125                                  rotateAxis:
  2126 00000A82 D9EB                    		fldpi				;{ PI,a}
  2127                                  		;fmulp	st1, st0		;{ PI*a}	
  2128 00000A84 DEC9                    		fmul
  2129 00000A86 DA36[DA0C]              		fidiv	dword [CONST65536]	;{ PI*a/65536}
  2130 00000A8A D9FB                    		fsincos				;{ cos,sin}
  2131 00000A8C D9C0                    		fld	st0			;{ cos,cos,sin}
  2132 00000A8E D80C                    		fmul	dword [si] 		;{ y*cos,cos,sin}
  2133 00000A90 D9C2                    		fld	st2			;{ sin,y*cos,cos,sin}
  2134 00000A92 D80F                    		fmul	dword [bx]		;{ z*sin,y*cos,cos,sin}
  2135 00000A94 DEE9                    		fsubp	st1, st0		;{ y*cos-z*sin,cos,sin}
  2136 00000A96 D9CA                    		fxch	st2			;{ sin,cos,y*cos-z*sin}
  2137 00000A98 D80C                    		fmul	dword [si]		;{ y*sin,cos,y*cos-z*sin}
  2138 00000A9A D9C9                    		fxch	st1			;{ cos,y*sin,y*cos-z*sin}
  2139 00000A9C D80F                    		fmul	dword [bx]		;{ z*cos,y*sin,y*cos-z*sin}
  2140 00000A9E DEC1                    		faddp	st1, st0		;{ y*sin+z*cos,y*cos-z*sin}
  2141 00000AA0 D91F                    		fstp	dword [bx]		;{ y*cos-z*sin}
  2142 00000AA2 D91C                    		fstp	dword [si]		;{}
  2143 00000AA4 C3                      		retn
  2144                                  
  2145                                  ;***********************************************
  2146                                  ;* descript. : rotate point		       *
  2147                                  ;* parameter : a,b,c:angles,adr:address        *
  2148                                  ;* sideeffect: all		 	       *
  2149                                  ;* back      : none			       *
  2150                                  ;***********************************************
  2151                                  
  2152                                  xyzRotate:
  2153                                  		adr	equ 4	; arg 1, [sp+2]
  2154                                  		c	equ 6	; arg 2, [sp+4]	
  2155                                  		b	equ 8	; arg 3, [sp+6]
  2156                                  		a	equ 10	; arg 4, [sp+8]
  2157                                  
  2158 00000AA5 55                      		push	bp
  2159 00000AA6 89E5                    		mov	bp, sp
  2160                                  	
  2161 00000AA8 8B7E04                  		mov	di, word [bp+adr]
  2162 00000AAB DF460A                  		fild	word [bp+a]
  2163 00000AAE 8D5D08                  		lea	bx, [di+8]
  2164 00000AB1 8D7504                  		lea	si, [di+4]
  2165 00000AB4 E8CBFF                  		call	rotateAxis
  2166 00000AB7 DF4608                  		fild	word [bp+b]
  2167 00000ABA 8D1D                    		lea	bx, [di]
  2168 00000ABC 8D7508                  		lea	si, [di+8]
  2169 00000ABF E8C0FF                  		call	rotateAxis
  2170 00000AC2 DF4606                  		fild	word [bp+c]
  2171 00000AC5 8D5D04                  		lea	bx, [di+4]
  2172 00000AC8 8D35                    		lea	si, [di]
  2173 00000ACA E8B5FF                  		call	rotateAxis
  2174                                  
  2175 00000ACD 5D                      		pop	bp
  2176 00000ACE C20800                  		ret	8
  2177                                  
  2178                                  ;***********************************************
  2179                                  ;* descript. : calculate world matrix	       *
  2180                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2181                                  ;* sideeffect: all		 	       *
  2182                                  ;* back      : none			       *
  2183                                  ;***********************************************
  2184                                  
  2185                                  calcRotMat:
  2186                                  		neig	equ 4   ; arg 1, [sp+2]
  2187                                  		zw	equ 6	; arg 2, [sp+4]	
  2188                                  		yw	equ 8	; arg 3, [sp+6]
  2189                                  		xw	equ 10  ; arg 4, [sp+8]
  2190                                  
  2191 00000AD1 55                      		push	bp
  2192 00000AD2 89E5                    		mov	bp, sp
  2193                                  
  2194 00000AD4 BF[D412]                		mov	di, nwmat
  2195                                  		identityMat
  2195 00000AD7 B502                <1>  mov ch, 2
  2195                              <1> iMolp:
  2195 00000AD9 B102                <1>  mov cl, 2
  2195                              <1> iMilp:
  2195 00000ADB D9EE                <1>  fldz
  2195 00000ADD 38CD                <1>  cmp ch, cl
  2195 00000ADF 7504                <1>  jne short iMwritezero
  2195 00000AE1 DDD8                <1>  fstp st0
  2195 00000AE3 D9E8                <1>  fld1
  2195                              <1> iMwritezero:
  2195 00000AE5 D91D                <1>  fstp dword [di]
  2195 00000AE7 83C704              <1>  add di, 4
  2195 00000AEA FEC9                <1>  dec cl
  2195 00000AEC 79ED                <1>  jns short iMilp
  2195 00000AEE FECD                <1>  dec ch
  2195 00000AF0 79E7                <1>  jns short iMolp
  2196 00000AF2 31FF                    		xor	di, di
  2197                                  cRMolp:
  2198 00000AF4 57                      		push	di
  2199 00000AF5 FF760A                  		push	word [bp+xw]
  2200 00000AF8 FF7608                  		push	word [bp+yw]
  2201 00000AFB FF7606                  		push	word [bp+zw]
  2202 00000AFE 81C7[D412]              		add	di, nwmat
  2203 00000B02 57                      		push	di
  2204 00000B03 E89FFF                  		call	xyzRotate
  2205 00000B06 5F                      		pop	di
  2206 00000B07 31DB                    		xor	bx, bx
  2207                                  cRMilp:
  2208 00000B09 D985[D412]              		fld	dword [di+nwmat]
  2209 00000B0D D88F[8C12]              		fmul	dword [bx+owmat]
  2210 00000B11 D985[D812]              		fld	dword [di+nwmat+4]
  2211 00000B15 D88F[9812]              		fmul	dword [bx+owmat+12]
  2212 00000B19 D985[DC12]              		fld	dword [di+nwmat+8]
  2213 00000B1D D88F[A412]              		fmul	dword [bx+owmat+24]
  2214 00000B21 DEC1                    		fadd
  2215 00000B23 DEC1                    		fadd
  2216 00000B25 D991[8C12]              		fst	dword [bx+di+owmat]
  2217 00000B29 D999[B012]              		fstp	dword [bx+di+wmat]
  2218 00000B2D 83C304                  		add	bx, 4
  2219 00000B30 80FB0C                  		cmp	bl, 12
  2220 00000B33 75D4                    		jne	short cRMilp
  2221 00000B35 83C70C                  		add	di, 12
  2222 00000B38 83FF24                  		cmp	di, 36
  2223 00000B3B 75B7                    		jne	short cRMolp
  2224                                  
  2225 00000B3D BE[B012]                		mov	si, wmat
  2226 00000B40 B90300                  		mov	cx, 3
  2227                                  cRMneigloop:
  2228 00000B43 DF4604                  		fild	word [bp+neig]
  2229 00000B46 8D5C0C                  		lea	bx, [si+12]
  2230 00000B49 E836FF                  		call	rotateAxis
  2231 00000B4C 83C604                  		add	si, 4
  2232 00000B4F E2F2                    		loop	cRMneigloop
  2233                                  
  2234 00000B51 5D                      		pop	bp
  2235 00000B52 C20800                  		ret	8
  2236                                  
  2237                                  ;***********************************************
  2238                                  ;* descript. : create the world		       *
  2239                                  ;* parameter : none			       *
  2240                                  ;* sideeffect: all		               *
  2241                                  ;* back      : none			       *
  2242                                  ;***********************************************
  2243                                  
  2244                                  createWorld:
  2245                                  		cw.direc  equ -2  ; word
  2246                                  		cw.shade  equ -4  ; word	
  2247                                  
  2248 00000B55 C8040000                		enter	4, 0
  2249                                  			; push bp ; mov bp, sp ; sub sp, 4
  2250 00000B59 BE[8F0F]                		mov	si, world
  2251 00000B5C B90400                  		mov	cx, 4
  2252                                  cWworldLoop:
  2253 00000B5F 51                      		push	cx
  2254 00000B60 56                      		push	si
  2255 00000B61 BF[72C1]                		mov	di, p
  2256 00000B64 BB[EAC1]                		mov	bx, pr
  2257 00000B67 BE[620F]                		mov	si, print
  2258 00000B6A B10F                    		mov	cl, 15 ; 0Fh
  2259                                  cWinitStartRoom:
  2260 00000B6C 51                      		push	cx
  2261 00000B6D B103                    		mov	cl, 3
  2262                                  cWinnerLoop:
  2263 00000B6F AC                      		lodsb  ; byte data (to be converted to dword) from the 'print:'
  2264 00000B70 98                      		cbw    ; convert byte to word with sign (0E0h -> FFE0h)	
  2265 00000B71 AB                      		stosw  ; store world coordinate/dimension as integer (word), to 'p:' 
  2266 00000B72 DF45FE                  		fild	word [di-2]
  2267 00000B75 D91F                    		fstp	dword [bx] ; store coordinate as floatpoint
  2268 00000B77 83C304                  		add	bx, 4 ; next dimension (x,y,z) in 'pr:'
  2269 00000B7A E2F3                    		loop	cWinnerLoop
  2270 00000B7C 59                      		pop	cx
  2271 00000B7D B8007F                  		mov	ax, 127*256 ; 7F00h ;  4th dimension in 'p:'
  2272 00000B80 AB                      		stosw
  2273 00000B81 E2E9                    		loop	cWinitStartRoom
  2274 00000B83 5E                      		pop	si
  2275                                  cWmainLoop:
  2276 00000B84 AC                      		lodsb	; the byte from 'world:' for shade and direction
  2277 00000B85 3CFF                    		cmp	al, 255 ; 0FFh
  2278 00000B87 0F840D01                		je	cWexit  ; end of stage (1 to 4)
  2279                                  
  2280 00000B8B 88C7                    		mov	bh, al  ; High 4 bits for shading
  2281 00000B8D 81E30070                		and	bx, 7000h
  2282 00000B91 80C70F                  		add	bh, 15 ; 0Fh
  2283 00000B94 895EFC                  		mov	word [bp+cw.shade], bx ; [bp-4]
  2284 00000B97 83E00F                  		and	ax, 0Fh ; 15   ; Low 4 bits for direction
  2285 00000B9A 8946FE                  		mov	word [bp+cw.direc], ax ; [bp-2]
  2286                                  
  2287 00000B9D 31DB                    		xor	bx, bx
  2288                                  cWsideLoop:
  2289 00000B9F F6C304                  		test	bl, 4
  2290 00000BA2 7405                    		jz	short cWfirstNibble
  2291 00000BA4 AC                      		lodsb
  2292 00000BA5 240F                    		and	al, 0Fh ; 15
  2293 00000BA7 EB05                    		jmp	short cWsecondNibble
  2294                                  cWfirstNibble:
  2295 00000BA9 8A04                    		mov	al, byte [si]
  2296 00000BAB C0E804                  		shr	al, 4
  2297                                  cWsecondNibble:
  2298 00000BAE 30E4                    		xor	ah, ah
  2299 00000BB0 48                      		dec	ax
  2300 00000BB1 7850                    		js	short cWnoWall ; ax = 0 -> ax = 0FFFFh
  2301 00000BB3 6B3E[6C16]0A            		imul	di, word [o+object.fanz], 10 ; 0Ah
  2302 00000BB8 81C7[EE22]              		add	di, o+object.f ; base address + offset
  2303 00000BBC FF06[6C16]              		inc	word [o+object.fanz] ; faces = faces + 1
  2304 00000BC0 894508                  		mov	word [di+8], ax ; 4th word is shading value
  2305                                  
  2306 00000BC3 53                      		push	bx
  2307 00000BC4 56                      		push	si
  2308 00000BC5 B104                    		mov	cl, 4
  2309                                  cWaddPointloop:
  2310 00000BC7 0FBEB7[4A0F]            		movsx	si, byte [bx+cube] ; cube coordinate offset
  2311 00000BCC 81C6[72C1]              		add	si, p ; + base address (p:)
  2312                                  
  2313 00000BD0 57                      		push	di
  2314 00000BD1 BF[6E16]                		mov	di, o+object.p  ; p area of object structure (in o:)
  2315 00000BD4 51                      		push	cx
  2316 00000BD5 8B0E[6A16]              		mov	cx, word [o+object.panz] ; number of points (for object.p)
  2317 00000BD9 31C0                    		xor	ax, ax
  2318 00000BDB E316                    		jcxz	cWfirstPoint
  2319                                  cWsearchPointLoop: ; check point coordinates are same or not
  2320 00000BDD 668B14                  		mov	edx, dword [si]
  2321 00000BE0 663B15                  		cmp	edx, dword [di]
  2322 00000BE3 7508                    		jne	short cWdifferent
  2323 00000BE5 8B5404                  		mov	dx, word [si+4]
  2324 00000BE8 3B5504                  		cmp	dx, word [di+4]
  2325 00000BEB 740E                    		je	short cWpointExists
  2326                                  cWdifferent:
  2327 00000BED 40                      		inc	ax ; number of different points (of object)
  2328 00000BEE 83C708                  		add	di, 8
  2329 00000BF1 E2EA                    		loop	cWsearchPointLoop
  2330                                  cWfirstPoint:
  2331 00000BF3 66A5                    		movsd
  2332 00000BF5 66A5                    		movsd
  2333 00000BF7 FF06[6A16]              		inc	word [o+object.panz] ; points = points + 1
  2334                                  cWpointExists:
  2335 00000BFB 59                      		pop	cx
  2336 00000BFC 5F                      		pop	di
  2337 00000BFD AB                      		stosw   ; store num of different points
  2338                                  			; in the Xth word of face structure (5 words)
  2339                                  			; (Xth word of 'object.f', X = 4-CL)
  2340 00000BFE 43                      		inc	bx
  2341 00000BFF E2C6                    		loop	cWaddPointloop
  2342 00000C01 5E                      		pop	si
  2343 00000C02 5B                      		pop	bx
  2344                                  cWnoWall:
  2345 00000C03 83C304                  		add	bx, 4
  2346 00000C06 83FB18                  		cmp	bx, 24 ; 18h
  2347 00000C09 7594                    		jne	short cWsideLoop
  2348                                  
  2349 00000C0B 6B7EFE0C                		imul	di, word [bp+cw.direc], 12 ; [bp-2]
  2350                                  		; di will have negative value if 12*[bp-2] > 127
  2351                                  		; max value of [bp-2] = 0Fh
  2352 00000C0F B103                    		mov	cl, 3
  2353 00000C11 BB[4AC2]                		mov	bx, pr+96 ; 24th dword of 'pr:'
  2354                                  cWaddStepLoop:
  2355 00000C14 D94748                  		fld	dword [bx+72] ; [bx+48h]
  2356 00000C17 D801                    		fadd	dword [bx+di]
  2357 00000C19 D95F48                  		fstp	dword [bx+72]
  2358 00000C1C 83C304                  		add	bx, 4
  2359 00000C1F E2F3                    		loop	cWaddStepLoop
  2360                                  
  2361 00000C21 807CFC00                		cmp	byte [si-4], 0
  2362 00000C25 7D25                    		jge	short cWsimpleRoom
  2363                                  
  2364 00000C27 BB[EAC1]                		mov	bx, pr
  2365 00000C2A B10E                    		mov	cl, 14 ; 0Eh
  2366                                  cWrotloop:
  2367 00000C2C 60                      		pusha
  2368 00000C2D B103                    		mov	cl, 3
  2369 00000C2F 8A14                    		mov	dl, byte [si]
  2370                                  cWpushLoop:
  2371                                  		;xor	ax, ax
  2372 00000C31 D0EA                    		shr	dl, 1
  2373 00000C33 7308                    		jnc	short cWnoRot
  2374 00000C35 8A24                    		mov	ah, byte [si]
  2375 00000C37 2500F0                  		and	ax, 0F000h
  2376                                  		;and	ah, 0F0h
  2377 00000C3A 50                      		push	ax
  2378 00000C3B EB02                    		jmp	short cWendIf
  2379                                  cWnoRot:
  2380 00000C3D 6A00                    		push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2381                                  		;push	ax
  2382                                  cWendIf:
  2383 00000C3F E2F0                    		loop	cWpushLoop
  2384 00000C41 53                      		push	bx ; arg 1 (addr)
  2385 00000C42 E860FE                  		call	xyzRotate
  2386 00000C45 61                      		popa
  2387 00000C46 83C30C                  		add	bx, 12 ; 0Ch
  2388 00000C49 E2E1                    		loop	cWrotloop
  2389 00000C4B 46                      		inc	si
  2390                                  cWsimpleRoom:
  2391 00000C4C 8B5EFE                  		mov	bx, word [bp+cw.direc]  ; [bp-2]
  2392 00000C4F C1E302                  		shl	bx, 2
  2393 00000C52 B104                    		mov	cl, 4
  2394                                  cWpointCopyLoop:
  2395 00000C54 60                      		pusha
  2396 00000C55 0FBEB7[4A0F]            		movsx	si, byte [bx+cube]
  2397 00000C5A 89F0                    		mov	ax, si
  2398 00000C5C 81C6[72C1]              		add	si, p ; + base address of 'p:'
  2399 00000C60 80F307                  		xor	bl, 7
  2400 00000C63 0FBEBF[4A0F]            		movsx	di, byte [bx+cube]
  2401 00000C68 81C7[72C1]              		add	di, p ; + base address of 'p:'
  2402 00000C6C 56                      		push	si 
  2403 00000C6D 66A5                    		movsd
  2404 00000C6F 66A5                    		movsd
  2405 00000C71 5E                      		pop	si
  2406                                  
  2407 00000C72 89C3                    		mov	bx, ax
  2408 00000C74 D1EB                    		shr	bx, 1
  2409 00000C76 01C3                    		add	bx, ax
  2410 00000C78 BF[EAC1]                		mov	di, pr ; + base address of 'pr:'
  2411 00000C7B B103                    		mov	cl, 3
  2412                                  cWSround:
  2413 00000C7D D901                    		fld	dword [bx+di]
  2414 00000C7F D885A800                		fadd	dword [di+168]  ; [di+0A8h]
  2415 00000C83 DF1C                    		fistp	word [si] ; world coordinate/dimension
  2416 00000C85 83C704                  		add	di, 4
  2417 00000C88 46                      		inc	si
  2418 00000C89 46                      		inc	si
  2419 00000C8A E2F1                    		loop	cWSround
  2420 00000C8C 8B46FC                  		mov	ax, word [bp+cw.shade]  ; [bp-4]
  2421 00000C8F 8904                    		mov	word [si], ax ; 4th word
  2422 00000C91 61                      		popa
  2423 00000C92 43                      		inc	bx
  2424 00000C93 E2BF                    		loop	cWpointCopyLoop
  2425 00000C95 E9ECFE                  		jmp	cWmainLoop
  2426                                  cWexit:
  2427 00000C98 59                      		pop	cx
  2428 00000C99 49                      		dec	cx
  2429 00000C9A 0F85C1FE                		jnz	cWworldLoop
  2430 00000C9E C9                      		leave
  2431                                  			; mov sp, bp ; pop bp
  2432 00000C9F C3                      		retn
  2433                                  
  2434 00000CA0 1111                    dels_pos_w:	dw 1111h
  2435 00000CA2 1111                    ddu_pos_w:	dw 1111h
  2436 00000CA4 1111                    ddv_pos_w:	dw 1111h
  2437                                  
  2438                                  prg_msg:
  2439 00000CA6 4552444F47414E2054-     		db	'ERDOGAN TAN - SNCOMNI.COM'
  2439 00000CAF 414E202D20534E434F-
  2439 00000CB8 4D4E492E434F4D     
  2440 00000CBF 0D0A                    		db	0Dh, 0Ah
  2441 00000CC1 30352F30322F323031-     		db	'05/02/2017'
  2441 00000CCA 37                 
  2442 00000CCB 0D0A                    		db	0Dh, 0Ah
  2443 00000CCD 00                      		db	0 
  2444                                  
  2445                                  ;=============================================================================
  2446                                  ;               preinitialized data
  2447                                  ;=============================================================================
  2448                                  
  2449 00000CCE 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  2450 00000CD2 0D00                    CONST13:	dw 13			; 000Dh			
  2451 00000CD4 6400                    CONST100:	dw CENTERY		; 0064h
  2452 00000CD6 A000                    CONST160:	dw CENTERX		; 00A0h
  2453 00000CD8 0007                    CONST1792:	dw 1792			; 0700h
  2454 00000CDA 00000100                CONST65536:	dd 65536		; 00010000h
  2455 00000CDE 05840808                randommul:	dd 134775813		; 08088405h
  2456 00000CE2 FB100000                randomseed:	dd 4347			; 000010FBh
  2457                                  credits:
  2458 00000CE6 0250FB                  		db	 2, 80,-5
  2459 00000CE9 FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  2459 00000CF2 51023E0245024F023E-
  2459 00000CFB 024502             
  2460 00000CFE 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  2460 00000D07 0200               
  2461 00000D09 FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  2461 00000D12 51023E0246024F023E-
  2461 00000D1B 024602             
  2462 00000D1E 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  2462 00000D27 0200               
  2463 00000D29 00                      		db       0
  2464 00000D2A 37203820                		db      55,32,56,32			; { pat 10 }
  2465 00000D2E 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  2466 00000D34 39203220                		db      57,32,50,32		 ; { pat 12 }
  2467 00000D38 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  2468 00000D3E 3740                    		db      55,64		   ; { pat 14 }
  2469 00000D40 FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  2469 00000D49 00                 
  2470 00000D4A FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  2470 00000D53 00                 
  2471 00000D54 00                      		db       0
  2472 00000D55 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  2473 00000D5B 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  2473 00000D64 083C08             
  2474 00000D67 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  2474 00000D70 08                 
  2475 00000D71 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  2476 00000D79 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  2477 00000D81 3E80                    		db      62,128		  ;{ pat 8,9 }
  2478 00000D83 4380                    		db      67,128		  ;{ pat 10,11 }
  2479 00000D85 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  2479 00000D8E 08                 
  2480 00000D8F 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  2481 00000D93 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  2482 00000D97 FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  2483 00000D9D FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  2484 00000DA3 00                      		db       0
  2485 00000DA4 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  2486 00000DAA 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  2487 00000DB2 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  2487 00000DBB 08                 
  2488 00000DBC 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  2488 00000DC5 18                 
  2489 00000DC6 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  2489 00000DCF 08                 
  2490 00000DD0 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  2491 00000DD8 FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  2492 00000DDE FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  2493 00000DE4 00                      		db       0
  2494 00000DE5 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  2494 00000DEE 2A012A0100         
  2495 00000DF3 F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  2495 00000DFC 2A0100             
  2496 00000DFF E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  2496 00000E08 2A012602           
  2497 00000E0C 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  2498 00000E14 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  2498 00000E1D 0126022A022E022601-
  2498 00000E26 2A0100             
  2499 00000E29 00                      		db     	 0
  2500 00000E2A 00                      		db	 0
  2501                                  
  2502                                  ; colortable 65 bytes
  2503 00000E2B 10                      colors 		db	16
  2504 00000E2C 1F3F3F3F                                db      31,63,63,63
  2505 00000E30 01000000                                db	 1, 0, 0, 0
  2506 00000E34 1F28203F                                db      31,40,32,63
  2507 00000E38 01000000                                db	 1, 0, 0, 0
  2508 00000E3C 1F3F0000                                db      31,63, 0, 0
  2509 00000E40 01060100                                db	 1, 6, 1, 0
  2510 00000E44 1F3F2914                                db      31,63,41,20
  2511 00000E48 01000000                                db	 1, 0, 0, 0
  2512 00000E4C 1F3F3F08                                db      31,63,63, 8
  2513 00000E50 01000000                                db	 1, 0, 0, 0
  2514 00000E54 1F38383F                                db	31,56,56,63
  2515 00000E58 013F0000                                db	 1,63, 0, 0
  2516 00000E5C 103F3F00                                db      16,63,63, 0
  2517 00000E60 103F0000                                db      16,63, 0, 0
  2518 00000E64 01160500                                db	 1,22, 5, 0
  2519 00000E68 073F3811                                db       7,63,56,17
  2520                                  
  2521                                  ; parameter for the texture effects 156 bytes
  2522 00000E6C 130F0F31310A            aE              db	013h,15,15,49,49,10
  2523 00000E72 131010303011                            db      013h,16,16,48,48,17
  2524 00000E78 1311112F2F18                            db      013h,17,17,47,47,24
  2525 00000E7E 1312122E2EBE                            db      013h,18,18,46,46,190
  2526 00000E84 1315152B2B1E                            db      013h,21,21,43,43,30
  2527 00000E8A 2500003E1E03                            db      025h,0,0,62,30,3
  2528 00000E90 2503033E1E07                            db      025h,3,3,62,30,7
  2529 00000E96 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  2530 00000E9C 2500203E3E03                            db      025h,0,32,62,62,3
  2531 00000EA2 2503233E3E07                            db      025h,3,35,62,62,7
  2532 00000EA8 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  2533 00000EAE 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  2534 00000EB4 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  2535 00000EBA 2C000B3F1004                            db      02Ch,0,11,63,16,4
  2536 00000EC0 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  2537 00000EC6 2C00303F3504                            db      02Ch,0,48,63,53,4
  2538 00000ECC 2E13182C2705                            db      02Eh,19,24,44,39,5
  2539 00000ED2 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  2540 00000ED8 2E14192B2607                            db      02Eh,20,25,43,38,7
  2541 00000EDE 3E14192B2606                            db      03Eh,20,25,43,38,6
  2542 00000EE4 2F00183F1E06                            db      02Fh,0,24,63,30,6
  2543 00000EEA 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  2544 00000EF0 3F00193F1E06                            db      03Fh,0,25,63,30,6
  2545 00000EF6 2F00203F2606                            db      02Fh,0,32,63,38,6
  2546 00000EFC 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  2547 00000F02 3F00213F2606                            db      03Fh,0,33,63,38,6
  2548                                  
  2549                                  ; parameter for fractaladd 28 bytes
  2550 00000F08 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  2550 00000F11 0020202040         
  2551 00000F16 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  2551 00000F1F 0024002400         
  2552                                  
  2553                                  ; star bob for the sparcling stars texture 25 bytes
  2554 00000F24 0000030000              bob:            db	0,0,3,0,0
  2555 00000F29 0002050200                              db	0,2,5,2,0
  2556 00000F2E 0305070503                              db	3,5,7,5,3
  2557 00000F33 0002050200                              db	0,2,5,2,0
  2558 00000F38 0000030000                              db	0,0,3,0,0
  2559                                  
  2560 00000F3D 04040C0408              cliptab:	db	4,4,12,4,8
  2561                                  
  2562 00000F42 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  2563                                  
  2564 00000F4A 08283010                cube:		db	1*8,5*8,6*8,2*8
  2565 00000F4E 18382000                                db      3*8,7*8,4*8,0*8
  2566 00000F52 10303818                                db      2*8,6*8,7*8,3*8
  2567 00000F56 00202808                                db      0*8,4*8,5*8,1*8
  2568 00000F5A 38302820                        	db	7*8,6*8,5*8,4*8
  2569 00000F5E 00081018                                db      0*8,1*8,2*8,3*8
  2570                                  
  2571 00000F62 E0E0E0                  print:		db	-32,-32,-32
  2572 00000F65 20E0E0                                  db       32,-32,-32
  2573 00000F68 2020E0                                  db   	 32, 32,-32
  2574 00000F6B E020E0                                  db  	-32, 32,-32
  2575 00000F6E E0E020                                  db  	-32,-32, 32
  2576 00000F71 20E020                                  db       32,-32, 32
  2577 00000F74 202020                                  db   	 32, 32, 32
  2578 00000F77 E02020                                  db  	-32, 32, 32
  2579 00000F7A 400000                                  db       64,  0,  0
  2580 00000F7D C00000                                  db      -64,  0,  0
  2581 00000F80 004000                                  db        0, 64,  0
  2582 00000F83 00C000                                  db        0,-64,  0
  2583 00000F86 000040                                  db        0,  0, 64
  2584 00000F89 0000C0                                  db        0,  0,-64
  2585 00000F8C 000000                                  db	  0,  0,  0
  2586                                  
  2587                                  ; world contruction data 599 bytes
  2588 00000F8F 71700006                world:		db	071h,070h,000h,006h
  2589 00000F93 72000006                                db	072h,000h,000h,006h
  2590 00000F97 71007006                                db	071h,000h,070h,006h
  2591 00000F9B 73077006                                db	073h,007h,070h,006h
  2592 00000F9F 73070006                                db	073h,007h,000h,006h
  2593 00000FA3 70070706                                db	070h,007h,007h,006h
  2594 00000FA7 74000706                                db	074h,000h,007h,006h
  2595 00000FAB 70000740                                db	070h,000h,007h,040h
  2596 00000FAF 72700750                                db	072h,070h,007h,050h
  2597 00000FB3 72700050                                db	072h,070h,000h,050h
  2598 00000FB7 71707050                                db	071h,070h,070h,050h
  2599 00000FBB 73007040                                db	073h,000h,070h,040h
  2600 00000FBF 71000040                                db	071h,000h,000h,040h
  2601 00000FC3 72000050                                db	072h,000h,000h,050h
  2602 00000FC7 71007050                                db	071h,000h,070h,050h
  2603 00000FCB 73077046                                db	073h,007h,070h,046h
  2604 00000FCF 73000046                                db	073h,000h,000h,046h
  2605 00000FD3 70070746                                db	070h,007h,007h,046h
  2606 00000FD7 72000750                                db	072h,000h,007h,050h
  2607 00000FDB 71000000                                db	071h,000h,000h,000h
  2608 00000FDF 71000000                                db	071h,000h,000h,000h
  2609 00000FE3 7100BB56                                db	071h,000h,0bbh,056h
  2610 00000FE7 700FBB46                                db	070h,00Fh,0bbh,046h
  2611 00000FEB FF                                      db	0FFh
  2612 00000FEC 33000000                                db	033h,000h,000h,000h
  2613 00000FF0 F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  2614 00000FF5 B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  2615 00000FFA 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2616 00000FFF 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2617 00001004 3000BB56                                db	030h,000h,0BBh,056h
  2618 00001008 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2619 0000100D F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2620 00001012 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2621 00001017 9000BB5611                              db	090h,000h,0BBh,056h,011h
  2622 0000101C B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2623 00001021 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2624 00001026 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2625 0000102B B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2626 00001030 3000BB56                                db	030h,000h,0BBh,056h
  2627 00001034 1000BB56                                db	010h,000h,0BBh,056h
  2628                                  
  2629 00001038 34000000                                db	034h,000h,000h,000h
  2630 0000103C 32050080                                db	032h,005h,000h,080h
  2631 00001040 35058080                                db	035h,005h,080h,080h
  2632 00001044 35058000                                db	035h,005h,080h,000h
  2633 00001048 33058008                                db	033h,005h,080h,008h
  2634 0000104C 33050008                                db	033h,005h,000h,008h
  2635 00001050 74050808                                db	074h,005h,008h,008h
  2636 00001054 74050000                                db	074h,005h,000h,000h
  2637 00001058 73050880                                db	073h,005h,008h,080h
  2638 0000105C 75000000                                db	075h,000h,000h,000h
  2639 00001060 75050888                                db	075h,005h,008h,088h
  2640 00001064 70000000                                db	070h,000h,000h,000h
  2641 00001068 74640808                                db	074h,064h,008h,008h
  2642 0000106C 74600800                                db	074h,060h,008h,000h
  2643 00001070 72640880                                db	072h,064h,008h,080h
  2644 00001074 05600080                                db	005h,060h,000h,080h
  2645 00001078 05600000                                db	005h,060h,000h,000h
  2646 0000107C 02600008                                db	002h,060h,000h,008h
  2647 00001080 34600008                                db	034h,060h,000h,008h
  2648 00001084 34600000                                db	034h,060h,000h,000h
  2649 00001088 32600080                                db	032h,060h,000h,080h
  2650 0000108C 35600080                                db	035h,060h,000h,080h
  2651 00001090 35600000                                db	035h,060h,000h,000h
  2652 00001094 32600008                                db	032h,060h,000h,008h
  2653 00001098 34350008                                db	034h,035h,000h,008h
  2654 0000109C 14650000                                db      014h,065h,000h,000h
  2655 000010A0 32350080                                db      032h,035h,000h,080h
  2656 000010A4 35350080                               	db      035h,035h,000h,080h
  2657 000010A8 15650000                               	db      015h,065h,000h,000h
  2658 000010AC 32350008                                db	032h,035h,000h,008h
  2659 000010B0 34358008                                db	034h,035h,080h,008h
  2660 000010B4 14650000                               	db      014h,065h,000h,000h
  2661 000010B8 32358080                               	db      032h,035h,080h,080h
  2662 000010BC 75000000                		db	075h,000h,000h,000h
  2663 000010C0 5265E077                		db	052h,065h,0E0h,077h
  2664 000010C4 32640E77                		db	032h,064h,00Eh,077h
  2665 000010C8 12650077                		db	012h,065h,000h,077h
  2666 000010CC 00650077                		db	000h,065h,000h,077h
  2667 000010D0 FF                      		db	0FFh
  2668 000010D1 32000000                		db	032h,000h,000h,000h
  2669 000010D5 F000000014              		db	0F0h,000h,000h,000h,014h
  2670 000010DA B000000014              		db	0B0h,000h,000h,000h,014h
  2671 000010DF 30000000                		db	030h,000h,000h,000h
  2672 000010E3 F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  2673 000010E8 F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  2674 000010ED 3000DD46                		db	030h,000h,0DDh,046h
  2675 000010F1 3000DD56                		db	030h,000h,0DDh,056h
  2676 000010F5 3000DD56                		db	030h,000h,0DDh,056h
  2677 000010F9 32000050                		db	032h,000h,000h,050h
  2678 000010FD 300AA050                		db	030h,00Ah,0A0h,050h
  2679 00001101 3300A050                		db	033h,000h,0A0h,050h
  2680 00001105 30000050                		db	030h,000h,000h,050h
  2681 00001109 32700050                		db	032h,070h,000h,050h
  2682 0000110D 3000A050                		db	030h,000h,0A0h,050h
  2683 00001111 33A0A750                		db	033h,0A0h,0A7h,050h
  2684 00001115 33000000                		db	033h,000h,000h,000h
  2685 00001119 31A07A50                		db	031h,0A0h,07Ah,050h
  2686 0000111D 31000A50                		db	031h,000h,00Ah,050h
  2687 00001121 31000A50                		db	031h,000h,00Ah,050h
  2688 00001125 320A0A50                		db	032h,00Ah,00Ah,050h
  2689 00001129 35000000                		db	035h,000h,000h,000h
  2690 0000112D 720A0000                		db	072h,00Ah,000h,000h
  2691 00001131 700AA000                		db	070h,00Ah,0A0h,000h
  2692 00001135 7300A000                		db	073h,000h,0A0h,000h
  2693 00001139 70000000                		db	070h,000h,000h,000h
  2694 0000113D 72000000                		db	072h,000h,000h,000h
  2695 00001141 7000A000                		db	070h,000h,0A0h,000h
  2696 00001145 73A0A000                		db	073h,0A0h,0A0h,000h
  2697 00001149 73A00099                		db	073h,0A0h,000h,099h
  2698 0000114D 71A00A00                		db	071h,0A0h,00Ah,000h
  2699 00001151 71000A00                		db	071h,000h,00Ah,000h
  2700 00001155 71000A00                                db	071h,000h,00Ah,000h
  2701 00001159 750A0A00                                db	075h,00Ah,00Ah,000h
  2702 0000115D 700C0C03                                db	070h,00Ch,00Ch,003h
  2703 00001161 70000C03                                db	070h,000h,00Ch,003h
  2704 00001165 70000C03                                db	070h,000h,00Ch,003h
  2705 00001169 72C07C03                                db	072h,0C0h,07Ch,003h
  2706 0000116D 72000000                                db	072h,000h,000h,000h
  2707 00001171 71C0C703                                db	071h,0C0h,0C7h,003h
  2708 00001175 7300C003                                db	073h,000h,0C0h,003h
  2709 00001179 71700003                                db	071h,070h,000h,003h
  2710 0000117D 72000003                                db	072h,000h,000h,003h
  2711 00001181 7100C003                                db	071h,000h,0C0h,003h
  2712 00001185 730CC003                                db	073h,00Ch,0C0h,003h
  2713 00001189 71000003                                db	071h,000h,000h,003h
  2714 0000118D 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  2715 00001191 FF                                      db	0FFh
  2716 00001192 32000000                                db	032h,000h,000h,000h
  2717 00001196 F000700614                              db	0F0h,000h,070h,006h,014h
  2718 0000119B B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  2719 000011A0 3000DD56                                db	030h,000h,0DDh,056h
  2720 000011A4 B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  2721 000011A9 32DD0056                                db	032h,0DDh,000h,056h
  2722 000011AD 32DD0056                                db	032h,0DDh,000h,056h
  2723 000011B1 32DD0056                                db	032h,0DDh,000h,056h
  2724 000011B5 7000F056                                db	070h,000h,0F0h,056h
  2725 000011B9 7000BB56                                db	070h,000h,0BBh,056h
  2726 000011BD 32B00B46                                db	032h,0B0h,00Bh,046h
  2727 000011C1 72BB0056                                db	072h,0BBh,000h,056h
  2728 000011C5 71B0B056                                db	071h,0B0h,0B0h,056h
  2729 000011C9 71021156                                db	071h,002h,011h,056h
  2730 000011CD 71221156                                db	071h,022h,011h,056h
  2731 000011D1 31201156                                db	031h,020h,011h,056h
  2732 000011D5 730BB056                                db	073h,00Bh,0B0h,056h
  2733 000011D9 73BB0056                                db	073h,0BBh,000h,056h
  2734 000011DD 300B0B46                                db	030h,00Bh,00Bh,046h
  2735 000011E1 3000BB56                                db	030h,000h,0BBh,056h
  2736 000011E5 FF                                      db	0FFh
  2737                                  
  2738                                  ; flying script	126 bytes
  2739                                  script:
  2740                                  ;     7 6 5 4 3 2 1 0
  2741                                  ;	  v v v v v c c c
  2742                                  ;
  2743                                  ;	  v = VALUE
  2744                                  ;	  c = COMMAND
  2745                                  ;
  2746                                  ;	  0 = NOP
  2747                                  ;	  1 = NEG ZSTEP
  2748                                  ;	  2 = INC SPEED
  2749                                  ;	  3 = DEC SPEED
  2750                                  ;	  4 = INC XSTEP
  2751                                  ;	  5 = DEC XSTEP
  2752                                  ;	  6 = INC YSTEP
  2753                                  ;	  7 = INC YSTEP
  2754                                  
  2755 000011E6 A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  2756 000011EC F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  2757 000011F2 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  2758 000011F8 F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  2759 000011FE F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  2760 00001204 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  2761 0000120A 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  2762 00001210 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  2763 00001216 F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  2764 0000121C A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  2765 00001222 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  2766 00001228 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  2767 0000122E A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  2768 00001234 B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  2769 0000123A A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  2770 00001240 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  2771 00001246 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  2772 0000124C 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  2773 00001252 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  2774 00001258 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  2775 0000125E F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  2776                                  
  2777 00001263 0100                    zstep:		dw	1			
  2778 00001265 66EF                    doortimer	dw 	-4250	; 0EF66h
  2779 00001267 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  2780                                  omniend:
  2781 00001270 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  2781 00001279 4B9A5050455253     
  2782                                  sancend:
  2783 00001280 0000A5C3                ob:		dd 	-330.0	; vector.x
  2784 00001284 00000000                		dd 	   0.0	; vector.y	
  2785 00001288 00008042                		dd	  64.0	; vector.z	
  2786                                  owmat:
  2787 0000128C 00000000                		dd 	   0.0	; vector.x
  2788 00001290 000080BF                		dd 	  -1.0	; vector.y
  2789 00001294 00000000                		dd	   0.0  ; vector.z
  2790                                  ;owmat+12:
  2791 00001298 00000000                		dd 	   0.0	; vector.x
  2792 0000129C 00000000                		dd 	   0.0	; vector.y
  2793 000012A0 000080BF                		dd	  -1.0  ; vector.z
  2794                                  ;owmat+24:
  2795 000012A4 0000803F                		dd 	   1.0	; vector.x
  2796 000012A8 00000000                		dd 	   0.0	; vector.y
  2797 000012AC 00000000                		dd	   0.0  ; vector.z
  2798                                  
  2799                                  bss_start:
  2800                                  
  2801                                  ABSOLUTE bss_start
  2802                                  
  2803                                  ;=============================================================================
  2804                                  ;        	null-initialized data
  2805                                  ;=============================================================================
  2806                                  
  2807                                  nullstart:
  2808 000012B0 <res 00000024>          wmat:           resb	matrix.size  ; 36
  2809 000012D4 <res 00000024>          nwmat:		resb	matrix.size  ; 36
  2810 000012F8 <res 00000002>          zspeed:		resw	1
  2811 000012FA <res 00000002>          oxw:		resw	1
  2812 000012FC <res 00000002>          oyw:		resw	1
  2813 000012FE <res 00000002>          ozw:		resw	1
  2814 00001300 <res 00000002>          scriptptr:	resw	1
  2815 00001302 <res 00000002>          scriptanz:	resw	1
  2816 00001304 <res 00000001>          scriptins:	resb	1
  2817 00001305 <res 00000001>          once:		resb	1
  2818 00001306 <res 00000002>          ticker:		resw	1
  2819 00001308 <res 00000002>          tracks:		resw	1
  2820 0000130A <res 00000300>          palette:        resb 	768
  2821 0000160A <res 00000060>          channels:       resb	16*6
  2822 0000166A <res 00001C24>          o:		resb	object.size ; 7204
  2823                                  nullend:
  2824                                  
  2825                                  ;=============================================================================
  2826                                  ;       	uninitialized data
  2827                                  ;=============================================================================
  2828 0000328E <res 00000002>          oldstack        resw	1
  2829                                  Old08IrqPtr:
  2830 00003290 <res 00000002>          Old08Irqofs:	resw	1
  2831 00003292 <res 00000002>          Old08Irqseg:	resw	1
  2832                                  ;Old09IrqPtr:
  2833                                  ;Old09Irqofs:	resw	1
  2834                                  ;Old09Irqseg:	resw	1
  2835 00003294 <res 00000E15>          songdata:	resb	3605
  2836 000040A9 <res 00000002>          root:   	resw	1
  2837 000040AB <res 00000040>          circletab:	resw	32
  2838 000040EB <res 0000005A>          stars:		resb	90
  2839 00004145 <res 00000001>          twice:		resb	1
  2840 00004146 <res 00000002>          vseg:		resw	1
  2841 00004148 <res 00000002>          bseg:		resw    1
  2842 0000414A <res 00000028>          tseg:   	resw	20
  2843 00004172 <res 00008000>          shadetab:	resb	256*128
  2844 0000C172 <res 00000078>          p:		resw	4*15
  2845 0000C1EA <res 000000B4>          pr:		resd	3*15
  2846 0000C29E <res 000000B4>          po:		resb	poly.size ; 5*36
  2847 0000C352 <res 000012C0>          rp:		resd	3*MAXPOINTS ; 3*400
  2848 0000D612 <res 00000640>          facei:		resd    MAXFACES ; 400
  2849                                  
  2850 0000DC52 <res 00000002>          alignb 4
  2851                                  
  2852                                  bss_end:
