A script to generate initial star coordinates.

Also a Makefile
This commit is contained in:
Pedro de Oliveira 2014-08-17 08:40:33 +01:00
parent 14eb356acf
commit fe9a4892e5
4 changed files with 44 additions and 0 deletions

10
starfield/Makefile Normal file
View File

@ -0,0 +1,10 @@
all: starfield
starfield: starrnd.asm
pasmo.exe -v --tap --err main.asm main.tap
starrnd.asm:
python stargen.py
clean:
rm -rf *.tap starrnd.asm

View File

@ -21,6 +21,8 @@ STAR_SIZE EQU $4
MAX_STARS EQU 10
STARS DS STAR_SIZE * MAX_STARS, 0
INCLUDE "starrnd.asm"
start
xor a
ld (tv_flag), a

21
starfield/stargen.py Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
random.seed()
NumStars = 10
f = open('starrnd.asm', 'w')
f.write("StarRnd db %i\n" % (3 * NumStars))
for x in range(NumStars):
x = random.randint(0,256)
y = random.randint(0,192)
z = random.randint(0,10)
f.write("db %i, %i, %i\n" % (x ,y ,z))
f.close()

11
starfield/starrnd.asm Normal file
View File

@ -0,0 +1,11 @@
StarRnd db 30
db 214, 156, 0
db 85, 103, 3
db 79, 28, 5
db 176, 161, 9
db 13, 143, 9
db 218, 63, 4
db 55, 13, 7
db 213, 60, 3
db 75, 192, 2
db 163, 167, 10