1 ; **************************************************************************** 2 ; stars32.s (TRDOS 386, TRDOS v2.0 - sample binary file, 'stars32.prg') 3 ; ---------------------------------------------------------------------------- 4 ; STARS32.PRG ! TEST program ! TRDOS 386 VGA Functionality test ! 5 ; 6 ; 02/10/2016 7 ; 8 ; [ Last Modification: 02/10/2016 ] 9 ; 10 ; Derived from source code of 'STARS.EXE' (MSDOS) intro file 11 ; (STARS.ASM, 15/03/1993) 12 ; 13 ; STARS.ASM by DRAEDEN 14 ; NASM version of BOARDZ.ASM: Erdogan Tan, 02/10/2016 (stars32.s) 15 ; 16 ; Assembler: NASM 2.11 17 ; 18 ; (Original -msdos- code has been modifed for TRDOS 386 system calls and 19 ; other protected mode (TRDOS 386) interrupts.) 20 ; **************************************************************************** 21 22 ; 19/05/2016 23 ; 29/04/2016 24 ; TRDOS 386 system calls (temporary list!) 25 _ver equ 0 26 _exit equ 1 27 _fork equ 2 28 _read equ 3 29 _write equ 4 30 _open equ 5 31 _close equ 6 32 _wait equ 7 33 _creat equ 8 34 _link equ 9 35 _unlink equ 10 36 _exec equ 11 37 _chdir equ 12 38 _time equ 13 39 _mkdir equ 14 40 _chmod equ 15 41 _chown equ 16 42 _break equ 17 43 _stat equ 18 44 _seek equ 19 45 _tell equ 20 46 _mount equ 21 47 _umount equ 22 48 _setuid equ 23 49 _getuid equ 24 50 _stime equ 25 51 _quit equ 26 52 _intr equ 27 53 _fstat equ 28 54 _emt equ 29 55 _mdate equ 30 56 _video equ 31 57 _audio equ 32 58 _timer equ 33 59 _sleep equ 34 60 _msg equ 35 61 _geterr equ 36 62 _rsrvd1 equ 37 63 _pri equ 38 64 _rele equ 39 65 66 %macro sys 1-4 67 ; 29/04/2016 - TRDOS 386 (TRDOS v2.0) 68 ; 03/09/2015 69 ; 13/04/2015 70 ; Retro UNIX 386 v1 system call. 71 %if %0 >= 2 72 mov ebx, %2 73 %if %0 >= 3 74 mov ecx, %3 75 %if %0 = 4 76 mov edx, %4 77 %endif 78 %endif 79 %endif 80 mov eax, %1 81 ;int 30h 82 int 40h ; TRDOS 386 (TRDOS v2.0) 83 %endmacro 84 85 ; TRDOS 386 (and Retro UNIX 386 v1) system call format: 86 ; sys systemcall (eax) , , 87 88 ; STARS.S (NASM version of STARS.ASM) 89 ;==============================================================================; 90 ; ; 91 ; TITLE: Star field ; 92 ;WRITTEN BY: DRAEDEN ; 93 ; DATE: 03/15/93 ; 94 ; ; 95 ; NOTES: Need 386 to execute. ; 96 ; ; 97 ;ASSOCIATED FILES: ; 98 ; ; 99 ; STARGEN.BAS => Basic program that generates a set of 'randomized' ; 100 ; numbers. Creates STARRND.DW ; 101 ; ; 102 ; STARS.TXT => The text file that explains starfields... ; 103 ; ; 104 ; STARRND.DW => File that contains a set of shuffled numbers. ; 105 ; Used to create 'random' star field. ; 106 ; ; 107 ;==============================================================================; 108 109 ; NASM version: Erdogan Tan, 02/10/2016 110 111 ;=== CODE 112 113 [Bits 32] ; Protected Mode (TRDOS 386) Program 114 115 [org 0] ; TRDOS 386 PRG File 116 117 START: 118 ; DIRECT VGA MEMORY ACCESS 119 ;xor ebx, ebx 120 00000000 B705 mov bh, 5 ; Direct access/map to VGA memory (0A0000h) 121 ;mov eax, _video ; 1Fh 122 00000002 B01F mov al, 1Fh ; sys _video ; TRDOS 386 Video functions 123 00000004 CD40 int 40h ; TRDOS 386 system call 124 125 ; eax = 0A0000h 126 00000006 21C0 and eax, eax 127 00000008 0F848A000000 jz terminate ; error (eax = 0) 128 129 0000000E 66B81300 mov ax,0013h ;set vid mode 320x200x256 graph 130 ;int 10h 131 00000012 CD31 int 31h ; TRDOS 386 - Video interrupt 132 133 00000014 BA[51050000] mov edx,Palette 134 00000019 66B81210 mov ax,1012h ; WRITE palette 135 0000001D 66BB0000 mov bx,0 136 00000021 66B90001 mov cx,256 ;write entire palette 137 ;int 10h ;doesn't matter if we didnt define it all 138 00000025 CD31 int 31h ; TRDOS 386 - Video interrupt 139 140 StarLoop: 141 00000027 E875000000 call MakeStar ;make stars 2x as thick 142 0000002C E870000000 call MakeStar 143 144 00000031 66BADA03 mov dx,3dah 145 00000035 B400 mov ah, 0 ; in (byte) 146 Vrt: 147 ;in al,dx 148 00000037 CD34 int 34h ; TRDOS 386 - IOCTL interrupt 149 00000039 A808 test al, 8 150 0000003B 75FA jnz short Vrt ; Wait until Verticle Retrace starts 151 NoVrt: 152 ;in al,dx 153 0000003D CD34 int 34h ; TRDOS 386 - IOCTL interrupt 154 0000003F A808 test al, 8 155 00000041 74FA jz short NoVrt ; Wait until Verticle Retrace ends 156 157 00000043 E842010000 call DisplayStars 158 159 00000048 B401 mov ah,1 ;check to see if a char is ready 160 ;int 16h 161 0000004A CD32 int 32h ; TRDOS 386 Keyboard interrupt 162 0000004C 74D9 jz short StarLoop ;nope, continue 163 164 0000004E B400 mov ah,0 165 ;int 16h ;get the character & put in AX 166 00000050 CD32 int 32h ; TRDOS 386 Keyboard interrupt 167 168 00000052 3C2B cmp al,"+" ;compare ASCII part (al) to see what was pressed 169 00000054 751C jne short NotPlus 170 171 00000056 66FF05[41050000] inc word [WarpSpeed] 172 0000005D 66833D[41050000]5A cmp word [WarpSpeed],MaxWarp 173 00000065 76C0 jbe short StarLoop 174 175 00000067 66C705[41050000]5A- mov word [WarpSpeed],MaxWarp 176 0000006F 00 177 00000070 EBB5 jmp short StarLoop 178 179 NotPlus: 180 00000072 3C2D cmp al,"-" 181 00000074 751C jne short NotMinus 182 183 00000076 66FF0D[41050000] dec word [WarpSpeed] 184 0000007D 66833D[41050000]00 cmp word [WarpSpeed],0 185 00000085 7DA0 jge short StarLoop 186 187 00000087 66C705[41050000]00- mov word [WarpSpeed],0 188 0000008F 00 189 00000090 EB95 jmp short StarLoop 190 191 NotMinus: 192 00000092 66B80300 mov ax,0003h ; Set 80x25x16 char mode 193 ;int 10h 194 00000096 CD31 int 31h ; TRDOS 386 - Video interrupt 195 196 terminate: 197 sys _exit ; INT 40h 198 <1> 199 <1> 200 <1> 201 <1> 202 <1> %if %0 >= 2 203 <1> mov ebx, %2 204 <1> %if %0 >= 3 205 <1> mov ecx, %3 206 <1> %if %0 = 4 207 <1> mov edx, %4 208 <1> %endif 209 <1> %endif 210 <1> %endif 211 00000098 B801000000 <1> mov eax, %1 212 <1> 213 0000009D CD40 <1> int 40h 214 here: 215 0000009F EBFE jmp short here 216 217 ;=== Code Includes 218 ;=== SUBROUTINES 219 220 ;finds 1st available slot for a star and puts it there 221 MakeStar: 222 000000A1 60 pusha 223 224 ; es = ds = cs 225 226 000000A2 66813D[4F050000]BE- cmp word [NumActive],MaxStars ;is there room for another star? 227 000000AA 00 228 000000AB 0F83D7000000 jae NoEmptySpace 229 230 ;search for 1st available slot 231 232 000000B1 BE[74060000] mov esi, Stars 233 TryAgain: 234 000000B6 66837E0400 cmp word [Stars.Z+esi],0 ;is this slot empty? 235 000000BB 7410 je short GotOne ;yes, go fill it 236 237 000000BD 83C609 add esi,StarStrucSize 238 000000C0 81FE[220D0000] cmp esi,Stars+(MaxStars*StarStrucSize) 239 000000C6 72EE jb short TryAgain 240 000000C8 E9BB000000 jmp NoEmptySpace 241 242 GotOne: ;si points to the record for the star to fill 243 000000CD 668B1D[45050000] mov bx,[Yindex] ;grab index for Ypos 244 000000D4 6601DB add bx,bx ;multiply by 2 to make it a WORD index 245 000000D7 668B83[1F020000] mov ax,[StarRnd+ebx] ;get the number 246 000000DE 66C1E003 shl ax,3 ;multiply by 8- could been done in BAS file 247 000000E2 66894602 mov [Stars.Y+esi],ax ;and save off the number 248 249 000000E6 668B1D[43050000] mov bx,[Xindex] ;grab index for Xpos 250 000000ED 6601DB add bx,bx ;... same as above, but for Xpos 251 000000F0 668B83[1F020000] mov ax,[StarRnd+ebx] 252 000000F7 66C1E003 shl ax,3 253 000000FB 668906 mov [Stars.X+esi],ax 254 255 000000FE 66C746040010 mov word [Stars.Z+esi],MaxZpos ;reset Zpos to the max 256 00000104 66FF05[4F050000] inc word [NumActive] ;we added a star so increase the counter 257 258 0000010B 668B1D[47050000] mov bx,[Cindex] ;grab the color index 259 00000112 8A83[49050000] mov al,[ColorChart+ebx] ;grab the BaseColor for the star 260 00000118 884608 mov [Stars.Color+esi],al ;save it in the record 261 262 ;increase all the index pointers 263 264 0000011B 66FF05[47050000] inc word [Cindex] ;increases the color counter 265 00000122 66833D[47050000]05 cmp word [Cindex],NumColors 266 0000012A 7209 jb short OkColor 267 0000012C 66C705[47050000]00- mov word [Cindex],0 268 00000134 00 269 OkColor: 270 00000135 66FF05[45050000] inc word [Yindex] ;increases Yindex 271 0000013C 66813D[45050000]90- cmp word [Yindex],NumRnds ;note that for this one we 272 00000144 01 273 00000145 7209 jb short YindNotZero ; subtract NumRnds from Yindex if we 274 00000147 66812D[45050000]90- sub word [Yindex],NumRnds ; go off the end of the chart 275 0000014F 01 276 YindNotZero: 277 00000150 66FF05[43050000] inc word [Xindex] ;increase Xindex 278 00000157 66813D[43050000]90- cmp word [Xindex],NumRnds ;have we gone through the entire chart? 279 0000015F 01 280 00000160 7226 jb short XindNotZero ;nope... 281 282 ;This clever bit of code makes more use out of the chart by increasing Yindex 283 ; one additional unit each time Xindex goes through the entire chart... the 284 ; result is nearly NumRND^2 random non-repeating points 285 286 00000162 66FF05[45050000] inc word [Yindex] ;yes, so change Yindex so that we get a 287 00000169 66A1[45050000] mov ax,[Yindex] ;new set of random (x,y) 288 0000016F 663B05[43050000] cmp ax,[Xindex] ;does Xindex = Yindex? 289 00000176 7507 jne short NotTheSame ;if the index were the same, you'd see 290 ;a graph of the line Y = X, not good... 291 00000178 66FF05[45050000] inc word [Yindex] ;if they are the same, inc Yindex again 292 NotTheSame: 293 0000017F 66C705[43050000]00- mov word [Xindex],0 ;reset Xindex to 0 294 00000187 00 295 XindNotZero: ;all done making the star... 296 297 NoEmptySpace: 298 00000188 61 popa 299 00000189 C3 retn 300 301 DisplayStars: 302 0000018A 60 pusha 303 304 0000018B BF00000A00 mov edi, 0A0000h ; es = 0A000h, ds = cs 305 306 00000190 BE[74060000] mov esi, Stars ; si points to first record 307 DispLoop: 308 00000195 668B4E04 mov cx,[Stars.Z+esi] 309 00000199 6609C9 or cx,cx ;if Zpos = 0 then this star is dead... 310 0000019C 745D jz short Cont ;continue to the next one- skip this one 311 312 0000019E 668B7E06 mov di,[Stars.OldDi+esi] ;grab old Di 313 000001A2 C60700 mov byte [edi],0 ;erase the star 314 315 000001A5 6683F902 cmp cx,MinZpos 316 000001A9 7C65 jl short TermStar ;if Zpos < MinZpos then kill the star 317 318 000001AB 668B4602 mov ax,[Stars.Y+esi] 319 000001AF 660FBED4 movsx dx,ah ;'multiply' Ypos by 256 320 000001B3 66C1E008 shl ax,8 321 322 000001B7 66F7F9 idiv cx ;and divide by Zpos 323 000001BA 6683C064 add ax,ScreenHeight/2 ;center it on the screen 324 000001BE 6689C7 mov di,ax 325 000001C1 6681FFC800 cmp di,ScreenHeight ;see if the star is in range. 326 000001C6 7340 jae PreTermStar ; If not, kill it 327 000001C8 6669FF4001 imul di,ScreenWidth ; DI = Y*ScreenWidth 328 329 000001CD 668B06 mov ax,[Stars.X+esi] 330 000001D0 660FBED4 movsx dx,ah ;multiply Xpos by 256 331 000001D4 66C1E008 shl ax,8 332 333 000001D8 66F7F9 idiv cx ;and divide by Zpos 334 000001DB 6605A000 add ax,ScreenWidth/2 ;center it on the screen 335 000001DF 663D4001 cmp ax,ScreenWidth ;are we inside the screen boundries? 336 000001E3 7323 jae short PreTermStar 337 000001E5 6601C7 add di,ax ; DI = Y * ScreenWidth + X 338 339 000001E8 66897E06 mov [Stars.OldDi+esi],di ;save old di 340 341 ;calculate the color below 342 343 000001EC 026E08 add ch,[Stars.Color+esi] ;i'm dividing cx (the zpos) by 256 and 344 ; putting the result in ch and adding 345 ; the base color to it in one instruction 346 000001EF 882F mov [edi],ch ;put the dot on the screen 347 348 000001F1 66A1[41050000] mov ax,[WarpSpeed] 349 000001F7 66294604 sub [Stars.Z+esi],ax ;move the stars inward at WarpSpeed 350 351 Cont: 352 000001FB 83C609 add esi,StarStrucSize ;point to next record 353 000001FE 81FE[220D0000] cmp esi,Stars+(MaxStars*StarStrucSize) ;are we done yet? 354 00000204 728F jb short DispLoop 355 00000206 61 popa 356 00000207 C3 retn 357 358 PreTermStar: 359 00000208 66C746040100 mov word [Stars.Z+esi],1 ;this is here so that the star will get erased 360 0000020E EBEB jmp short Cont ;next time through if I just went off and killed 361 ;the star, it would leave a dot on the screen 362 TermStar: 363 00000210 66C746040000 mov word [Stars.Z+esi],0 ;this actually kills the star, after it has 364 00000216 66FF0D[4F050000] dec word [NumActive] ;been erased 365 0000021D EBDC jmp short Cont 366 367 ;=== GLOBALS 368 ;=== Data Includes 369 370 ;%include starrnd.dw ;file that has label StarRnd numbers 371 372 0000021F A600 StarRnd: dw 166 373 00000221 430066002E0053FF66- dw 67, 102, 46,-173,-154,-210,-192, 173,-196, -81 374 0000022A FF2EFF40FFAD003CFF- 375 00000233 AFFF 376 00000235 CEFF2400320038FFA1- dw -50, 36, 50,-200, -95, 209, -16,-179, -30, 18 377 0000023E FFD100F0FF4DFFE2FF- 378 00000247 1200 379 00000249 AE00C5007F0047001D- dw 174, 197, 127, 71, 29,-121,-160,-176, 19, -52 380 00000252 0087FF60FF50FF1300- 381 0000025B CCFF 382 0000025D 47FF5900AC004A0064- dw -185, 89, 172, 74,-156, 157,-125, 144, -34, 69 383 00000266 FF9D0083FF9000DEFF- 384 0000026F 4500 385 00000271 1100D8FF40009EFF67- dw 17, -40, 64, -98,-153, 125, 160, 140,-204, 141 386 0000027A FF7D00A0008C0034FF- 387 00000283 8D00 388 00000285 89005BFFF2FF9A006E- dw 137,-165, -14, 154,-146, 119, 123, 165,-130, 168 389 0000028E FF77007B00A5007EFF- 390 00000297 A800 391 00000299 4CFF8F0034006B0095- dw -180, 143, 52, 107,-107,-102, 57, 27, 117, 37 392 000002A2 FF9AFF39001B007500- 393 000002AB 2500 394 000002AD 7E000F00A7FFB80074- dw 126, 15, -89, 184, 116, 183, -99,-139, 150, 188 395 000002B6 00B7009DFF75FF9600- 396 000002BF BC00 397 000002C1 26005A005D003EFFCF- dw 38, 90, 93,-194, 207,-187, 62, 59, 196, 12 398 000002CA 0045FF3E003B00C400- 399 000002D3 0C00 400 000002D5 52FF3600920077FFC6- dw -174, 54, 146,-137, 198, 162, 155,-163, -77,-144 401 000002DE 00A2009B005DFFB3FF- 402 000002E7 70FF 403 000002E9 BF007CFFD5FF970099- dw 191,-132, -43, 151,-103, 20, -46, 13,-140, 31 404 000002F2 FF1400D2FF0D0074FF- 405 000002FB 1F00 406 000002FD 820057FF44FF6D00DF- dw 130,-169,-188, 109, -33,-150,-170, 68, -75,-201 407 00000306 FF6AFF56FF4400B5FF- 408 0000030F 37FF 409 00000311 9CFF55FFEDFFC3FF32- dw -100,-171, -19, -61,-206, 149, 99, -76,-186, -44 410 0000031A FF95006300B4FF46FF- 411 00000323 D4FF 412 00000325 4EFF22003D001C0072- dw -178, 34, 61, 28, 114, 199, 201, -83, -27, 63 413 0000032E 00C700C900ADFFE5FF- 414 00000337 3F00 415 00000339 DAFFCC00D00090FF30- dw -38, 204, 208,-112,-208, 122, -90, 23,-122, 161 416 00000342 FF7A00A6FF170086FF- 417 0000034B A100 418 0000034D 230058FFAA005CFF69- dw 35,-168, 170,-164,-151, 75, -60,-109, 85, 193 419 00000356 FF4B00C4FF93FF5500- 420 0000035F C100 421 00000361 2D0051FF7AFFCD00EB- dw 45,-175,-134, 205, -21, 49, 133, -85, -47, -37 422 0000036A FF31008500ABFFD1FF- 423 00000373 DBFF 424 00000375 E3FFA0FFBEFF49008A- dw -29, -96, -66, 73,-118, 147, -53, 120, 153,-155 425 0000037E FF9300CBFF78009900- 426 00000387 65FF 427 00000389 F5FF0B005F00E6FF86- dw -11, 11, 95, -26, 134,-145, -49, -74, 42,-124 428 00000392 006FFFCFFFB6FF2A00- 429 0000039B 84FF 430 0000039D BD00D6FF5C0059FF58- dw 189, -42, 92,-167, 88,-126,-129,-108,-193, 195 431 000003A6 0082FF7FFF94FF3FFF- 432 000003AF C300 433 000003B1 BE0096FF8BFFCB0054- dw 190,-106,-117, 203, 84, 139,-123, -94, -88,-158 434 000003BA 008B0085FFA2FFA8FF- 435 000003C3 62FF 436 000003C5 B5009FFFECFF5200C7- dw 181, -97, -20, 82, -57, 112, -35, 14, -56, -58 437 000003CE FF7000DDFF0E00C8FF- 438 000003D7 C6FF 439 000003D9 C800500049FF6A0057- dw 200, 80,-183, 106, 87, 30, 51, -28, 98, -12 440 000003E2 001E003300E4FF6200- 441 000003EB F4FF 442 000003ED 41FF80FFF3FF48FF88- dw -191,-128, -13,-184, 136, 43,-166, -62, -73,-116 443 000003F6 002B005AFFC2FFB7FF- 444 000003FF 8CFF 445 00000401 E1FF79FF9BFF190029- dw -31,-135,-101, 25, 41, -82, 110, 10, -45, -41 446 0000040A 00AEFF6E000A00D3FF- 447 00000413 D7FF 448 00000415 6100AF008A00AB0048- dw 97, 175, 138, 171, 72,-133,-157, 58,-104, 187 449 0000041E 007BFF63FF3A0098FF- 450 00000427 BB00 451 00000429 C000BCFFA9FFA90092- dw 192, -68, -87, 169,-110, 91, 129, 104, -70,-114 452 00000432 FF5B0081006800BAFF- 453 0000043B 8EFF 454 0000043D 76FF8DFF73FFBDFF3D- dw -138,-115,-141, -67,-195, -79, -69, 40,-147, -80 455 00000446 FFB1FFBBFF28006DFF- 456 0000044F B0FF 457 00000451 89FF800098002FFF53- dw -119, 128, 152,-209, 83, 53, 159, 66,-190, 81 458 0000045A 0035009F00420042FF- 459 00000463 5100 460 00000465 A4FFF6FF4BFF87003C- dw -92, -10,-181, 135, 60, 33, -25, 70, 22, -72 461 0000046E 002100E7FF46001600- 462 00000477 B8FF 463 00000479 6700E9FF83004F00C0- dw 103, -23, 131, 79, -64, 55, -86, -32,-182,-136 464 00000482 FF3700AAFFE0FF4AFF- 465 0000048B 78FF 466 0000048D 1A00CAFF54FF6CFF94- dw 26, -54,-172,-148, 148, -65,-152,-207, -39, -71 467 00000496 00BFFF68FF31FFD9FF- 468 0000049F B9FF 469 000004A1 4100B3004FFF180076- dw 65, 179,-177, 24, 118, -59, -63, 44, 105, 206 470 000004AA 00C5FFC1FF2C006900- 471 000004B3 CE00 472 000004B5 B200ACFF36FF8400BA- dw 178, -84,-202, 132, 186, -17, 76, 176, -22, 177 473 000004BE 00EFFF4C00B000EAFF- 474 000004C7 B100 475 000004C9 3AFF61FF5EFF4E004D- dw -198,-159,-162, 78, 77, -55,-120,-203,-113, 156 476 000004D2 00C9FF88FF35FF8FFF- 477 000004DB 9C00 478 000004DD 43FF3BFF7C00790072- dw -189,-197, 124, 121,-142, -15,-205, 56, 158, -18 479 000004E6 FFF1FF33FF38009E00- 480 000004EF EEFF 481 000004F1 A3FF5FFF2700300065- dw -93,-161, 39, 48, 101, -91, 182,-127, 108, 111 482 000004FA 00A5FFB60081FF6C00- 483 00000503 6F00 484 00000505 DCFF71FF15006BFFB2- dw -36,-143, 21,-149, -78, -48, 164, 202, 185, 180 485 0000050E FFD0FFA400CA00B900- 486 00000517 B400 487 00000519 CDFF39FF6400C20020- dw -51,-199, 100, 194, 32, -24, 142, 86,-111, 47 488 00000522 00E8FF8E00560091FF- 489 0000052B 2F00 490 0000052D 730097FF1000A7005E- dw 115,-105, 16, 167, 94, 163, 96, 113,-131, 145 491 00000536 00A300600071007DFF- 492 0000053F 9100 493 494 ;=== DATA Structures 495 496 ;Star_Struc STRUC 497 ; X dw 0 498 ; Y dw 0 499 ; Z dw 0 500 ; OldDi dw 0 ;where to erase last dot 501 ; Color db 0 ;BASE color. a number 0-16 is added to it 502 ;Star_Struc ENDS 503 504 ;StarStrucSize = 9 ;number of bytes per entry 505 506 ;=== DATA 507 508 ScreenWidth EQU 320 509 ScreenHeight EQU 200 510 511 NumRnds EQU 400 ;number of random numbers defined 512 513 MaxZpos EQU 4096 514 MinZpos EQU 2 515 MaxStars EQU 190 516 NumColors EQU 5 ;number of Base colors in the Color Chart 517 518 00000541 0F00 WarpSpeed: dw 15 ;how quickly the stars move toward ya 519 MaxWarp EQU 90 520 521 00000543 1E00 Xindex: dw 30 ;index into the StarRnd chart for X & Y 522 00000545 E600 Yindex: dw 230 ; -note they must be different; set em the same to 523 ;see why 524 00000547 0000 Cindex: dw 0 ;index into ColorChart 525 526 00000549 001020304050 ColorChart: db 0,16,32,48,64,80 ;a list of base colors (-1) 527 528 ;Stars Star_Struc MaxStars DUP (<>) ;where all the data is held 529 0000054F 0000 NumActive: dw 0 ;number of stars active 530 531 Palette: ;the palette.. first entrie is BG color (black) 532 00000551 000000 db 0,0,0 533 00000554 1E2D3C db 2*15,3*15,4*15 534 00000557 1C2A38 db 2*14,3*14,4*14 535 0000055A 1A2734 db 2*13,3*13,4*13 536 0000055D 182430 db 2*12,3*12,4*12 537 00000560 16212C db 2*11,3*11,4*11 538 00000563 141E28 db 2*10,3*10,4*10 539 00000566 121B24 db 2*9,3*9,4*9 540 00000569 101820 db 2*8,3*8,4*8 541 0000056C 0E151C db 2*7,3*7,4*7 542 0000056F 0C1218 db 2*6,3*6,4*6 543 00000572 0A0F14 db 2*5,3*5,4*5 544 00000575 080C10 db 2*4,3*4,4*4 545 00000578 06090C db 2*3,3*3,4*3 546 0000057B 040608 db 2*2,3*2,4*2 547 0000057E 020304 db 2*1,3*1,4*1 548 00000581 000000 db 2*0,3*0,4*0 549 00000584 1E1E3C db 2*15,2*15,4*15 550 00000587 1C1C38 db 2*14,2*14,4*14 551 0000058A 1A1A34 db 2*13,2*13,4*13 552 0000058D 181830 db 2*12,2*12,4*12 553 00000590 16162C db 2*11,2*11,4*11 554 00000593 141428 db 2*10,2*10,4*10 555 00000596 121224 db 2*9,2*9,4*9 556 00000599 101020 db 2*8,2*8,4*8 557 0000059C 0E0E1C db 2*7,2*7,4*7 558 0000059F 0C0C18 db 2*6,2*6,4*6 559 000005A2 0A0A14 db 2*5,2*5,4*5 560 000005A5 080810 db 2*4,2*4,4*4 561 000005A8 06060C db 2*3,2*3,4*3 562 000005AB 040408 db 2*2,2*2,4*2 563 000005AE 020204 db 2*1,2*1,4*1 564 000005B1 000000 db 2*0,2*0,4*0 565 000005B4 2D2D3C db 3*15,3*15,4*15 566 000005B7 2A2A38 db 3*14,3*14,4*14 567 000005BA 272734 db 3*13,3*13,4*13 568 000005BD 242430 db 3*12,3*12,4*12 569 000005C0 21212C db 3*11,3*11,4*11 570 000005C3 1E1E28 db 3*10,3*10,4*10 571 000005C6 1B1B24 db 3*9,3*9,4*9 572 000005C9 181820 db 3*8,3*8,4*8 573 000005CC 15151C db 3*7,3*7,4*7 574 000005CF 121218 db 3*6,3*6,4*6 575 000005D2 0F0F14 db 3*5,3*5,4*5 576 000005D5 0C0C10 db 3*4,3*4,4*4 577 000005D8 09090C db 3*3,3*3,4*3 578 000005DB 060608 db 3*2,3*2,4*2 579 000005DE 030304 db 3*1,3*1,4*1 580 000005E1 000000 db 3*0,3*0,4*0 581 000005E4 2D1E3C db 3*15,2*15,4*15 582 000005E7 2A1C38 db 3*14,2*14,4*14 583 000005EA 271A34 db 3*13,2*13,4*13 584 000005ED 241830 db 3*12,2*12,4*12 585 000005F0 21162C db 3*11,2*11,4*11 586 000005F3 1E1428 db 3*10,2*10,4*10 587 000005F6 1B1224 db 3*9,2*9,4*9 588 000005F9 181020 db 3*8,2*8,4*8 589 000005FC 150E1C db 3*7,2*7,4*7 590 000005FF 120C18 db 3*6,2*6,4*6 591 00000602 0F0A14 db 3*5,2*5,4*5 592 00000605 0C0810 db 3*4,2*4,4*4 593 00000608 09060C db 3*3,2*3,4*3 594 0000060B 060408 db 3*2,2*2,4*2 595 0000060E 030204 db 3*1,2*1,4*1 596 00000611 000000 db 3*0,2*0,4*0 597 00000614 2D2D2D db 3*15,3*15,3*15 598 00000617 2A2A2A db 3*14,3*14,3*14 599 0000061A 272727 db 3*13,3*13,3*13 600 0000061D 242424 db 3*12,3*12,3*12 601 00000620 212121 db 3*11,3*11,3*11 602 00000623 1E1E1E db 3*10,3*10,3*10 603 00000626 1B1B1B db 3*9,3*9,3*9 604 00000629 181818 db 3*8,3*8,3*8 605 0000062C 151515 db 3*7,3*7,3*7 606 0000062F 121212 db 3*6,3*6,3*6 607 00000632 0F0F0F db 3*5,3*5,3*5 608 00000635 0C0C0C db 3*4,3*4,3*4 609 00000638 090909 db 3*3,3*3,3*3 610 0000063B 060606 db 3*2,3*2,3*2 611 0000063E 030303 db 3*1,3*1,3*1 612 00000641 000000 db 3*0,3*0,3*0 613 00000644 1E3C2D db 2*15,4*15,3*15 614 00000647 1C382A db 2*14,4*14,3*14 615 0000064A 1A3427 db 2*13,4*13,3*13 616 0000064D 183024 db 2*12,4*12,3*12 617 00000650 162C21 db 2*11,4*11,3*11 618 00000653 14281E db 2*10,4*10,3*10 619 00000656 12241B db 2*9,4*9,3*9 620 00000659 102018 db 2*8,4*8,3*8 621 0000065C 0E1C15 db 2*7,4*7,3*7 622 0000065F 0C1812 db 2*6,4*6,3*6 623 00000662 0A140F db 2*5,4*5,3*5 624 00000665 08100C db 2*4,4*4,3*4 625 00000668 060C09 db 2*3,4*3,3*3 626 0000066B 040806 db 2*2,4*2,3*2 627 0000066E 020403 db 2*1,4*1,3*1 628 00000671 000000 db 2*0,4*0,3*0 629 630 bss_start: 631 632 ABSOLUTE bss_start 633 634 alignb 2 635 636 Star_Struct: 637 Stars.X equ 0 ; X-position of star 638 Stars.Y equ 2 ; Y-position of star 639 Stars.Z equ 4 ; Z-position of star 640 Stars.OldDi equ 6 ; Where to erase old star 641 Stars.Color equ 8 ; Color of star 642 643 StarStrucSize equ 9 ; Number of bytes per entry ( 4 wordz and a byte ) 644 645 Stars: 646 00000674 resb StarStrucSize * MaxStars ; Array of star-records 647 648 bss_end: