     1                                  ; ****************************************************************************
     2                                  ; sncomni.s (TRDOS 386, TRDOS v2.0 - sample binary file, 'sncomni.prg')
     3                                  ; ----------------------------------------------------------------------------
     4                                  ; SNCOMNI.PRG ! TEST program !  TRDOS 386 VGA Functionality test !
     5                                  ;
     6                                  ; 02/09/2016
     7                                  ;
     8                                  ; [ Last Modification: 18/12/2016 ]
     9                                  ;
    10                                  ; Derived from source code of 'OMNISCENT.ASM' by Dirk Kppers
    11                                  ;          SNC_OMNI.COM	 (MSDOS) intro file, 1997
    12                                  ;
    13                                  ; Assembler: NASM 2.11
    14                                  
    15                                  ; (Original TASM -msdos- code has been modifed for TRDOS 386 system calls and
    16                                  ; other protected mode (TRDOS 386) interrupts.)
    17                                  ; ****************************************************************************
    18                                  
    19                                  ;		   ----====> Omniscent <====----
    20                                  ;
    21                                  ;   Omniscent was done by Pinker of SANCTION for the Mekka '97. The song
    22                                  ;   was written by Nyphton. It place XXX out of XXX.
    23                                  ;
    24                                  ;   Special thanks in alphabetical order :
    25                                  ;
    26                                  ;       Andreas Mautsch     (beta testing)
    27                                  ;       Axel Scheel Meyer   (MACM sources, nice IRC chat's)
    28                                  ;       Christian Cohnen    (for his help on perspective texture mapping and
    29                                  ;	   		designing world and script)
    30                                  ;       Daniel Weinand	    (song)
    31                                  ;       Funk                (for give me the idea trying a 4K Descent)
    32                                  ;       Stephanie Schepers  (moral and food support ;-) )
    33                                  ;
    34                                  ;       and all other SANCTION dudes for supporting this product !
    35                                  
    36                                  ; 16/10/2016
    37                                  ; 29/04/2016
    38                                  ; TRDOS 386 system calls (temporary list!)
    39                                  _ver 	equ 0
    40                                  _exit 	equ 1
    41                                  _fork 	equ 2
    42                                  _read 	equ 3
    43                                  _write	equ 4
    44                                  _open	equ 5
    45                                  _close 	equ 6
    46                                  _wait 	equ 7
    47                                  _creat 	equ 8
    48                                  _link 	equ 9
    49                                  _unlink	equ 10
    50                                  _exec	equ 11
    51                                  _chdir	equ 12
    52                                  _time 	equ 13
    53                                  _mkdir 	equ 14
    54                                  _chmod	equ 15
    55                                  _chown	equ 16
    56                                  _break	equ 17
    57                                  _stat	equ 18
    58                                  _seek	equ 19
    59                                  _tell 	equ 20
    60                                  _mount	equ 21
    61                                  _umount	equ 22
    62                                  _setuid	equ 23
    63                                  _getuid	equ 24
    64                                  _stime	equ 25
    65                                  _quit	equ 26	
    66                                  _intr	equ 27
    67                                  _fstat	equ 28
    68                                  _emt 	equ 29
    69                                  _mdate 	equ 30
    70                                  _video 	equ 31
    71                                  _audio	equ 32
    72                                  _timer	equ 33
    73                                  _sleep	equ 34
    74                                  _msg    equ 35
    75                                  _geterr	equ 36
    76                                  _rsvd1	equ 37
    77                                  _pri	equ 38
    78                                  _rele	equ 39
    79                                  _fff	equ 40
    80                                  _fnf	equ 41
    81                                  
    82                                  %macro sys 1-4
    83                                      ; 29/04/2016 - TRDOS 386 (TRDOS v2.0)	
    84                                      ; 03/09/2015	
    85                                      ; 13/04/2015
    86                                      ; Retro UNIX 386 v1 system call.	
    87                                      %if %0 >= 2   
    88                                          mov ebx, %2
    89                                          %if %0 >= 3    
    90                                              mov ecx, %3
    91                                              %if %0 = 4
    92                                                 mov edx, %4   
    93                                              %endif
    94                                          %endif
    95                                      %endif
    96                                      mov eax, %1
    97                                      ;int 30h
    98                                      int 40h ; TRDOS 386 (TRDOS v2.0)	   
    99                                  %endmacro
   100                                  
   101                                  ; TRDOS 386 (and Retro UNIX 386 v1) system call format:
   102                                  ; sys systemcall (eax) <arg1 (ebx)>, <arg2 (ecx)>, <arg3 (edx)>
   103                                  
   104                                  ; SNCOMNI.ASM
   105                                  ; ͻ
   106                                  ; 	This file is generated by The Interactive Disassembler (IDA)	    
   107                                  ; 	Copyright (c) 2010 by Hex-Rays SA, <support@hex-rays.com>	    
   108                                  ; 			 Licensed to: Freeware version			    
   109                                  ; ͼ
   110                                  ;
   111                                  ; Input	MD5   :	933E2716A5E585459024215F4468CDBC
   112                                  
   113                                  ; File Name   :	C:\dosprogs\MEMDUMP.COM ; SNC_OMNI.COM UNPACKED!
   114                                  ; Format      :	MS-DOS COM-file
   115                                  ; Base Address:	0h Range: 100h-60100h Loaded length: 60000h
   116                                  
   117                                  ; NASM version: Erdogan Tan, 14/08/2016 (Modified from MEMDUMP.ASM)
   118                                  ; (SNC_OMNI.COM -> unpacking by using DosBox Debug -> MEMDUMP.COM ->
   119                                  ; disassembling by using IDA Pro Free -> MEMDUMP.ASM -> converting to
   120                                  ; NASM syntax (manual) -> test with DosBox -> correcting different code by
   121                                  ; matching MEMDUMP.LST and SNCOMNI.LST files -> this file !!!)
   122                                  
   123                                  ;==============================================================================
   124                                  ;		   constants
   125                                  ;==============================================================================
   126                                  
   127                                  GMPort		equ 0331h
   128                                  CMD_NOTEON      equ 090h
   129                                  CMD_NOTEOFF     equ 080h
   130                                  CMD_CHANGEPARAM equ 0B0h
   131                                  CMD_CHANGEPRG   equ 0C0h
   132                                  MOD_ALLNOTESOFF equ 07Bh
   133                                  MAXFACES	equ 400
   134                                  MAXPOINTS	equ 400
   135                                  SONGSPEED   	equ 29
   136                                  XMAX		equ 320
   137                                  YMIN		equ 21
   138                                  YMAX		equ 179
   139                                  SUBRANGE	equ 16
   140                                  %define ASPECT_RATIO 1.2
   141                                  CENTERX		equ 160
   142                                  CENTERY		equ 100
   143                                  
   144                                  ;==============================================================================
   145                                  ;		   structures
   146                                  ;==============================================================================
   147                                  
   148                                  struc channel
   149 00000000 <res 00000002>           .del:	resw 1
   150 00000002 <res 00000001>           .trk:	resb 1
   151 00000003 <res 00000001>           .ln:	resb 1
   152 00000004 <res 00000002>           .adr:	resw 1
   153                                  endstruc
   154                                  
   155                                  struc matrix
   156 00000000 <res 00000024>          	resd 9
   157                                   .size:
   158                                  endstruc
   159                                  
   160                                  struc vector
   161 00000000 <res 00000004>           .x:	resd 1
   162 00000004 <res 00000004>           .y:	resd 1
   163 00000008 <res 00000004>           .z:	resd 1
   164                                   .size:
   165                                  endstruc
   166                                  
   167                                  struc point
   168 00000000 <res 00000002>           .x:	resw 1
   169 00000002 <res 00000002>           .y:	resw 1
   170 00000004 <res 00000002>           .z:	resw 1
   171 00000006 <res 00000002>           .s:	resw 1
   172                                   .size:
   173                                  endstruc
   174                                  
   175                                  struc face
   176 00000000 <res 0000000A>          	resw 5
   177                                   .size: 	
   178                                  endstruc
   179                                  
   180                                  struc object
   181 00000000 <res 00000002>           .panz:	resw 1
   182 00000002 <res 00000002>           .fanz:	resw 1
   183 00000004 <res 00000C80>           .p:	resb point.size*MAXPOINTS
   184 00000C84 <res 00000FA0>           .f:	resb face.size*MAXFACES
   185                                   .size:
   186                                  endstruc
   187                                  
   188                                  struc edges
   189 00000000 <res 00000004>           .x:	resd 1
   190 00000004 <res 00000004>           .u:	resd 1
   191 00000008 <res 00000004>           .v:	resd 1
   192 0000000C <res 00000004>           .w:	resd 1
   193 00000010 <res 00000004>           .s:	resd 1
   194                                   .size:	
   195                                  endstruc
   196                                  
   197                                  struc edge
   198 00000000 <res 0000000C>           .p:	resb vector.size
   199 0000000C <res 00000004>           .py:	resd 1
   200 00000010 <res 00000014>           .e:	resb edges.size
   201                                   .size:
   202                                  endstruc
   203                                  
   204                                  struc poly
   205 00000000 <res 000000B4>          	resb edge.size*5
   206                                   .size:	
   207                                  endstruc
   208                                  
   209                                  ;==============================================================================
   210                                  ;		      %macros
   211                                  ;==============================================================================
   212                                  ;***********************************************
   213                                  ;* descript. : start timer interrupt 70/s      *
   214                                  ;* parameter : none			       *
   215                                  ;* sideeffect: all		 	       *
   216                                  ;* back      : none			       *
   217                                  ;***********************************************
   218                                  %macro		startTimer 0
   219                                                  ;mov     ax,03508h
   220                                                  ;int     21h
   221                                                  ;mov     [word ptr Old08Irqseg],es
   222                                                  ;mov     [word ptr Old08Irqofs],bx
   223                                                  ;mov     ax,02508h
   224                                                  ;mov     dx,offset irqHandler08
   225                                                  ;int     21h
   226                                                  ;mov     bx,3409		; 350 ticks per second
   227                                                  ;call    setTimer
   228                                  		
   229                                  		; start timer event
   230                                          	;mov     bl, 0FFh ; signal return (response) byte
   231                                          	;mov     bh, 1    ; 18.2 ticks per second (*!) -default-
   232                                  		mov	ebx, 1FFh
   233                                  		mov	ecx, 1
   234                                  		;mov	cl, 1
   235                                  		mov	edx, timer_sig_response ; signal response address
   236                                  		mov	eax, 33	; 'systimer'
   237                                  		int	40h	; TRDOS 386 system call
   238                                  		jc	loc_err_exit
   239                                  
   240                                  		mov	bx, 3409 ; 1193180/3409 = 350 ticks per second (*!)
   241                                  		call	setTimer
   242                                  %endmacro
   243                                  
   244                                  ;***********************************************
   245                                  ;* descript. : stop timer interrupt            *
   246                                  ;* parameter : none			       *
   247                                  ;* sideeffect: all		 	       *
   248                                  ;* back      : none			       *
   249                                  ;***********************************************
   250                                  %macro		stopTimer 0
   251                                                  ;push    ds
   252                                                  ;xor     bx,bx                  ; set timer to default
   253                                                  ;call    setTimer		; 18.2 ticks per second
   254                                                  ;mov     ax,02508h              ; restore old IRQ-vector
   255                                                  ;lds     dx,[Old08Irqptr]
   256                                                  ;int     21h
   257                                                  ;pop     ds
   258                                  
   259                                  		xor	bx, bx	; set timer to default (18.2 Hz) value
   260                                  		call	setTimer
   261                                  
   262                                  		; Stop timer event
   263                                  		movzx	ebx, byte [timer_sig_response] ; Timer Event Number (>0)
   264                                  		and	bl, bl
   265                                  		jz	short r_t_m ; 0 = error (no timer event)
   266                                   		; bh = 0 -> stop timer event
   267                                  		mov	eax, 33	; 'systimer'
   268                                  		int	40h	; TRDOS 386 system call
   269                                  r_t_m:
   270                                  %endmacro
   271                                  
   272                                  ;***********************************************
   273                                  ;* descript. : start keyboard handler          *
   274                                  ;* parameter : none			       *
   275                                  ;* sideeffect: all		 	       *
   276                                  ;* back      : none			       *
   277                                  ;***********************************************
   278                                  %macro		startKBDHandler 0
   279                                                  ;mov     ax,03509h
   280                                                  ;int     21h
   281                                                  ;mov     [word ptr Old09Irqseg],es
   282                                                  ;mov     [word ptr Old09Irqofs],bx
   283                                                  ;mov     ax,02509h
   284                                                  ;mov     dx,offset irqHandler09
   285                                                  ;int     21h
   286                                  
   287                                  		; TRDOS 386 already have a CRTL+BRK
   288                                  		; preview feature to call 'sysexit'
   289                                  		; /// nothing to do here ! ///
   290                                  		; 10/12/2016 - Erdogan Tan
   291                                  		nop
   292                                  %endmacro
   293                                  
   294                                  ;***********************************************
   295                                  ;* descript. : stop keyboard handler           *
   296                                  ;* parameter : none			       *
   297                                  ;* sideeffect: all		               *
   298                                  ;* back      : none		               *
   299                                  ;***********************************************
   300                                  %macro		stopKBDHandler 0
   301                                                  ;push    ds
   302                                                  ;mov     ax,02509h             ; restore old IRQ-vector
   303                                                  ;lds     dx,[Old09Irqptr]      ;
   304                                                  ;int     21h
   305                                                  ;pop     ds
   306                                  
   307                                  		; TRDOS 386 already have a CRTL+BRK
   308                                  		; preview feature to call 'sysexit'
   309                                  		; /// nothing to do here ! ///
   310                                  		; 10/12/2016 - Erdogan Tan
   311                                  		nop
   312                                  %endmacro
   313                                  
   314                                  ;***********************************************
   315                                  ;* descript. : zero null-initialized data      *
   316                                  ;* parameter : none			       *
   317                                  ;* sideeffect: all		               *
   318                                  ;* back      : none		               *
   319                                  ;***********************************************
   320                                  %macro		nullData 0
   321                                  		;mov	di, nullstart
   322                                                  mov	edi, nullstart
   323                                  		mov	cx, nullend-nullstart
   324                                                  xor	eax, eax
   325                                                  rep	stosb
   326                                  %endmacro
   327                                  
   328                                  ;***********************************************
   329                                  ;* descript. : set textmode		       *
   330                                  ;* parameter : none		               *
   331                                  ;* sideeffect: all		               *
   332                                  ;* back      : none		               *
   333                                  ;***********************************************
   334                                  %macro		set80x25 0
   335                                  		mov	ax, 3
   336                                  		;int	10h	; - VIDEO - SET	VIDEO MODE
   337                                  				; AL = mode
   338                                  		int	31h	; TRDOS 386 Video interrupt 
   339                                  %endmacro
   340                                  
   341                                  ;***********************************************
   342                                  ;* descript. : set gfx-mode 320x200            *
   343                                  ;* parameter : none		               *
   344                                  ;* sideeffect: all		               *
   345                                  ;* back      : none		               *
   346                                  ;***********************************************
   347                                  %macro		set320x200 0
   348                                  		mov	ax, 13h
   349                                  		;int	10h		; - VIDEO - SET	VIDEO MODE
   350                                  					; AL = mode
   351                                  		int	31h ; TRDOS 386 - Video interrupt
   352                                  %endmacro
   353                                  
   354                                  ;***********************************************
   355                                  ;* descript. : calculate a smooth colorrange   *
   356                                  ;* parameter : none             	       *
   357                                  ;* sideeffect: all              	       *
   358                                  ;* back	     : none                	       *
   359                                  ;***********************************************
   360                                  %macro		makePalette 0
   361                                  		;mov	bx, 3
   362                                  		mov	ebx, 3
   363                                  mPcolor:
   364                                  		;mov	si, colors
   365                                  		mov	esi, colors
   366                                  		mov	edi, palette
   367                                  		xor	dh, dh
   368                                  		lodsb
   369                                  		movzx	cx, al
   370                                  mPouter:
   371                                  		push	cx
   372                                  		mov	cl, [esi]
   373                                  		mov	ah, [ebx+esi]
   374                                  		sub	ax, dx
   375                                  		push	dx
   376                                  		cwd
   377                                  		idiv	cx
   378                                  		pop	dx
   379                                  mPinner:
   380                                  		add	dx, ax
   381                                  		mov	[edi+ebx-1], dh
   382                                  		add	di, 3
   383                                  		loop	mPinner
   384                                  		add	si, 4
   385                                  		pop	cx
   386                                  		loop	mPouter
   387                                  		dec	bx
   388                                  		jnz	short mPcolor
   389                                  %endmacro
   390                                  
   391                                  ;***********************************************
   392                                  ;* descript. : reset the GM-Port and switch to *
   393                                  ;*             UART mode.		       *
   394                                  ;* parameter : none			       *
   395                                  ;* sideeffect: dx,al		               *
   396                                  ;* back      : none		               *
   397                                  ;***********************************************
   398                                  %macro		resetGM 0
   399                                  		mov	dx, GMPort
   400                                  		mov	al, 0FFh
   401                                  		;out	dx, al
   402                                  	
   403                                  		mov	ah, 1 ; out (byte)
   404                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   405                                  		; cl = 0
   406                                  		dec	ah ; 0
   407                                  		;sub	cl, cl
   408                                  resGMbusy1:
   409                                  		dec	cl
   410                                  		jz	short rGMerror	;{ timeout }
   411                                  		;in	al, dx		;{ read acknowledge }
   412                                  		
   413                                  		;mov	ah, 0 ; in (byte)
   414                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   415                                  		
   416                                  		test	al, 80h
   417                                  		jnz	short resGMbusy1
   418                                  		dec	dx
   419                                  		;in	al, dx
   420                                  
   421                                  		;mov	ah, 0 ; in (byte)
   422                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   423                                  
   424                                  		cmp	al, 0FEh
   425                                  		jne	short rGMerror
   426                                  		inc	dx		;{ switch into UART mode }
   427                                  resGMbusy2:
   428                                  		;in	al, dx
   429                                  
   430                                  		;mov	ah, 0 ; in (byte)
   431                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   432                                  		
   433                                  		test	al, 40h
   434                                  		jnz	short resGMbusy2
   435                                  		mov	al, 3Fh
   436                                  		;out	dx, al
   437                                  
   438                                  		;mov	ah, 1 ; out (byte)
   439                                  		inc	ah ; 1
   440                                  		int	34h ; TRDOS 386 - IOCTL interrupt
   441                                  rGMerror:
   442                                  %endmacro
   443                                  
   444                                  ;***********************************************
   445                                  ;* descript. : mute midi channels 0..15        *
   446                                  ;* parameter : none                	       *
   447                                  ;* sideeffect: ax,cx		               *
   448                                  ;* back		 : none                	       *
   449                                  ;***********************************************
   450                                  %macro		silence 0
   451                                  		mov	cx, 15 ; 0Fh
   452                                  Siloop:	
   453                                  		mov	ax, cx
   454                                  		add	al, CMD_CHANGEPARAM ; 0B0h
   455                                  		call	writeGM
   456                                  		mov	al, MOD_ALLNOTESOFF ; 7Bh
   457                                  		call	writeGM
   458                                  		xor	al, al
   459                                  		call	writeGM
   460                                  		loop	Siloop
   461                                  Sinosound:
   462                                  %endmacro
   463                                  
   464                                  ;***********************************************
   465                                  ;* descript. : create the reactor wall texture *
   466                                  ;* parameter : none		               *
   467                                  ;* sideeffect: ax,bx,cx,di,es                  *
   468                                  ;* back      : none			       *
   469                                  ;* length    : 45 bytes		               *
   470                                  ;***********************************************
   471                                  %macro		reactorWall 0
   472                                  		mov	edi, [tseg]
   473                                  		mov	cx, 4096 ; 1000h
   474                                  rsmloop:
   475                                  		mov	ax, di
   476                                  		;and	ax, 0FFFh
   477                                  		test	al, 8
   478                                  		jle	short rsnonot1
   479                                  		not	al
   480                                  rsnonot1:
   481                                  		and	al, 15 ; 0Fh
   482                                  		mov	bx, ax
   483                                  		mov	ax, di
   484                                  		and	ax, 0FFFh ; 18/12/2016
   485                                  		shr	ax, 6
   486                                  		test	al, 8
   487                                  		jle	short rsnonot2
   488                                  		not	al
   489                                  rsnonot2:
   490                                  		and	al, 15 ; 0Fh
   491                                  		cmp	al, bl
   492                                  		jle	short rstakeal
   493                                  		mov	ax, bx
   494                                  rstakeal:
   495                                  		add	al, 224 ; 0E0h
   496                                  		stosb
   497                                  		loop	rsmloop
   498                                  %endmacro
   499                                  
   500                                  ;***********************************************
   501                                  ;* descript. : calc background-fractal         *
   502                                  ;* parameter : none		               *
   503                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   504                                  ;* back      : none			       *
   505                                  ;***********************************************
   506                                  %macro		createFrac2 0
   507                                  		mov	edi, [tseg+72] ; word [tseg+36] (*)
   508                                  		mov	ebx, edi ; 16/12/2016
   509                                  		mov	al, 20	; 14h
   510                                  		call	setFrac
   511                                  		;mov	di, 64	; 40h
   512                                  		mov	edi, ebx
   513                                  		or	di, 64
   514                                  		mov	cx, 4096-64 ; 0FC0h
   515                                  		mov	ebx, 4 ; 16/12/2016
   516                                  cF1loop:
   517                                  		;mov	bx, 4
   518                                  		call	rnd
   519                                  		add	al, [edi-64]  ; byte [es:di-64] (*) 16 bit
   520                                  		add	al, [edi-63]  ; byte [es:di-63] (*)
   521                                  		dec	ax
   522                                  		shr	ax, 1
   523                                  		stosb
   524                                  		loop	cF1loop
   525                                  %endmacro
   526                                  
   527                                  ;***********************************************
   528                                  ;* descript. : calc random noise fractal       *
   529                                  ;* parameter : none		               *
   530                                  ;* sideeffect: ax,bx,cx,si,di,es	       *
   531                                  ;* back      : none			       *
   532                                  ;***********************************************
   533                                  %macro		createFrac3 0
   534                                  		mov	edi, [tseg+76] ; es = word [tseg+38] (*)
   535                                  		mov	ebx, edi ; 16/12/2016
   536                                  		mov	al, 3
   537                                  		call	setFrac
   538                                  		mov	edi, ebx
   539                                  		mov	cx, 4096 ; 1000h
   540                                  		movzx	ebx, cx ; 16/12/2016
   541                                  cF3loop:
   542                                  		;mov	bx, 4096 ; 1000h
   543                                  		call	rnd
   544                                  		;mov	di, ax 
   545                                  		or	di, ax ; 16/12/2016 (ax <= 4095)
   546                                  		inc	byte [edi] ; byte [es:di] (*) 16 bit dos code
   547                                  		loop	cF3loop
   548                                  %endmacro
   549                                  
   550                                  ;***********************************************
   551                                  ;* descript. : init stars (positions and state)*
   552                                  ;* parameter : none			       *
   553                                  ;* sideeffect: eax,bx,cx,edx,si,di,es          *
   554                                  ;* back      : none		               *
   555                                  ;***********************************************
   556                                  %macro		initStars 0
   557                                  		mov	cx, 30 ; 1Eh
   558                                  		mov	edi, stars
   559                                  		xor	ebx, ebx ; ? 18/12/2016
   560                                  iSloop:	
   561                                  		mov	bx, 256 ; 100h
   562                                  		call	rnd
   563                                  		stosb
   564                                  		mov	bx, 4096-64*5 ; 0EC0h
   565                                  		add	bx, 128 ; 80h
   566                                  		call	rnd
   567                                  		add	ax, 64  ; 40h
   568                                  		stosw
   569                                  		loop	iSloop
   570                                  %endmacro
   571                                  
   572                                  ;***********************************************
   573                                  ;* descript. : add effects to fractals	       *
   574                                  ;* parameter : none		               *
   575                                  ;* sideeffect: ax,bx,cx,di,es		       *
   576                                  ;* back      : none		               *
   577                                  ;***********************************************
   578                                  %macro		effects 0
   579                                  		; effects
   580                                  		mov	cx, 26		; 1Ah
   581                                  		mov	esi, aE
   582                                  		;mov	si, aE
   583                                  		; 16/12/2016
   584                                  		;xor	bh, bh
   585                                  		xor	ebx, ebx ; 18/12/2016
   586                                  		xor	edi, edi
   587                                  effmloop:
   588                                  		push	cx
   589                                  		mov	bl, [esi]	; mseg+effect
   590                                  		mov	dl, bl
   591                                  		shr	dl, 4
   592                                  		and	bl, 0Fh ; 15
   593                                  		shl	bl, 2
   594                                  		mov	ebp, [ebx+tseg]
   595                                  		movzx	cx, byte [esi+2] ; y1
   596                                  effyloop:
   597                                  		movzx	bx, byte [esi+1] ; x1
   598                                  effxloop:
   599                                  		mov	di, cx
   600                                  		shl	di, 6
   601                                  		add	di, bx
   602                                  		mov	al, dl
   603                                  		dec	al
   604                                  		jz	short effect1
   605                                  		dec	al
   606                                  		jz	short effect2
   607                                  		mov	ax, bx
   608                                  		add	ax, cx
   609                                  		and	al, 4
   610                                  		;jz	short effdonot
   611                                  		jz	short effect1
   612                                  		mov	al, 152 ; 98h
   613                                  effdonot:
   614                                  		jmp	short effect1
   615                                  effect2:
   616                                  		mov	al, [ebp+edi] ; 16/12/2016
   617                                  effect1:
   618                                  		add	al, [esi+5]	; value
   619                                  		mov	[ebp+edi], al ; 16/12/2016
   620                                  		inc	bx
   621                                  		cmp	bl, [esi+3]	; x2
   622                                  		jle	short effxloop
   623                                  		inc	cx
   624                                  		cmp	cl, [esi+4]	; y2
   625                                  		jle	short effyloop
   626                                  		add	si, 6
   627                                  		pop	cx
   628                                  		loop	effmloop
   629                                  %endmacro
   630                                  
   631                                  ;***********************************************
   632                                  ;* descript. : copy fractals and add value     *
   633                                  ;* parameter : none		               *
   634                                  ;* sideeffect: al,cx,di,es,fs		       *
   635                                  ;* back      : none		               *
   636                                  ;***********************************************
   637                                  %macro		addFractals 0
   638                                  		mov	esi, aF
   639                                  		;mov	si, aF
   640                                  		mov	dl, 8
   641                                  		xor	ebx, ebx
   642                                  		;xor	bh, bh
   643                                  aFloop:
   644                                  		mov	bl, dl
   645                                  		mov	edi, [ebx+tseg] ; es
   646                                  		lodsw
   647                                  		mov	bl, al ; 16 bit offset (original)
   648                                  		shl	bl, 1  ; 32 bit offset (trdos 386)
   649                                  		mov	ebp, [ebx+tseg] ; fs:
   650                                  		mov	cx, 4096 ; 1000h
   651                                  aFiloop:
   652                                  		mov	al, [ebp]  ; [fs:di]
   653                                  		add	al, ah
   654                                  		stosb
   655                                  		inc	ebp
   656                                  		loop	aFiloop
   657                                  		add	dl, 4
   658                                  		cmp	dl, 60 ; 3Ch
   659                                  		jle	short aFloop
   660                                  %endmacro
   661                                  
   662                                  ;***********************************************
   663                                  ;* descript. : calculate and initalize textures*
   664                                  ;* parameter : none			       *
   665                                  ;* sideeffect: al,cx,di,es,fs		       *
   666                                  ;* back      : none			       *
   667                                  ;***********************************************
   668                                  %macro		addLava 0
   669                                  		push	edx ; 18/12/2016
   670                                  		mov	edi, [tseg+44]
   671                                  		;mov	di, 4095	; 0FFFh
   672                                  		;or	di, 0FFFh ; 4095 ; 12/12/2016
   673                                  		mov	edx, 4095 ; 18/12/2016
   674                                  		mov	cx, 20		; 14h
   675                                  		mov	al, 94		; 5Eh
   676                                  aLyloop:
   677                                  		push	ecx
   678                                  		shl	cx, 3
   679                                  aLxloop:
   680                                  		;push	edi
   681                                  		push	edx
   682                                  		push	eax
   683                                  		;mov	bx, 64		; 40h
   684                                  		mov	ebx, 64 ; 18/12/2016 ; temp
   685                                  		call	rnd
   686                                  		;sub	di, ax
   687                                  		sub	dx, ax ; 18/12/2016
   688                                  		pop	eax
   689                                  		;stosb
   690                                  		mov	[edi+edx], al
   691                                  		pop	edx
   692                                  		;pop	edi
   693                                  		loop	aLxloop
   694                                  		pop	ecx
   695                                  		dec	al
   696                                  		sub	di, 64 		; 40h
   697                                  		loop	aLyloop
   698                                  		pop	edx
   699                                  %endmacro
   700                                  
   701                                  ;***********************************************
   702                                  ;* descript. : calculate and initalize textures*
   703                                  ;* parameter : none		               *
   704                                  ;* sideeffect: al,cx,di,es,fs		       *
   705                                  ;* back      : none		               *
   706                                  ;***********************************************
   707                                  %macro		initTextures 0
   708                                  		;mov	bx, 34	; 22h
   709                                  		mov	ebx, 34
   710                                  		push	800	; 320h
   711                                  		push	5
   712                                  		call	createFrac1
   713                                  		;mov	bx, 32	; 20h
   714                                  		mov	ebx, 32
   715                                  		push	112	; 70h
   716                                  		push	15	; 0Fh
   717                                  		call	createFrac1
   718                                  		createFrac2
   719                                  		createFrac3
   720                                  		initStars
   721                                  		reactorWall
   722                                  		addFractals
   723                                  		effects
   724                                  		addLava
   725                                  %endmacro
   726                                  
   727                                  ;***********************************************
   728                                  ;* descript. : cycle "range" colors at "base"  *
   729                                  ;* parameter : none		               *
   730                                  ;* sideeffect: ax,(bl),cx,si,di,es             *
   731                                  ;* back      : none			       *
   732                                  ;***********************************************
   733                                  %macro		colorCycle 0
   734                                  		bas	equ 6*32
   735                                                  range	equ 32
   736                                  		
   737                                  		; 16/12/2016
   738                                  		mov	edi, palette+(base*3)
   739                                  		mov	esi, edi
   740                                  		lodsw
   741                                  		;mov	bl,[esi]  ; works only with fire (no blue)
   742                                  		inc	esi
   743                                  		mov	cx, (range*3-3)
   744                                  		rep movsb
   745                                  		stosw
   746                                  		;mov	[edi],bl  ; works only with fire (no blue)
   747                                  %endmacro
   748                                  
   749                                  ;***********************************************
   750                                  ;* descript. : animate the stars	       *
   751                                  ;* parameter : none			       *
   752                                  ;* sideeffect: ax,bx,cx,dl,si,di,es            *
   753                                  ;* back      : none			       *
   754                                  ;***********************************************
   755                                  %macro		animStars 0
   756                                  		base	equ 7*32
   757                                  
   758                                  		mov	edi, [tseg+4] ; es = word [tseg+2]
   759                                  		call	clearFrac
   760                                  
   761                                  		;mov	ecx, 30
   762                                  		mov	cl, 30	; 1Eh
   763                                  		mov	ebx, stars
   764                                  		;mov	bx, stars
   765                                  aSoloop:
   766                                  		dec	byte [ebx]
   767                                  		mov	ah, [ebx]
   768                                  		and	ah, 63	; 3Fh
   769                                  		cmp	ah, 31	; 1Fh
   770                                  		jbe	short aSnonot
   771                                  		not	ah
   772                                  		and	ah, 31	; 1Fh
   773                                  aSnonot:
   774                                  		shr	ah, 1
   775                                  		mov	edi, [tseg+4] ; 16/12/2016
   776                                  		;mov	di, [ebx+1]
   777                                  		or	di, [ebx+1] ; 16/12/2016
   778                                  		push	cx
   779                                  		push	bx
   780                                  
   781                                  		mov	dx, 64-5 ; 3Bh
   782                                  		mov	cx, base*256+0 ; 0E000h
   783                                  		call	setstarbob
   784                                  
   785                                  		pop	bx
   786                                  		pop	cx
   787                                  		add	bx, 3
   788                                  		loop	aSoloop
   789                                  %endmacro
   790                                  
   791                                  ;***********************************************
   792                                  ;* descript. : calculate shading tab           *
   793                                  ;* parameter : none		               *
   794                                  ;* sideeffect: ax,bl,cx,di,es                  *
   795                                  ;* back      : none		               *
   796                                  ;***********************************************
   797                                  %macro		calcShadeTab 0
   798                                  		mov	edi, shadetab
   799                                  		xor	bl, bl
   800                                  cSolp:
   801                                  		inc	bl
   802                                  		xor	cx, cx
   803                                  cSilp1:
   804                                  		mov	al, cl
   805                                  		and	al, 31	; 1Fh
   806                                  		mul	bl
   807                                  		add	ax, ax
   808                                  		mov	al, cl
   809                                  		and	al, 224	; 0E0h
   810                                  		add	al, ah
   811                                  		stosb
   812                                  		inc	cl
   813                                  		cmp	cl, 192 ; 0C0h
   814                                  		jne	short cSilp1
   815                                  cSilp2:
   816                                  		mov	al, cl
   817                                  		stosb
   818                                  		inc	cl
   819                                  		jnz	short cSilp2
   820                                  		cmp	bl, 128	; 80h
   821                                  		jnz	short cSolp
   822                                  %endmacro
   823                                  
   824                                  ;***********************************************
   825                                  ;* descript. : expand a song       	       *
   826                                  ;* parameter : si:song base adress	       *
   827                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
   828                                  ;* back      : none                	       *
   829                                  ;***********************************************
   830                                  %macro		expandSong 0
   831                                                  mov	si, credits
   832                                                  mov	bx, channels
   833                                                  mov	di, songdata
   834                                  EPSwhile:	lodsw
   835                                                  dec	al
   836                                                  js      short EPSendwhile
   837                                                  mov	[ebx+channel.trk], al ; [ebx+2]
   838                                                  add	al, CMD_CHANGEPRG ; 0C0h
   839                                                  call	setinstr
   840                                                  mov	[ebx+channel.adr], di ; [ebx+4]	
   841                                                 	call	expand
   842                                                  xor	al, al
   843                                                  stosb
   844                                                  add	bx, 6
   845                                                  inc	word [tracks]
   846                                                  jmp	short EPSwhile
   847                                  EPSendwhile:
   848                                  %endmacro
   849                                  
   850                                  ;***********************************************
   851                                  ;* descript. : parse the script,rotate and move*
   852                                  ;* parameter : none                	       *
   853                                  ;* sideeffect: all		               *
   854                                  ;* back      : none		               *
   855                                  ;***********************************************
   856                                  %macro		scriptIt 0
   857                                   		; scriptIt
   858                                  		mov	cx, [ticker]
   859                                  		mov	word [ticker], 0
   860                                  		or	cx, cx
   861                                  		jz	sItickerNull
   862                                  sImloop:
   863                                  		push	ecx
   864                                  		mov	esi, zspeed
   865                                  		;mov	si, zspeed
   866                                  		dec	word  [esi+10]	      ;	scriptanz
   867                                  		jns	short sIwaitTimer
   868                                  		mov	bx, [esi+8]	      ;	scriptptr
   869                                  		mov	al, [ebx+script]
   870                                  		or	al, al
   871                                  		jz	_exit_
   872                                  		mov	bx, ax
   873                                  		and	bl, 7
   874                                  		mov	[esi+12], bl	      ;	scriptins
   875                                  		dec	bl
   876                                  		jnz	short sInegateTurn
   877                                  		neg	word [zstep]
   878                                  sInegateTurn:
   879                                  		and	ax, 0F8h
   880                                  		add	ax, ax
   881                                  		mov	[esi+10], ax	      ; scriptanz
   882                                  		inc	word [esi+8]	      ; scriptptr
   883                                  sIwaitTimer:
   884                                  		mov	al, [esi+12]	      ;	scriptins
   885                                  		cbw
   886                                  		dec	ax
   887                                  		jnz	short sInoturn
   888                                  		mov	bx, [zstep]
   889                                  		add	[esi+6], bx	      ; ozw 	
   890                                  sInoturn:
   891                                  		mov	cx, 3
   892                                  sIrotateLoop:
   893                                  		dec	ax
   894                                  		jnz	short sInoIncrement
   895                                  		inc	word [esi]
   896                                  sInoIncrement:
   897                                  		dec	ax
   898                                  		jnz	short sInoDecrement
   899                                  		dec	word [esi]
   900                                  sInoDecrement:
   901                                  		inc	esi
   902                                  		inc	esi
   903                                  		loop	sIrotateLoop
   904                                  		mov	si, zspeed+2
   905                                  		mov	cl, 3
   906                                  		xor	eax, eax
   907                                  sIpushloop:
   908                                  		lodsw
   909                                  		sar	ax, 2
   910                                  		push	eax
   911                                  		loop	sIpushloop
   912                                  
   913                                  		imul	ax, word [esi-4], 16
   914                                  		push	eax
   915                                  		call	calcRotMat
   916                                  
   917                                  		mov	cl, 3
   918                                  		xor	esi, esi
   919                                  sImoveLoop:
   920                                  		fld	dword [esi+owmat+24]
   921                                  		fimul	word [zspeed]
   922                                  		fidiv	word [CONST1792]
   923                                  		fadd	dword [esi+ob]
   924                                  		fstp	dword [esi+ob]
   925                                  		add	si, 4
   926                                  		loop	sImoveLoop
   927                                  		pop	ecx
   928                                  		dec	cx
   929                                  		jnz	sImloop
   930                                  sItickerNull:
   931                                  %endmacro
   932                                  
   933                                  ;***********************************************
   934                                  ;* descript. : rotate all points from o -> rp  *
   935                                  ;* parameter : none                	       *
   936                                  ;* sideeffect: all		               *
   937                                  ;* back      : none		               *
   938                                  ;***********************************************
   939                                  %macro		rotation 0
   940                                  		mov	cx, [o+object.panz]
   941                                  		mov	esi, o+object.p
   942                                  		mov	edi, rp
   943                                  rotmlp:
   944                                  		;mov	bx, wmat
   945                                  		mov	ebx, wmat
   946                                  		mov	dx, 3
   947                                  rotilp:	
   948                                  		fild	word [esi+0]
   949                                  		fsub	dword [ob+vector.x]
   950                                  		fmul	dword [ebx+0]
   951                                  		fild	word [esi+2]
   952                                  		fsub	dword [ob+vector.y]
   953                                  		fmul	dword [ebx+4]
   954                                  		fild	word [esi+4]
   955                                  		fsub	dword [ob+vector.z]
   956                                  		fmul	dword [ebx+8]
   957                                  		fadd
   958                                  		fadd
   959                                  		fstp	dword [edi]
   960                                  		add	di, 4
   961                                  		;add	edi, 4
   962                                  		add	bx, 12	; 0Ch
   963                                  		dec	dx
   964                                  		jnz	short rotilp
   965                                  		add	si, 8
   966                                  		;add	esi, 8
   967                                  		loop	rotmlp
   968                                  %endmacro
   969                                  
   970                                  ;***********************************************
   971                                  ;* descript. : sort faces by z-koord	       *
   972                                  ;* parameter : none		               *
   973                                  ;* sideeffect: ax,bx,cx,dx,si,di,es            *
   974                                  ;* back      : none		               *
   975                                  ;***********************************************
   976                                  %macro		sortFaces 0
   977                                  		mov	edi, facei
   978                                  		push	edi	; facei
   979                                  		mov	esi, o+object.f
   980                                  		;mov	si, o+object.f
   981                                  		mov	ax, si	; pointer to faces
   982                                  		mov	cx, [o+object.fanz]
   983                                  sFmloop:
   984                                  		fldz
   985                                  		push	cx
   986                                  		mov	cx, 4
   987                                  sFiloop:
   988                                  		imul	bx, word [esi], 12
   989                                  		inc	esi
   990                                  		inc	esi
   991                                  		fsub	dword [ebx+rp+vector.z]
   992                                  		loop	sFiloop
   993                                  		pop	cx
   994                                  		fistp	word [edi]
   995                                  		inc	edi
   996                                  		inc	edi
   997                                  		stosw
   998                                  		add	ax, 10
   999                                  		inc	esi
  1000                                  		inc	esi
  1001                                  		loop	sFmloop
  1002                                  		push	edi	; facei+4*(o+object.fanz-1)
  1003                                  		call	qsort
  1004                                  %endmacro
  1005                                  
  1006                                  ;***********************************************
  1007                                  ;* descript. : animate the door  	       *
  1008                                  ;* parameter : none		               *
  1009                                  ;* sideeffect: ax,cx,si,di,es                  *
  1010                                  ;* back      : none		               *
  1011                                  ;***********************************************
  1012                                  %macro		animDoor 0
  1013                                  		;mov	ax, [doortimer]
  1014                                  		movzx	eax, word [doortimer]
  1015                                  		or	ax, ax
  1016                                  		jns	short aDnounder
  1017                                  		xor	ax, ax
  1018                                  		jmp	short alreadydrawed
  1019                                  aDnounder:
  1020                                  		cmp	byte [once], 0
  1021                                  		jnz	short alreadydrawed
  1022                                  		inc	byte [once]
  1023                                  		push	ax
  1024                                  		starbackground
  1025                                  		pop	ax
  1026                                  alreadydrawed:
  1027                                  		cmp	ax, 24
  1028                                  		jle	short aDnoover
  1029                                  		mov	ax, 24
  1030                                  aDnoover:
  1031                                  		shl	ax, 6
  1032                                  		mov	edi, [tseg+52] ; es = word [tseg+26]
  1033                                  		mov	esi, [tseg+60] ; ds = word [tseg+30]
  1034                                  		push	esi ; 16/12/2016
  1035                                  		;mov	si, ax
  1036                                  		add	esi, eax
  1037                                  		mov	cx, 1024
  1038                                  		rep movsw
  1039                                  		; 16/12/2016
  1040                                  		;mov	si, 2048
  1041                                                  ;sub	si, ax
  1042                                  		mov	cx, 2048
  1043                                  		sub	cx, ax
  1044                                  		pop	esi
  1045                                  		add	esi, ecx
  1046                                  		push	esi
  1047                                  		;mov	ch, 4
  1048                                  		mov	cx, 400h
  1049                                  		rep movsw
  1050                                  		pop	edi
  1051                                  		mov	cx, ax
  1052                                  		xor	ax, ax
  1053                                  		rep stosw
  1054                                  %endmacro
  1055                                  
  1056                                  ;***********************************************
  1057                                  ;* descript. : play a tick of the song	       *
  1058                                  ;* parameter : none                	       *
  1059                                  ;* sideeffect: ax,bx,cx,dx,si		       *
  1060                                  ;* back      : none                	       *
  1061                                  ;***********************************************
  1062                                  %macro		playsong 0
  1063                                  		mov	cx, [tracks]
  1064                                  		mov	si, channels
  1065                                  PSmloop:
  1066                                  		dec	word [esi+channel.del]
  1067                                  		jg	short PSdelayed
  1068                                  		mov	ax, [esi+channel.trk]
  1069                                  		add	al, CMD_NOTEOFF	; 80h
  1070                                  		call	setnote
  1071                                  		mov	bx, [esi+channel.adr]
  1072                                  		mov	ah, 127 	; 7Fh
  1073                                  		cmp	byte [ebx], 0
  1074                                  		jz	short PStrackend
  1075                                  		mov	ah, [ebx]
  1076                                  		mov	[esi+channel.ln], ah
  1077                                  		mov	al, [esi+channel.trk]
  1078                                  		add	al, CMD_NOTEON	; 90h
  1079                                  		call	setnote
  1080                                  		mov	al, [ebx+1]
  1081                                  		mov	bl, SONGSPEED	; 1Dh
  1082                                  		mul	bl
  1083                                  PStrackend:
  1084                                  		mov	[esi+channel.del], ax
  1085                                  		add	word [esi+channel.adr], 2
  1086                                  PSdelayed:
  1087                                  		add	si, 6
  1088                                  		loop	PSmloop
  1089                                  PSnosound:
  1090                                  %endmacro
  1091                                  
  1092                                  ;***********************************************
  1093                                  ;* descript. : dump palette to CRT             *
  1094                                  ;* parameter : bl:intensity (0..255)           *
  1095                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1096                                  ;* back      : none		               *
  1097                                  ;***********************************************
  1098                                  %macro		setPalette2 0
  1099                                  		xor	al, al
  1100                                  		mov	dx, 3C8h
  1101                                  		;out	dx, al
  1102                                  		
  1103                                  		mov 	ah, 1 ; out (byte)
  1104                                  		int	34h ; TRDOS 386 - IOCTL interrupt
  1105                                  		
  1106                                  		inc	dx
  1107                                  		mov	esi, palette
  1108                                  		mov	cx, 768 ; 300h
  1109                                  _sp2loop:
  1110                                  		;rep outsb
  1111                                  		
  1112                                  		lodsb	
  1113                                  		;mov 	ah, 1 ; out (byte)
  1114                                  		;mov 	dx, 3C9h
  1115                                  		;out 	dx, al
  1116                                  		int	34h ; TRDOS 386 - IOCTL interrupt
  1117                                  		loop	_sp2loop
  1118                                  %endmacro
  1119                                  
  1120                                  ;***********************************************
  1121                                  ;* descript. : clear starbackground            *
  1122                                  ;* parameter : none		               *
  1123                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1124                                  ;* back      : none		               *
  1125                                  ;***********************************************
  1126                                  %macro		cls 0
  1127                                  		mov	edi, [bseg] ; es = word [bseg]
  1128                                  		mov	esi, 0A0000h + (320*5) ; 0A0640h
  1129                                  		mov	cx, 32000 ; 7D00h
  1130                                  clsloop:
  1131                                  		lodsb
  1132                                  		stosb
  1133                                  		stosb
  1134                                  		loop	clsloop
  1135                                  %endmacro
  1136                                  
  1137                                  ;***********************************************
  1138                                  ;* descript. : draw starbackground             *
  1139                                  ;* parameter : none		               *
  1140                                  ;* sideeffect: ax,es,di,cx,dx                  *
  1141                                  ;* back      : none		               *
  1142                                  ;***********************************************
  1143                                  %macro		starbackground 0
  1144                                  		mov	edi, [bseg]
  1145                                  		mov	cx, 100 ; 64h
  1146                                  starbackloop:
  1147                                  		push	cx
  1148                                  		mov	bx, 320*155 ; 0C1C0h
  1149                                  		call	rnd
  1150                                  		add	ax, 320*20  ; 1900h
  1151                                  		mov	di, ax
  1152                                  		and	ah, 7
  1153                                  		mov	dx, 320-5   ; 13Bh
  1154                                  		mov	cx, 2
  1155                                  		call	setstarbob
  1156                                  		pop	cx
  1157                                  		loop	starbackloop
  1158                                  %endmacro
  1159                                  
  1160                                  ;***********************************************
  1161                                  ;* descript. : create identity matrix	       *
  1162                                  ;* parameter : ds:di address                   *
  1163                                  ;* sideeffect: cx,di		   	       *
  1164                                  ;* back      : none			       *
  1165                                  ;***********************************************
  1166                                  %macro		identityMat 0
  1167                                  		mov	ch, 2
  1168                                  iMolp:
  1169                                  		mov	cl, 2
  1170                                  iMilp:
  1171                                  		fldz
  1172                                  		cmp	ch, cl
  1173                                  		jne	short iMwritezero
  1174                                  		fstp	st0
  1175                                  		fld1
  1176                                  iMwritezero:
  1177                                  		fstp	dword [edi]
  1178                                  		add	di, 4
  1179                                  		dec	cl
  1180                                  		jns	short iMilp
  1181                                  		dec	ch
  1182                                  		jns	short iMolp
  1183                                  %endmacro
  1184                                  
  1185                                  ;=============================================================================
  1186                                  ;               entry point
  1187                                  ;=============================================================================
  1188                                  ;***********************************************
  1189                                  ;* descript. : entry point		       *
  1190                                  ;* parameter : none		               *
  1191                                  ;* sideeffect: all		               *
  1192                                  ;* back      : none		               *
  1193                                  ;***********************************************
  1194                                  
  1195                                  [BITS 32] ; 80386 Protected Mode (32 bit) intructions
  1196                                  
  1197                                  [ORG 0] 
  1198                                  
  1199                                  start:
  1200                                  		; clear bss (18/12/2016)
  1201                                  		;mov	edi, bss_start		
  1202 00000000 66BF[A516]              		mov	di, bss_start
  1203                                  		;mov	ecx, (bss_end - bss_start)/4
  1204 00000004 66B97432                		mov	cx, (bss_end - bss_start)/4
  1205                                  		;xor	eax, eax
  1206 00000008 F3AB                    		rep	stosd
  1207                                  
  1208                                  		; DIRECT VGA MEMORY ACCESS
  1209                                  		;xor	ebx, ebx
  1210 0000000A B705                    		mov	bh, 5 ; Direct access/map to VGA memory (0A0000h)
  1211                                  		;mov	eax, _video ; 1Fh
  1212 0000000C B01F                    		mov	al, 1Fh ; sys _video ; TRDOS 386 Video functions
  1213 0000000E CD40                    		int	40h   ; TRDOS 386 system call
  1214                                  
  1215                                  		; eax = 0A0000h
  1216 00000010 21C0                    		and	eax, eax
  1217 00000012 0F84D8050000            		jz      terminate ; error (eax = 0)
  1218                                  
  1219                                  		;mov	edi, vseg
  1220 00000018 66BF[4045]              		mov	di, vseg
  1221 0000001C B800000100              		mov	eax, 10000h
  1222 00000021 AB                      		stosd			; virtual screen address
  1223 00000022 0500000100              		add	eax, 10000h
  1224 00000027 AB                      		stosd			; star background address
  1225 00000028 0500000100              		add	eax, 10000h
  1226 0000002D 66B91400                		mov	cx, 20
  1227                                  segloop:				; texture addresses
  1228 00000031 AB                      		stosd
  1229 00000032 0500100000              		add	eax, 1000h
  1230 00000037 E2F8                    		loop	segloop
  1231                                  
  1232                                  		nullData
  1232                              <1> 
  1232 00000039 BF[A8160000]        <1>  mov edi, nullstart
  1232 0000003E 66B9E01F            <1>  mov cx, nullend-nullstart
  1232 00000042 31C0                <1>  xor eax, eax
  1232 00000044 F3AA                <1>  rep stosb
  1233                                  		resetGM
  1233 00000046 66BA3103            <1>  mov dx, GMPort
  1233 0000004A B0FF                <1>  mov al, 0FFh
  1233                              <1> 
  1233                              <1> 
  1233 0000004C B401                <1>  mov ah, 1
  1233 0000004E CD34                <1>  int 34h
  1233                              <1> 
  1233 00000050 FECC                <1>  dec ah
  1233                              <1> 
  1233                              <1> resGMbusy1:
  1233 00000052 FEC9                <1>  dec cl
  1233 00000054 741C                <1>  jz short rGMerror
  1233                              <1> 
  1233                              <1> 
  1233                              <1> 
  1233 00000056 CD34                <1>  int 34h
  1233                              <1> 
  1233 00000058 A880                <1>  test al, 80h
  1233 0000005A 75F6                <1>  jnz short resGMbusy1
  1233 0000005C 664A                <1>  dec dx
  1233                              <1> 
  1233                              <1> 
  1233                              <1> 
  1233 0000005E CD34                <1>  int 34h
  1233                              <1> 
  1233 00000060 3CFE                <1>  cmp al, 0FEh
  1233 00000062 750E                <1>  jne short rGMerror
  1233 00000064 6642                <1>  inc dx
  1233                              <1> resGMbusy2:
  1233                              <1> 
  1233                              <1> 
  1233                              <1> 
  1233 00000066 CD34                <1>  int 34h
  1233                              <1> 
  1233 00000068 A840                <1>  test al, 40h
  1233 0000006A 75FA                <1>  jnz short resGMbusy2
  1233 0000006C B03F                <1>  mov al, 3Fh
  1233                              <1> 
  1233                              <1> 
  1233                              <1> 
  1233 0000006E FEC4                <1>  inc ah
  1233 00000070 CD34                <1>  int 34h
  1233                              <1> rGMerror:
  1234                                  		expandSong
  1234 00000072 66BE[DB10]          <1>  mov si, credits
  1234 00000076 66BB[041A]          <1>  mov bx, channels
  1234 0000007A 66BF[8D36]          <1>  mov di, songdata
  1234 0000007E 66AD                <1> EPSwhile: lodsw
  1234 00000080 FEC8                <1>  dec al
  1234 00000082 7823                <1>  js short EPSendwhile
  1234 00000084 884302              <1>  mov [ebx+channel.trk], al
  1234 00000087 04C0                <1>  add al, CMD_CHANGEPRG
  1234 00000089 E8E8060000          <1>  call setinstr
  1234 0000008E 66897B04            <1>  mov [ebx+channel.adr], di
  1234 00000092 E818060000          <1>  call expand
  1234 00000097 30C0                <1>  xor al, al
  1234 00000099 AA                  <1>  stosb
  1234 0000009A 6683C306            <1>  add bx, 6
  1234 0000009E 66FF05[00170000]    <1>  inc word [tracks]
  1234 000000A5 EBD7                <1>  jmp short EPSwhile
  1234                              <1> EPSendwhile:
  1235                                  
  1236 000000A7 E8410E0000              		call	createWorld
  1237                                  
  1238                                  		set320x200
  1238 000000AC 66B81300            <1>  mov ax, 13h
  1238                              <1> 
  1238                              <1> 
  1238 000000B0 CD31                <1>  int 31h
  1239                                  
  1240 000000B2 86E0                    		xchg	ah, al 		; ah = write string = 13h, 
  1241                                  					; al = write mode = 0
  1242 000000B4 66BB1C00                		mov	bx, 1Ch
  1243 000000B8 BD[5C160000]            		mov	ebp, omniscent
  1244 000000BD 66B90900                		mov	cx, omniend-omniscent ; 9
  1245 000000C1 66BA0601                		mov	dx, 106h
  1246                                  		;int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1247                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1248                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1249                                  					; ES:BP	-> start of string
  1250 000000C5 CD31                    		int	31h ; TRDOS 386 - Video interrupt
  1251                                  
  1252 000000C7 6601CD                  		add	bp, cx
  1253 000000CA B110                    		mov	cl, sancend-sanction ; 11h
  1254 000000CC 66BA010C                		mov	dx, 0C01h
  1255                                  		;int	10h		; - VIDEO - WRITE STRING (AT,XT286,PS,EGA,VGA)
  1256                                  					; AL = mode, BL	= attribute if AL bit 1	clear, BH = display page number
  1257                                  					; DH,DL	= row,column of	starting cursor	position, CX = length of string
  1258                                  					; ES:BP	-> start of string
  1259 000000D0 CD31                    		int	31h ; TRDOS 386 - Video interrupt
  1260                                  
  1261                                  		makePalette
  1261                              <1> 
  1261 000000D2 BB03000000          <1>  mov ebx, 3
  1261                              <1> mPcolor:
  1261                              <1> 
  1261 000000D7 BE[20120000]        <1>  mov esi, colors
  1261 000000DC BF[04170000]        <1>  mov edi, palette
  1261 000000E1 30F6                <1>  xor dh, dh
  1261 000000E3 AC                  <1>  lodsb
  1261 000000E4 660FB6C8            <1>  movzx cx, al
  1261                              <1> mPouter:
  1261 000000E8 6651                <1>  push cx
  1261 000000EA 8A0E                <1>  mov cl, [esi]
  1261 000000EC 8A2433              <1>  mov ah, [ebx+esi]
  1261 000000EF 6629D0              <1>  sub ax, dx
  1261 000000F2 6652                <1>  push dx
  1261 000000F4 6699                <1>  cwd
  1261 000000F6 66F7F9              <1>  idiv cx
  1261 000000F9 665A                <1>  pop dx
  1261                              <1> mPinner:
  1261 000000FB 6601C2              <1>  add dx, ax
  1261 000000FE 88741FFF            <1>  mov [edi+ebx-1], dh
  1261 00000102 6683C703            <1>  add di, 3
  1261 00000106 E2F3                <1>  loop mPinner
  1261 00000108 6683C604            <1>  add si, 4
  1261 0000010C 6659                <1>  pop cx
  1261 0000010E E2D8                <1>  loop mPouter
  1261 00000110 664B                <1>  dec bx
  1261 00000112 75C3                <1>  jnz short mPcolor
  1262                                  		
  1263                                  		initTextures
  1263                              <1> 
  1263 00000114 BB22000000          <1>  mov ebx, 34
  1263 00000119 6820030000          <1>  push 800
  1263 0000011E 6A05                <1>  push 5
  1263 00000120 E867060000          <1>  call createFrac1
  1263                              <1> 
  1263 00000125 BB20000000          <1>  mov ebx, 32
  1263 0000012A 6A70                <1>  push 112
  1263 0000012C 6A0F                <1>  push 15
  1263 0000012E E859060000          <1>  call createFrac1
  1263                              <1>  createFrac2
  1263 00000133 8B3D[90450000]      <2>  mov edi, [tseg+72]
  1263 00000139 89FB                <2>  mov ebx, edi
  1263 0000013B B014                <2>  mov al, 20
  1263 0000013D E843060000          <2>  call setFrac
  1263                              <2> 
  1263 00000142 89DF                <2>  mov edi, ebx
  1263 00000144 6683CF40            <2>  or di, 64
  1263 00000148 66B9C00F            <2>  mov cx, 4096-64
  1263 0000014C BB04000000          <2>  mov ebx, 4
  1263                              <2> cF1loop:
  1263                              <2> 
  1263 00000151 E8C6050000          <2>  call rnd
  1263 00000156 0247C0              <2>  add al, [edi-64]
  1263 00000159 0247C1              <2>  add al, [edi-63]
  1263 0000015C 6648                <2>  dec ax
  1263 0000015E 66D1E8              <2>  shr ax, 1
  1263 00000161 AA                  <2>  stosb
  1263 00000162 E2ED                <2>  loop cF1loop
  1263                              <1>  createFrac3
  1263 00000164 8B3D[94450000]      <2>  mov edi, [tseg+76]
  1263 0000016A 89FB                <2>  mov ebx, edi
  1263 0000016C B003                <2>  mov al, 3
  1263 0000016E E812060000          <2>  call setFrac
  1263 00000173 89DF                <2>  mov edi, ebx
  1263 00000175 66B90010            <2>  mov cx, 4096
  1263 00000179 0FB7D9              <2>  movzx ebx, cx
  1263                              <2> cF3loop:
  1263                              <2> 
  1263 0000017C E89B050000          <2>  call rnd
  1263                              <2> 
  1263 00000181 6609C7              <2>  or di, ax
  1263 00000184 FE07                <2>  inc byte [edi]
  1263 00000186 E2F4                <2>  loop cF3loop
  1263                              <1>  initStars
  1263 00000188 66B91E00            <2>  mov cx, 30
  1263 0000018C BF[E4440000]        <2>  mov edi, stars
  1263 00000191 31DB                <2>  xor ebx, ebx
  1263                              <2> iSloop:
  1263 00000193 66BB0001            <2>  mov bx, 256
  1263 00000197 E880050000          <2>  call rnd
  1263 0000019C AA                  <2>  stosb
  1263 0000019D 66BBC00E            <2>  mov bx, 4096-64*5
  1263 000001A1 6681C38000          <2>  add bx, 128
  1263 000001A6 E871050000          <2>  call rnd
  1263 000001AB 6683C040            <2>  add ax, 64
  1263 000001AF 66AB                <2>  stosw
  1263 000001B1 E2E0                <2>  loop iSloop
  1263                              <1>  reactorWall
  1263 000001B3 8B3D[48450000]      <2>  mov edi, [tseg]
  1263 000001B9 66B90010            <2>  mov cx, 4096
  1263                              <2> rsmloop:
  1263 000001BD 6689F8              <2>  mov ax, di
  1263                              <2> 
  1263 000001C0 A808                <2>  test al, 8
  1263 000001C2 7E02                <2>  jle short rsnonot1
  1263 000001C4 F6D0                <2>  not al
  1263                              <2> rsnonot1:
  1263 000001C6 240F                <2>  and al, 15
  1263 000001C8 6689C3              <2>  mov bx, ax
  1263 000001CB 6689F8              <2>  mov ax, di
  1263 000001CE 6625FF0F            <2>  and ax, 0FFFh
  1263 000001D2 66C1E806            <2>  shr ax, 6
  1263 000001D6 A808                <2>  test al, 8
  1263 000001D8 7E02                <2>  jle short rsnonot2
  1263 000001DA F6D0                <2>  not al
  1263                              <2> rsnonot2:
  1263 000001DC 240F                <2>  and al, 15
  1263 000001DE 38D8                <2>  cmp al, bl
  1263 000001E0 7E03                <2>  jle short rstakeal
  1263 000001E2 6689D8              <2>  mov ax, bx
  1263                              <2> rstakeal:
  1263 000001E5 04E0                <2>  add al, 224
  1263 000001E7 AA                  <2>  stosb
  1263 000001E8 E2D3                <2>  loop rsmloop
  1263                              <1>  addFractals
  1263 000001EA BE[FD120000]        <2>  mov esi, aF
  1263                              <2> 
  1263 000001EF B208                <2>  mov dl, 8
  1263 000001F1 31DB                <2>  xor ebx, ebx
  1263                              <2> 
  1263                              <2> aFloop:
  1263 000001F3 88D3                <2>  mov bl, dl
  1263 000001F5 8BBB[48450000]      <2>  mov edi, [ebx+tseg]
  1263 000001FB 66AD                <2>  lodsw
  1263 000001FD 88C3                <2>  mov bl, al
  1263 000001FF D0E3                <2>  shl bl, 1
  1263 00000201 8BAB[48450000]      <2>  mov ebp, [ebx+tseg]
  1263 00000207 66B90010            <2>  mov cx, 4096
  1263                              <2> aFiloop:
  1263 0000020B 8A4500              <2>  mov al, [ebp]
  1263 0000020E 00E0                <2>  add al, ah
  1263 00000210 AA                  <2>  stosb
  1263 00000211 45                  <2>  inc ebp
  1263 00000212 E2F7                <2>  loop aFiloop
  1263 00000214 80C204              <2>  add dl, 4
  1263 00000217 80FA3C              <2>  cmp dl, 60
  1263 0000021A 7ED7                <2>  jle short aFloop
  1263                              <1>  effects
  1263                              <2> 
  1263 0000021C 66B91A00            <2>  mov cx, 26
  1263 00000220 BE[61120000]        <2>  mov esi, aE
  1263                              <2> 
  1263                              <2> 
  1263                              <2> 
  1263 00000225 31DB                <2>  xor ebx, ebx
  1263 00000227 31FF                <2>  xor edi, edi
  1263                              <2> effmloop:
  1263 00000229 6651                <2>  push cx
  1263 0000022B 8A1E                <2>  mov bl, [esi]
  1263 0000022D 88DA                <2>  mov dl, bl
  1263 0000022F C0EA04              <2>  shr dl, 4
  1263 00000232 80E30F              <2>  and bl, 0Fh
  1263 00000235 C0E302              <2>  shl bl, 2
  1263 00000238 8BAB[48450000]      <2>  mov ebp, [ebx+tseg]
  1263 0000023E 660FB64E02          <2>  movzx cx, byte [esi+2]
  1263                              <2> effyloop:
  1263 00000243 660FB65E01          <2>  movzx bx, byte [esi+1]
  1263                              <2> effxloop:
  1263 00000248 6689CF              <2>  mov di, cx
  1263 0000024B 66C1E706            <2>  shl di, 6
  1263 0000024F 6601DF              <2>  add di, bx
  1263 00000252 88D0                <2>  mov al, dl
  1263 00000254 FEC8                <2>  dec al
  1263 00000256 7416                <2>  jz short effect1
  1263 00000258 FEC8                <2>  dec al
  1263 0000025A 740E                <2>  jz short effect2
  1263 0000025C 6689D8              <2>  mov ax, bx
  1263 0000025F 6601C8              <2>  add ax, cx
  1263 00000262 2404                <2>  and al, 4
  1263                              <2> 
  1263 00000264 7408                <2>  jz short effect1
  1263 00000266 B098                <2>  mov al, 152
  1263                              <2> effdonot:
  1263 00000268 EB04                <2>  jmp short effect1
  1263                              <2> effect2:
  1263 0000026A 8A443D00            <2>  mov al, [ebp+edi]
  1263                              <2> effect1:
  1263 0000026E 024605              <2>  add al, [esi+5]
  1263 00000271 88443D00            <2>  mov [ebp+edi], al
  1263 00000275 6643                <2>  inc bx
  1263 00000277 3A5E03              <2>  cmp bl, [esi+3]
  1263 0000027A 7ECC                <2>  jle short effxloop
  1263 0000027C 6641                <2>  inc cx
  1263 0000027E 3A4E04              <2>  cmp cl, [esi+4]
  1263 00000281 7EC0                <2>  jle short effyloop
  1263 00000283 6683C606            <2>  add si, 6
  1263 00000287 6659                <2>  pop cx
  1263 00000289 E29E                <2>  loop effmloop
  1263                              <1>  addLava
  1263 0000028B 52                  <2>  push edx
  1263 0000028C 8B3D[74450000]      <2>  mov edi, [tseg+44]
  1263                              <2> 
  1263                              <2> 
  1263 00000292 BAFF0F0000          <2>  mov edx, 4095
  1263 00000297 66B91400            <2>  mov cx, 20
  1263 0000029B B05E                <2>  mov al, 94
  1263                              <2> aLyloop:
  1263 0000029D 51                  <2>  push ecx
  1263 0000029E 66C1E103            <2>  shl cx, 3
  1263                              <2> aLxloop:
  1263                              <2> 
  1263 000002A2 52                  <2>  push edx
  1263 000002A3 50                  <2>  push eax
  1263                              <2> 
  1263 000002A4 BB40000000          <2>  mov ebx, 64
  1263 000002A9 E86E040000          <2>  call rnd
  1263                              <2> 
  1263 000002AE 6629C2              <2>  sub dx, ax
  1263 000002B1 58                  <2>  pop eax
  1263                              <2> 
  1263 000002B2 880417              <2>  mov [edi+edx], al
  1263 000002B5 5A                  <2>  pop edx
  1263                              <2> 
  1263 000002B6 E2EA                <2>  loop aLxloop
  1263 000002B8 59                  <2>  pop ecx
  1263 000002B9 FEC8                <2>  dec al
  1263 000002BB 6683EF40            <2>  sub di, 64
  1263 000002BF E2DC                <2>  loop aLyloop
  1263 000002C1 5A                  <2>  pop edx
  1264                                  
  1265                                  		calcShadeTab
  1265 000002C2 BF[98450000]        <1>  mov edi, shadetab
  1265 000002C7 30DB                <1>  xor bl, bl
  1265                              <1> cSolp:
  1265 000002C9 FEC3                <1>  inc bl
  1265 000002CB 6631C9              <1>  xor cx, cx
  1265                              <1> cSilp1:
  1265 000002CE 88C8                <1>  mov al, cl
  1265 000002D0 241F                <1>  and al, 31
  1265 000002D2 F6E3                <1>  mul bl
  1265 000002D4 6601C0              <1>  add ax, ax
  1265 000002D7 88C8                <1>  mov al, cl
  1265 000002D9 24E0                <1>  and al, 224
  1265 000002DB 00E0                <1>  add al, ah
  1265 000002DD AA                  <1>  stosb
  1265 000002DE FEC1                <1>  inc cl
  1265 000002E0 80F9C0              <1>  cmp cl, 192
  1265 000002E3 75E9                <1>  jne short cSilp1
  1265                              <1> cSilp2:
  1265 000002E5 88C8                <1>  mov al, cl
  1265 000002E7 AA                  <1>  stosb
  1265 000002E8 FEC1                <1>  inc cl
  1265 000002EA 75F9                <1>  jnz short cSilp2
  1265 000002EC 80FB80              <1>  cmp bl, 128
  1265 000002EF 75D8                <1>  jnz short cSolp
  1266                                  
  1267 000002F1 8925[88360000]          		mov	[oldstack], esp
  1268                                  
  1269                                  		startTimer
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269                              <1> 
  1269 000002F7 BBFF010000          <1>  mov ebx, 1FFh
  1269 000002FC B901000000          <1>  mov ecx, 1
  1269                              <1> 
  1269 00000301 BA[8C360000]        <1>  mov edx, timer_sig_response
  1269 00000306 B821000000          <1>  mov eax, 33
  1269 0000030B CD40                <1>  int 40h
  1269 0000030D 0F8298020000        <1>  jc loc_err_exit
  1269                              <1> 
  1269 00000313 66BB510D            <1>  mov bx, 3409
  1269 00000317 E815040000          <1>  call setTimer
  1270                                  		startKBDHandler
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270                              <1> 
  1270 0000031C 90                  <1>  nop
  1271                                  		cls
  1271 0000031D 8B3D[44450000]      <1>  mov edi, [bseg]
  1271 00000323 BE40060A00          <1>  mov esi, 0A0000h + (320*5)
  1271 00000328 66B9007D            <1>  mov cx, 32000
  1271                              <1> clsloop:
  1271 0000032C AC                  <1>  lodsb
  1271 0000032D AA                  <1>  stosb
  1271 0000032E AA                  <1>  stosb
  1271 0000032F E2FB                <1>  loop clsloop
  1272                                  mainloop:
  1273 00000331 B401                    		mov	ah, 1	; Check keyboard buffer
  1274 00000333 CD32                    		int	32h	; TRDOS 386 Keyboard interrupt
  1275 00000335 0F8570020000            		jnz	_exit_  ; exit
  1276                                  
  1277 0000033B E8B9020000              		call	timer_routine ; irqHandler08
  1278                                  
  1279                                  		setPalette2
  1279 00000340 30C0                <1>  xor al, al
  1279 00000342 66BAC803            <1>  mov dx, 3C8h
  1279                              <1> 
  1279                              <1> 
  1279 00000346 B401                <1>  mov ah, 1
  1279 00000348 CD34                <1>  int 34h
  1279                              <1> 
  1279 0000034A 6642                <1>  inc dx
  1279 0000034C BE[04170000]        <1>  mov esi, palette
  1279 00000351 66B90003            <1>  mov cx, 768
  1279                              <1> _sp2loop:
  1279                              <1> 
  1279                              <1> 
  1279 00000355 AC                  <1>  lodsb
  1279                              <1> 
  1279                              <1> 
  1279                              <1> 
  1279 00000356 CD34                <1>  int 34h
  1279 00000358 E2FB                <1>  loop _sp2loop
  1280                                  
  1281                                  		scriptIt
  1281                              <1> 
  1281 0000035A 668B0D[FE160000]    <1>  mov cx, [ticker]
  1281 00000361 66C705[FE160000]00- <1>  mov word [ticker], 0
  1281 00000369 00                  <1>
  1281 0000036A 6609C9              <1>  or cx, cx
  1281 0000036D 0F84B8000000        <1>  jz sItickerNull
  1281                              <1> sImloop:
  1281 00000373 51                  <1>  push ecx
  1281 00000374 BE[F0160000]        <1>  mov esi, zspeed
  1281                              <1> 
  1281 00000379 66FF4E0A            <1>  dec word [esi+10]
  1281 0000037D 7935                <1>  jns short sIwaitTimer
  1281 0000037F 668B5E08            <1>  mov bx, [esi+8]
  1281 00000383 8A83[DB150000]      <1>  mov al, [ebx+script]
  1281 00000389 08C0                <1>  or al, al
  1281 0000038B 0F841A020000        <1>  jz _exit_
  1281 00000391 6689C3              <1>  mov bx, ax
  1281 00000394 80E307              <1>  and bl, 7
  1281 00000397 885E0C              <1>  mov [esi+12], bl
  1281 0000039A FECB                <1>  dec bl
  1281 0000039C 7507                <1>  jnz short sInegateTurn
  1281 0000039E 66F71D[58160000]    <1>  neg word [zstep]
  1281                              <1> sInegateTurn:
  1281 000003A5 6625F800            <1>  and ax, 0F8h
  1281 000003A9 6601C0              <1>  add ax, ax
  1281 000003AC 6689460A            <1>  mov [esi+10], ax
  1281 000003B0 66FF4608            <1>  inc word [esi+8]
  1281                              <1> sIwaitTimer:
  1281 000003B4 8A460C              <1>  mov al, [esi+12]
  1281 000003B7 6698                <1>  cbw
  1281 000003B9 6648                <1>  dec ax
  1281 000003BB 750B                <1>  jnz short sInoturn
  1281 000003BD 668B1D[58160000]    <1>  mov bx, [zstep]
  1281 000003C4 66015E06            <1>  add [esi+6], bx
  1281                              <1> sInoturn:
  1281 000003C8 66B90300            <1>  mov cx, 3
  1281                              <1> sIrotateLoop:
  1281 000003CC 6648                <1>  dec ax
  1281 000003CE 7503                <1>  jnz short sInoIncrement
  1281 000003D0 66FF06              <1>  inc word [esi]
  1281                              <1> sInoIncrement:
  1281 000003D3 6648                <1>  dec ax
  1281 000003D5 7503                <1>  jnz short sInoDecrement
  1281 000003D7 66FF0E              <1>  dec word [esi]
  1281                              <1> sInoDecrement:
  1281 000003DA 46                  <1>  inc esi
  1281 000003DB 46                  <1>  inc esi
  1281 000003DC E2EE                <1>  loop sIrotateLoop
  1281 000003DE 66BE[F216]          <1>  mov si, zspeed+2
  1281 000003E2 B103                <1>  mov cl, 3
  1281 000003E4 31C0                <1>  xor eax, eax
  1281                              <1> sIpushloop:
  1281 000003E6 66AD                <1>  lodsw
  1281 000003E8 66C1F802            <1>  sar ax, 2
  1281 000003EC 50                  <1>  push eax
  1281 000003ED E2F7                <1>  loop sIpushloop
  1281                              <1> 
  1281 000003EF 666B46FC10          <1>  imul ax, word [esi-4], 16
  1281 000003F4 50                  <1>  push eax
  1281 000003F5 E84D0A0000          <1>  call calcRotMat
  1281                              <1> 
  1281 000003FA B103                <1>  mov cl, 3
  1281 000003FC 31F6                <1>  xor esi, esi
  1281                              <1> sImoveLoop:
  1281 000003FE D986[99160000]      <1>  fld dword [esi+owmat+24]
  1281 00000404 DE0D[F0160000]      <1>  fimul word [zspeed]
  1281 0000040A DE35[CD100000]      <1>  fidiv word [CONST1792]
  1281 00000410 D886[75160000]      <1>  fadd dword [esi+ob]
  1281 00000416 D99E[75160000]      <1>  fstp dword [esi+ob]
  1281 0000041C 6683C604            <1>  add si, 4
  1281 00000420 E2DC                <1>  loop sImoveLoop
  1281 00000422 59                  <1>  pop ecx
  1281 00000423 6649                <1>  dec cx
  1281 00000425 0F8548FFFFFF        <1>  jnz sImloop
  1281                              <1> sItickerNull:
  1282                                  
  1283                                  		animDoor
  1283                              <1> 
  1283 0000042B 0FB705[5A160000]    <1>  movzx eax, word [doortimer]
  1283 00000432 6609C0              <1>  or ax, ax
  1283 00000435 7905                <1>  jns short aDnounder
  1283 00000437 6631C0              <1>  xor ax, ax
  1283 0000043A EB43                <1>  jmp short alreadydrawed
  1283                              <1> aDnounder:
  1283 0000043C 803D[FD160000]00    <1>  cmp byte [once], 0
  1283 00000443 753A                <1>  jnz short alreadydrawed
  1283 00000445 FE05[FD160000]      <1>  inc byte [once]
  1283 0000044B 6650                <1>  push ax
  1283                              <1>  starbackground
  1283 0000044D 8B3D[44450000]      <2>  mov edi, [bseg]
  1283 00000453 66B96400            <2>  mov cx, 100
  1283                              <2> starbackloop:
  1283 00000457 6651                <2>  push cx
  1283 00000459 66BBC0C1            <2>  mov bx, 320*155
  1283 0000045D E8BA020000          <2>  call rnd
  1283 00000462 66050019            <2>  add ax, 320*20
  1283 00000466 6689C7              <2>  mov di, ax
  1283 00000469 80E407              <2>  and ah, 7
  1283 0000046C 66BA3B01            <2>  mov dx, 320-5
  1283 00000470 66B90200            <2>  mov cx, 2
  1283 00000474 E80D020000          <2>  call setstarbob
  1283 00000479 6659                <2>  pop cx
  1283 0000047B E2DA                <2>  loop starbackloop
  1283 0000047D 6658                <1>  pop ax
  1283                              <1> alreadydrawed:
  1283 0000047F 6683F818            <1>  cmp ax, 24
  1283 00000483 7E04                <1>  jle short aDnoover
  1283 00000485 66B81800            <1>  mov ax, 24
  1283                              <1> aDnoover:
  1283 00000489 66C1E006            <1>  shl ax, 6
  1283 0000048D 8B3D[7C450000]      <1>  mov edi, [tseg+52]
  1283 00000493 8B35[84450000]      <1>  mov esi, [tseg+60]
  1283 00000499 56                  <1>  push esi
  1283                              <1> 
  1283 0000049A 01C6                <1>  add esi, eax
  1283 0000049C 66B90004            <1>  mov cx, 1024
  1283 000004A0 F366A5              <1>  rep movsw
  1283                              <1> 
  1283                              <1> 
  1283                              <1> 
  1283 000004A3 66B90008            <1>  mov cx, 2048
  1283 000004A7 6629C1              <1>  sub cx, ax
  1283 000004AA 5E                  <1>  pop esi
  1283 000004AB 01CE                <1>  add esi, ecx
  1283 000004AD 56                  <1>  push esi
  1283                              <1> 
  1283 000004AE 66B90004            <1>  mov cx, 400h
  1283 000004B2 F366A5              <1>  rep movsw
  1283 000004B5 5F                  <1>  pop edi
  1283 000004B6 6689C1              <1>  mov cx, ax
  1283 000004B9 6631C0              <1>  xor ax, ax
  1283 000004BC F366AB              <1>  rep stosw
  1284                                  
  1285 000004BF 8B3D[40450000]          		mov	edi, [vseg]
  1286 000004C5 8B35[44450000]          		mov	esi, [bseg]
  1287 000004CB E8D8010000              		call	copyseg
  1288                                  
  1289 000004D0 C70500000A00AFAFAF-     mov dword [0A0000h], 0AFAFAFAFh ; temporary
  1289 000004D9 AF                 
  1290                                  
  1291                                  		rotation
  1291 000004DA 668B0D[641A0000]    <1>  mov cx, [o+object.panz]
  1291 000004E1 BE[681A0000]        <1>  mov esi, o+object.p
  1291 000004E6 BF[78C70000]        <1>  mov edi, rp
  1291                              <1> rotmlp:
  1291                              <1> 
  1291 000004EB BB[A8160000]        <1>  mov ebx, wmat
  1291 000004F0 66BA0300            <1>  mov dx, 3
  1291                              <1> rotilp:
  1291 000004F4 DF06                <1>  fild word [esi+0]
  1291 000004F6 D825[75160000]      <1>  fsub dword [ob+vector.x]
  1291 000004FC D80B                <1>  fmul dword [ebx+0]
  1291 000004FE DF4602              <1>  fild word [esi+2]
  1291 00000501 D825[79160000]      <1>  fsub dword [ob+vector.y]
  1291 00000507 D84B04              <1>  fmul dword [ebx+4]
  1291 0000050A DF4604              <1>  fild word [esi+4]
  1291 0000050D D825[7D160000]      <1>  fsub dword [ob+vector.z]
  1291 00000513 D84B08              <1>  fmul dword [ebx+8]
  1291 00000516 DEC1                <1>  fadd
  1291 00000518 DEC1                <1>  fadd
  1291 0000051A D91F                <1>  fstp dword [edi]
  1291 0000051C 6683C704            <1>  add di, 4
  1291                              <1> 
  1291 00000520 6683C30C            <1>  add bx, 12
  1291 00000524 664A                <1>  dec dx
  1291 00000526 75CC                <1>  jnz short rotilp
  1291 00000528 6683C608            <1>  add si, 8
  1291                              <1> 
  1291 0000052C E2BD                <1>  loop rotmlp
  1292                                  		sortFaces
  1292 0000052E BF[38DA0000]        <1>  mov edi, facei
  1292 00000533 57                  <1>  push edi
  1292 00000534 BE[E8260000]        <1>  mov esi, o+object.f
  1292                              <1> 
  1292 00000539 6689F0              <1>  mov ax, si
  1292 0000053C 668B0D[661A0000]    <1>  mov cx, [o+object.fanz]
  1292                              <1> sFmloop:
  1292 00000543 D9EE                <1>  fldz
  1292 00000545 6651                <1>  push cx
  1292 00000547 66B90400            <1>  mov cx, 4
  1292                              <1> sFiloop:
  1292 0000054B 666B1E0C            <1>  imul bx, word [esi], 12
  1292 0000054F 46                  <1>  inc esi
  1292 00000550 46                  <1>  inc esi
  1292 00000551 D8A3[80C70000]      <1>  fsub dword [ebx+rp+vector.z]
  1292 00000557 E2F2                <1>  loop sFiloop
  1292 00000559 6659                <1>  pop cx
  1292 0000055B DF1F                <1>  fistp word [edi]
  1292 0000055D 47                  <1>  inc edi
  1292 0000055E 47                  <1>  inc edi
  1292 0000055F 66AB                <1>  stosw
  1292 00000561 6683C00A            <1>  add ax, 10
  1292 00000565 46                  <1>  inc esi
  1292 00000566 46                  <1>  inc esi
  1292 00000567 E2DA                <1>  loop sFmloop
  1292 00000569 57                  <1>  push edi
  1292 0000056A E86A010000          <1>  call qsort
  1293                                  
  1294 0000056F 31C0                    		xor	eax, eax
  1295 00000571 0FB70D[661A0000]        		movzx	ecx, word [o+object.fanz]
  1296 00000578 BE[38DA0000]            		mov	esi, facei
  1297                                  drawloop:
  1298 0000057D 66AD                    		lodsw
  1299 0000057F 66AD                    		lodsw
  1300 00000581 89C3                    		mov	ebx, eax
  1301 00000583 60                      		pusha
  1302 00000584 E817060000              		call	drawclippedface
  1303 00000589 61                      		popa
  1304 0000058A E2F1                    		loop	drawloop
  1305                                  
  1306 0000058C BF00000A00              		mov	edi, 0A0000h
  1307 00000591 8B35[40450000]          		mov	esi, [vseg]
  1308 00000597 E80C010000              		call	copyseg
  1309                                  
  1310 0000059C C70500000A00FAFAFA-     mov dword [0A0000h], 0FAFAFAFAh ; temporary
  1310 000005A5 FA                 
  1311                                  
  1312 000005A6 E986FDFFFF              		jmp	mainloop
  1313                                  loc_err_exit:
  1314                                  _exit_:
  1315 000005AB 8B25[88360000]          		mov	esp, [oldstack]
  1316                                  		silence
  1316 000005B1 66B90F00            <1>  mov cx, 15
  1316                              <1> Siloop:
  1316 000005B5 6689C8              <1>  mov ax, cx
  1316 000005B8 04B0                <1>  add al, CMD_CHANGEPARAM
  1316 000005BA E889010000          <1>  call writeGM
  1316 000005BF B07B                <1>  mov al, MOD_ALLNOTESOFF
  1316 000005C1 E882010000          <1>  call writeGM
  1316 000005C6 30C0                <1>  xor al, al
  1316 000005C8 E87B010000          <1>  call writeGM
  1316 000005CD E2E6                <1>  loop Siloop
  1316                              <1> Sinosound:
  1317                                  		stopKBDHandler
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317                              <1> 
  1317 000005CF 90                  <1>  nop
  1318                                  		stopTimer
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318                              <1> 
  1318 000005D0 6631DB              <1>  xor bx, bx
  1318 000005D3 E859010000          <1>  call setTimer
  1318                              <1> 
  1318                              <1> 
  1318 000005D8 0FB61D[8C360000]    <1>  movzx ebx, byte [timer_sig_response]
  1318 000005DF 20DB                <1>  and bl, bl
  1318 000005E1 7407                <1>  jz short r_t_m
  1318                              <1> 
  1318 000005E3 B821000000          <1>  mov eax, 33
  1318 000005E8 CD40                <1>  int 40h
  1318                              <1> r_t_m:
  1319                                  ;restore_text_mode:
  1320                                  		set80x25
  1320 000005EA 66B80300            <1>  mov ax, 3
  1320                              <1> 
  1320                              <1> 
  1320 000005EE CD31                <1>  int 31h
  1321                                  terminate:
  1322                                  		sys 	_exit   ; INT 40h
  1322                              <1> 
  1322                              <1> 
  1322                              <1> 
  1322                              <1> 
  1322                              <1>  %if %0 >= 2
  1322                              <1>  mov ebx, %2
  1322                              <1>  %if %0 >= 3
  1322                              <1>  mov ecx, %3
  1322                              <1>  %if %0 = 4
  1322                              <1>  mov edx, %4
  1322                              <1>  %endif
  1322                              <1>  %endif
  1322                              <1>  %endif
  1322 000005F0 B801000000          <1>  mov eax, %1
  1322                              <1> 
  1322 000005F5 CD40                <1>  int 40h
  1323                                  here:
  1324 000005F7 EBFE                    		jmp	short here
  1325                                  
  1326                                  ;==============================================================================
  1327                                  ;		interrupt handler
  1328                                  ;==============================================================================
  1329                                  ;***********************************************
  1330                                  ;* descript. : timer routine                   *
  1331                                  ;* parameter : none		               *
  1332                                  ;* sideeffect: none		               *
  1333                                  ;* back      : none		               *
  1334                                  ;***********************************************
  1335                                  
  1336                                  timer_routine:
  1337 000005F9 803D[8C360000]FF        		cmp	byte [timer_sig_response], 0FFh ; [timer_event]
  1338 00000600 7401                    		je	short  tr_0
  1339 00000602 C3                      		retn
  1340                                  tr_0:
  1341 00000603 C605[8C360000]00        		mov	byte [timer_sig_response], 0 ; reset signal response byte
  1342                                  
  1343 0000060A 60                      		pushad
  1344                                  		
  1345                                  		;playsong
  1346                                  
  1347 0000060B 66FF05[FE160000]        		inc	word [ticker]
  1348 00000612 FE05[3E450000]          		inc	byte [twice]
  1349 00000618 8025[3E450000]07        		and	byte [twice], 7
  1350 0000061F 7563                    		jnz	short tr_1
  1351                                  
  1352                                  		colorCycle
  1352                              <1>  bas equ 6*32
  1352                              <1>  range equ 32
  1352                              <1> 
  1352                              <1> 
  1352 00000621 BF[A4190000]        <1>  mov edi, palette+(base*3)
  1352 00000626 89FE                <1>  mov esi, edi
  1352 00000628 66AD                <1>  lodsw
  1352                              <1> 
  1352 0000062A 46                  <1>  inc esi
  1352 0000062B 66B95D00            <1>  mov cx, (range*3-3)
  1352 0000062F F3A4                <1>  rep movsb
  1352 00000631 66AB                <1>  stosw
  1352                              <1> 
  1353                                  		animStars
  1353                              <1>  base equ 7*32
  1353                              <1> 
  1353 00000633 8B3D[4C450000]      <1>  mov edi, [tseg+4]
  1353 00000639 E845010000          <1>  call clearFrac
  1353                              <1> 
  1353                              <1> 
  1353 0000063E B11E                <1>  mov cl, 30
  1353 00000640 BB[E4440000]        <1>  mov ebx, stars
  1353                              <1> 
  1353                              <1> aSoloop:
  1353 00000645 FE0B                <1>  dec byte [ebx]
  1353 00000647 8A23                <1>  mov ah, [ebx]
  1353 00000649 80E43F              <1>  and ah, 63
  1353 0000064C 80FC1F              <1>  cmp ah, 31
  1353 0000064F 7605                <1>  jbe short aSnonot
  1353 00000651 F6D4                <1>  not ah
  1353 00000653 80E41F              <1>  and ah, 31
  1353                              <1> aSnonot:
  1353 00000656 D0EC                <1>  shr ah, 1
  1353 00000658 8B3D[4C450000]      <1>  mov edi, [tseg+4]
  1353                              <1> 
  1353 0000065E 660B7B01            <1>  or di, [ebx+1]
  1353 00000662 6651                <1>  push cx
  1353 00000664 6653                <1>  push bx
  1353                              <1> 
  1353 00000666 66BA3B00            <1>  mov dx, 64-5
  1353 0000066A 66B900E0            <1>  mov cx, base*256+0
  1353 0000066E E813000000          <1>  call setstarbob
  1353                              <1> 
  1353 00000673 665B                <1>  pop bx
  1353 00000675 6659                <1>  pop cx
  1353 00000677 6683C303            <1>  add bx, 3
  1353 0000067B E2C8                <1>  loop aSoloop
  1354                                  	
  1355 0000067D 66FF05[5A160000]        		inc	word [doortimer]
  1356                                  tr_1:
  1357 00000684 61                      		popad
  1358 00000685 C3                      		retn
  1359                                  
  1360                                  ;==============================================================================
  1361                                  ;		sub routines
  1362                                  ;==============================================================================
  1363                                  ;***********************************************
  1364                                  ;* descript. : draw a the starbob	       *
  1365                                  ;* parameter : ds,es: source seg,dest seg      *
  1366                                  ;* sideeffect: ax,cx,si,di	               *
  1367                                  ;* back      : none		               *
  1368                                  ;***********************************************
  1369                                  
  1370                                  setstarbob:
  1371 00000686 BE[19130000]            		mov	esi, bob
  1372 0000068B B305                    		mov	bl, 5
  1373                                  yloop:
  1374 0000068D B705                    		mov	bh, 5
  1375                                  xloop:
  1376 0000068F AC                      		lodsb
  1377 00000690 28E0                    		sub	al, ah
  1378 00000692 7E06                    		jle	short aSnodraw
  1379 00000694 00E8                    		add	al, ch
  1380 00000696 D2E0                    		shl	al, cl
  1381 00000698 8807                    		mov	[edi], al
  1382                                  aSnodraw:
  1383 0000069A 6647                    		inc	di
  1384 0000069C FECF                    		dec	bh
  1385 0000069E 75EF                    		jnz	short xloop
  1386 000006A0 6601D7                  		add	di, dx
  1387 000006A3 FECB                    		dec	bl
  1388 000006A5 75E6                    		jnz	short yloop
  1389 000006A7 C3                      		retn
  1390                                  
  1391                                  ;***********************************************
  1392                                  ;* descript. : copy 16000 longs ds --> es      *
  1393                                  ;* parameter : ds,es: source seg,dest seg      *
  1394                                  ;* sideeffect: ax,cx,si,di	               *
  1395                                  ;* back      : none		               *
  1396                                  ;***********************************************
  1397                                  
  1398                                  copyseg:
  1399 000006A8 66B9803E                		mov	cx, 16000 ; 3E80h
  1400 000006AC F3A5                    		rep movsd
  1401 000006AE C3                      		retn
  1402                                  
  1403                                  ;***********************************************
  1404                                  ;* descript. : expand a part of the song       *
  1405                                  ;* parameter : si:base adress		       *
  1406                                  ;* sideeffect: si,ax		               *
  1407                                  ;* back      : ax=si:new baseadress            *
  1408                                  ;***********************************************
  1409                                  
  1410                                  expand:
  1411 000006AF 8A0E                    EPwhile: 	mov	cl, [esi]
  1412 000006B1 08C9                    		or	cl, cl
  1413 000006B3 741E                    		jz	short EPendwhile
  1414 000006B5 7918                    		jns	short EPnote
  1415                                  EPcall:
  1416 000006B7 6651                    		push	cx
  1417 000006B9 6656                    		push	si
  1418 000006BB 6646                    		inc	si
  1419 000006BD E8EDFFFFFF              		call	expand
  1420 000006C2 665E                    		pop	si
  1421 000006C4 6659                    		pop	cx
  1422 000006C6 FEC1                    		inc	cl
  1423 000006C8 75ED                    		jnz	short EPcall
  1424 000006CA 6689C6                  		mov	si, ax
  1425 000006CD EBE0                    		jmp	short EPwhile 
  1426                                  EPnote:
  1427 000006CF 66A5                    		movsw
  1428 000006D1 EBDC                    		jmp	short EPwhile
  1429                                  EPendwhile:
  1430 000006D3 6646                    		inc	si
  1431 000006D5 6689F0                  		mov	ax, si
  1432 000006D8 C3                      		retn
  1433                                  
  1434                                  ;***********************************************
  1435                                  ;* descript. : recursive index quicksort       *
  1436                                  ;* parameter : l,r:stack left and right border *
  1437                                  ;* sideeffect: ax,bx,cx,dx,si,di               *
  1438                                  ;* back      : none		               *
  1439                                  ;***********************************************
  1440                                  
  1441                                  qsort:
  1442 000006D9 58                      		pop	eax 	; get adress
  1443 000006DA 59                      		pop	ecx	; get 2. param r
  1444 000006DB 5B                      		pop	ebx	; get 1. param l
  1445 000006DC 50                      		push	eax	; store adress
  1446                                  
  1447 000006DD 39D9                    		cmp	ecx, ebx
  1448 000006DF 7E3A                    		jle	short QSendrek
  1449 000006E1 89DE                    		mov	esi, ebx
  1450 000006E3 89CF                    		mov	edi, ecx
  1451 000006E5 668B16                  		mov	dx, [esi]
  1452                                  QSrepeat:
  1453 000006E8 663916                  QSwhile1:	cmp	[esi], dx
  1454 000006EB 7E05                    		jle	short QSwhile2
  1455 000006ED 83C604                  		add	esi, 4
  1456 000006F0 EBF6                    		jmp	short QSwhile1
  1457                                  QSwhile2:
  1458 000006F2 663917                  		cmp	[edi], dx
  1459 000006F5 7D05                    		jnl	short QSwhile2e
  1460 000006F7 83EF04                  		sub	edi, 4
  1461 000006FA EBF6                    		jmp	short QSwhile2
  1462                                  QSwhile2e:
  1463 000006FC 39FE                    		cmp	esi, edi
  1464 000006FE 7F09                    		jg	short QSnoswap
  1465 00000700 AD                      		lodsd
  1466 00000701 8707                    		xchg	eax, [edi]
  1467 00000703 8946FC                  		mov	[esi-4], eax
  1468 00000706 83EF04                  		sub	edi, 4
  1469                                  QSnoswap:
  1470 00000709 39FE                    		cmp	esi, edi
  1471 0000070B 7EDB                    		jle	short QSrepeat
  1472                                  
  1473 0000070D 56                      		push	esi 
  1474 0000070E 51                      		push	ecx
  1475 0000070F 53                      		push	ebx
  1476 00000710 57                      		push	edi
  1477 00000711 E8C3FFFFFF              		call	qsort
  1478 00000716 E8BEFFFFFF              		call	qsort
  1479                                  QSendrek:
  1480 0000071B C3                      		retn
  1481                                  
  1482                                  ;***********************************************
  1483                                  ;* descript. : returns a pseudo random number  *
  1484                                  ;* parameter : bx=range		               *
  1485                                  ;* sideeffect: eax,edx,si		       *
  1486                                  ;* back      : ax=rnd(range)                   *
  1487                                  ;***********************************************
  1488                                  
  1489                                  rnd:
  1490 0000071C BE[D3100000]            		mov	esi, randommul
  1491                                  		;mov	si, randommul
  1492 00000721 AD                      		lodsd
  1493 00000722 F726                    		mul	dword [esi] ; randomseed
  1494 00000724 40                      		inc	eax
  1495 00000725 8906                    		mov	[esi], eax  ; ; randomseed
  1496 00000727 66AD                    		lodsw
  1497 00000729 66AD                    		lodsw
  1498 0000072B 66F7E3                  		mul	bx
  1499 0000072E 6692                    		xchg	ax, dx
  1500 00000730 C3                      		retn
  1501                                  
  1502                                  ;***********************************************
  1503                                  ;* descript. : set timer speed to 1193180/AX   *
  1504                                  ;*             interrupts per second           *
  1505                                  ;* parameter : bx		               *
  1506                                  ;* sideeffect: ax		               *
  1507                                  ;* back      : none		               *
  1508                                  ;***********************************************
  1509                                  
  1510                                  setTimer:	; set timer speed to 1193180/BX (TRDOS 386)
  1511 00000731 B036                    		mov	al, 36h
  1512                                  		;out	43h, al		; Timer	8253-5 (AT: 8254.2).
  1513                                  
  1514 00000733 B401                    		mov	ah, 1 ; out (byte)
  1515 00000735 66BA4300                		mov	dx, 43h
  1516 00000739 CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1517                                  
  1518 0000073B 88D8                    		mov	al, bl
  1519                                  		;out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1520                                  		
  1521 0000073D 66BA4000                		mov	dx, 40h
  1522                                  		;mov	ah, 1 ; out (byte)
  1523 00000741 CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1524                                  
  1525 00000743 88F8                    		mov	al, bh
  1526                                  		;out	40h, al		; Timer	8253-5 (AT: 8254.2).
  1527                                  		
  1528                                  		;mov	ah, 1 ; out (byte)
  1529                                  		;mov	dx, 40h
  1530 00000745 CD34                    		int	34h ; TRDOS 386 - IOCTL interrupt
  1531                                  
  1532 00000747 C3                      		retn
  1533                                  
  1534                                  ;***********************************************
  1535                                  ;* descript. : send a byte to the GM-Port      *
  1536                                  ;* parameter : al:midi command                 *
  1537                                  ;* sideeffect: dx		               *
  1538                                  ;* back      : none		               *
  1539                                  ;***********************************************
  1540                                  
  1541                                  writeGM:
  1542 00000748 66BA3103                		mov	dx, GMPort  ; 331h
  1543 0000074C 6651                    		push	cx
  1544 0000074E 6650                    		push	ax
  1545 00000750 30C9                    		xor	cl, cl
  1546                                  busy:
  1547 00000752 FEC9                    		dec	cl
  1548 00000754 7408                    		jz	short timeOut
  1549                                  		;in	al, dx
  1550                                  
  1551 00000756 B400                    		mov	ah, 0	; in (byte)
  1552 00000758 CD34                      		int	34h	; TRDOS 386 - IOCTL interrupt
  1553                                  		
  1554 0000075A A840                    		test	al, 40h
  1555 0000075C 75F4                    		jnz	short busy
  1556                                  
  1557                                  timeOut:				; CODE XREF: writeGM+8j
  1558 0000075E 6658                    		pop	ax
  1559 00000760 6659                    		pop	cx
  1560 00000762 664A                    		dec	dx
  1561                                  		;out	dx, al
  1562                                  		
  1563 00000764 B401                    		mov	ah, 1	; out (byte)
  1564 00000766 CD34                      		int	34h	; TRDOS 386 - IOCTL interrupt
  1565                                  
  1566 00000768 C3                      		retn
  1567                                  
  1568                                  ;***********************************************
  1569                                  ;* descript. : send NOTEON command, volume 127 *
  1570                                  ;* parameter : al:channel;ah:note              *
  1571                                  ;* sideeffect: dx,al		               *
  1572                                  ;* back      : none		               *
  1573                                  ;***********************************************
  1574                                  
  1575                                  setnote:
  1576 00000769 E808000000              		call	setinstr
  1577 0000076E B07F                    		mov	al, 127	; 7Fh
  1578 00000770 E8D3FFFFFF              		call	writeGM
  1579 00000775 C3                      		retn
  1580                                  
  1581                                  ;***********************************************
  1582                                  ;* descript. : send CHANGEPRG command	       *
  1583                                  ;* parameter : al:channel;ah:instrument        *
  1584                                  ;* sideeffect: dx,al		               *
  1585                                  ;* back      : none		               *
  1586                                  ;***********************************************
  1587                                  
  1588                                  setinstr:
  1589 00000776 E8CDFFFFFF              		call	writeGM
  1590 0000077B 88E0                    		mov	al, ah
  1591 0000077D E8C6FFFFFF              		call	writeGM
  1592 00000782 C3                      		retn
  1593                                  
  1594                                  ;***********************************************
  1595                                  ;* descript. : clear/set the fractal es: to al *
  1596                                  ;* parameter : al,es		               *
  1597                                  ;* sideeffect: ax,cx,di,es  	               *
  1598                                  ;* back      : none			       *
  1599                                  ;***********************************************
  1600                                  
  1601                                  clearFrac:
  1602 00000783 31C0                    		xor	eax, eax
  1603                                  setFrac:
  1604 00000785 66B90010                		mov	cx, 4096 ; 1000h
  1605 00000789 F3AA                    		rep stosb
  1606 0000078B C3                      		retn
  1607                                  
  1608                                  ;***********************************************
  1609                                  ;* descript. : calc shade bob fractal          *
  1610                                  ;* parameter : es:seg;num,rad:stack            *
  1611                                  ;* sideeffect: all			       *
  1612                                  ;* back      : none			       *
  1613                                  ;***********************************************
  1614                                  
  1615                                  createFrac1:
  1616                                  		rad	equ 8  ; arg 1 in [esp]
  1617                                  		num	equ 12 ; arg 2 in [esp+4]
  1618                                  
  1619 0000078C 55                      		push	ebp
  1620 0000078D 89E5                    		mov	ebp, esp
  1621 0000078F D0E3                    		shl	bl, 1 ; word -> dword 
  1622 00000791 8BBB[48450000]          		mov	edi, [ebx+tseg] ; es = word [tseg+bx]
  1623 00000797 89FB                    		mov	ebx, edi ; 16/12/2016
  1624 00000799 E8E5FFFFFF              		call	clearFrac
  1625                                  		;mov	si, circletab
  1626 0000079E BE[A4440000]            		mov	esi, circletab ; 16/12/2016
  1627 000007A3 668B5508                		mov	dx, [ebp+rad]
  1628 000007A7 88D0                    		mov	al, dl
  1629 000007A9 F6EA                    		imul	dl
  1630                                  
  1631                                  		;mov	di, ax
  1632 000007AB 89DF                    		mov	edi, ebx
  1633 000007AD 0FB7D8                  		movzx	ebx, ax ; 16/12/2016
  1634 000007B0 6689D1                  		mov	cx, dx
  1635 000007B3 6601C9                  		add	cx, cx
  1636                                  CCTloop:
  1637 000007B6 88D0                    		mov	al, dl
  1638 000007B8 F6EA                    		imul	dl
  1639 000007BA 66F7D8                  		neg	ax
  1640                                  		;add	ax, di
  1641 000007BD 6601D8                  		add	ax, bx
  1642 000007C0 668906                  		mov	[esi], ax
  1643 000007C3 DF06                    		fild	word [esi]
  1644 000007C5 D9FA                    		fsqrt
  1645 000007C7 DF1E                    		fistp	word [esi]
  1646 000007C9 46                      		inc	esi
  1647 000007CA 46                      		inc	esi
  1648 000007CB 664A                    		dec	dx
  1649 000007CD E2E7                    		loop	CCTloop
  1650                                  
  1651 000007CF 668B4D0C                		mov	cx, [ebp+num]
  1652                                  SBloop1:
  1653 000007D3 6651                    		push	cx
  1654 000007D5 66BB0010                		mov	bx, 4096 ; 1000h
  1655 000007D9 E83EFFFFFF              		call	rnd
  1656                                  		;mov	di, ax
  1657 000007DE 6689C3                  		mov	bx, ax ; 16/12/2016
  1658 000007E1 66BE[A444]              		mov	si, circletab
  1659 000007E5 668B4D08                		mov	cx, [ebp+rad]
  1660 000007E9 6601C9                  		add	cx, cx
  1661                                  SBloop2:
  1662 000007EC 6651                    		push	cx
  1663 000007EE 66AD                    		lodsw
  1664 000007F0 6689C1                  		mov	cx, ax
  1665 000007F3 6601C9                  		add	cx, cx
  1666 000007F6 7411                    		jz	short SBskip
  1667 000007F8 53                      		push	ebx
  1668                                  		;sub	di, ax
  1669 000007F9 6629C3                  		sub	bx, ax
  1670                                  SBloop3:
  1671                                  		;and	di, 4095  ; 0FFFh
  1672 000007FC 6681E3FF0F              		and	bx, 0FFFh
  1673 00000801 FE041F                  		inc	byte [edi+ebx] ; 16/12/2016
  1674                                  		;inc	di
  1675 00000804 6643                    		inc	bx
  1676 00000806 E2F4                    		loop	SBloop3
  1677 00000808 5B                      		pop	ebx
  1678                                  SBskip:
  1679                                  		;add	di, 64 ; 40h
  1680 00000809 6683C340                		add	bx, 64
  1681 0000080D 6659                    		pop	cx
  1682 0000080F E2DB                    		loop	SBloop2
  1683 00000811 6659                    		pop	cx
  1684 00000813 E2BE                    		loop	SBloop1
  1685 00000815 5D                      		pop	ebp
  1686 00000816 C20800                  		ret	8
  1687                                  
  1688                                  ;***********************************************
  1689                                  ;* descript. : draw a perpective-texturemapped *
  1690                                  ;*	       and g.-shaded n-sided polygon   *
  1691                                  ;* parameter : far ptr to poly, sides, textnum *
  1692                                  ;* sideeffect: all			       *
  1693                                  ;* back      : none			       *
  1694                                  ;* length    : 700 bytes		       *
  1695                                  ;***********************************************
  1696                                  
  1697                                  scansubtextpoly:
  1698                                  		col	equ 8   ; arg 1, [esp+4]
  1699                                  		n	equ 12  ; arg 2, [esp+8]
  1700                                  		pol	equ 16  ; arg 3, [esp+12]
  1701                                  
  1702                                   		;enter	150, 0	; 96h
  1703 00000819 C8980000                		enter	152, 0  ; 98h ; 12/12/2016		
  1704                                  			; push ebp ; mov ebp, esp ; sub esp, 152
  1705                                  
  1706                                  		; ebp - x
  1707                                  		sstb.edg  equ -60   ; 90-150 ; edges * 3
  1708                                  		sstb.del  equ -120  ; 30-150 ; edges * 3 
  1709                                  		sstb.mx1  equ -122  ; 28-150 ; word
  1710                                  		sstb.mx2  equ -124  ; 26-150 ; word	 				
  1711                                  		sstb.miny equ -126  ; 24-150 ; word
  1712                                  		sstb.maxy equ -128  ; 22-150 ; word	
  1713                                  		sstb.y	  equ -130  ; 20-150 ; word
  1714                                  		sstb.l	  equ -132  ; 18-150 ; word	 				
  1715                                  		sstb.r	  equ -134  ; 16-150 ; word
  1716                                  		sstb.uu1  equ -136  ; 14-150 ; word
  1717                                  		sstb.vv1  equ -138  ; 12-150 ; word
  1718                                  		sstb.uu2  equ -140  ; 10-150 ; word	 				
  1719                                  		sstb.vv2  equ -142  ;  8-150 ; word
  1720                                  		sstb.ddu  equ -144  ;  6-150 ; word
  1721                                  		sstb.ddv  equ -146  ;  4-150 ; word
  1722                                  		sstb.dy   equ -150  ;  0-150 ; dword
  1723                                  		; 12/12/2016
  1724                                  		sstb.pad  equ -152  ; padding (for dword boundary)
  1725                                  
  1726                                  		;mov	ax, -32767  ; 8001h
  1727 0000081D B8FF7F0000              		mov	eax, 32767
  1728 00000822 89C2                    		mov	edx, eax
  1729 00000824 66F7D8                  		neg	ax
  1730 00000827 89C3                    		mov	ebx, eax
  1731 00000829 89C6                    		mov	esi, eax
  1732                                  		;neg	ax
  1733                                  		;mov	edx, eax
  1734                                  		;movzx	edi, word [ebp+pol] ; [ebp+16]
  1735 0000082B 8B7D10                  		mov	edi, [ebp+pol] ; [ebp+16]
  1736                                  
  1737 0000082E 31C9                    		xor	ecx, ecx
  1738                                  minmax:
  1739 00000830 663B4712                		cmp	ax, [edi+2+edge.e+edges.x] ; [edi+12h]
  1740 00000834 7E04                    		jle	short noswap1
  1741 00000836 668B4712                		mov	ax, [edi+2+edge.e+edges.x] ; [edi+12h]
  1742                                  noswap1:
  1743 0000083A 663B5F12                		cmp	bx, [edi+2+edge.e+edges.x] ; [edi+12h]
  1744 0000083E 7D04                    		jge	short noswap2
  1745 00000840 668B5F12                		mov	bx, [edi+2+edge.e+edges.x] ; [edi+12h]
  1746                                  noswap2:
  1747 00000844 663B570C                		cmp	dx, [edi+edge.py]  ; [edi+0Ch]
  1748 00000848 7E12                    		jle	short noswap3
  1749 0000084A 668B570C                		mov	dx, [edi+edge.py]  ; [edi+0Ch]
  1750 0000084E 66898D7CFFFFFF          		mov	[ebp+sstb.l], cx   ; [ebp-84h]
  1751 00000855 66898D7AFFFFFF          		mov	[ebp+sstb.r], cx   ; [ebp-86h]
  1752                                  noswap3:
  1753 0000085C 663B770C                		cmp	si, [edi+edge.py]  ; [edi+0Ch]
  1754 00000860 7D04                    		jge	short noswap4
  1755 00000862 668B770C                		mov	si, [edi+edge.py]  ; [edi+0Ch]
  1756                                  noswap4:
  1757 00000866 6683C724                		add	di, 36 ; 24h
  1758 0000086A 6641                    		inc	cx
  1759 0000086C 663B4D0C                		cmp	cx, [ebp+n] ; [ebp+12]
  1760 00000870 75BE                    		jnz	short minmax
  1761                                  
  1762 00000872 6683FB00                		cmp	bx, 0
  1763 00000876 0F8CCA020000            		jl	exitDraw
  1764 0000087C 663D4001                		cmp	ax, XMAX  ; 140h
  1765 00000880 0F8FC0020000            		jg	exitDraw
  1766                                  
  1767 00000886 6683FE15                		cmp	si, YMIN  ; 15h
  1768 0000088A 0F8CB6020000            		jl	exitDraw
  1769 00000890 6681FAB300              		cmp	dx, YMAX  ; 0B3h
  1770 00000895 0F8FAB020000            		jg	exitDraw
  1771 0000089B 66895582                		mov	[ebp+sstb.miny], dx ; [ebp-7Eh]
  1772 0000089F 66897580                		mov	[ebp+sstb.maxy], si ; [ebp-80h]
  1773                                  
  1774                                  		;{ down clipping }
  1775 000008A3 66817D80B300            		cmp	word [ebp+sstb.maxy], YMAX ; 0B3h
  1776 000008A9 7E06                    		jle	short noclipdown
  1777 000008AB 66C74580B300            		mov	word [ebp+sstb.maxy], YMAX ; 0B3h
  1778                                  noclipdown:
  1779 000008B1 668B4582                		mov	ax, [ebp+sstb.miny] ; [ebp-7Eh]
  1780 000008B5 663B4580                		cmp	ax, [ebp+sstb.maxy] ; [ebp-80h]
  1781 000008B9 0F8487020000            		je	exitDraw
  1782 000008BF 6689857EFFFFFF          		mov	[ebp+sstb.y], ax    ; [ebp-82h]
  1783 000008C6 668B5D08                		mov	bx, [ebp+col]	    ; [ebp+8]
  1784 000008CA C0E302                  		shl	bl, 2
  1785                                  		;mov	es, word [vseg]
  1786                                  		;mov	fs, word [ebx+tseg]
  1787 000008CD FFB3[48450000]          		push	dword [ebx+tseg] ; *
  1788                                  for:
  1789 000008D3 668B857EFFFFFF          		mov	ax, [ebp+sstb.y]    ; [ebp-82h]
  1790 000008DA 663B4580                		cmp	ax, [ebp+sstb.maxy] ; [ebp-80h]
  1791 000008DE 0F8F5F020000            		jg	_exitDraw
  1792 000008E4 0F848A000000            		je	exitwhile2 ; 18/12/2016
  1793                                  while1:
  1794 000008EA 668B7510                		mov	si, [ebp+pol]	    ; [ebp+16]
  1795 000008EE 666B9D7CFFFFFF24        		imul	bx, word [ebp+sstb.l], 36 ; [ebp-84h]
  1796 000008F6 6601DE                  		add	si, bx
  1797 000008F9 663B460C                		cmp	ax, [esi+edge.py]   ; [esi+0Ch]
  1798 000008FD 752F                    		jne	short while2
  1799 000008FF 668B9D7CFFFFFF          		mov	bx, [ebp+sstb.l]    ; [ebp-84h]
  1800 00000906 664B                    		dec	bx
  1801 00000908 7D06                    		jge	short nounder
  1802 0000090A 668B5D0C                		mov	bx, [ebp+n]	    ; [ebp+12]
  1803 0000090E 664B                    		dec	bx
  1804                                  nounder:
  1805 00000910 66899D7CFFFFFF          		mov	[ebp+sstb.l], bx    ; [ebp-84h]
  1806 00000917 6631FF                  		xor	di, di
  1807 0000091A E82B020000              		call	calcDeltas
  1808                                  
  1809 0000091F 668B857EFFFFFF          		mov	ax, [ebp+sstb.y]    ; [ebp-82h]
  1810 00000926 663B4580                		cmp	ax, [ebp+sstb.maxy] ; [ebp-80h]
  1811                                  		;jge	short while2	
  1812 0000092A 7CBE                    		jnge	short while1 ; 18/12/2016
  1813                                  		;jmp	short while1
  1814 0000092C EB46                    		jmp	short exitwhile2
  1815                                  while2:
  1816                                  		;mov	ax, [ebp+sstb.y]    ; [ebp-82h]
  1817 0000092E 663B4580                		cmp	ax, [ebp+sstb.maxy] ; [ebp-80h]
  1818 00000932 7D40                    		jge	short exitwhile2
  1819 00000934 668B7510                		mov	si, [ebp+pol]	    ; [ebp+16]
  1820 00000938 666B9D7AFFFFFF24        		imul	bx, word [ebp+sstb.r], 36 ; [ebp-86h]
  1821 00000940 6601DE                  		add	si, bx
  1822 00000943 663B460C                		cmp	ax, [esi+edge.py]   ; [esi+0Ch]
  1823 00000947 752B                    		jnz	short exitwhile2
  1824                                  
  1825 00000949 668B9D7AFFFFFF          		mov	bx, [ebp+sstb.r]    ; [ebp-86h]
  1826 00000950 6643                    		inc	bx
  1827 00000952 663B5D0C                		cmp	bx, [ebp+n]	    ; [ebp+12
  1828 00000956 7C03                    		jl	short noover
  1829 00000958 6631DB                  		xor	bx, bx
  1830                                  noover:
  1831 0000095B 66899D7AFFFFFF          		mov	[ebp+sstb.r], bx    ; [ebp-86h]
  1832 00000962 66BF1400                		mov	di, 20  ; 14h
  1833 00000966 E8DF010000              		call	calcDeltas
  1834                                  		; 18/12/2016
  1835 0000096B 668B857EFFFFFF          		mov	ax, [ebp+sstb.y]    ; [ebp-82h]
  1836 00000972 EBBA                    		jmp	short while2
  1837                                  exitwhile2:
  1838                                  		;{ up clipping }
  1839 00000974 6683BD7EFFFFFF15        		cmp	word [ebp+sstb.y], YMIN	; 15h
  1840 0000097C 0F8CA3010000            		jl	clipup
  1841 00000982 31DB                    		xor	ebx, ebx
  1842 00000984 31C9                    		xor	ecx, ecx
  1843 00000986 668B5DC6                		mov	bx, [ebp+sstb.edg+2+edges.x] ; [ebp-3Ah]
  1844 0000098A 66895D86                		mov	[ebp+sstb.mx1], bx  ; [ebp-7Ah]
  1845 0000098E 668B4DDA                		mov	cx, [ebp+sstb.edg+20+2+edges.x] ; [ebp-26h]
  1846 00000992 66894D84                		mov	[ebp+sstb.mx2], cx  ; [ebp-7Ch]
  1847 00000996 6629D9                  		sub	cx, bx
  1848 00000999 0F8486010000            		jz	exitol
  1849 0000099F 66837D8400              		cmp	word [ebp+sstb.mx2], 0 ; [ebp-7Ch]
  1850 000009A4 0F8E7B010000            		jle	exitol
  1851 000009AA 66817D864001            		cmp	word [ebp+sstb.mx1], XMAX ; 140h
  1852 000009B0 0F8F6F010000            		jg	exitol
  1853                                  
  1854 000009B6 66F7DB                  		neg	bx
  1855 000009B9 790B                    		jns	short myelse
  1856 000009BB 6631DB                  		xor	bx, bx
  1857 000009BE EB0C                    		jmp	short myendif
  1858                                  _nodivbyzero:
  1859 000009C0 8B443DB0                		mov	eax, [ebp+edi+sstb.del+40] ; [ebp+edi-50h]
  1860 000009C4 EB1C                    		jmp	short nodivbyzero
  1861                                  myelse:
  1862 000009C6 66C745860000            		mov	word [ebp+sstb.mx1], 0 ; [ebp-7Ah]
  1863                                  myendif:
  1864 000009CC 66BF1000                		mov	di, 16 ; 10h
  1865                                  addloop1:
  1866                                  		;{ calculate deltas }
  1867 000009D0 8B443DD8                		mov	eax, [ebp+edi+sstb.edg+20] ; [ebp+edi-28h]
  1868 000009D4 2B443DC4                		sub	eax, [ebp+edi+sstb.edg]    ; [ebp+edi-3Ch]
  1869 000009D8 99                      		cdq
  1870                                  		;jcxz	nodivbyzero
  1871 000009D9 67E3E4                  		jcxz	_nodivbyzero
  1872 000009DC F7F9                    		idiv	ecx
  1873 000009DE 89443DB0                		mov	[ebp+edi+sstb.del+40], eax ; [ebp+edi-50h]
  1874                                  nodivbyzero:
  1875                                  		;{ left clipping }
  1876                                  		;mov	eax, [ebp+edi+sstb.del+40] ; [ebp+edi-50h]
  1877 000009E2 F7EB                    		imul	ebx
  1878 000009E4 03443DC4                		add	eax, [ebp+edi+sstb.edg]	   ; [ebp+edi-3Ch]
  1879 000009E8 89443DEC                		mov	[ebp+edi+sstb.edg+40], eax ; [ebp+edi-14h]
  1880 000009EC 6683EF04                		sub	di, 4
  1881 000009F0 75DE                    		jnz	short addloop1
  1882                                  
  1883 000009F2 668B45C0                		mov	ax, [ebp+sstb.del+40+16]   ; [ebp-40h]
  1884 000009F6 66A3[070B0000]          		mov	[dels_pos_w], ax  ; [dels_pos+2]
  1885                                  
  1886                                  		;{ right clipping }
  1887 000009FC 66817D844001            		cmp	word  [ebp+sstb.mx2], XMAX  ; [ebp-7Ch]
  1888 00000A02 7E06                    		jle	short norightclip
  1889 00000A04 66C745844001            		mov	word  [ebp+sstb.mx2], XMAX  ; 140h
  1890                                  norightclip:
  1891 00000A0A 6669BD7EFFFFFF4001      		imul	di, word [ebp+sstb.y], 320  ; [ebp-82h]
  1892 00000A13 66037D86                		add	di, [ebp+sstb.mx1]	    ; [ebp-7Ah]
  1893 00000A17 66BB0001                		mov	bx, 256 ; 100h
  1894 00000A1B 8B45F0                  		mov	eax, [ebp+sstb.edg+40+edges.u] ; [ebp-10h]
  1895 00000A1E F7EB                    		imul	ebx
  1896 00000A20 F77DF8                  		idiv	dword [ebp+sstb.edg+40+edges.w] ; [ebp-8]
  1897 00000A23 66898574FFFFFF          		mov	[ebp+sstb.uu2], ax 	    ; [ebp-8Ch]
  1898 00000A2A 8B45F4                  		mov	eax, [ebp+sstb.edg+40+edges.v] ; [ebp-0Ch]
  1899 00000A2D F7EB                    		imul	ebx
  1900 00000A2F F77DF8                  		idiv	dword [ebp+sstb.edg+40+edges.w] ; [ebp-8]
  1901 00000A32 66898572FFFFFF          		mov	[ebp+sstb.vv2], ax	    ; [ebp-8Eh]
  1902                                  
  1903                                  outloop:
  1904 00000A39 668B4D84                		mov	cx, [ebp+sstb.mx2]	    ;[ebp-7Ch]
  1905 00000A3D 662B4D86                		sub	cx, [ebp+sstb.mx1]	    ; [ebp-7Ah]
  1906 00000A41 0F8EDE000000            		jle	exitol
  1907 00000A47 6683F910                		cmp	cx, SUBRANGE ; 10h
  1908 00000A4B 7E04                    		jle	short lastSeg
  1909 00000A4D 66B91000                		mov	cx, SUBRANGE ; 10h
  1910                                  lastSeg:
  1911                                  		;{ uu1:=uu2 }
  1912                                  		;{ vv1:=vv2 }
  1913 00000A51 8B8572FFFFFF            		mov	eax, [ebp+sstb.vv2]	    ; [ebp-8Eh]
  1914 00000A57 898576FFFFFF            		mov	[ebp+sstb.vv1], eax	    ; [ebp-8Ah]
  1915                                  
  1916 00000A5D 8B45B4                  		mov	eax, [ebp+sstb.del+40+edges.u] ; [ebp-4Ch]
  1917 00000A60 F7E9                    		imul	ecx
  1918 00000A62 0145F0                  		add	[ebp+sstb.edg+40+edges.u], eax ; [ebp-10h]
  1919 00000A65 8B45B8                  		mov	eax, [ebp+sstb.del+40+edges.v] ; [ebp-48h]
  1920 00000A68 F7E9                    		imul	ecx
  1921 00000A6A 0145F4                  		add	[ebp+sstb.edg+40+edges.v], eax ; [ebp-0Ch]
  1922 00000A6D 8B45BC                  		mov	eax, [ebp+sstb.del+40+edges.w] ; [ebp-44h]
  1923 00000A70 F7E9                    		imul	ecx
  1924 00000A72 0145F8                  		add	[ebp+sstb.edg+40+edges.w], eax ; [ebp-8]
  1925 00000A75 66BB0001                		mov	bx, 256 ; 100h
  1926 00000A79 8B45F0                  		mov	eax, [ebp+sstb.edg+40+edges.u] ; [ebp-10h]
  1927 00000A7C F7EB                    		imul	ebx
  1928 00000A7E F77DF8                  		idiv	dword [ebp+sstb.edg+40+edges.w] ; [ebp-8]
  1929 00000A81 66898574FFFFFF          		mov	[ebp+sstb.uu2], ax	     ; [ebp-8Ch]
  1930 00000A88 8B45F4                  		mov	eax, [ebp+sstb.edg+40+edges.v] ; [ebp-0Ch]
  1931 00000A8B F7EB                    		imul	ebx
  1932 00000A8D F77DF8                  		idiv	dword [ebp+sstb.edg+40+edges.w] ; [ebp-8]
  1933 00000A90 66898572FFFFFF          		mov	[ebp+sstb.vv2], ax	    ; [ebp-8Eh]
  1934                                  
  1935 00000A97 668B8574FFFFFF          		mov	ax, [ebp+sstb.uu2]	    ; [ebp-8Ch]
  1936 00000A9E 662B8578FFFFFF          		sub	ax, [ebp+sstb.uu1]	    ; [ebp-88h]
  1937 00000AA5 6699                    		cwd
  1938 00000AA7 66F7F9                  		idiv	cx
  1939 00000AAA 66A3[0C0B0000]          		mov	[ddu_pos_w], ax ; [ddu_pos+3]
  1940                                  
  1941 00000AB0 668B8572FFFFFF          		mov	ax, [ebp+sstb.vv2]	    ; [ebp-8Eh]
  1942 00000AB7 662B8576FFFFFF          		sub	ax, [ebp+sstb.vv1]	    ; [ebp-8Ah]
  1943 00000ABE 6699                    		cwd
  1944 00000AC0 66F7F9                  		idiv	cx
  1945 00000AC3 66A3[110B0000]          		mov	[ddv_pos_w], ax ; [ddv_pos+3]
  1946                                  
  1947 00000AC9 668BB576FFFFFF          		mov	si, [ebp+sstb.vv1]	    ; [ebp-8Ah]
  1948 00000AD0 668B9578FFFFFF          		mov	dx, [ebp+sstb.uu1]	    ; [ebp-88h]
  1949 00000AD7 668B45FC                		mov	ax, [ebp+sstb.edg+40+16]    ; [ebp-4]
  1950                                  innerloop:
  1951 00000ADB 6689F3                  		mov	bx, si
  1952 00000ADE 30DB                    		xor	bl, bl
  1953 00000AE0 66C1EB02                		shr	bx, 2
  1954 00000AE4 00F3                    		add	bl, dh
  1955 00000AE6 031C24                  		add	ebx, [esp]  ; *
  1956                                  		;mov	bl, [fs:bx]
  1957 00000AE9 0FB61B                  		movzx	ebx, byte [ebx]	
  1958 00000AEC 08DB                    		or	bl, bl
  1959 00000AEE 7415                    		jz	short dels_pos
  1960 00000AF0 88E7                    		mov	bh, ah
  1961 00000AF2 8A9B[98450000]          		mov	bl, [ebx+shadetab]
  1962                                  
  1963 00000AF8 56                      		push	esi
  1964 00000AF9 8B35[40450000]          		mov	esi, [vseg]
  1965 00000AFF 6601FE                  		add	si, di
  1966 00000B02 881E                    		mov	[esi], bl
  1967 00000B04 5E                      		pop	esi
  1968                                  
  1969                                  dels_pos:	; add ax, 1111h
  1970 00000B05 66                      		db 66h
  1971 00000B06 05                      		db 05h
  1972 00000B07 1111                    dels_pos_w:	dw 1111h
  1973                                  
  1974                                  ddu_pos:	; add dx, 1111h
  1975 00000B09 66                      		db 66h
  1976 00000B0A 81                      		db 81h
  1977 00000B0B C2                      		db 0C2h 
  1978 00000B0C 1111                    ddu_pos_w:	dw 1111h
  1979                                  
  1980                                  ddv_pos:	; add si, 1111h
  1981 00000B0E 66                      		db 66h
  1982 00000B0F 81                      		db 81h
  1983 00000B10 C6                      		db 0C6h
  1984 00000B11 1111                    ddv_pos_w:	dw 1111h
  1985                                  
  1986 00000B13 6647                    		inc	di	
  1987 00000B15 E2C4                    		loop	innerloop
  1988 00000B17 668945FC                		mov	[ebp+sstb.edg+40+16], ax ; [ebp-4]
  1989 00000B1B 6683458610              		add	word [ebp+sstb.mx1], SUBRANGE ; [ebp-7Ah]
  1990 00000B20 E914FFFFFF              		jmp	outloop
  1991                                  exitol:
  1992 00000B25 66BF2400                clipup:		mov	di, 36 ; 24h
  1993                                  addloop:
  1994 00000B29 8B443D88                		mov	eax, [ebp+edi+sstb.del]  ; [ebp+edi-78h]
  1995 00000B2D 01443DC4                		add	[ebp+edi+sstb.edg], eax  ; [ebp+edi-3Ch]
  1996 00000B31 6683EF04                		sub	di, 4
  1997 00000B35 79F2                    		jns	short addloop
  1998 00000B37 66FF857EFFFFFF          		inc	word [ebp+sstb.y]	 ; [ebp-82h]
  1999 00000B3E E990FDFFFF              		jmp	for
  2000                                  _exitDraw:
  2001 00000B43 83C404                  		add	esp, 4 ; *
  2002                                  exitDraw:
  2003 00000B46 C9                      		leave
  2004                                  			; mov esp, ebp ; pop ebp
  2005 00000B47 C20C00                  		ret	12
  2006                                  
  2007                                    ;***********************************************
  2008                                    ;* descript. : calc deltas for vertical interp.*
  2009                                    ;* parameter : none			         *
  2010                                    ;* sideeffect: all		 	         *
  2011                                    ;***********************************************
  2012                                  
  2013                                  calcDeltas:
  2014 00000B4A 666BD324                		imul	dx, bx,	36
  2015 00000B4E 6689F3                  		mov	bx, si
  2016 00000B51 668B7510                		mov	si, [ebp+pol] ; [ebp+16]
  2017 00000B55 6601D6                  		add	si, dx
  2018 00000B58 668B460C                		mov	ax, [esi+12]
  2019 00000B5C 662B857EFFFFFF          		sub	ax, [ebp+sstb.y] ; [ebp-82h]
  2020 00000B63 0FBFC0                  		movsx	eax, ax
  2021 00000B66 89856AFFFFFF            		mov	[ebp+sstb.dy], eax ; [ebp-96h]
  2022 00000B6C 66B90500                		mov	cx, 5
  2023                                  cDloop:
  2024 00000B70 8B5310                  		mov	edx, [ebx+16]
  2025 00000B73 89543DC4                		mov	[ebp+edi+sstb.edg], edx ; [ebp+edi-3Ch]
  2026 00000B77 8B4610                  		mov	eax, [esi+16]
  2027 00000B7A 29D0                    		sub	eax, edx
  2028 00000B7C 99                      		cdq
  2029 00000B7D 6683BD6AFFFFFF00        		cmp	word [ebp+sstb.dy], 0 ; [ebp-96h]
  2030 00000B85 740A                    		je	short cDskip
  2031 00000B87 F7BD6AFFFFFF            		idiv	dword [ebp+sstb.dy]   ; [ebp-96h]
  2032 00000B8D 89443D88                		mov	[ebp+edi+sstb.del], eax ; [ebp+edi-78h]
  2033                                  cDskip:
  2034 00000B91 6683C704                		add	di, 4
  2035 00000B95 6683C604                		add	si, 4
  2036 00000B99 6683C304                		add	bx, 4
  2037 00000B9D E2D1                    		loop	cDloop
  2038 00000B9F C3                      		retn
  2039                                  
  2040                                  ;***********************************************
  2041                                  ;* descript. : clip a poly at the viewplane,   *
  2042                                  ;*             project and draw it	       *
  2043                                  ;* parameter : bx:adress of the face	       *
  2044                                  ;* sideeffect: all		 	       *
  2045                                  ;* back      : none			       *
  2046                                  ;***********************************************
  2047                                  
  2048                                  drawclippedface:
  2049                                  
  2050                                  		dcf.d	equ -2	  ; word
  2051                                  		dcf.h	equ -4	  ; word	
  2052                                  		dcf.j	equ -6	  ; word
  2053                                  		dcf.col equ -8	  ; word
  2054                                  		dcf.is_in equ -10 ; byte
  2055                                  		dcf.p0	equ -190  ; poly (5*36 bytes)
  2056                                  		dcf.p2	equ -370  ; poly (5*36 bytes)
  2057                                  		; 12/12/2016
  2058                                  		dcf.pad equ -372  ; padding (for dword boundary)
  2059                                  
  2060                                  		;enter	370, 0  ; 172h
  2061 00000BA0 C8740100                		enter	372, 0  ; 174h ; 12/12/2016
  2062                                   			; push ebp ; mov ebp, esp ; sub esp, 372
  2063 00000BA4 BE[37130000]            		mov	esi, uvtab
  2064                                  		;mov	si, uvtab		
  2065 00000BA9 31FF                    		xor	edi, edi
  2066 00000BAB 66B90400                		mov	cx, 4
  2067                                  dcFinitloop:
  2068 00000BAF 6653                    		push	bx
  2069 00000BB1 668B1B                  		mov	bx, [ebx]
  2070                                  
  2071 00000BB4 6653                    		push	bx
  2072 00000BB6 666BDB0C                		imul	bx, bx, 12
  2073 00000BBA 6681C3[78C7]            		add	bx, rp
  2074 00000BBF 8B03                    		mov	eax, [ebx]
  2075 00000BC1 89843D42FFFFFF          		mov	[ebp+edi+dcf.p0+0], eax	 ; [ebp+edi-0BEh]
  2076                                  
  2077 00000BC8 8B4304                  		mov	eax, [ebx+4]
  2078 00000BCB 89843D46FFFFFF          		mov	[ebp+edi+dcf.p0+4], eax  ; [ebp+edi-0BAh]
  2079                                  
  2080 00000BD2 D94308                  		fld	dword [ebx+8]
  2081 00000BD5 D9943D4AFFFFFF          		fst	dword [ebp+edi+dcf.p0+8] ; [ebp+edi-0B6h]
  2082 00000BDC DF5DFC                  		fistp	word [ebp+dcf.h]	 ; [ebp-04h]	
  2083 00000BDF 665B                    		pop	bx
  2084                                  
  2085 00000BE1 668B45FC                		mov	ax, [ebp+dcf.h]		 ; [ebp-04h]
  2086 00000BE5 66050002                		add	ax, 512	; 200h
  2087 00000BE9 0F8884010000            		js	dCFbackclip
  2088 00000BEF 663DFF01                		cmp	ax, 511 ; 1FFh
  2089 00000BF3 7E04                    		jle	short intensityOK
  2090 00000BF5 66B8FF01                		mov	ax, 511 ; 1FFh
  2091                                  intensityOK:
  2092 00000BF9 66C1E303                		shl	bx, 3
  2093 00000BFD 31D2                    		xor	edx, edx
  2094 00000BFF 66C1E007                		shl	ax, 7
  2095 00000C03 66F7A3[6E1A0000]        		mul	word [ebx+o+6+object.p]	 ; [ebx+o+6+4]
  2096 00000C0A 89943D62FFFFFF          		mov	[ebp+edi+dcf.p0+32], edx ; [ebp+edi-9Eh]
  2097                                  
  2098 00000C11 30E4                    		xor	ah, ah
  2099 00000C13 8A4604                  		mov	al, [esi+4]
  2100 00000C16 C1E010                  		shl	eax, 16	; 10h
  2101 00000C19 89843D5AFFFFFF          		mov	[ebp+edi+dcf.p0+24], eax ; [ebp+edi-0A6h]
  2102 00000C20 AC                      		lodsb
  2103 00000C21 C1E010                  		shl	eax, 16	; 10h
  2104 00000C24 89843D56FFFFFF          		mov	[ebp+edi+dcf.p0+20], eax ; [ebp+edi-0AAh]
  2105                                  		
  2106 00000C2B 665B                    		pop	bx
  2107 00000C2D 6643                    		inc	bx
  2108 00000C2F 6643                    		inc	bx
  2109 00000C31 6683C724                		add	di, 36	; 24h
  2110 00000C35 FEC9                    		dec	cl
  2111 00000C37 0F8572FFFFFF            		jnz	dcFinitloop	
  2112 00000C3D 668B03                  		mov	ax, [ebx]
  2113 00000C40 668945F8                		mov	[ebp+dcf.col], ax	 ; [ebp-08h]
  2114                                  
  2115 00000C44 6631DB                  		xor	bx, bx
  2116 00000C47 66895DFA                		mov	[ebp+dcf.j], bx		 ; [ebp-06h]
  2117 00000C4B D945B6                  		fld	dword [ebp+dcf.p0+108+8] ; [ebp-4Ah]
  2118 00000C4E D9E4                    		ftst
  2119 00000C50 9BDFE0                  		fstsw	ax
  2120 00000C53 DDD8                    		fstp	st0
  2121 00000C55 9E                      		sahf
  2122 00000C56 7302                    		jnb	short isFalse
  2123 00000C58 664B                    		dec	bx
  2124                                  isFalse:
  2125 00000C5A 885DF6                  		mov	[ebp+dcf.is_in], bl	 ; [ebp-0Ah]
  2126                                  		;xor	si, si
  2127                                  		;xor	di, di
  2128 00000C5D 31F6                    		xor	esi, esi
  2129 00000C5F 31FF                    		xor	edi, edi 
  2130                                  forloop:
  2131 00000C61 D984354AFFFFFF          		fld	dword [ebp+esi+dcf.p0+8] ; [ebp+esi-0B6h]
  2132 00000C68 D9E4                    		ftst
  2133 00000C6A 9BDFE0                  		fstsw	ax
  2134 00000C6D DDD8                    		fstp	st0
  2135 00000C6F 9E                      		sahf
  2136 00000C70 7337                    		jnb	short elseFall
  2137 00000C72 807DF6FF                		cmp	byte [ebp+dcf.is_in], 0FFh
  2138 00000C76 7408                    		je	short inside
  2139 00000C78 E8F8000000              		call	clipsub
  2140                                  		; { OUT / IN }
  2141 00000C7D F655F6                  		not	byte [ebp+dcf.is_in]	 ; [ebp-0Ah]
  2142                                  inside:
  2143 00000C80 6657                    		push	di
  2144 00000C82 6656                    		push	si
  2145 00000C84 668DBC3D8EFEFFFF        		lea	di, [ebp+edi+dcf.p2]	 ; [ebp+edi-172h]
  2146 00000C8C 668DB43542FFFFFF        		lea	si, [ebp+esi+dcf.p0]	 ; [ebp+esi-0BEh]
  2147 00000C94 66B91200                		mov	cx, 18	; 12h
  2148 00000C98 F366A5                  		rep movsw 			 ; { IN / IN }
  2149                                  
  2150 00000C9B 665E                    		pop	si
  2151 00000C9D 665F                    		pop	di
  2152 00000C9F 6683C724                		add	di, 36	; 24h
  2153 00000CA3 66FF45FA                		inc	word [ebp+dcf.j]	 ; [ebp-06h]
  2154 00000CA7 EB0E                    		jmp	short dCFendif
  2155                                  elseFall:
  2156 00000CA9 807DF6FF                		cmp	byte [ebp+dcf.is_in], 0FFh ; [ebp-0Ah]
  2157 00000CAD 7508                    		jne	short outside
  2158 00000CAF E8C1000000              		call	clipsub
  2159 00000CB4 F655F6                  		not	byte [ebp+dcf.is_in]	 ; [ebp-0Ah]	
  2160                                  outside:
  2161 00000CB7 6683C624                dCFendif:	add	si, 36 ; 24h
  2162 00000CBB 6681FE9000              		cmp	si, 4*36 ; 90h
  2163 00000CC0 759F                    		jne	short forloop
  2164                                  
  2165 00000CC2 668B4DFA                		mov	cx, [ebp+dcf.j]		 ; [ebp-06h]
  2166 00000CC6 6683F902                		cmp	cx, 2
  2167 00000CCA 0F8CA3000000            		jl	dCFnodraw
  2168 00000CD0 6631FF                  		xor	di, di
  2169                                  dCFloop:
  2170 00000CD3 DF05[C7100000]          		fild	word [CONST13]
  2171 00000CD9 D8A43D96FEFFFF          		fsub	dword [ebp+edi+dcf.p2+8] ; [ebp+edi-16Ah]
  2172 00000CE0 DE35[CB100000]          		fidiv	word [CONST160]
  2173                                  		
  2174 00000CE6 D9843D92FEFFFF          		fld	dword [ebp+edi+dcf.p2+4] ; [ebp+edi-16Eh]
  2175 00000CED D8F1                    		fdiv	st0, st1
  2176 00000CEF DE05[C9100000]          		fiadd	word [CONST100]
  2177 00000CF5 DB9C3D9AFEFFFF          		fistp	dword [ebp+edi+dcf.p2+12] ; [ebp+edi-166h]
  2178                                  		
  2179 00000CFC D9843D8EFEFFFF          		fld	dword [ebp+edi+dcf.p2]	 ; [ebp+edi-172h]
  2180 00000D03 D80D[C3100000]          		fmul	dword [ASPECT_PLACE]
  2181 00000D09 D8F1                    		fdiv	st0, st1
  2182 00000D0B DE05[CB100000]          		fiadd	word [CONST160]
  2183 00000D11 D9FC                    		frndint
  2184 00000D13 DA0D[CF100000]          		fimul	dword [CONST65536]
  2185 00000D19 DB9C3D9EFEFFFF          		fistp	dword [ebp+edi+dcf.p2+16] ; [ebp+edi-162h]
  2186                                  
  2187 00000D20 DB843DA2FEFFFF          		fild	dword [ebp+edi+dcf.p2+20] ; [ebp+edi-15Eh]
  2188 00000D27 D8F1                    		fdiv	st0, st1
  2189 00000D29 DB9C3DA2FEFFFF          		fistp	dword [ebp+edi+dcf.p2+20] ; [ebp+edi-15Eh]
  2190 00000D30 DB843DA6FEFFFF          		fild	dword [ebp+edi+dcf.p2+24] ; [ebp+edi-15Ah]
  2191 00000D37 D8F1                    		fdiv	st0, st1
  2192 00000D39 DB9C3DA6FEFFFF          		fistp	dword [ebp+edi+dcf.p2+24] ; [ebp+edi-15Ah]
  2193 00000D40 DB05[CF100000]          		fild	dword [CONST65536]
  2194 00000D46 D8F1                    		fdiv	st0, st1
  2195 00000D48 DB9C3DAAFEFFFF          		fistp	dword [ebp+edi+dcf.p2+28] ; [ebp+edi-156h]
  2196 00000D4F DDD8                    		fstp	st0
  2197 00000D51 6683C724                		add	di, 36 ; 24h
  2198 00000D55 6649                    		dec	cx
  2199 00000D57 0F8576FFFFFF            		jnz	dCFloop
  2200 00000D5D 668DBD8EFEFFFF          		lea	di, [ebp+dcf.p2]	 ; [ebp-172h]
  2201 00000D64 6657                    		push	di
  2202 00000D66 66FF75FA                		push	word [ebp+dcf.j]	 ; [ebp-06h]	 
  2203 00000D6A 66FF75F8                		push	word [ebp+dcf.col]	 ; [ebp-08h]
  2204 00000D6E E8A6FAFFFF              		call	scansubtextpoly
  2205                                  dCFnodraw:
  2206 00000D73 C9                      dCFbackclip:	leave
  2207                                  			; mov esp, ebp ; pop ebp
  2208 00000D74 C3                      		retn
  2209                                  
  2210                                  clipsub:
  2211 00000D75 6656                    		push	si
  2212 00000D77 6657                    		push	di
  2213 00000D79 668D46DC                		lea	ax, [esi-36]  ; [esi-24h]
  2214 00000D7D 6683F800                		cmp	ax, 0
  2215 00000D81 7D04                    		jge	short cSnounder
  2216 00000D83 66B86C00                		mov	ax, 108 ; 6Ch
  2217                                  cSnounder:
  2218 00000D87 D984354AFFFFFF          		fld	dword [ebp+esi+dcf.p0+8] ; [ebp+esi-0B6h]
  2219 00000D8E D9C0                    		fld	st0
  2220 00000D90 6697                    		xchg	ax, di
  2221 00000D92 D8A43D4AFFFFFF          		fsub	dword [ebp+edi+dcf.p0+8] ; [ebp+edi-0B6h]
  2222 00000D99 6697                    		xchg	ax, di
  2223 00000D9B DEF9                    		fdivp	st1, st0
  2224                                  
  2225 00000D9D 66BB[3213]              		mov	bx, cliptab
  2226 00000DA1 66B90600                		mov	cx, 6
  2227                                  dCFclipLoop2:
  2228 00000DA5 6697                    		xchg	ax, di
  2229 00000DA7 D9843D42FFFFFF          		fld	dword [ebp+edi+dcf.p0]	; [ebp+edi-0BEh]
  2230 00000DAE 6697                    		xchg	ax, di
  2231 00000DB0 D8A43542FFFFFF          		fsub	dword [ebp+esi+dcf.p0]	; [ebp+esi-0BEh]
  2232 00000DB7 D8C9                    		fmul	st0, st1
  2233 00000DB9 D8843542FFFFFF          		fadd	dword [ebp+esi+dcf.p0]	; [ebp+esi-0BEh]
  2234 00000DC0 D99C3D8EFEFFFF          		fstp	dword [ebp+edi+dcf.p2]	; [ebp+edi-172h]
  2235                                  
  2236 00000DC7 8A13                    		mov	dl, [ebx]
  2237 00000DC9 43                      		inc	ebx
  2238 00000DCA 30F6                    		xor	dh, dh
  2239 00000DCC 6601D7                  		add	di, dx
  2240 00000DCF 6601D6                  		add	si, dx
  2241 00000DD2 6601D0                  		add	ax, dx
  2242 00000DD5 E2CE                    		loop	dCFclipLoop2
  2243 00000DD7 DDD8                    		fstp	st0
  2244 00000DD9 665F                    		pop	di
  2245 00000DDB 665E                    		pop	si
  2246 00000DDD 66FF45FA                		inc	word [ebp+dcf.j] 	; [ebp-6]
  2247 00000DE1 6683C724                		add	di, 36 ; 24h
  2248 00000DE5 C3                      		retn
  2249                                  
  2250                                  ;***********************************************
  2251                                  ;* descript. : rotate point over one axis      *
  2252                                  ;* parameter : st(0):angle, [ds:si] ptr to     *
  2253                                  ;*	       1.koord.,[ds:bx] ptr to 2.koord.*
  2254                                  ;* sideeffect: empty copro-stack               *
  2255                                  ;* back      : none			       *
  2256                                  ;***********************************************
  2257                                  
  2258                                  rotateAxis:
  2259 00000DE6 D9EB                    		fldpi
  2260 00000DE8 DEC9                    		fmulp	st1, st0
  2261 00000DEA DA35[CF100000]          		fidiv	dword [CONST65536]
  2262 00000DF0 D9FB                    		fsincos
  2263 00000DF2 D9C0                    		fld	st0
  2264 00000DF4 D80E                    		fmul	dword [esi]
  2265 00000DF6 D9C2                    		fld	st2
  2266 00000DF8 D80B                    		fmul	dword [ebx]
  2267 00000DFA DEE9                    		fsubp	st1, st0
  2268 00000DFC D9CA                    		fxch	st2
  2269 00000DFE D80E                    		fmul	dword [esi]
  2270 00000E00 D9C9                    		fxch	st1
  2271 00000E02 D80B                    		fmul	dword [ebx]
  2272 00000E04 DEC1                    		faddp	st1, st0
  2273 00000E06 D91B                    		fstp	dword [ebx]
  2274 00000E08 D91E                    		fstp	dword [esi]
  2275 00000E0A C3                      		retn
  2276                                  
  2277                                  ;***********************************************
  2278                                  ;* descript. : rotate point		       *
  2279                                  ;* parameter : a,b,c:angles,adr:address        *
  2280                                  ;* sideeffect: all		 	       *
  2281                                  ;* back      : none			       *
  2282                                  ;***********************************************
  2283                                  
  2284                                  xyzRotate:
  2285                                  		adr	equ 8   ; arg 1, [esp+4]
  2286                                  		c	equ 12	; arg 2, [esp+8]	
  2287                                  		b	equ 16  ; arg 3, [esp+12]
  2288                                  		a	equ 20  ; arg 4, [esp+16]
  2289                                  
  2290 00000E0B 31DB                    		xor	ebx, ebx ; ? (12/12/2016)
  2291 00000E0D 31F6                    		xor	esi, esi ; ? (12/12/2016)
  2292                                  
  2293 00000E0F 55                      		push	ebp
  2294 00000E10 89E5                    		mov	ebp, esp
  2295                                  	
  2296 00000E12 8B7D08                  		mov	edi, [ebp+adr]
  2297 00000E15 DF4514                  		fild	word [ebp+a]
  2298 00000E18 668D5F08                		lea	bx, [edi+8]
  2299 00000E1C 668D7704                		lea	si, [edi+4]
  2300 00000E20 E8C1FFFFFF              		call	rotateAxis
  2301 00000E25 DF4510                  		fild	word [ebp+b]
  2302 00000E28 668D1F                  		lea	bx, [edi]
  2303 00000E2B 668D7708                		lea	si, [edi+8]
  2304 00000E2F E8B2FFFFFF              		call	rotateAxis
  2305 00000E34 DF450C                  		fild	word [ebp+c]
  2306 00000E37 668D5F04                		lea	bx, [edi+4]
  2307 00000E3B 668D37                  		lea	si, [edi]
  2308 00000E3E E8A3FFFFFF              		call	rotateAxis
  2309                                  
  2310 00000E43 5D                      		pop	ebp
  2311 00000E44 C21000                  		ret	16
  2312                                  
  2313                                  ;***********************************************
  2314                                  ;* descript. : calculate world matrix	       *
  2315                                  ;* parameter : x-,y-,z-angle,neig:stack	       *
  2316                                  ;* sideeffect: all		 	       *
  2317                                  ;* back      : none			       *
  2318                                  ;***********************************************
  2319                                  
  2320                                  calcRotMat:
  2321                                  		neig	equ 8   ; arg 1, [esp+4]
  2322                                  		zw	equ 12	; arg 2, [esp+8]	
  2323                                  		yw	equ 16  ; arg 3, [esp+12]
  2324                                  		xw	equ 20  ; arg 4, [esp+16]
  2325                                  
  2326 00000E47 55                      		push	ebp
  2327 00000E48 89E5                    		mov	ebp, esp
  2328                                  
  2329 00000E4A BF[CC160000]            		mov	edi, nwmat
  2330                                  		identityMat
  2330 00000E4F B502                <1>  mov ch, 2
  2330                              <1> iMolp:
  2330 00000E51 B102                <1>  mov cl, 2
  2330                              <1> iMilp:
  2330 00000E53 D9EE                <1>  fldz
  2330 00000E55 38CD                <1>  cmp ch, cl
  2330 00000E57 7504                <1>  jne short iMwritezero
  2330 00000E59 DDD8                <1>  fstp st0
  2330 00000E5B D9E8                <1>  fld1
  2330                              <1> iMwritezero:
  2330 00000E5D D91F                <1>  fstp dword [edi]
  2330 00000E5F 6683C704            <1>  add di, 4
  2330 00000E63 FEC9                <1>  dec cl
  2330 00000E65 79EC                <1>  jns short iMilp
  2330 00000E67 FECD                <1>  dec ch
  2330 00000E69 79E6                <1>  jns short iMolp
  2331 00000E6B 31FF                    		xor	edi, edi
  2332                                  cRMolp:
  2333 00000E6D 57                      		push	edi
  2334 00000E6E FF7514                  		push	dword [ebp+xw]
  2335 00000E71 FF7510                  		push	dword [ebp+yw]
  2336 00000E74 FF750C                  		push	dword [ebp+zw]
  2337 00000E77 6681C7[CC16]            		add	di, nwmat
  2338 00000E7C 57                      		push	edi
  2339 00000E7D E889FFFFFF              		call	xyzRotate
  2340 00000E82 5F                      		pop	edi
  2341 00000E83 31DB                    		xor	ebx, ebx
  2342                                  cRMilp:
  2343 00000E85 D987[CC160000]          		fld	dword [edi+nwmat]
  2344 00000E8B D88B[81160000]          		fmul	dword [ebx+owmat]
  2345 00000E91 D987[D0160000]          		fld	dword [edi+nwmat+4]
  2346 00000E97 D88B[8D160000]          		fmul	dword [ebx+owmat+12]
  2347 00000E9D D987[D4160000]          		fld	dword [edi+nwmat+8]
  2348 00000EA3 D88B[99160000]          		fmul	dword [ebx+owmat+24]
  2349 00000EA9 DEC1                    		fadd
  2350 00000EAB DEC1                    		fadd
  2351 00000EAD D9943B[81160000]        		fst	dword [ebx+edi+owmat]
  2352 00000EB4 D99C3B[A8160000]        		fstp	dword [ebx+edi+wmat]
  2353 00000EBB 6683C304                		add	bx, 4
  2354 00000EBF 80FB0C                  		cmp	bl, 12
  2355 00000EC2 75C1                    		jnz	short cRMilp
  2356 00000EC4 6683C70C                		add	di, 12
  2357 00000EC8 6683FF24                		cmp	di, 36
  2358 00000ECC 759F                    		jnz	short cRMolp
  2359                                  
  2360 00000ECE BE[A8160000]            		mov	esi, wmat
  2361 00000ED3 66B90300                		mov	cx, 3
  2362                                  cRMneigloop:
  2363 00000ED7 DF4508                  		fild	word [ebp+neig]
  2364 00000EDA 668D5E0C                		lea	bx, [esi+12]
  2365 00000EDE E803FFFFFF              		call	rotateAxis
  2366 00000EE3 6683C604                		add	si, 4
  2367 00000EE7 E2EE                    		loop	cRMneigloop
  2368                                  
  2369 00000EE9 5D                      		pop	ebp
  2370 00000EEA C21000                  		ret	16
  2371                                  
  2372                                  ;***********************************************
  2373                                  ;* descript. : create the world		       *
  2374                                  ;* parameter : none			       *
  2375                                  ;* sideeffect: all		               *
  2376                                  ;* back      : none			       *
  2377                                  ;***********************************************
  2378                                  
  2379                                  createWorld:
  2380                                  		cw.direc  equ -2  ; word
  2381                                  		cw.shade  equ -4  ; word	
  2382                                  
  2383 00000EED C8040000                		enter	4, 0
  2384                                  			; push ebp ; mov ebp, esp ; sub esp, 4
  2385 00000EF1 BE[84130000]            		mov	esi, world
  2386 00000EF6 66B90400                		mov	cx, 4
  2387                                  cWworldLoop:
  2388 00000EFA 51                      		push	ecx
  2389 00000EFB 56                      		push	esi
  2390 00000EFC BF[98C50000]            		mov	edi, p
  2391 00000F01 BB[10C60000]            		mov	ebx, pr
  2392 00000F06 66BE[5713]              		mov	si, print
  2393 00000F0A B10F                    		mov	cl, 15 ; 0Fh
  2394                                  cWinitStartRoom:
  2395 00000F0C 51                      		push	ecx
  2396 00000F0D B103                    		mov	cl, 3
  2397                                  cWinnerLoop:
  2398 00000F0F AC                      		lodsb
  2399 00000F10 6698                    		cbw
  2400 00000F12 66AB                    		stosw
  2401 00000F14 DF47FE                  		fild	word [edi-2]
  2402 00000F17 D91B                    		fstp	dword [ebx]
  2403 00000F19 6683C304                		add	bx, 4
  2404 00000F1D E2F0                    		loop	cWinnerLoop
  2405 00000F1F 59                      		pop	ecx
  2406 00000F20 66B8007F                		mov	ax, 127*256 ; 7F00h
  2407 00000F24 66AB                    		stosw
  2408 00000F26 E2E4                    		loop	cWinitStartRoom
  2409 00000F28 5E                      		pop	esi
  2410                                  cWmainLoop:
  2411 00000F29 AC                      		lodsb
  2412 00000F2A 3CFF                    		cmp	al, 255 ; 0FFh
  2413 00000F2C 0F8449010000            		je	cWexit
  2414                                  
  2415 00000F32 88C7                    		mov	bh, al
  2416 00000F34 6681E30070              		and	bx, 7000h
  2417 00000F39 80C70F                  		add	bh, 15 ; 0Fh
  2418 00000F3C 66895DFC                		mov	[ebp+cw.shade], bx ; [ebp-4]
  2419 00000F40 6683E00F                		and	ax, 0Fh ; 15
  2420 00000F44 668945FE                		mov	[ebp+cw.direc], ax ; [ebp-2]
  2421                                  
  2422 00000F48 31DB                    		xor	ebx, ebx
  2423                                  cWsideLoop:
  2424 00000F4A F6C304                  		test	bl, 4
  2425 00000F4D 7405                    		jz	short cWfirstNibble
  2426 00000F4F AC                      		lodsb
  2427 00000F50 240F                    		and	al, 0Fh ; 15
  2428 00000F52 EB05                    		jmp	short cWsecondNibble
  2429                                  cWfirstNibble:
  2430 00000F54 8A06                    		mov	al, [esi]
  2431 00000F56 C0E804                  		shr	al, 4
  2432                                  cWsecondNibble:
  2433 00000F59 30E4                    		xor	ah, ah
  2434 00000F5B 6648                    		dec	ax
  2435 00000F5D 7866                    		js	short cWnoWall
  2436 00000F5F 666B3D[661A0000]0A      		imul	di, word [o+object.fanz], 10 ; 0Ah
  2437 00000F67 6681C7[E826]            		add	di, o+object.f
  2438 00000F6C 66FF05[661A0000]        		inc	word [o+object.fanz]
  2439 00000F73 66894708                		mov	[edi+8], ax
  2440                                  
  2441 00000F77 53                      		push	ebx
  2442 00000F78 56                      		push	esi
  2443 00000F79 B104                    		mov	cl, 4
  2444                                  cWaddPointloop:
  2445 00000F7B 660FBEB3[3F130000]      		movsx	si, byte [ebx+cube]
  2446 00000F83 6681C6[98C5]            		add	si, p
  2447                                  
  2448 00000F88 57                      		push	edi
  2449 00000F89 66BF[681A]              		mov	di, o+object.p
  2450 00000F8D 51                      		push	ecx
  2451 00000F8E 668B0D[641A0000]        		mov	cx, [o+object.panz]
  2452 00000F95 6631C0                  		xor	ax, ax
  2453 00000F98 67E318                  		jcxz	cWfirstPoint
  2454                                  cWsearchPointLoop:
  2455 00000F9B 8B16                    		mov	edx, [esi]
  2456 00000F9D 3B17                    		cmp	edx, [edi]
  2457 00000F9F 750A                    		jne	short cWdifferent
  2458 00000FA1 668B5604                		mov	dx, [esi+4]
  2459 00000FA5 663B5704                		cmp	dx, [edi+4]
  2460 00000FA9 7411                    		je	short cWpointExists
  2461                                  cWdifferent:
  2462 00000FAB 6640                    		inc	ax
  2463 00000FAD 6683C708                		add	di, 8
  2464 00000FB1 E2E8                    		loop	cWsearchPointLoop
  2465                                  cWfirstPoint:
  2466 00000FB3 A5                      		movsd
  2467 00000FB4 A5                      		movsd
  2468 00000FB5 66FF05[641A0000]        		inc	word [o+object.panz]
  2469                                  cWpointExists:
  2470 00000FBC 59                      		pop	ecx
  2471 00000FBD 5F                      		pop	edi
  2472 00000FBE 66AB                    		stosw
  2473 00000FC0 43                      		inc	ebx
  2474 00000FC1 E2B8                    		loop	cWaddPointloop
  2475 00000FC3 5E                      		pop	esi
  2476 00000FC4 5B                      		pop	ebx
  2477                                  cWnoWall:
  2478 00000FC5 6683C304                		add	bx, 4
  2479 00000FC9 6683FB18                		cmp	bx, 24 ; 18h
  2480 00000FCD 0F8577FFFFFF            		jne	cWsideLoop
  2481                                  
  2482 00000FD3 666B7DFE0C              		imul	di, word [ebp+cw.direc], 12 ; [ebp-2]
  2483 00000FD8 B103                    		mov	cl, 3
  2484 00000FDA 66BB[70C6]              		mov	bx, pr+96
  2485                                  cWaddStepLoop:
  2486 00000FDE D94348                  		fld	dword [ebx+72] ; [ebx+48h]
  2487 00000FE1 D8043B                  		fadd	dword [ebx+edi]
  2488 00000FE4 D95B48                  		fstp	dword [ebx+72]
  2489 00000FE7 6683C304                		add	bx, 4
  2490 00000FEB E2F1                    		loop	cWaddStepLoop
  2491                                  
  2492 00000FED 807EFC00                		cmp	byte [esi-4], 0
  2493 00000FF1 7D27                    		jge	short cWsimpleRoom
  2494                                  
  2495 00000FF3 66BB[10C6]              		mov	bx, pr
  2496 00000FF7 B10E                    		mov	cl, 14 ; 0Eh
  2497                                  cWrotloop:
  2498 00000FF9 60                      		pushad
  2499 00000FFA B103                    		mov	cl, 3
  2500 00000FFC 8A16                    		mov	dl, [esi]
  2501                                  cWpushLoop:
  2502 00000FFE 31C0                    		xor	eax, eax
  2503 00001000 D0EA                    		shr	dl, 1
  2504 00001002 7305                    		jnc	short cWnoRot
  2505 00001004 8A26                    		mov	ah, [esi]
  2506                                  		;and	ax, 0F000h
  2507 00001006 80E4F0                  		and	ah, 0F0h
  2508                                  		;push	ax
  2509                                  		;jmp	short cWendIf
  2510                                  cWnoRot:
  2511                                  		;push	0 ; arg 2 (c), arg 3 (b), arg 4 (a)
  2512 00001009 50                      		push	eax
  2513                                  cWendIf:
  2514 0000100A E2F2                    		loop	cWpushLoop
  2515 0000100C 53                      		push	ebx ; arg 1 (addr)
  2516 0000100D E8F9FDFFFF              		call	xyzRotate
  2517 00001012 61                      		popad
  2518 00001013 6683C30C                		add	bx, 12 ; 0Ch
  2519 00001017 E2E0                    		loop	cWrotloop
  2520 00001019 46                      		inc	esi
  2521                                  cWsimpleRoom:
  2522 0000101A 668B5DFE                		mov	bx, [ebp+cw.direc]  ; [ebp-2]
  2523 0000101E 66C1E302                		shl	bx, 2
  2524 00001022 B104                    		mov	cl, 4
  2525                                  cWpointCopyLoop:
  2526 00001024 60                      		pushad
  2527 00001025 660FBEB3[3F130000]      		movsx	si, byte [ebx+cube]
  2528 0000102D 6689F0                  		mov	ax, si
  2529 00001030 6681C6[98C5]            		add	si, p
  2530 00001035 80F307                  		xor	bl, 7
  2531 00001038 660FBEBB[3F130000]      		movsx	di, byte [ebx+cube]
  2532 00001040 6681C7[98C5]            		add	di, p
  2533 00001045 56                      		push	esi
  2534 00001046 A5                      		movsd
  2535 00001047 A5                      		movsd
  2536 00001048 5E                      		pop	esi
  2537                                  
  2538 00001049 6689C3                  		mov	bx, ax
  2539 0000104C 66D1EB                  		shr	bx, 1
  2540 0000104F 6601C3                  		add	bx, ax
  2541 00001052 66BF[10C6]              		mov	di, pr
  2542 00001056 B103                    		mov	cl, 3
  2543                                  cWSround:
  2544 00001058 D9043B                  		fld	dword [ebx+edi]
  2545 0000105B D887A8000000            		fadd	dword [edi+168]  ; [edi+0A8h]
  2546 00001061 DF1E                    		fistp	word [esi]
  2547 00001063 6683C704                		add	di, 4
  2548 00001067 46                      		inc	esi
  2549 00001068 46                      		inc	esi
  2550 00001069 E2ED                    		loop	cWSround
  2551 0000106B 668B45FC                		mov	ax, [ebp+cw.shade]  ;[ebp-4]
  2552 0000106F 668906                  		mov	[esi], ax
  2553 00001072 61                      		popad
  2554 00001073 43                      		inc	ebx
  2555 00001074 E2AE                    		loop	cWpointCopyLoop
  2556 00001076 E9AEFEFFFF              		jmp	cWmainLoop
  2557                                  cWexit:
  2558 0000107B 59                      		pop	ecx
  2559 0000107C 6649                    		dec	cx
  2560 0000107E 0F8576FEFFFF            		jnz	cWworldLoop
  2561 00001084 C9                      		leave
  2562                                  			; mov esp, ebp ; pop ebp
  2563 00001085 C3                      		retn
  2564                                  
  2565                                  prg_msg:
  2566 00001086 4552444F47414E2054-     		db	'ERDOGAN TAN - TRDOS 386 VGA Test - SNCOMNI.PRG'
  2566 0000108F 414E202D205452444F-
  2566 00001098 532033383620564741-
  2566 000010A1 2054657374202D2053-
  2566 000010AA 4E434F4D4E492E5052-
  2566 000010B3 47                 
  2567 000010B4 0D0A                    		db	0Dh, 0Ah
  2568 000010B6 31382F31322F323031-     		db	'18/12/2016'
  2568 000010BF 36                 
  2569 000010C0 0D0A                    		db	0Dh, 0Ah
  2570 000010C2 00                      		db	0 
  2571                                  
  2572                                  ;=============================================================================
  2573                                  ;               preinitialized data
  2574                                  ;=============================================================================
  2575                                  
  2576 000010C3 9A99993F                ASPECT_PLACE:	dd ASPECT_RATIO		; 1.2
  2577 000010C7 0D00                    CONST13:	dw 13			; 000Dh			
  2578 000010C9 6400                    CONST100:	dw CENTERY		; 0064h
  2579 000010CB A000                    CONST160:	dw CENTERX		; 00A0h
  2580 000010CD 0007                    CONST1792:	dw 1792			; 0700h
  2581 000010CF 00000100                CONST65536:	dd 65536		; 00010000h
  2582 000010D3 05840808                randommul:	dd 134775813		; 08088405h
  2583 000010D7 FB100000                randomseed:	dd 4347			; 000010FBh
  2584                                  credits:
  2585 000010DB 0250FB                  		db	 2, 80,-5
  2586 000010DE FE320445023E024502-     		db      -2,50,4,69,2,62,2,69,2,81,2,62,2,69,2,79,2,62,2,69,2
  2586 000010E7 51023E0245024F023E-
  2586 000010F0 024502             
  2587 000010F3 51023E0245024F0251-     		db	81,2,62,2,69,2,79,2,81,2,0	; { pat 0,2,4,6,8 }
  2587 000010FC 0200               
  2588 000010FE FE320446023E024602-     		db      -2,50,4,70,2,62,2,70,2,81,2,62,2,70,2,79,2,62,2,70,2
  2588 00001107 51023E0246024F023E-
  2588 00001110 024602             
  2589 00001113 52023E0246024F0252-     		db	82,2,62,2,70,2,79,2,82,2,0	; { pat 1,3,5,7,9 }
  2589 0000111C 0200               
  2590 0000111E 00                      		db       0
  2591 0000111F 37203820                		db      55,32,56,32			; { pat 10 }
  2592 00001123 332035183708            		db      51,32,53,24,55,8                ; { pat 11 }
  2593 00001129 39203220                		db      57,32,50,32		 	; { pat 12 }
  2594 0000112D 3C303A083908            		db      60,48,58,8,57,8                 ; { pat 13 }
  2595 00001133 3740                    		db      55,64		   		; { pat 14 }
  2596 00001135 FE43103E1045104610-     		db      -2,67,16,62,16,69,16,70,16,0	; { pat 15 }
  2596 0000113E 00                 
  2597 0000113F FE461045103E104110-     		db      -2,70,16,69,16,62,16,65,16,0    ; { pat 16 }
  2597 00001148 00                 
  2598 00001149 00                      		db       0
  2599 0000114A 043201800180            		db       4, 50,1,128,1,128              ;{ pat 0-3 }
  2600 00001150 411C4002410240103E-     		db      65,28,64,2,65,2,64,16,62,8,60,8 ;{ pat 4 }
  2600 00001159 083C08             
  2601 0000115C 431C41043C10410840-     		db      67,28,65,4,60,16,65,8,64,8      ;{ pat 5 }
  2601 00001165 08                 
  2602 00001166 3E20321040084108        		db      62,32,50,16,64,8,65,8           ;{ pat 6 }
  2603 0000116E 43203C103E084008        		db      67,32,60,16,62,8,64,8           ;{ pat 7 }
  2604 00001176 3E80                    		db      62,128		  		;{ pat 8,9 }
  2605 00001178 4380                    		db      67,128		  		;{ pat 10,11 }
  2606 0000117A 431040104210400842-     		db     	67,16,64,16,66,16,64,8,66,8	;{ pat 12 }
  2606 00001183 08                 
  2607 00001184 48304610                		db     	72,48,70,16                 	;{ pat 13 }
  2608 00001188 43203720                		db     	67,32,55,32                 	;{ pat 14 }
  2609 0000118C FE1F20372000            		db     	-2,31,32,55,32,0                ;{ pat 15 }
  2610 00001192 FE1A20322000            		db      -2,26,32,50,32,0                ;{ pat 16 }
  2611 00001198 00                      		db       0
  2612 00001199 0559FB018000            		db       5, 89,-5,1,128,0		;{ pat 0-9 }
  2613 0000119F 43084A1844084B18        		db      67,8,74,24,68,8,75,24           ;{ pat 10 }
  2614 000011A7 3F0846183C08451043-     		db      63,8,70,24,60,8,69,16,67,8      ;{ pat 11 }
  2614 000011B0 08                 
  2615 000011B1 3E08451043083E0842-     		db      62,8,69,16,67,8,62,8,66,24	;{ pat 12 }
  2615 000011BA 18                 
  2616 000011BB 3F0843183C08431045-     		db      63,8,67,24,60,8,67,16,69,8	;{ pat 13 }
  2616 000011C4 08                 
  2617 000011C5 370843182B083218        		db      55,8,67,24,43,8,50,24           ;{ pat 14 }
  2618 000011CD FE1F01263F00            		db      -2,31,1,38,63,0                	;{ pat 15 }
  2619 000011D3 FE1A01213F00            		db      -2,26,1,33,63,0                	;{ pat 16 }
  2620 000011D9 00                      		db       0
  2621 000011DA 0A00F02A022A022A02-     		db	10,  0,-16,42,2,42,2,42,2,42,1,42,1,0 ;{ pat 0,1 }
  2621 000011E3 2A012A0100         
  2622 000011E8 F024022A022A022A01-     		db     -16,36,2,42,2,42,2,42,1,42,1,0   ;{ pat 2,3 }
  2622 000011F1 2A0100             
  2623 000011F4 E224022A022E022401-     		db     -30,36,2,42,2,46,2,36,1,42,1,38,2
  2623 000011FD 2A012602           
  2624 00001201 2A022E0226012A01        		db	42,2,46,2,38,1,42,1     	;{ pat 4-16 }
  2625 00001209 2402260224022A012A-     		db      36,2,38,2,36,2,42,1,42,1,38,2,42,2,46,2,38,1,42,1,0
  2625 00001212 0126022A022E022601-
  2625 0000121B 2A0100             
  2626 0000121E 00                      		db     	 0
  2627 0000121F 00                      		db	 0
  2628                                  
  2629                                  ; colortable 65 bytes
  2630 00001220 10                      colors 		db	16
  2631 00001221 1F3F3F3F                                db      31,63,63,63
  2632 00001225 01000000                                db	 1, 0, 0, 0
  2633 00001229 1F28203F                                db      31,40,32,63
  2634 0000122D 01000000                                db	 1, 0, 0, 0
  2635 00001231 1F3F0000                                db      31,63, 0, 0
  2636 00001235 01060100                                db	 1, 6, 1, 0
  2637 00001239 1F3F2914                                db      31,63,41,20
  2638 0000123D 01000000                                db	 1, 0, 0, 0
  2639 00001241 1F3F3F08                                db      31,63,63, 8
  2640 00001245 01000000                                db	 1, 0, 0, 0
  2641 00001249 1F38383F                                db	31,56,56,63
  2642 0000124D 013F0000                                db	 1,63, 0, 0
  2643 00001251 103F3F00                                db      16,63,63, 0
  2644 00001255 103F0000                                db      16,63, 0, 0
  2645 00001259 01160500                                db	 1,22, 5, 0
  2646 0000125D 073F3811                                db       7,63,56,17
  2647                                  
  2648                                  ; parameter for the texture effects 156 bytes
  2649 00001261 130F0F31310A            aE              db	013h,15,15,49,49,10
  2650 00001267 131010303011                            db      013h,16,16,48,48,17
  2651 0000126D 1311112F2F18                            db      013h,17,17,47,47,24
  2652 00001273 1312122E2EBE                            db      013h,18,18,46,46,190
  2653 00001279 1315152B2B1E                            db      013h,21,21,43,43,30
  2654 0000127F 2500003E1E03                            db      025h,0,0,62,30,3
  2655 00001285 2503033E1E07                            db      025h,3,3,62,30,7
  2656 0000128B 2503033B1BFC                            db      025h,3,3,59,27,0FCh
  2657 00001291 2500203E3E03                            db      025h,0,32,62,62,3
  2658 00001297 2503233E3E07                            db      025h,3,35,62,62,7
  2659 0000129D 2503233B3BFC                            db      025h,3,35,59,59,0FCh
  2660 000012A3 2500003F3FFE                            db      025h,0,0,63,63,0FEh
  2661 000012A9 2C000A3F0FF6                            db      02Ch,0,10,63,15,0F6h
  2662 000012AF 2C000B3F1004                            db      02Ch,0,11,63,16,4
  2663 000012B5 2C002F3F34F6                            db      02Ch,0,47,63,52,0F6h
  2664 000012BB 2C00303F3504                            db      02Ch,0,48,63,53,4
  2665 000012C1 2E13182C2705                            db      02Eh,19,24,44,39,5
  2666 000012C7 2E14192C27F4                            db      02Eh,20,25,44,39,0F4h
  2667 000012CD 2E14192B2607                            db      02Eh,20,25,43,38,7
  2668 000012D3 3E14192B2606                            db      03Eh,20,25,43,38,6
  2669 000012D9 2F00183F1E06                            db      02Fh,0,24,63,30,6
  2670 000012DF 2F00193F1FFA                            db      02Fh,0,25,63,31,0FAh
  2671 000012E5 3F00193F1E06                            db      03Fh,0,25,63,30,6
  2672 000012EB 2F00203F2606                            db      02Fh,0,32,63,38,6
  2673 000012F1 2F00213F27FA                            db      02Fh,0,33,63,39,0FAh
  2674 000012F7 3F00213F2606                            db      03Fh,0,33,63,38,6
  2675                                  
  2676                                  ; parameter for fractaladd 28 bytes
  2677 000012FD 22C026012601260020-     aF:             db      34,192,38,1,38,1,38,0,32,0,32,32,32,64
  2677 00001306 0020202040         
  2678 0000130B 226024002260240024-                     db	34,96,36,0,34,96,36,0,36,0,36,0,36,0
  2678 00001314 0024002400         
  2679                                  
  2680                                  ; star bob for the sparcling stars texture 25 bytes
  2681 00001319 0000030000              bob:            db	0,0,3,0,0
  2682 0000131E 0002050200                              db	0,2,5,2,0
  2683 00001323 0305070503                              db	3,5,7,5,3
  2684 00001328 0002050200                              db	0,2,5,2,0
  2685 0000132D 0000030000                              db	0,0,3,0,0
  2686                                  
  2687 00001332 04040C0408              cliptab:	db	4,4,12,4,8
  2688                                  
  2689 00001337 00003F3F3F00003F        uvtab:		db	0,0,63,63,63,0,0,63
  2690                                  
  2691 0000133F 08283010                cube:		db	1*8,5*8,6*8,2*8
  2692 00001343 18382000                                db      3*8,7*8,4*8,0*8
  2693 00001347 10303818                                db      2*8,6*8,7*8,3*8
  2694 0000134B 00202808                                db      0*8,4*8,5*8,1*8
  2695 0000134F 38302820                        	db	7*8,6*8,5*8,4*8
  2696 00001353 00081018                                db      0*8,1*8,2*8,3*8
  2697                                  
  2698 00001357 E0E0E0                  print:		db	-32,-32,-32
  2699 0000135A 20E0E0                                  db       32,-32,-32
  2700 0000135D 2020E0                                  db   	 32, 32,-32
  2701 00001360 E020E0                                  db  	-32, 32,-32
  2702 00001363 E0E020                                  db  	-32,-32, 32
  2703 00001366 20E020                                  db       32,-32, 32
  2704 00001369 202020                                  db   	 32, 32, 32
  2705 0000136C E02020                                  db  	-32, 32, 32
  2706 0000136F 400000                                  db       64,  0,  0
  2707 00001372 C00000                                  db      -64,  0,  0
  2708 00001375 004000                                  db        0, 64,  0
  2709 00001378 00C000                                  db        0,-64,  0
  2710 0000137B 000040                                  db        0,  0, 64
  2711 0000137E 0000C0                                  db        0,  0,-64
  2712 00001381 000000                                  db	  0,  0,  0
  2713                                  
  2714                                  ; world contruction data 599 bytes
  2715 00001384 71700006                world:		db	071h,070h,000h,006h
  2716 00001388 72000006                                db	072h,000h,000h,006h
  2717 0000138C 71007006                                db	071h,000h,070h,006h
  2718 00001390 73077006                                db	073h,007h,070h,006h
  2719 00001394 73070006                                db	073h,007h,000h,006h
  2720 00001398 70070706                                db	070h,007h,007h,006h
  2721 0000139C 74000706                                db	074h,000h,007h,006h
  2722 000013A0 70000740                                db	070h,000h,007h,040h
  2723 000013A4 72700750                                db	072h,070h,007h,050h
  2724 000013A8 72700050                                db	072h,070h,000h,050h
  2725 000013AC 71707050                                db	071h,070h,070h,050h
  2726 000013B0 73007040                                db	073h,000h,070h,040h
  2727 000013B4 71000040                                db	071h,000h,000h,040h
  2728 000013B8 72000050                                db	072h,000h,000h,050h
  2729 000013BC 71007050                                db	071h,000h,070h,050h
  2730 000013C0 73077046                                db	073h,007h,070h,046h
  2731 000013C4 73000046                                db	073h,000h,000h,046h
  2732 000013C8 70070746                                db	070h,007h,007h,046h
  2733 000013CC 72000750                                db	072h,000h,007h,050h
  2734 000013D0 71000000                                db	071h,000h,000h,000h
  2735 000013D4 71000000                                db	071h,000h,000h,000h
  2736 000013D8 7100BB56                                db	071h,000h,0BBh,056h
  2737 000013DC 700FBB46                                db	070h,00Fh,0BBh,046h
  2738 000013E0 FF                                      db	0FFh
  2739 000013E1 33000000                                db	033h,000h,000h,000h
  2740 000013E5 F0000706E4                              db	0F0h,000h,007h,006h,0E4h
  2741 000013EA B000BB46E4                              db	0B0h,000h,0BBh,046h,0E4h
  2742 000013EF 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2743 000013F4 9000BB56E4                              db	090h,000h,0BBh,056h,0E4h
  2744 000013F9 3000BB56                                db	030h,000h,0BBh,056h
  2745 000013FD F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2746 00001402 F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2747 00001407 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2748 0000140C 9000BB5611                              db	090h,000h,0BBh,056h,011h
  2749 00001411 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2750 00001416 F000BB5611                              db	0F0h,000h,0BBh,056h,011h
  2751 0000141B F000BB4611                              db	0F0h,000h,0BBh,046h,011h
  2752 00001420 B000BB5611                              db	0B0h,000h,0BBh,056h,011h
  2753 00001425 3000BB56                                db	030h,000h,0BBh,056h
  2754 00001429 1000BB56                                db	010h,000h,0BBh,056h
  2755                                  
  2756 0000142D 34000000                                db	034h,000h,000h,000h
  2757 00001431 32050080                                db	032h,005h,000h,080h
  2758 00001435 35058080                                db	035h,005h,080h,080h
  2759 00001439 35058000                                db	035h,005h,080h,000h
  2760 0000143D 33058008                                db	033h,005h,080h,008h
  2761 00001441 33050008                                db	033h,005h,000h,008h
  2762 00001445 74050808                                db	074h,005h,008h,008h
  2763 00001449 74050000                                db	074h,005h,000h,000h
  2764 0000144D 73050880                                db	073h,005h,008h,080h
  2765 00001451 75000000                                db	075h,000h,000h,000h
  2766 00001455 75050888                                db	075h,005h,008h,088h
  2767 00001459 70000000                                db	070h,000h,000h,000h
  2768 0000145D 74640808                                db	074h,064h,008h,008h
  2769 00001461 74600800                                db	074h,060h,008h,000h
  2770 00001465 72640880                                db	072h,064h,008h,080h
  2771 00001469 05600080                                db	005h,060h,000h,080h
  2772 0000146D 05600000                                db	005h,060h,000h,000h
  2773 00001471 02600008                                db	002h,060h,000h,008h
  2774 00001475 34600008                                db	034h,060h,000h,008h
  2775 00001479 34600000                                db	034h,060h,000h,000h
  2776 0000147D 32600080                                db	032h,060h,000h,080h
  2777 00001481 35600080                                db	035h,060h,000h,080h
  2778 00001485 35600000                                db	035h,060h,000h,000h
  2779 00001489 32600008                                db	032h,060h,000h,008h
  2780 0000148D 34350008                                db	034h,035h,000h,008h
  2781 00001491 14650000                                db      014h,065h,000h,000h
  2782 00001495 32350080                                db      032h,035h,000h,080h
  2783 00001499 35350080                               	db      035h,035h,000h,080h
  2784 0000149D 15650000                               	db      015h,065h,000h,000h
  2785 000014A1 32350008                                db	032h,035h,000h,008h
  2786 000014A5 34358008                                db	034h,035h,080h,008h
  2787 000014A9 14650000                               	db      014h,065h,000h,000h
  2788 000014AD 32358080                               	db      032h,035h,080h,080h
  2789 000014B1 75000000                		db	075h,000h,000h,000h
  2790 000014B5 5265E077                		db	052h,065h,0E0h,077h
  2791 000014B9 32640E77                		db	032h,064h,00Eh,077h
  2792 000014BD 12650077                		db	012h,065h,000h,077h
  2793 000014C1 00650077                		db	000h,065h,000h,077h
  2794 000014C5 FF                      		db	0FFh
  2795 000014C6 32000000                		db	032h,000h,000h,000h
  2796 000014CA F000000014              		db	0F0h,000h,000h,000h,014h
  2797 000014CF B000000014              		db	0B0h,000h,000h,000h,014h
  2798 000014D4 30000000                		db	030h,000h,000h,000h
  2799 000014D8 F0000000F4              		db	0F0h,000h,000h,000h,0F4h
  2800 000014DD F000DD56F4              		db	0F0h,000h,0DDh,056h,0F4h
  2801 000014E2 3000DD46                		db	030h,000h,0DDh,046h
  2802 000014E6 3000DD56                		db	030h,000h,0DDh,056h
  2803 000014EA 3000DD56                		db	030h,000h,0DDh,056h
  2804 000014EE 32000050                		db	032h,000h,000h,050h
  2805 000014F2 300AA050                		db	030h,00Ah,0A0h,050h
  2806 000014F6 3300A050                		db	033h,000h,0A0h,050h
  2807 000014FA 30000050                		db	030h,000h,000h,050h
  2808 000014FE 32700050                		db	032h,070h,000h,050h
  2809 00001502 3000A050                		db	030h,000h,0A0h,050h
  2810 00001506 33A0A750                		db	033h,0A0h,0A7h,050h
  2811 0000150A 33000000                		db	033h,000h,000h,000h
  2812 0000150E 31A07A50                		db	031h,0A0h,07Ah,050h
  2813 00001512 31000A50                		db	031h,000h,00Ah,050h
  2814 00001516 31000A50                		db	031h,000h,00Ah,050h
  2815 0000151A 320A0A50                		db	032h,00Ah,00Ah,050h
  2816 0000151E 35000000                		db	035h,000h,000h,000h
  2817 00001522 720A0000                		db	072h,00Ah,000h,000h
  2818 00001526 700AA000                		db	070h,00Ah,0A0h,000h
  2819 0000152A 7300A000                		db	073h,000h,0A0h,000h
  2820 0000152E 70000000                		db	070h,000h,000h,000h
  2821 00001532 72000000                		db	072h,000h,000h,000h
  2822 00001536 7000A000                		db	070h,000h,0A0h,000h
  2823 0000153A 73A0A000                		db	073h,0A0h,0A0h,000h
  2824 0000153E 73A00099                		db	073h,0A0h,000h,099h
  2825 00001542 71A00A00                		db	071h,0A0h,00Ah,000h
  2826 00001546 71000A00                		db	071h,000h,00Ah,000h
  2827 0000154A 71000A00                                db	071h,000h,00Ah,000h
  2828 0000154E 750A0A00                                db	075h,00Ah,00Ah,000h
  2829 00001552 700C0C03                                db	070h,00Ch,00Ch,003h
  2830 00001556 70000C03                                db	070h,000h,00Ch,003h
  2831 0000155A 70000C03                                db	070h,000h,00Ch,003h
  2832 0000155E 72C07C03                                db	072h,0C0h,07Ch,003h
  2833 00001562 72000000                                db	072h,000h,000h,000h
  2834 00001566 71C0C703                                db	071h,0C0h,0C7h,003h
  2835 0000156A 7300C003                                db	073h,000h,0C0h,003h
  2836 0000156E 71700003                                db	071h,070h,000h,003h
  2837 00001572 72000003                                db	072h,000h,000h,003h
  2838 00001576 7100C003                                db	071h,000h,0C0h,003h
  2839 0000157A 730CC003                                db	073h,00Ch,0C0h,003h
  2840 0000157E 71000003                                db	071h,000h,000h,003h
  2841 00001582 310CCCA3                                db	031h,00Ch,0CCh,0A3h
  2842 00001586 FF                                      db	0FFh
  2843 00001587 32000000                                db	032h,000h,000h,000h
  2844 0000158B F000700614                              db	0F0h,000h,070h,006h,014h
  2845 00001590 B000DD4614                              db	0B0h,000h,0DDh,046h,014h
  2846 00001595 3000DD56                                db	030h,000h,0DDh,056h
  2847 00001599 B2000D56C4                              db	0B2h,000h,00Dh,056h,0C4h
  2848 0000159E 32DD0056                                db	032h,0DDh,000h,056h
  2849 000015A2 32DD0056                                db	032h,0DDh,000h,056h
  2850 000015A6 32DD0056                                db	032h,0DDh,000h,056h
  2851 000015AA 7000F056                                db	070h,000h,0F0h,056h
  2852 000015AE 7000BB56                                db	070h,000h,0BBh,056h
  2853 000015B2 32B00B46                                db	032h,0B0h,00Bh,046h
  2854 000015B6 72BB0056                                db	072h,0BBh,000h,056h
  2855 000015BA 71B0B056                                db	071h,0B0h,0B0h,056h
  2856 000015BE 71021156                                db	071h,002h,011h,056h
  2857 000015C2 71221156                                db	071h,022h,011h,056h
  2858 000015C6 31201156                                db	031h,020h,011h,056h
  2859 000015CA 730BB056                                db	073h,00Bh,0B0h,056h
  2860 000015CE 73BB0056                                db	073h,0BBh,000h,056h
  2861 000015D2 300B0B46                                db	030h,00Bh,00Bh,046h
  2862 000015D6 3000BB56                                db	030h,000h,0BBh,056h
  2863 000015DA FF                                      db	0FFh
  2864                                  
  2865                                  ; flying script	126 bytes
  2866                                  script:
  2867                                  ;     7 6 5 4 3 2 1 0
  2868                                  ;	  v v v v v c c c
  2869                                  ;
  2870                                  ;	  v = VALUE
  2871                                  ;	  c = COMMAND
  2872                                  ;
  2873                                  ;	  0 = NOP
  2874                                  ;	  1 = NEG ZSTEP
  2875                                  ;	  2 = INC SPEED
  2876                                  ;	  3 = DEC SPEED
  2877                                  ;	  4 = INC XSTEP
  2878                                  ;	  5 = DEC XSTEP
  2879                                  ;	  6 = INC YSTEP
  2880                                  ;	  7 = INC YSTEP
  2881                                  
  2882 000015DB A1F8F898A1A6                            db      0A1h,0f8h,0f8h,098h,0a1h,0A6h
  2883 000015E1 F0A7B3371036                            db      0F0h,0A7h,0B3h,037h,010h,036h
  2884 000015E7 5084858584F0                            db      050h,084h,085h,085h,084h,0F0h
  2885 000015ED F0B2A7A6A6A7                            db      0F0h,0B2h,0A7h,0A6h,0A6h,0A7h
  2886 000015F3 F32670278044                            db      0f3h,026h,070h,027h,080h,044h
  2887 000015F9 457776A6B061                            db      045h,077h,076h,0a6h,0b0h,061h
  2888 000015FF 6152A7773076                            db      061h,052h,0a7h,077h,030h,076h
  2889 00001605 80A201414101                            db      080h,0a2H,001h,041h,041h,001h
  2890 0000160B F530F4B3A4F8            		db	0f5h,030h,0f4h,0b3h,0a4h,0f8h
  2891 00001611 A5D04746F0A6            		db	0a5h,0D0h,047h,046h,0F0h,0A6h
  2892 00001617 80A770A710A6                            db      080h,0A7h,070h,0A7h,010h,0A6h
  2893 0000161D 8EF0508FB2F8                            db      08eh,0f0h,050h,08fh,0b2h,0f8h
  2894 00001623 A3808EF0508F                            db      0a3h,080h,08eh,0f0h,050h,08fh
  2895 00001629 B710B6F080A6                            db      0b7h,010h,0b6h,0f0h,080h,0a6h
  2896 0000162F A7F087F07086            		db      0a7h,0f0h,087h,0F0h,070h,086h
  2897 00001635 36F0F0903783            		db      036h,0f0h,0f0h,090h,037h,083h
  2898 0000163B 2CF0F0F0302D                            db      02ch,0f0h,0f0h,0f0h,030h,02dh
  2899 00001641 8230B5B4F2A6            		db	082h,030h,0b5h,0b4h,0f2h,0a6h
  2900 00001647 30A78383A6F0            		db	030h,0a7h,083h,083h,0a6h,0f0h
  2901 0000164D 58A77776F0F0            		db	058h,0a7h,077h,076h,0f0h,0f0h
  2902 00001653 F0F0F8F800                              db	0f0h,0f0h,0f8h,0f8h,000h
  2903                                  
  2904 00001658 0100                    zstep:		dw	1			
  2905 0000165A 66EF                    doortimer	dw 	-4250	; 0EF66h
  2906 0000165C 4F4D4E495343454E54      omniscent	db	"OMNISCENT"
  2907                                  omniend:
  2908 00001665 284329204449524B20-     sanction        db      "(C) DIRK KPPERS"
  2908 0000166E 4B9A5050455253     
  2909                                  sancend:
  2910 00001675 0000A5C3                ob:		dd 	-330.0	; vector.x
  2911 00001679 00000000                		dd 	   0.0	; vector.y	
  2912 0000167D 00008042                		dd	  64.0	; vector.z	
  2913                                  owmat:
  2914 00001681 00000000                		dd 	   0.0	; vector.x
  2915 00001685 000080BF                		dd 	  -1.0	; vector.y
  2916 00001689 00000000                		dd	   0.0  ; vector.z
  2917                                  ;owmat+12:
  2918 0000168D 00000000                		dd 	   0.0	; vector.x
  2919 00001691 00000000                		dd 	   0.0	; vector.y
  2920 00001695 000080BF                		dd	  -1.0  ; vector.z
  2921                                  ;owmat+24:
  2922 00001699 0000803F                		dd 	   1.0	; vector.x
  2923 0000169D 00000000                		dd 	   0.0	; vector.y
  2924 000016A1 00000000                		dd	   0.0  ; vector.z
  2925                                  
  2926                                  bss_start:
  2927                                  
  2928                                  ABSOLUTE bss_start
  2929                                  
  2930                                  ;=============================================================================
  2931                                  ;        	null-initialized data
  2932                                  ;=============================================================================
  2933                                  
  2934 000016A5 <res 00000003>          alignb 4 
  2935                                  
  2936                                  nullstart:
  2937 000016A8 <res 00000024>          wmat:           resb	matrix.size
  2938 000016CC <res 00000024>          nwmat:		resb	matrix.size
  2939                                  alignb 4
  2940 000016F0 <res 00000002>          zspeed:		resw	1
  2941 000016F2 <res 00000002>          oxw:		resw	1
  2942 000016F4 <res 00000002>          oyw:		resw	1
  2943 000016F6 <res 00000002>          ozw:		resw	1
  2944 000016F8 <res 00000002>          scriptptr:	resw	1
  2945 000016FA <res 00000002>          scriptanz:	resw	1
  2946 000016FC <res 00000001>          scriptins:	resb	1
  2947 000016FD <res 00000001>          once:		resb	1
  2948 000016FE <res 00000002>          ticker:		resw	1
  2949 00001700 <res 00000002>          tracks:		resw	1
  2950 00001702 <res 00000002>          alignb 4
  2951 00001704 <res 00000300>          palette:        resb 	768
  2952 00001A04 <res 00000060>          channels:       resb	16*6
  2953 00001A64 <res 00001C24>          o:		resb	object.size
  2954                                  nullend:
  2955                                  
  2956                                  ;=============================================================================
  2957                                  ;       	uninitialized data
  2958                                  ;=============================================================================
  2959 00003688 <res 00000004>          oldstack        resd	1
  2960                                  ;Old08IrqPtr:
  2961                                  ;Old08Irqofs:   resw	1
  2962                                  ;Old08Irqseg:   resw	1
  2963                                  ;Old09IrqPtr:
  2964                                  ;Old09Irqofs:   resw	1
  2965                                  ;Old09Irqseg:	resw	1
  2966                                  
  2967                                  alignb 4
  2968                                  
  2969 0000368C <res 00000001>          timer_sig_response:	resb	1 ; signal response byte address (time revent)
  2970                                  
  2971 0000368D <res 00000E15>          songdata:	resb	3605
  2972 000044A2 <res 00000002>          root:   	resw	1
  2973                                  alignb 4
  2974 000044A4 <res 00000040>          circletab:	resw	32
  2975                                  alignb 4
  2976 000044E4 <res 0000005A>          stars:		resb	90
  2977 0000453E <res 00000001>          twice:		resb	1
  2978 0000453F <res 00000001>          alignb 4
  2979 00004540 <res 00000004>          vseg:		resd	1
  2980 00004544 <res 00000004>          bseg:		resd    1
  2981 00004548 <res 00000050>          tseg:   	resd	20
  2982 00004598 <res 00008000>          shadetab:	resb	256*128
  2983                                  alignb 4
  2984 0000C598 <res 00000078>          p:		resw	4*15
  2985 0000C610 <res 000000B4>          pr:		resd	3*15
  2986 0000C6C4 <res 000000B4>          po:		resb	poly.size
  2987 0000C778 <res 000012C0>          rp:		resd	3*MAXPOINTS
  2988 0000DA38 <res 00000640>          facei:		resd    MAXFACES
  2989                                  
  2990                                  alignb 4
  2991                                  
  2992                                  bss_end:
