o add another snes demo

This commit is contained in:
optixx 2009-04-05 18:47:38 +02:00
parent 0354b82c8e
commit c9a23df103
25 changed files with 2798 additions and 0 deletions

44
snes/ascii/Makefile Normal file
View File

@ -0,0 +1,44 @@
CC = wla-65816
CFLAGS = -o
LD = wlalink
LDFLAGS = -v
SFILES = main.asm
IFILES =
OFILES = main.o
GFXDATA = optixx_logo.bmp
all: $(OFILES) Makefile
$(LD) $(LDFLAGS) linkfile ascii.rom
ucon64 -chk -swc ascii.rom
run:
/Applications/ZSNES.app/Contents/MacOS/ZSNES ascii.rom
main.o: colorlist sine gfx main.asm
$(CC) $(CFLAGS) main.asm main.o
gfx: bmp2bitplane.py optixx_logo.bmp
python bmp2bitplane.py optixx_logo.bmp
sine: sinegen.py
python sinegen.py vsine_1.s 256 96 1
python sinegen.py vsine_2.s 256 96 1 flip
python sinegen.py colbarsine_1.s 256 64 3
colorlist: bmp2col.py
python bmp2col.py backcolors.bmp list
python bmp2col.py colbar_1.bmp
python bmp2col.py colbar_2.bmp
python bmp2col.py colbar_3.bmp
$(OFILES): $(HFILES)
clean:
rm -f $(OFILES) core *~ result.rom optixx_logo.s

BIN
snes/ascii/backcolors.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

472
snes/ascii/backcolors.s Normal file
View File

@ -0,0 +1,472 @@
backcolors_color_list:
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db $01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00,$01,$00
.db 0
backcolors_color_values:
.db $01
.dw $1400 ;line=0x01
.db $01
.dw $1400 ;line=0x02
.db $01
.dw $1400 ;line=0x03
.db $01
.dw $1400 ;line=0x04
.db $01
.dw $1400 ;line=0x05
.db $01
.dw $1400 ;line=0x06
.db $01
.dw $1400 ;line=0x07
.db $01
.dw $1400 ;line=0x08
.db $01
.dw $1400 ;line=0x09
.db $01
.dw $1400 ;line=0x0a
.db $01
.dw $1400 ;line=0x0b
.db $01
.dw $1400 ;line=0x0c
.db $01
.dw $1400 ;line=0x0d
.db $01
.dw $1400 ;line=0x0e
.db $01
.dw $1400 ;line=0x0f
.db $01
.dw $1400 ;line=0x10
.db $01
.dw $1400 ;line=0x11
.db $01
.dw $1400 ;line=0x12
.db $01
.dw $1400 ;line=0x13
.db $01
.dw $1400 ;line=0x14
.db $01
.dw $1400 ;line=0x15
.db $01
.dw $1400 ;line=0x16
.db $01
.dw $1400 ;line=0x17
.db $01
.dw $1400 ;line=0x18
.db $01
.dw $1400 ;line=0x19
.db $01
.dw $1400 ;line=0x1a
.db $01
.dw $1400 ;line=0x1b
.db $01
.dw $1400 ;line=0x1c
.db $01
.dw $1400 ;line=0x1d
.db $01
.dw $1400 ;line=0x1e
.db $01
.dw $1400 ;line=0x1f
.db $01
.dw $1400 ;line=0x20
.db $01
.dw $1400 ;line=0x21
.db $01
.dw $1400 ;line=0x22
.db $01
.dw $1400 ;line=0x23
.db $01
.dw $1400 ;line=0x24
.db $01
.dw $1400 ;line=0x25
.db $01
.dw $1400 ;line=0x26
.db $01
.dw $1400 ;line=0x27
.db $01
.dw $1400 ;line=0x28
.db $01
.dw $1400 ;line=0x29
.db $01
.dw $1400 ;line=0x2a
.db $01
.dw $1400 ;line=0x2b
.db $01
.dw $1400 ;line=0x2c
.db $01
.dw $1400 ;line=0x2d
.db $01
.dw $1400 ;line=0x2e
.db $01
.dw $1400 ;line=0x2f
.db $01
.dw $1400 ;line=0x30
.db $01
.dw $1400 ;line=0x31
.db $01
.dw $1400 ;line=0x32
.db $01
.dw $1400 ;line=0x33
.db $01
.dw $1400 ;line=0x34
.db $01
.dw $1400 ;line=0x35
.db $01
.dw $1400 ;line=0x36
.db $01
.dw $1400 ;line=0x37
.db $01
.dw $1400 ;line=0x38
.db $01
.dw $1400 ;line=0x39
.db $01
.dw $1400 ;line=0x3a
.db $01
.dw $1400 ;line=0x3b
.db $01
.dw $1400 ;line=0x3c
.db $01
.dw $1400 ;line=0x3d
.db $01
.dw $1400 ;line=0x3e
.db $01
.dw $1400 ;line=0x3f
.db $01
.dw $1400 ;line=0x40
.db $01
.dw $1400 ;line=0x41
.db $01
.dw $1400 ;line=0x42
.db $01
.dw $1400 ;line=0x43
.db $01
.dw $1400 ;line=0x44
.db $01
.dw $1400 ;line=0x45
.db $01
.dw $1400 ;line=0x46
.db $01
.dw $1400 ;line=0x47
.db $01
.dw $1400 ;line=0x48
.db $01
.dw $1400 ;line=0x49
.db $01
.dw $1400 ;line=0x4a
.db $01
.dw $1400 ;line=0x4b
.db $01
.dw $1400 ;line=0x4c
.db $01
.dw $1400 ;line=0x4d
.db $01
.dw $1400 ;line=0x4e
.db $01
.dw $1400 ;line=0x4f
.db $01
.dw $1400 ;line=0x50
.db $01
.dw $1400 ;line=0x51
.db $01
.dw $1400 ;line=0x52
.db $01
.dw $1400 ;line=0x53
.db $01
.dw $1400 ;line=0x54
.db $01
.dw $1400 ;line=0x55
.db $01
.dw $1400 ;line=0x56
.db $01
.dw $1400 ;line=0x57
.db $01
.dw $1400 ;line=0x58
.db $01
.dw $1400 ;line=0x59
.db $01
.dw $1400 ;line=0x5a
.db $01
.dw $1400 ;line=0x5b
.db $01
.dw $1800 ;line=0x5c
.db $01
.dw $1800 ;line=0x5d
.db $01
.dw $1820 ;line=0x5e
.db $01
.dw $1820 ;line=0x5f
.db $01
.dw $1820 ;line=0x60
.db $01
.dw $1820 ;line=0x61
.db $01
.dw $1820 ;line=0x62
.db $01
.dw $1820 ;line=0x63
.db $01
.dw $1820 ;line=0x64
.db $01
.dw $1820 ;line=0x65
.db $01
.dw $1820 ;line=0x66
.db $01
.dw $1c20 ;line=0x67
.db $01
.dw $1c20 ;line=0x68
.db $01
.dw $1c20 ;line=0x69
.db $01
.dw $1c20 ;line=0x6a
.db $01
.dw $1c40 ;line=0x6b
.db $01
.dw $1c40 ;line=0x6c
.db $01
.dw $1c40 ;line=0x6d
.db $01
.dw $1c40 ;line=0x6e
.db $01
.dw $1c40 ;line=0x6f
.db $01
.dw $1c41 ;line=0x70
.db $01
.dw $1c41 ;line=0x71
.db $01
.dw $2041 ;line=0x72
.db $01
.dw $2041 ;line=0x73
.db $01
.dw $2041 ;line=0x74
.db $01
.dw $2041 ;line=0x75
.db $01
.dw $2041 ;line=0x76
.db $01
.dw $2041 ;line=0x77
.db $01
.dw $2061 ;line=0x78
.db $01
.dw $2061 ;line=0x79
.db $01
.dw $2061 ;line=0x7a
.db $01
.dw $2061 ;line=0x7b
.db $01
.dw $2061 ;line=0x7c
.db $01
.dw $2461 ;line=0x7d
.db $01
.dw $2461 ;line=0x7e
.db $01
.dw $2461 ;line=0x7f
.db $01
.dw $2461 ;line=0x80
.db $01
.dw $2461 ;line=0x81
.db $01
.dw $2461 ;line=0x82
.db $01
.dw $2461 ;line=0x83
.db $01
.dw $2461 ;line=0x84
.db $01
.dw $2481 ;line=0x85
.db $01
.dw $2481 ;line=0x86
.db $01
.dw $2481 ;line=0x87
.db $01
.dw $2881 ;line=0x88
.db $01
.dw $2881 ;line=0x89
.db $01
.dw $2881 ;line=0x8a
.db $01
.dw $2881 ;line=0x8b
.db $01
.dw $2882 ;line=0x8c
.db $01
.dw $2882 ;line=0x8d
.db $01
.dw $2882 ;line=0x8e
.db $01
.dw $2882 ;line=0x8f
.db $01
.dw $2882 ;line=0x90
.db $01
.dw $2882 ;line=0x91
.db $01
.dw $28a2 ;line=0x92
.db $01
.dw $2ca2 ;line=0x93
.db $01
.dw $2ca2 ;line=0x94
.db $01
.dw $2ca2 ;line=0x95
.db $01
.dw $2ca2 ;line=0x96
.db $01
.dw $2ca2 ;line=0x97
.db $01
.dw $2ca2 ;line=0x98
.db $01
.dw $2ca2 ;line=0x99
.db $01
.dw $2ca2 ;line=0x9a
.db $01
.dw $2ca2 ;line=0x9b
.db $01
.dw $2ca2 ;line=0x9c
.db $01
.dw $30a2 ;line=0x9d
.db $01
.dw $30a2 ;line=0x9e
.db $01
.dw $30c2 ;line=0x9f
.db $01
.dw $30c2 ;line=0xa0
.db $01
.dw $30c2 ;line=0xa1
.db $01
.dw $30c2 ;line=0xa2
.db $01
.dw $30c2 ;line=0xa3
.db $01
.dw $30c2 ;line=0xa4
.db $01
.dw $34c3 ;line=0xa5
.db $01
.dw $34e3 ;line=0xa6
.db $01
.dw $34e3 ;line=0xa7
.db $01
.dw $38e3 ;line=0xa8
.db $01
.dw $38e3 ;line=0xa9
.db $01
.dw $3903 ;line=0xaa
.db $01
.dw $3903 ;line=0xab
.db $01
.dw $3d03 ;line=0xac
.db $01
.dw $3d03 ;line=0xad
.db $01
.dw $3d24 ;line=0xae
.db $01
.dw $4124 ;line=0xaf
.db $01
.dw $4124 ;line=0xb0
.db $01
.dw $4124 ;line=0xb1
.db $01
.dw $4144 ;line=0xb2
.db $01
.dw $4544 ;line=0xb3
.db $01
.dw $4544 ;line=0xb4
.db $01
.dw $4544 ;line=0xb5
.db $01
.dw $4945 ;line=0xb6
.db $01
.dw $4965 ;line=0xb7
.db $01
.dw $4965 ;line=0xb8
.db $01
.dw $4965 ;line=0xb9
.db $01
.dw $4d65 ;line=0xba
.db $01
.dw $4d85 ;line=0xbb
.db $01
.dw $4d85 ;line=0xbc
.db $01
.dw $5185 ;line=0xbd
.db $01
.dw $51a5 ;line=0xbe
.db $01
.dw $51c5 ;line=0xbf
.db $01
.dw $55c5 ;line=0xc0
.db $01
.dw $55e4 ;line=0xc1
.db $01
.dw $55e4 ;line=0xc2
.db $01
.dw $5a04 ;line=0xc3
.db $01
.dw $5a04 ;line=0xc4
.db $01
.dw $5a24 ;line=0xc5
.db $01
.dw $5e24 ;line=0xc6
.db $01
.dw $5e43 ;line=0xc7
.db $01
.dw $5e63 ;line=0xc8
.db $01
.dw $6263 ;line=0xc9
.db $01
.dw $6283 ;line=0xca
.db $01
.dw $6283 ;line=0xcb
.db $01
.dw $66a2 ;line=0xcc
.db $01
.dw $66a2 ;line=0xcd
.db $01
.dw $66c2 ;line=0xce
.db $01
.dw $6ae2 ;line=0xcf
.db $01
.dw $6ae2 ;line=0xd0
.db $01
.dw $6b02 ;line=0xd1
.db $01
.dw $6f01 ;line=0xd2
.db $01
.dw $6f21 ;line=0xd3
.db $01
.dw $6f41 ;line=0xd4
.db $01
.dw $7341 ;line=0xd5
.db $01
.dw $7361 ;line=0xd6
.db $01
.dw $7760 ;line=0xd7
.db $01
.dw $7780 ;line=0xd8
.db $01
.dw $77a0 ;line=0xd9
.db $01
.dw $7ba0 ;line=0xda
.db $01
.dw $7bc0 ;line=0xdb
.db $01
.dw $7bc0 ;line=0xdc
.db 0

167
snes/ascii/bmp2bitplane.py Normal file
View File

@ -0,0 +1,167 @@
import os
import re
import string
import sys
import binascii
import math
def openfile(filename):
return open(filename)
def mk_sint(s):
a = ord(s[1])
b = ord(s[0])
return (a<<8) + b
def mk_int(s):
a = ord(s[3])
b = ord(s[2])
c = ord(s[1])
d = ord(s[0])
return (a<<32) + (b<<16) + (c<<8) + d
def main():
file = sys.argv[1]
asmfile = string.replace(file,".bmp",".s")
basename = string.replace(file,".bmp","")
fp =openfile(file)
header_offset = 14 + 40
data = fp.read()
fp.close()
type = mk_sint(data[0:2])
size = mk_int(data[2:6])
width = mk_int(data[18:22])
height = mk_int(data[22:26])
bits_per_pixel = mk_int(data[28:32])
num_of_colors = mk_int(data[46:50])
bytes_per_line = width / 8
bytes_per_line_padded = bytes_per_line + (4-(bytes_per_line % 4))
header = data[0:header_offset]
colors = data[header_offset: header_offset + (num_of_colors * 4)]
data = data[header_offset + (num_of_colors * 4):]
raw = []
for i in data:
raw.append(ord(i))
raw_len = len(raw)
print "file:\t\t%s" % file
print "basename:\t%s" % asmfile
print "header info"
print "type: \t\t%04X " % type
print "size: \t\t%i bytes" % size
print "width: \t\t%i pixel" % width
print "height: \t%i pixel" % height
print "bit per pixel:\t%i" % bits_per_pixel
print "num of colors:\t%i" % num_of_colors
print "imagedata: \t%s bytes" % raw_len
print "per line: \t%i bytes" % bytes_per_line
print "per line pad: \t%i bytes" % bytes_per_line_padded
bitplane={}
for bit in range(0,bits_per_pixel):
bitplane[bit] = []
bytes = [0,0,0,0]
bit_cnt =0
cnt=0
last_progress = 0
for byte in raw:
cnt+=1
progress = cnt / (raw_len/100)
if (progress%10)==0:
if (progress>last_progress):
print "converting bmp to bitplane buffers %i%% done" % (progress)
last_progress = progress
if bits_per_pixel == 4 :
hi_nibble = (byte >> 4)
lo_nibble = byte & 16
hi_nibble_bin = ''
for nibble in (hi_nibble,lo_nibble):
for plane in range(bits_per_pixel-1,-1,-1):
if (nibble & (1 << plane)):
bytes[plane] |= 1 << bit_cnt
bit_cnt += 1
if (bit_cnt==8):
for i in range(0,bits_per_pixel):
bitplane[i].append(bytes[i])
bytes=[0,0,0,0]
bit_cnt =0
if bits_per_pixel == 1 :
bitplane[0] = raw
break
out='';
for plane in range(0,bits_per_pixel):
print "bitplane %i has %i bytes " % (plane,len(bitplane[plane]))
x_tiles = width / 8
y_tiles = height / 8
cnt=0
last_progress=0
fp = open(asmfile,'w')
tile_cnt = 0
out ="\n\n\n%s:\n\n" % (basename)
fp.write(out)
#for yt in range(0,y_tiles):
for yt in range(y_tiles-1,-1,-1): # needed for h flip
out ="; ### row %02x ### \n" % yt
fp.write(out)
progress = cnt / (raw_len/100)
if(progress%5)==0:
print "building asm include %i%% done" % (progress)
#last_progress = progress
for xt in range(0,x_tiles):
for plane in range(0,bits_per_pixel):
out = ' .db '
for y in range(((yt+1)*8)-1,(yt*8)-1,-1): # needed for h flip
#for y in range(yt*8,(yt+1)*8):
out += "$%02x," % bitplane[plane][(y*x_tiles)+xt]
cnt+=1
out = out[:-1]
out += ' ; tile=%02x plane=%02x row=%02x col=%02x \n' % (tile_cnt,plane,yt,xt)
fp.write(out)
tile_cnt+=1
fp.close()
if __name__ == '__main__':
if len(sys.argv) is 2:
main()
else:
print "usage: %s in out" % sys.argv[0]

180
snes/ascii/bmp2col.py Normal file
View File

@ -0,0 +1,180 @@
import os
import re
import string
import sys
import binascii
import math
class color:
def __init__(self,r,g,b):
self.r = r >> 3
self.g = g >> 3
self.b = b >> 3
self.snes = "$%04x" % (( self.b << 10 ) | (self.g << 5) | self.r )
def get(self):
return self.snes
def __str__(self):
return "r=0x%02x g=0x%02x b=0x%02x snes=%s" % ( self.r,self.g,self.b,self.snes)
def openfile(filename):
return open(filename)
def mk_sint(s):
a = ord(s[1])
b = ord(s[0])
return (a<<8) + b
def mk_int(s):
a = ord(s[3])
b = ord(s[2])
c = ord(s[1])
d = ord(s[0])
return (a<<32) + (b<<16) + (c<<8) + d
def main():
file = sys.argv[1]
asmfile = string.replace(file,".bmp",".s")
basename = string.replace(file,".bmp","")
if len(sys.argv) >= 3 and sys.argv[2] =='list' :
do_list = 1
else:
do_list = 0
if len(sys.argv) >= 4 and sys.argv[3] =='compress':
do_compress = 1
else:
do_compress = 0
fp =openfile(file)
header_offset = 14 + 40
data = fp.read()
fp.close()
type = mk_sint(data[0:2])
size = mk_int(data[2:6])
width = mk_int(data[18:22])
height = mk_int(data[22:26])
bits_per_pixel = mk_int(data[28:32])
num_of_colors = mk_int(data[46:50])
bytes_per_line = width / 8
bytes_per_line_padded = bytes_per_line + (4-(bytes_per_line % 4))
header = data[0:header_offset]
colors = data[header_offset: header_offset + (num_of_colors * 4)]
data = data[header_offset + (num_of_colors * 4):]
raw = []
for i in data:
raw.append(ord(i))
raw_len = len(raw)
palette = []
for i in range(0,len(colors),4):
palette.append(color(ord(colors[i+2]),ord(colors[i+1]),ord(colors[i])))
print "file:\t\t%s" % file
print "basename:\t%s" % asmfile
print "header info"
print "type: \t\t%04X " % type
print "size: \t\t%i bytes" % size
print "width: \t\t%i pixel" % width
print "height: \t%i pixel" % height
print "bit per pixel:\t%i" % bits_per_pixel
print "num of colors:\t%i" % num_of_colors
print "imagedata: \t%s bytes" % raw_len
print "per line: \t%i bytes" % bytes_per_line
print "per line pad: \t%i bytes" % bytes_per_line_padded
out='';
fp = open(asmfile,'w')
tile_cnt = 0
color_list = str()
value_list = str()
color_list="\n\n\n%s_color_list:\n\n" % (basename)
value_list ="\n\n\n%s_color_values:\n\n" % (basename)
out = " .db "
cnt=0
last = "";
repeat = 1;
for i in range(raw_len-1,-1,-width):
idx = raw[i]
col = palette[idx].get()
if col == last and do_compress:
repeat += 1
continue
else:
#print palette[idx]
last = col
if do_list:
value_list += " .db $%02x\n" % repeat
value_list += " .dw %s ;line=0x%02x\n" % (col, (height - (i/width)) )
out += "$%02x,$00," % repeat
repeat = 1
cnt +=1
if cnt == width/20:
cnt=0
out = out[:-1]
out +="\n"
color_list += out
out = " .db "
value_list += " .db 0\n"
color_list += " .db 0\n"
if do_list:
fp.write(color_list)
fp.write(value_list)
fp.close()
if __name__ == '__main__':
if len(sys.argv)>= 2:
main()
else:
print "usage: %s in [list] [compress]" % sys.argv[0]

BIN
snes/ascii/colbar_1.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

38
snes/ascii/colbar_1.s Normal file
View File

@ -0,0 +1,38 @@
colbar_1_color_values:
.dw $0001 ;line=0x01
.dw $0003 ;line=0x02
.dw $0004 ;line=0x03
.dw $0006 ;line=0x04
.dw $0008 ;line=0x05
.dw $000a ;line=0x06
.dw $000c ;line=0x07
.dw $000e ;line=0x08
.dw $0011 ;line=0x09
.dw $0014 ;line=0x0a
.dw $0019 ;line=0x0b
.dw $001b ;line=0x0c
.dw $001a ;line=0x0d
.dw $0019 ;line=0x0e
.dw $0018 ;line=0x0f
.dw $0017 ;line=0x10
.dw $0016 ;line=0x11
.dw $0015 ;line=0x12
.dw $0014 ;line=0x13
.dw $0013 ;line=0x14
.dw $0010 ;line=0x15
.dw $000d ;line=0x16
.dw $000a ;line=0x17
.dw $0008 ;line=0x18
.dw $0006 ;line=0x19
.dw $0004 ;line=0x1a
.dw $0002 ;line=0x1b
.dw $0001 ;line=0x1c
.dw $0000 ;line=0x1d
.dw $0000 ;line=0x1e
.dw $0000 ;line=0x1f
.dw $0000 ;line=0x20
.db 0

BIN
snes/ascii/colbar_2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

38
snes/ascii/colbar_2.s Normal file
View File

@ -0,0 +1,38 @@
colbar_2_color_values:
.dw $0020 ;line=0x01
.dw $0060 ;line=0x02
.dw $0080 ;line=0x03
.dw $00c0 ;line=0x04
.dw $0100 ;line=0x05
.dw $0140 ;line=0x06
.dw $0180 ;line=0x07
.dw $01c0 ;line=0x08
.dw $0220 ;line=0x09
.dw $0280 ;line=0x0a
.dw $0320 ;line=0x0b
.dw $0360 ;line=0x0c
.dw $0340 ;line=0x0d
.dw $0320 ;line=0x0e
.dw $0300 ;line=0x0f
.dw $02e0 ;line=0x10
.dw $02c0 ;line=0x11
.dw $02a0 ;line=0x12
.dw $0280 ;line=0x13
.dw $0260 ;line=0x14
.dw $0200 ;line=0x15
.dw $01a0 ;line=0x16
.dw $0140 ;line=0x17
.dw $0100 ;line=0x18
.dw $00c0 ;line=0x19
.dw $0080 ;line=0x1a
.dw $0040 ;line=0x1b
.dw $0020 ;line=0x1c
.dw $0000 ;line=0x1d
.dw $0000 ;line=0x1e
.dw $0000 ;line=0x1f
.dw $0000 ;line=0x20
.db 0

BIN
snes/ascii/colbar_3.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

38
snes/ascii/colbar_3.s Normal file
View File

@ -0,0 +1,38 @@
colbar_3_color_values:
.dw $0400 ;line=0x01
.dw $0c00 ;line=0x02
.dw $1000 ;line=0x03
.dw $1800 ;line=0x04
.dw $2000 ;line=0x05
.dw $2800 ;line=0x06
.dw $3000 ;line=0x07
.dw $3800 ;line=0x08
.dw $4400 ;line=0x09
.dw $5000 ;line=0x0a
.dw $6400 ;line=0x0b
.dw $6c00 ;line=0x0c
.dw $6800 ;line=0x0d
.dw $6400 ;line=0x0e
.dw $6000 ;line=0x0f
.dw $5c00 ;line=0x10
.dw $5800 ;line=0x11
.dw $5400 ;line=0x12
.dw $5000 ;line=0x13
.dw $4c00 ;line=0x14
.dw $4000 ;line=0x15
.dw $3400 ;line=0x16
.dw $2800 ;line=0x17
.dw $2000 ;line=0x18
.dw $1800 ;line=0x19
.dw $1000 ;line=0x1a
.dw $0800 ;line=0x1b
.dw $0400 ;line=0x1c
.dw $0000 ;line=0x1d
.dw $0000 ;line=0x1e
.dw $0000 ;line=0x1f
.dw $0000 ;line=0x20
.db 0

13
snes/ascii/colbarsine_1.s Normal file
View File

@ -0,0 +1,13 @@
colbarsine_1:
.db $60,$60,$63,$66,$69,$69,$6c,$6f,$72,$75,$75,$78,$7b,$7e,$7e,$81,$84,$84,$87,$8a,$8d,$8d,$90,$93,$93,$96,$99,$99,$9c,$9c,$9f,$a2
.db $a2,$a5,$a5,$a8,$a8,$ab,$ab,$ae,$ae,$b1,$b1,$b1,$b4,$b4,$b4,$b7,$b7,$b7,$ba,$ba,$ba,$ba,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd
.db $c0,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$bd,$ba,$ba,$ba,$ba,$b7,$b7,$b7,$b4,$b4,$b4,$b1,$b1,$b1,$ae,$ae,$ab,$ab,$a8,$a8,$a5,$a5
.db $a2,$a2,$9f,$9c,$9c,$99,$99,$96,$93,$93,$90,$8d,$8d,$8a,$87,$84,$84,$81,$7e,$7e,$7b,$78,$75,$75,$72,$6f,$6c,$69,$69,$66,$63,$60
.db $60,$60,$5d,$5a,$57,$57,$54,$51,$4e,$4b,$4b,$48,$45,$42,$42,$3f,$3c,$3c,$39,$36,$33,$33,$30,$2d,$2d,$2a,$27,$27,$24,$24,$21,$1e
.db $1e,$1b,$1b,$18,$18,$15,$15,$12,$12,$0f,$0f,$0f,$0c,$0c,$0c,$09,$09,$09,$06,$06,$06,$06,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03
.db $00,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$06,$06,$06,$06,$09,$09,$09,$0c,$0c,$0c,$0f,$0f,$0f,$12,$12,$15,$15,$18,$18,$1b,$1b
.db $1e,$1e,$21,$24,$24,$27,$27,$2a,$2d,$2d,$30,$33,$33,$36,$39,$3c,$3c,$3f,$42,$42,$45,$48,$4b,$4b,$4e,$51,$54,$57,$57,$5a,$5d,$60

2
snes/ascii/linkfile Normal file
View File

@ -0,0 +1,2 @@
[objects]
main.o

832
snes/ascii/main.asm Normal file
View File

@ -0,0 +1,832 @@
.EMPTYFILL 0
.LOROM
.MEMORYMAP
SLOTSIZE $8000
DEFAULTSLOT 0
SLOT 0 $0000 ; ram , direct page
SLOT 1 $2000 ; PPU1, APU
SLOT 2 $3000 ; SFX, DSP
SLOT 3 $4000 ; Controller
SLOT 4 $4200 ; PPU2, DMA
SLOT 5 $6000 ; RESERVED
SLOT 6 $8000 ; code segment
.ENDME
.ROMBANKMAP
BANKSTOTAL $8
BANKSIZE $8000
BANKS $8
.ENDRO
.NAME "optixx"
.BANK $00 SLOT 6
;.ORG $0000
;.ORGA $8000
.SECTION "MAIN"
.define dp $0000
.define sineswap $0002
.define sine_offset $0003
.define scrollval $0005
.define colbar_offset_1 $0006
.define colbar_offset_2 $0007
.define colbar_offset_3 $0008
.define colbar_offset_table $0010
.define colbar_color_table $0020
.define colbar_count $0030
.define colbar_color $0032
.define colbar_color_ptr $0034
.define hdma_table0 $0050
.define hdma_table1 $0200
.define plane_0 $0800
.define plane_1 $0c00
.define char_data $2000
.define logo_data $2200
init:
sei ;stop interrupts
phk ;get the current bank and store on stack
plb ;get value off stack and make it the current
;programming bank
clc ;clear carry bit
xce ;native 16 bit mode (no 6502 emulation!)
jsr setup
rep #$30 ; x,y,a fixed -> 16 bit mode
sep #$20 ; accumulator -> 8 bit mode
lda #(dp+0) ;load direct page
tcd ;store & and assign
lda #(plane_0>>8) ; screen map data @ vram location $1000
sta $2107 ; plane 0 map location register
lda #(plane_1>>8) ; screen map data @ vram location $1000
sta $2108 ; plane 1 map location register
lda #$22 ; plane 0 and plane 1 tile graphics @ $2000
sta $210b ; plane 0 tile graphics register
lda #$00 ; mode 0 value / tile mode
sta $2105 ; graphics mode register
lda #%00000011 ;
sta $212c ; plane enable register
lda #$01
sta $4200 ; enable joypad read (bit one)
lda #$00
sta $2121
ldx #$0000
col_loop:
lda #$ff
sta $2122
lda #$7f
sta $2122
inx
cpx #$00ff
bne col_loop
ldx.w #char_data ; assign vram location
stx $2116 ; writing to $2118/9 will store data here!
ldx #$0000
copychar:
lda.w charset,x ; get character set data (font data)
sta $2118 ; store bitplane 1
stz $2119 ; clear bitplane 2 and increase vram address
inx
cpx #$0200 ; transfer $0200 bytes
bne copychar
ldx #$0000
copy_logo: ; copy tile data to vram
lda.w optixx_logo,x ; using continuos tile vram pointer
sta $2118 ; charset @ $2000
stz $2119 ; logo @ $2200
inx
cpx #$0500
bne copy_logo
init_plane_0:
ldx.w #plane_0 ; assign vram location $1000 to $2116/7
stx $2116
ldx #$0000
init_plane_0_loop:
lda.w text_0,x ; get ascii text data
and #$3f ; we only want the first 64 characters
; convert ascii to c64 screen code
sta $2118
stz $2119 ; clear unwanted bits, no h/v flipping
inx
cpx #$0400 ; transfer entire screen
; $20*$20=$0400 (1024 bytes)
bne init_plane_0_loop
init_plane_1: ; write optixx logo tiles
ldx.w #plane_1
stx $2116
ldx #$0000
lda #$0040
init_plane_1_clear_1: ; 0x0140 tiles clear
sta $2118
stz $2119
inx
cpx #$0140
bne init_plane_1_clear_1
ldx #$0000
init_plane_1_loop_1:
ina
sta $2118
stz $2119
inx
cpx #$00a0 ; 0x00a0 logo tiles
bne init_plane_1_loop_1
ldx #$0000
lda #$0040
init_plane_1_clear_2:
sta $2118
stz $2119
inx
cpx #$01a0 ; 0x01a0 tiles clear
bne init_plane_1_clear_2
ldx #$0000
init_screen:
lda #$0f ; screen enabled, full brightness
sta $2100 ;
cli ; clear interrupt bit
init_scroll:
lda #$00
sta.w scrollval
init_sineoffset:
lda #$00
sta.w sine_offset
lda #$00
sta sineswap
ldx.w #colbar_1_color_values
stx colbar_color_table
ldx.w #colbar_2_color_values
stx colbar_color_table + $02
ldx.w #colbar_3_color_values
stx colbar_color_table + $04
ldx.w #colbar_1_color_values
stx colbar_color_table + $06
ldx.w #colbar_2_color_values
stx colbar_color_table + $08
ldx.w #colbar_3_color_values
stx colbar_color_table + $0a
lda #$00
sta colbar_offset_table
lda #$15
sta colbar_offset_table + $01
lda #$25
sta colbar_offset_table + $02
lda #$35
sta colbar_offset_table + $03
lda #$45
sta colbar_offset_table + $04
lda #$55
sta colbar_offset_table + $05
call_hmda_setup:
jsr init_hdma_table0
jsr init_hdma_table1
jmp intro
main:
jsr wait_vbl
jsr sine_plane
jsr sine_colbar
jsr scroll_plane
jsr joypad
jmp main
; test vertical interrupt
wait_vbl:
lda $4210 ; check for vertical blank
and #$80
beq wait_vbl
rts
; joypad poll
joypad:
lda $4212 ; is joypad ready to be read?
and #$0001
bne joypad ; no? go back until it is!
lda $4219 ; read joypad high byte
and #$10 ; leave only "start" bit
bne reset ; "start" pressed? go to reset
rts ; if not then jump back to loop
reset:
sep #$30
lda #$00
pha ; push #$00 to stack
plb ; pull #$00 from stack and make it the
; the programming bank
jmp init ; jump long to $008000
; gfx routine
; intro stuff
intro:
rep #$30
sep #$20
ldx #$f2
mosaic_l:
jsr wait_vbl
jsr wait_vbl
txa
sta $2106
sbc #$10
tax
cmp #$02
bne mosaic_l
stz $2106
fade:
ldy #$0f
fade_dark:
jsr wait_vbl
tya
sta $2100
dey
cpy #$0000
bne fade_dark
ldy #$0000
fade_light:
jsr wait_vbl
tya
sta $2100
iny
cpy #$000f
bne fade_light
jmp main
; scroll loop
scroll_plane:
lda.w scrollval
sta $210e
stz $210e
adc #$01
sta.w scrollval
cmp #$ff
beq restore_scroll
rts
restore_scroll:
lda #$00
sta.w scrollval
rts
sine_plane:
rep #$10
sep #$20
lda sine_offset
ina
sta sine_offset
cmp #$ff
bne sine_plane_c
lda #$00
sta sine_offset
lda sineswap ; check wich sine table ot take
ina
sta sineswap
cmp #$04 ; after 4 loop reset counter
bne sine_plane_c
lda #$00
sta sineswap
sine_plane_c:
tay
ldx #$0000
sine_plane_l:
iny
cpy #$ff
bne sine_plane_l_c
lda #$00
tay
sine_plane_l_c:
inx
lda.w sineswap
cmp #$02 ; lower 2 use vsine 1
bmi sine_load_vsine1
sine_load_vsine2: ; else use vsine 2
lda.w vsine_2,y
bra sine_load_done
sine_load_vsine1:
lda.w vsine_1,y
sine_load_done:
adc #$c8 ; shift logo left
sta hdma_table0+3,x
inx
inx
cpx #$00c0 ; 64 hdma lines a 3 byte
bne sine_plane_l
rep #$30
sep #$20
rts
sine_colbar:
rep #$10
sep #$20
ldx #$00
sine_colbar_clear:
stz hdma_table1+1,x
stz hdma_table1+2,x
inx
inx
inx
cpx #$012c
bne sine_colbar_clear
lda #$00
sta colbar_count
ldy #$0000
sty colbar_color
sine_colbar_init:
ldy colbar_color
ldx colbar_color_table,y
stx colbar_color_ptr
lda.w colbar_count
tay
lda colbar_offset_table,y
ina
sta colbar_offset_table,y
cmp #$ff ; if end of sine table
bne sine_colbar_continue
lda #$00 ; reset table pointer
sta colbar_offset_table,y
sine_colbar_continue:
tay
lda.w colbarsine_1,y
tax
ldy #$0000
sine_colbar_loop:
lda (colbar_color_ptr),y
ora hdma_table1+1,x
and #$ff
sta hdma_table1+1,x
iny
lda (colbar_color_ptr),y
ora hdma_table1+2,x
and #$ff
sta hdma_table1+2,x
inx
inx
inx
iny
;iny
cpy #$0040 ; 32 colot lines a 2 byte
bne sine_colbar_loop
ldy colbar_color
iny
iny
sty colbar_color
lda.w colbar_count
ina
sta.w colbar_count
cmp #$06
bne sine_colbar_init
sine_colbar_end:
rep #$30
sep #$20
rts
; init hdma list
init_hdma_table0:
rep #$10
sep #$20
ldy #$0000
ldx #$0000
;lda #$00
;sta sine_offset
lda #$4c
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
sta hdma_table0,x
inx
init_hdma_table0_loop:
lda #$01
sta hdma_table0,x
inx
;lda vsine_1,y
lda #$00
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
iny
;cpx #$0183 ; (128 + 1) * 3 = 387 = 0x0183
cpx #$00c3 ; (64 + 1) * 3 = 195 = 0x00c0
bne init_hdma_table0_loop
lda #$4c
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
sta hdma_table0,x
inx
sta hdma_table0,x
inx
sta hdma_table0,x
lda #$02
sta $4300
lda #$0f
sta $4301
ldx.w #hdma_table0
;ldx.w #test_hmda_table
stx $4302
lda #$00
sta $4304
;lda #%00000001
;sta $420c
rep #$30
sep #$20
rts
init_hdma_table1:
;rep #$10
;sep #$30
ldx #$0000
init_hdma_tabel1_copy:
ldy.w backcolors_color_values,x
tya
sta hdma_table1,x
inx
cpx #$0295
bne init_hdma_tabel1_copy
lda #$00
sta $4310
lda #$21
sta $4311
ldx.w #backcolors_color_list
stx $4312
lda #$00
sta $4314
lda #$02
sta $4320
lda #$22
sta $4321
;ldx.w #backcolors_color_values
ldx.w #hdma_table1
stx $4322
lda #$00
sta $4324
lda #%00000111
sta $420c
rep #$30
sep #$20
rts
setup:
sep #$30 ; x,y,a are 8 bit numbers
lda #$8f ; screen off, full brightness
sta $2100 ; brightness + screen enable register
lda #$00 ;
sta $2101 ; sprite register (size + address in vram)
lda #$00
sta $2102 ; sprite registers (address of sprite memory [oam])
sta $2103 ; "" ""
lda #$00 ; mode 0
sta $2105 ; graphic mode register
lda #$00 ; no planes, no mosaic
sta $2106 ; mosaic register
lda #$00 ;
sta $2107 ; plane 0 map vram location
lda #$00
sta $2108 ; plane 1 map vram location
lda #$00
sta $2109 ; plane 2 map vram location
lda #$00
sta $210a ; plane 3 map vram location
lda #$00
sta $210b ; plane 0+1 tile data location
lda #$00
sta $210c ; plane 2+3 tile data location
lda #$00
sta $210d ; plane 0 scroll x (first 8 bits)
sta $210d ; plane 0 scroll x (last 3 bits) #$0 - #$07ff
sta $210e ; plane 0 scroll y (first 8 bits)
sta $210e ; plane 0 scroll y (last 3 bits) #$0 - #$07ff
sta $210f ; plane 1 scroll x (first 8 bits)
sta $210f ; plane 1 scroll x (last 3 bits) #$0 - #$07ff
sta $2110 ; plane 1 scroll y (first 8 bits)
sta $2110 ; plane 1 scroll y (last 3 bits) #$0 - #$07ff
sta $2111 ; plane 2 scroll x (first 8 bits)
sta $2111 ; plane 2 scroll x (last 3 bits) #$0 - #$07ff
sta $2112 ; plane 2 scroll y (first 8 bits)
sta $2112 ; plane 2 scroll y (last 3 bits) #$0 - #$07ff
sta $2113 ; plane 3 scroll x (first 8 bits)
sta $2113 ; plane 3 scroll x (last 3 bits) #$0 - #$07ff
sta $2114 ; plane 3 scroll y (first 8 bits)
sta $2114 ; plane 3 scroll y (last 3 bits) #$0 - #$07ff
lda #$80 ; increase vram address after writing to $2119
sta $2115 ; vram address increment register
lda #$00
sta $2116 ; vram address low
sta $2117 ; vram address high
sta $211a ; initial mode 7 setting register
sta $211b ; mode 7 matrix parameter a register (low)
lda #$01
sta $211b ; mode 7 matrix parameter a register (high)
lda #$00
sta $211c ; mode 7 matrix parameter b register (low)
sta $211c ; mode 7 matrix parameter b register (high)
sta $211d ; mode 7 matrix parameter c register (low)
sta $211d ; mode 7 matrix parameter c register (high)
sta $211e ; mode 7 matrix parameter d register (low)
lda #$01
sta $211e ; mode 7 matrix parameter d register (high)
lda #$00
sta $211f ; mode 7 center position x register (low)
sta $211f ; mode 7 center position x register (high)
sta $2120 ; mode 7 center position y register (low)
sta $2120 ; mode 7 center position y register (high)
sta $2121 ; color number register ($0-ff)
sta $2123 ; bg1 & bg2 window mask setting register
sta $2124 ; bg3 & bg4 window mask setting register
sta $2125 ; obj & color window mask setting register
sta $2126 ; window 1 left position register
sta $2127 ; window 2 left position register
sta $2128 ; window 3 left position register
sta $2129 ; window 4 left position register
sta $212a ; bg1, bg2, bg3, bg4 window logic register
sta $212b ; obj, color window logic register (or,and,xor,xnor)
lda #$01
sta $212c ; main screen designation (planes, sprites enable)
lda #$00
sta $212d ; sub screen designation
lda #$00
sta $212e ; window mask for main screen
sta $212f ; window mask for sub screen
lda #$30
sta $2130 ; color addition & screen addition init setting
lda #$00
sta $2131 ; add/sub sub designation for screen, sprite, color
lda #$e0
sta $2132 ; color data for addition/subtraction
lda #$00
sta $2133 ; screen setting (interlace x,y/enable sfx data)
lda #$00
sta $4200 ; enable v-blank, interrupt, joypad register
lda #$ff
sta $4201 ; programmable i/o port
lda #$00
sta $4202 ; multiplicand a
sta $4203 ; multiplier b
sta $4204 ; multiplier c
sta $4205 ; multiplicand c
sta $4206 ; divisor b
sta $4207 ; horizontal count timer
sta $4208 ; horizontal count timer msb (most significant bit)
sta $4209 ; vertical count timer
sta $420a ; vertical count timer msb
sta $420b ; general dma enable (bits 0-7)
sta $420c ; horizontal dma (hdma) enable (bits 0-7)
sta $420d ; access cycle designation (slow/fast rom)
rts
charset:
.db $55,$aa,$55,$aa,$55,$aa,$55,$aa ;'@'
.db $00,$3c,$66,$7e,$66,$66,$66,$00 ;'a'
.db $00,$7c,$66,$7c,$66,$66,$7c,$00 ;'b'
.db $00,$3c,$66,$60,$60,$66,$3c,$00 ;'c'
.db $00,$78,$6c,$66,$66,$6c,$78,$00 ;'d'
.db $00,$7e,$60,$78,$60,$60,$7e,$00 ;'e'
.db $00,$7e,$60,$78,$60,$60,$60,$00 ;'f'
.db $00,$3c,$66,$60,$6e,$66,$3c,$00 ;'g'
.db $00,$66,$66,$7e,$66,$66,$66,$00 ;'h'
.db $00,$3c,$18,$18,$18,$18,$3c,$00 ;'i'
.db $00,$1e,$0c,$0c,$0c,$6c,$38,$00 ;'j'
.db $00,$6c,$78,$70,$78,$6c,$66,$00 ;'k'
.db $00,$60,$60,$60,$60,$60,$7e,$00 ;'l'
.db $00,$63,$77,$7f,$6b,$63,$63,$00 ;'m'
.db $00,$66,$76,$7e,$7e,$6e,$66,$00 ;'n'
.db $00,$3c,$66,$66,$66,$66,$3c,$00 ;'o'
.db $00,$7c,$66,$66,$7c,$60,$60,$00 ;'p'
.db $00,$3c,$66,$66,$66,$3c,$0e,$00 ;'q'
.db $00,$7c,$66,$66,$7c,$6c,$66,$00 ;'r'
.db $00,$3e,$60,$3c,$06,$66,$3c,$00 ;'s'
.db $00,$7e,$18,$18,$18,$18,$18,$00 ;'t'
.db $00,$66,$66,$66,$66,$66,$3c,$00 ;'u'
.db $00,$66,$66,$66,$66,$3c,$18,$00 ;'v'
.db $00,$63,$63,$6b,$7f,$77,$63,$00 ;'w'
.db $00,$66,$3c,$18,$3c,$66,$66,$00 ;'x'
.db $00,$66,$66,$3c,$18,$18,$18,$00 ;'y'
.db $00,$7e,$0c,$18,$30,$60,$7e,$00 ;'z'
.db $00,$3c,$30,$30,$30,$30,$3c,$00 ;'['
.db $c0,$60,$30,$18,$0c,$06,$03,$00 ;'|'
.db $00,$3c,$0c,$0c,$0c,$0c,$3c,$00 ;']'
.db $10,$38,$6c,$c6,$00,$00,$00,$00 ;'^'
.db $00,$00,$00,$00,$00,$00,$00,$fe ;'_'
.db $00,$00,$00,$00,$00,$00,$00,$00 ;' '
.db $00,$18,$18,$18,$00,$00,$18,$00 ;'!'
.db $00,$66,$66,$00,$00,$00,$00,$00 ;'"'
.db $00,$66,$ff,$66,$ff,$66,$00,$00 ;'#'
.db $00,$08,$1c,$28,$28,$1c,$08,$00 ;'$'
.db $00,$64,$6c,$18,$30,$6c,$4c,$00 ;'%'
.db $00,$00,$18,$18,$7e,$18,$18,$00 ;'&'
.db $00,$0c,$18,$00,$00,$00,$00,$00 ;'''
.db $00,$18,$30,$30,$30,$18,$0c,$00 ;'('
.db $00,$18,$0c,$0c,$0c,$18,$30,$00 ;')'
.db $00,$66,$3c,$ff,$3c,$66,$00,$00 ;'*'
.db $00,$18,$18,$7e,$18,$18,$00,$00 ;'+'
.db $00,$00,$00,$00,$00,$18,$18,$30 ;','
.db $00,$00,$00,$fe,$00,$00,$00,$00 ;'-'
.db $00,$00,$00,$00,$00,$18,$18,$00 ;'.'
.db $03,$06,$0c,$18,$30,$60,$c0,$00 ;'/'
.db $00,$3c,$66,$6e,$76,$66,$3c,$00 ;'0'
.db $00,$18,$38,$18,$18,$18,$7e,$00 ;'1'
.db $00,$7c,$06,$0c,$30,$60,$7e,$00 ;'2'
.db $00,$7e,$06,$1c,$06,$66,$3c,$00 ;'3'
.db $00,$0e,$1e,$36,$7f,$06,$06,$00 ;'4'
.db $00,$7e,$60,$7c,$06,$66,$3c,$00 ;'5'
.db $00,$3e,$60,$7c,$66,$66,$3c,$00 ;'6'
.db $00,$7e,$06,$0c,$0c,$0c,$0c,$00 ;'7'
.db $00,$3c,$66,$3c,$66,$66,$3c,$00 ;'8'
.db $00,$3c,$66,$3e,$06,$66,$3c,$00 ;'9'
.db $00,$00,$18,$00,$00,$18,$00,$00 ;':'
.db $00,$00,$18,$00,$00,$18,$18,$30 ;';'
.db $18,$18,$18,$18,$18,$18,$18,$00 ;'<'
.db $00,$00,$7e,$00,$7e,$00,$00,$00 ;'='
.db $18,$18,$0c,$0c,$0c,$0c,$18,$18 ;'>'
.db $00,$7c,$06,$0c,$18,$00,$18,$00 ;'?'
; 12345678901234567890123456789012
text_0:
.db " _ _ "
.db " ___ _ __ | |_(_)_ ____ __ "
.db " / _ \| '_ \| __| \ \/ /\ \/ / "
.db " | (_) | |_) | |_| |> < > < "
.db " \___/| .__/ \__|_/_/\_\/_/\_\ "
.db " |_| "
.db " "
.db " "
.db " "
.db " OPTIXX ONCE A AGAIN "
.db " WITH A CONSOLE RELEASE "
.db " WWW.OPTIXX.ORG "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.db " "
.INCLUDE "vsine_1.s"
.INCLUDE "vsine_2.s"
.INCLUDE "backcolors.s"
.INCLUDE "colbar_1.s"
.INCLUDE "colbar_2.s"
.INCLUDE "colbar_3.s"
.INCLUDE "colbarsine_1.s"
.INCLUDE "optixx_logo.s"
.ENDS
;.BANK $04 SLOT 6
;.ORGA $8000
;long_label:
nop
nop
rts
;.BANK $01 SLOT 6
;.ORGA $8000
;.BASE $01
;.INCLUDE "music.s"
;.BANK $02 SLOT 6
;.ORG $0000
;music_data_1:
;.INCBIN "music1.bin"
;.BANk $03 SLOT 6
;.ORG $0000
;music_data_2:
;.INCBIN "music2.bin"

140
snes/ascii/music.inc Normal file
View File

@ -0,0 +1,140 @@
; ***********************************************************
; *** Music routine taken from 'ZOOM.ASM'. ***
; *** Optimized by Yoshi ***
; ***********************************************************
play_music:
sep #$30
lda #$ff
sta $2140
rep #$10
ldx.w #$7fff
- lda.l $028000,x
sta.l $7f0000,x
lda.l $038000,x
sta.l $7f8000,x
dex
bpl -
stz $00fd
stz $00fe
lda #$7f
sta $00ff
ina ; Oh boy. Actually stores #$80. :-)
sta $2100
stz $4200
sei
jsr res1
sep #$30
- lda $2140
bne -
lda #$e0
sta $2143
lda #$ff
sta $2142
lda #$01
sta $2141
sta $2140
- lda $2140
cmp #$01
bne -
- lda $2140
cmp #$55
bne -
lda $0207
sta $2141
lda #$07
sta $2140
- lda $2140
cmp #$07
bne -
- lda $2140
cmp #$55
bne -
cli
rts
res1 php
jsr res2
plp
stz $2140
rts
res2 php
rep #$30
;ldy.w #$0000
lda.w #$bbaa
- cmp $2140
bne -
sep #$20
lda #$cc
bra B1
B4 lda [$fd],y
iny
xba
lda #$00
bra B2
B3 xba
lda [$fd],y
iny
xba
B5 cmp $2140
bne B5
ina
B2 rep #$20
sta $2140
sep #$20
dex
bne B3
- cmp $2140
bne -
- adc #$03
beq -
B1 pha
rep #$20
lda [$fd],y
iny
iny
tax
lda [$fd],y
iny
iny
sta $2142
sep #$20
cpx.w #$0001
lda #$00
rol
sta $2141
adc #$7f
pla
sta $2140
- cmp $2140
bne -
bvs B4
plp
rts
pla
sta $2140
- cmp $2140
bne -
bvs B5
plp
rts

BIN
snes/ascii/optixx_logo.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
snes/ascii/optixx_logo2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
snes/ascii/result.bak Normal file

Binary file not shown.

BIN
snes/ascii/result.swc Normal file

Binary file not shown.

BIN
snes/ascii/result.tmp Normal file

Binary file not shown.

705
snes/ascii/save.s Normal file
View File

@ -0,0 +1,705 @@
.EMPTYFILL 0
.LOROM
.MEMORYMAP
SLOTSIZE $8000
DEFAULTSLOT 0
SLOT 0 $0000 ; ram , direct page
SLOT 1 $2000 ; PPU1, APU
SLOT 2 $3000 ; SFX, DSP
SLOT 3 $4000 ; Controller
SLOT 4 $4200 ; PPU2, DMA
SLOT 5 $6000 ; RESERVED
SLOT 6 $8000 ; code segment
.ENDME
;.ROMBANKSIZE $8000
;.ROMBANKS $80
.ROMBANKMAP
BANKSTOTAL $80
BANKSIZE $8000
BANKS $80
.ENDRO
.NAME "optixx"
.BANK $00 SLOT 6
.ORG $0000
.ORGA $8000
.SECTION "MAIN"
.define dp $0000
.define xstorage1 $0001
.define xstorage2 $0002
.define sineoffset $0003
.define scrollval $0005
.define col_reg $0007
.define hdma_table0 $0010
.define plane_0 $0400
.define plane_1 $0800
.define tile $2000
init:
sei ;stop interrupts
phk ;get the current bank and store on stack
plb ;get value off stack and make it the current
;programming bank
clc ;clear carry bit
xce ;native 16 bit mode (no 6502 emulation!)
jsr init_hdma_table0
;==========================================================================
; start of snes register initialization
;==========================================================================
sep #$30 ; x,y,a are 8 bit numbers
lda #$8f ; screen off, full brightness
sta $2100 ; brightness + screen enable register
lda #$00 ;
sta $2101 ; sprite register (size + address in vram)
lda #$00
sta $2102 ; sprite registers (address of sprite memory [oam])
sta $2103 ; "" ""
lda #$00 ; mode 0
sta $2105 ; graphic mode register
lda #$00 ; no planes, no mosaic
sta $2106 ; mosaic register
lda #$00 ;
sta $2107 ; plane 0 map vram location
lda #$00
sta $2108 ; plane 1 map vram location
lda #$00
sta $2109 ; plane 2 map vram location
lda #$00
sta $210a ; plane 3 map vram location
lda #$00
sta $210b ; plane 0+1 tile data location
lda #$00
sta $210c ; plane 2+3 tile data location
lda #$00
sta $210d ; plane 0 scroll x (first 8 bits)
sta $210d ; plane 0 scroll x (last 3 bits) #$0 - #$07ff
sta $210e ; plane 0 scroll y (first 8 bits)
sta $210e ; plane 0 scroll y (last 3 bits) #$0 - #$07ff
sta $210f ; plane 1 scroll x (first 8 bits)
sta $210f ; plane 1 scroll x (last 3 bits) #$0 - #$07ff
sta $2110 ; plane 1 scroll y (first 8 bits)
sta $2110 ; plane 1 scroll y (last 3 bits) #$0 - #$07ff
sta $2111 ; plane 2 scroll x (first 8 bits)
sta $2111 ; plane 2 scroll x (last 3 bits) #$0 - #$07ff
sta $2112 ; plane 2 scroll y (first 8 bits)
sta $2112 ; plane 2 scroll y (last 3 bits) #$0 - #$07ff
sta $2113 ; plane 3 scroll x (first 8 bits)
sta $2113 ; plane 3 scroll x (last 3 bits) #$0 - #$07ff
sta $2114 ; plane 3 scroll y (first 8 bits)
sta $2114 ; plane 3 scroll y (last 3 bits) #$0 - #$07ff
lda #$80 ; increase vram address after writing to $2119
sta $2115 ; vram address increment register
lda #$00
sta $2116 ; vram address low
sta $2117 ; vram address high
sta $211a ; initial mode 7 setting register
sta $211b ; mode 7 matrix parameter a register (low)
lda #$01
sta $211b ; mode 7 matrix parameter a register (high)
lda #$00
sta $211c ; mode 7 matrix parameter b register (low)
sta $211c ; mode 7 matrix parameter b register (high)
sta $211d ; mode 7 matrix parameter c register (low)
sta $211d ; mode 7 matrix parameter c register (high)
sta $211e ; mode 7 matrix parameter d register (low)
lda #$01
sta $211e ; mode 7 matrix parameter d register (high)
lda #$00
sta $211f ; mode 7 center position x register (low)
sta $211f ; mode 7 center position x register (high)
sta $2120 ; mode 7 center position y register (low)
sta $2120 ; mode 7 center position y register (high)
sta $2121 ; color number register ($0-ff)
sta $2123 ; bg1 & bg2 window mask setting register
sta $2124 ; bg3 & bg4 window mask setting register
sta $2125 ; obj & color window mask setting register
sta $2126 ; window 1 left position register
sta $2127 ; window 2 left position register
sta $2128 ; window 3 left position register
sta $2129 ; window 4 left position register
sta $212a ; bg1, bg2, bg3, bg4 window logic register
sta $212b ; obj, color window logic register (or,and,xor,xnor)
lda #$01
sta $212c ; main screen designation (planes, sprites enable)
lda #$00
sta $212d ; sub screen designation
lda #$00
sta $212e ; window mask for main screen
sta $212f ; window mask for sub screen
lda #$30
sta $2130 ; color addition & screen addition init setting
lda #$00
sta $2131 ; add/sub sub designation for screen, sprite, color
lda #$e0
sta $2132 ; color data for addition/subtraction
lda #$00
sta $2133 ; screen setting (interlace x,y/enable sfx data)
lda #$00
sta $4200 ; enable v-blank, interrupt, joypad register
lda #$ff
sta $4201 ; programmable i/o port
lda #$00
sta $4202 ; multiplicand a
sta $4203 ; multiplier b
sta $4204 ; multiplier c
sta $4205 ; multiplicand c
sta $4206 ; divisor b
sta $4207 ; horizontal count timer
sta $4208 ; horizontal count timer msb (most significant bit)
sta $4209 ; vertical count timer
sta $420a ; vertical count timer msb
sta $420b ; general dma enable (bits 0-7)
sta $420c ; horizontal dma (hdma) enable (bits 0-7)
sta $420d ; access cycle designation (slow/fast rom)
;===========================================================================
; end of init routine
;===========================================================================
rep #$30 ; x,y,a fixed -> 16 bit mode
sep #$20 ; accumulator -> 8 bit mode
lda #(dp+0) ;load direct page
tcd ;store & and assign
lda #(plane_0>>8) ; screen map data @ vram location $1000
sta $2107 ; plane 0 map location register
lda #(plane_1>>8) ; screen map data @ vram location $1000
sta $2108 ; plane 1 map location register
lda #$22 ; plane 0 and plane 1 tile graphics @ $2000
sta $210b ; plane 0 tile graphics register
lda #$00 ; mode 0 value / tile mode
sta $2105 ; graphics mode register
lda #%00000011 ;
sta $212c ; plane enable register
lda #$00
sta $2121 ; set color number to 0 (background)
lda #$46 ; blue color, lower 8 bits
sta $2122 ; enter color value #$46 to color num. (low)
lda #$69 ; blue color, higher 8 bits
sta $2122 ; enter color value #$69 to color num. (high)
lda #$ff ; white color, lower 8 bits
sta $2122 ; write to next color number (01)
sta $2122 ; enter same value to color number (01)
ldx #$00
col_loop:
txa
sta $2121
lda #$00
sta $2122
lda #$7f
sta $2122
txa
ina
tax
cmp #$ff
beq col_loop
lda #$01
sta $4200 ; enable joypad read (bit one)
;==========================================================================
; start transfer of graphics to vram
;==========================================================================
ldx #(tile+0) ; assign vram location
stx $2116 ; writing to $2118/9 will store data here!
ldx #$0000
copychar:
lda.w charset,x ; get character set data (font data)
sta $2118 ; store bitplane 1
stz $2119 ; clear bitplane 2 and increase vram address
inx
cpx #$0200 ; transfer $0200 bytes
bne copychar
init_plane_0:
ldx #(plane_0+0) ; assign vram location $1000 to $2116/7
stx $2116
ldx #$0000
init_plane_0_loop:
lda.w text_0,x ; get ascii text data
and #$3f ; we only want the first 64 characters
; convert ascii to c64 screen code
sta $2118
stz $2119 ; clear unwanted bits, no h/v flipping
inx
cpx #$0400 ; transfer entire screen
; $20*$20=$0400 (1024 bytes)
bne init_plane_0_loop
init_plane_1:
ldx #(plane_1+0) ; assign vram location $1000 to $2116/7
stx $2116
ldx #$0000
init_plane_1_loop:
lda.w text_1,x ; get ascii text data
and #$3f ; we only want the first 64 characters
; convert ascii to c64 screen code
sta $2118
stz $2119 ; clear unwanted bits, no h/v flipping
inx
cpx #$0400 ; transfer entire screen
; $20*$20=$0400 (1024 bytes)
bne init_plane_1_loop
init_screen:
lda #$0f ; screen enabled, full brightness
sta $2100 ;
cli ; clear interrupt bit
init_scroll:
lda #$00
sta.w scrollval
init_col_reg:
lda #$00
sta.w col_reg
init_sineoffset:
lda #$00
sta.w sineoffset
call_hmda_setup:
jsr init_hdma_table0
jmp intro
main:
jsr wait_vbl
jsr sine_plane
jsr scroll_plane
jsr cycle_color
jsr joypad
jmp main
; test vertical interrupt
wait_vbl:
lda $4210 ; check for vertical blank
and #$80
beq wait_vbl
rts
; joypad poll
joypad:
lda $4212 ; is joypad ready to be read?
and #$0001
bne joypad ; no? go back until it is!
lda $4219 ; read joypad high byte
and #$10 ; leave only "start" bit
bne reset ; "start" pressed? go to reset
rts ; if not then jump back to loop
reset:
sep #$30
lda #$00
pha ; push #$00 to stack
plb ; pull #$00 from stack and make it the
; the programming bank
jmp init ; jump long to $008000
; gfx routine
; intro stuff
intro:
rep #$30
sep #$20
ldx #$f1
mosaic_l:
jsr wait_vbl
txa
sta $2106
sbc #$10
tax
cmp #$01
bne mosaic_l
stz $2106
fade:
ldy #$0f
fade_dark:
jsr wait_vbl
tya
sta $2100
dey
cpy #$0000
bne fade_dark
ldy #$0000
fade_light:
jsr wait_vbl
tya
sta $2100
iny
cpy #$000f
bne fade_light
jmp main
; scroll loop
scroll_plane:
lda.w scrollval
sta $210e
stz $210e
adc #$01
sta.w scrollval
cmp #$ff
beq restore_scroll
rts
restore_scroll:
lda #$00
sta.w scrollval
rts
; cycle loop
cycle_color:
ldx #$0000
lda.w col_reg,x
adc #$01
stz $2121
sta $2122
stz $2122
sta col_reg
cmp #$7f
bne cycle_c
lda #$0000
sta col_reg
cycle_c:
rts
sine_plane:
rep #$10
sep #$20
lda sineoffset
ina
sta sineoffset
cmp #$ff
bne sine_plane_c
lda #$00
sta sineoffset
sine_plane_c:
tay
ldx #$0000
sine_plane_l:
iny
cpy #$ff
bne sine_plane_l_c
lda #$00
tay
sine_plane_l_c:
inx
lda.w vsine,y
sta hdma_table0+3,x
inx
inx
cpx #$0180
bne sine_plane_l
rep #$30
sep #$20
rts
; init hdma list
init_hdma_table0:
rep #$10
sep #$20
ldy #$0000
ldx #$0000
;lda #$00
;sta sineoffset
lda #$30
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
sta hdma_table0,x
inx
init_hdma_table0_loop:
lda #$01
sta hdma_table0,x
inx
lda vsine,y
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
iny
cpx #$0183 ; (128 + 1) * 3 = 387 = 0x0183
bne init_hdma_table0_loop
lda #$20
sta hdma_table0,x
inx
lda #$00
sta hdma_table0,x
inx
sta hdma_table0,x
inx
sta hdma_table0,x
inx
sta hdma_table0,x
lda #$02
sta $4300
lda #$0f
sta $4301
ldx.w #hdma_table0
;ldx.w #test_hmda_table
stx $4302
lda #$00
sta $4304
lda #%00000001
sta $420c
rep #$30
sep #$20
rts
charset:
.db $55,$aa,$55,$aa,$55,$aa,$55,$aa ;'@'
.db $00,$3c,$66,$7e,$66,$66,$66,$00 ;'a'
.db $00,$7c,$66,$7c,$66,$66,$7c,$00 ;'b'
.db $00,$3c,$66,$60,$60,$66,$3c,$00 ;'c'
.db $00,$78,$6c,$66,$66,$6c,$78,$00 ;'d'
.db $00,$7e,$60,$78,$60,$60,$7e,$00 ;'e'
.db $00,$7e,$60,$78,$60,$60,$60,$00 ;'f'
.db $00,$3c,$66,$60,$6e,$66,$3c,$00 ;'g'
.db $00,$66,$66,$7e,$66,$66,$66,$00 ;'h'
.db $00,$3c,$18,$18,$18,$18,$3c,$00 ;'i'
.db $00,$1e,$0c,$0c,$0c,$6c,$38,$00 ;'j'
.db $00,$6c,$78,$70,$78,$6c,$66,$00 ;'k'
.db $00,$60,$60,$60,$60,$60,$7e,$00 ;'l'
.db $00,$63,$77,$7f,$6b,$63,$63,$00 ;'m'
.db $00,$66,$76,$7e,$7e,$6e,$66,$00 ;'n'
.db $00,$3c,$66,$66,$66,$66,$3c,$00 ;'o'
.db $00,$7c,$66,$66,$7c,$60,$60,$00 ;'p'
.db $00,$3c,$66,$66,$66,$3c,$0e,$00 ;'q'
.db $00,$7c,$66,$66,$7c,$6c,$66,$00 ;'r'
.db $00,$3e,$60,$3c,$06,$66,$3c,$00 ;'s'
.db $00,$7e,$18,$18,$18,$18,$18,$00 ;'t'
.db $00,$66,$66,$66,$66,$66,$3c,$00 ;'u'
.db $00,$66,$66,$66,$66,$3c,$18,$00 ;'v'
.db $00,$63,$63,$6b,$7f,$77,$63,$00 ;'w'
.db $00,$66,$3c,$18,$3c,$66,$66,$00 ;'x'
.db $00,$66,$66,$3c,$18,$18,$18,$00 ;'y'
.db $00,$7e,$0c,$18,$30,$60,$7e,$00 ;'z'
.db $00,$3c,$30,$30,$30,$30,$3c,$00 ;'['
.db $c0,$60,$30,$18,$0c,$06,$03,$00 ;'|'
.db $00,$3c,$0c,$0c,$0c,$0c,$3c,$00 ;']'
.db $10,$38,$6c,$c6,$00,$00,$00,$00 ;'^'
.db $00,$00,$00,$00,$00,$00,$00,$fe ;'_'
.db $00,$00,$00,$00,$00,$00,$00,$00 ;' '
.db $00,$18,$18,$18,$00,$00,$18,$00 ;'!'
.db $00,$66,$66,$00,$00,$00,$00,$00 ;'"'
.db $00,$66,$ff,$66,$ff,$66,$00,$00 ;'#'
.db $00,$08,$1c,$28,$28,$1c,$08,$00 ;'$'
.db $00,$64,$6c,$18,$30,$6c,$4c,$00 ;'%'
.db $00,$00,$18,$18,$7e,$18,$18,$00 ;'&'
.db $00,$0c,$18,$00,$00,$00,$00,$00 ;'''
.db $00,$18,$30,$30,$30,$18,$0c,$00 ;'('
.db $00,$18,$0c,$0c,$0c,$18,$30,$00 ;')'
.db $00,$66,$3c,$ff,$3c,$66,$00,$00 ;'*'
.db $00,$18,$18,$7e,$18,$18,$00,$00 ;'+'
.db $00,$00,$00,$00,$00,$18,$18,$30 ;','
.db $00,$00,$00,$fe,$00,$00,$00,$00 ;'-'
.db $00,$00,$00,$00,$00,$18,$18,$00 ;'.'
.db $03,$06,$0c,$18,$30,$60,$c0,$00 ;'/'
.db $00,$3c,$66,$6e,$76,$66,$3c,$00 ;'0'
.db $00,$18,$38,$18,$18,$18,$7e,$00 ;'1'
.db $00,$7c,$06,$0c,$30,$60,$7e,$00 ;'2'
.db $00,$7e,$06,$1c,$06,$66,$3c,$00 ;'3'
.db $00,$0e,$1e,$36,$7f,$06,$06,$00 ;'4'
.db $00,$7e,$60,$7c,$06,$66,$3c,$00 ;'5'
.db $00,$3e,$60,$7c,$66,$66,$3c,$00 ;'6'
.db $00,$7e,$06,$0c,$0c,$0c,$0c,$00 ;'7'
.db $00,$3c,$66,$3c,$66,$66,$3c,$00 ;'8'
.db $00,$3c,$66,$3e,$06,$66,$3c,$00 ;'9'
.db $00,$00,$18,$00,$00,$18,$00,$00 ;':'
.db $00,$00,$18,$00,$00,$18,$18,$30 ;';'
.db $18,$18,$18,$18,$18,$18,$18,$00 ;'<'
.db $00,$00,$7e,$00,$7e,$00,$00,$00 ;'='
.db $18,$18,$0c,$0c,$0c,$0c,$18,$18 ;'>'
.db $00,$7c,$06,$0c,$18,$00,$18,$00 ;'?'
; 12345678901234567890123456789012
text_0:
.db "| _ _ |"
.db "| ___ _ __ | |_(_)_ ____ __|"
.db "| / _ \| '_ \| __| \ \/ /\ \/ /|"
.db "|| (_) | |_) | |_| |> < > < |"
.db "| \___/| .__/ \__|_/_/\_\/_/\_\|"
.db "| |_| |"
.db "| |"
.db "| |"
.db "| |"
.db "| OPTIXX ONCE A AGAIN |"
.db "| WITH A CLASSIS CONSOL |"
.db "| PIECE OF CODE... |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
.db "| |"
text_1:
.REPT 20
.db "| _ _ |"
.db "| ___ _ __ | |_(_)_ ____ __|"
.db "| / _ \| '_ \| __| \ \/ /\ \/ /|"
.db "|| (_) | |_) | |_| |> < > < |"
.db "| \___/| .__/ \__|_/_/\_\/_/\_\|"
.db "| |_| |"
.db "| |"
.ENDR
vsine:
.db 108,109,111,112,113,114,115,115,116,117,118,119,120,120,121
.db 122,122,123,123,124,124,125,125,125,126,126,126,127,127,127
.db 127,127,127,127,127,127,127,127,126,126,126,125,125,125,124
.db 124,123,123,122,122,121,120,120,119,118,117,116,115,115,114
.db 113,112,111,109,108,107,106,105,104,103,101,100,99,97,96,95
.db 93,92,91,89,88,86,85,83,82,80,79,77,76,74,73,71,70,68,67,65
.db 64,62,60,59,57,56,54,53,51,50,48,47,45,44,42,41,39,38,36,35
.db 34,32,31,30,28,27,26,24,23,22,21,20,19,18,16,15,14,13,12,12
.db 11,10,9,8,7,7,6,5,5,4,4,3,3,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0
.db 0,1,1,1,2,2,2,3,3,4,4,5,5,6,7,7,8,9,10,11,12,12,13,14,15,16
.db 18,19,20,21,22,23,24,26,27,28,30,31,32,34,35,36,38,39,41,42
.db 44,45,47,48,50,51,53,54,56,57,59,60,62,64,65,67,68,70,71,73
.db 74,76,77,79,80,82,83,85,86,88,89,91,92,93,95,96,97,99,100,101
.db 103,104,105,106,107
vsine_end:
.ENDS
.BANK $04 SLOT 6
.ORGA $8000
long_label:
nop
nop
rts
.BANK $01 SLOT 6
.ORGA $8000
.BASE $01
.INCLUDE "music.s"
.BANK $02 SLOT 6
.ORG $0000
music_data_1:
.INCBIN "music1.bin"
.BANk $03 SLOT 6
.ORG $0000
music_data_2:
.INCBIN "music2.bin"

90
snes/ascii/sinegen.py Normal file
View File

@ -0,0 +1,90 @@
import string
import math
import sys
M_PI = 3.14159265358979323846
def writefile(fp,val):
global out,el
if not len(out):
out = " .db "
el+=1
out += "$%02x," % val
if el == cnt/8 :
out=out[:-1]
out+="\n"
fp.write(out)
out =""
el=0
def sine(val,r,scale,stepping):
global M_PI,flip
re = int(math.sin(val*(M_PI*scale)/r)*r) + r
re = re & 0xff
if flip and val%2:
re = (r*2) - re
re = re * stepping
#print "sine %s -> %s " % (val,re)
return re
def main():
global cnt,flip
asmfile = sys.argv[1]
basename = string.replace(asmfile,".s","")
cnt = int(sys.argv[2])
upper = int(sys.argv[3])
if len(sys.argv) >= 5:
stepping = int(sys.argv[4])
else:
stepping = 1
if len(sys.argv) >= 6 and sys.argv[5]=='flip':
flip = 1
else:
flip = 0
half = int(cnt) / 2
if cnt%8:
print "ctn should be modulo 8"
sys.exit(1)
fp = open(asmfile,'w')
out = "\n\n\n%s:\n\n" % (basename)
fp.write(out)
out = ""
for i in range(0,cnt):
writefile(fp,sine(i,upper/2,(float(upper)/cnt),stepping))
out = str()
el = 0
if __name__ == '__main__':
if len(sys.argv) >= 4:
main()
else:
print "usage: %s filename cnt(int) upper(int) [stepping (int)] ['flip']" % sys.argv[0]

13
snes/ascii/test.s Normal file
View File

@ -0,0 +1,13 @@
test:
.db $30,$2f,$32,$2d,$34,$2b,$37,$28,$39,$26,$3b,$24,$3d,$21,$40,$1f,$42,$1d,$44,$1b,$46,$19,$48,$17,$4a,$15,$4c,$13,$4e,$11,$50,$0f
.db $51,$0e,$53,$0c,$55,$0b,$56,$09,$57,$08,$59,$07,$5a,$06,$5b,$05,$5c,$04,$5d,$03,$5d,$02,$5e,$02,$5f,$01,$5f,$01,$5f,$01,$5f,$01
.db $60,$01,$5f,$01,$5f,$01,$5f,$01,$5f,$02,$5e,$02,$5d,$03,$5d,$04,$5c,$05,$5b,$06,$5a,$07,$59,$08,$57,$09,$56,$0b,$55,$0c,$53,$0e
.db $51,$0f,$50,$11,$4e,$13,$4c,$15,$4a,$17,$48,$19,$46,$1b,$44,$1d,$42,$1f,$40,$21,$3d,$24,$3b,$26,$39,$28,$37,$2b,$34,$2d,$32,$2f
.db $30,$31,$2e,$33,$2c,$35,$29,$38,$27,$3a,$25,$3c,$23,$3f,$20,$41,$1e,$43,$1c,$45,$1a,$47,$18,$49,$16,$4b,$14,$4d,$12,$4f,$10,$51
.db $0f,$52,$0d,$54,$0b,$55,$0a,$57,$09,$58,$07,$59,$06,$5a,$05,$5b,$04,$5c,$03,$5d,$03,$5e,$02,$5e,$01,$5f,$01,$5f,$01,$5f,$01,$5f
.db $00,$5f,$01,$5f,$01,$5f,$01,$5f,$01,$5e,$02,$5e,$03,$5d,$03,$5c,$04,$5b,$05,$5a,$06,$59,$07,$58,$09,$57,$0a,$55,$0b,$54,$0d,$52
.db $0f,$51,$10,$4f,$12,$4d,$14,$4b,$16,$49,$18,$47,$1a,$45,$1c,$43,$1e,$41,$20,$3f,$23,$3c,$25,$3a,$27,$38,$29,$35,$2c,$33,$2e,$31

13
snes/ascii/vsine_1.s Normal file
View File

@ -0,0 +1,13 @@
vsine_1:
.db $30,$31,$32,$33,$34,$35,$37,$38,$39,$3a,$3b,$3c,$3d,$3f,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$50,$51
.db $51,$52,$53,$54,$55,$55,$56,$57,$57,$58,$59,$59,$5a,$5a,$5b,$5b,$5c,$5c,$5d,$5d,$5d,$5e,$5e,$5e,$5f,$5f,$5f,$5f,$5f,$5f,$5f,$5f
.db $60,$5f,$5f,$5f,$5f,$5f,$5f,$5f,$5f,$5e,$5e,$5e,$5d,$5d,$5d,$5c,$5c,$5b,$5b,$5a,$5a,$59,$59,$58,$57,$57,$56,$55,$55,$54,$53,$52
.db $51,$51,$50,$4f,$4e,$4d,$4c,$4b,$4a,$49,$48,$47,$46,$45,$44,$43,$42,$41,$40,$3f,$3d,$3c,$3b,$3a,$39,$38,$37,$35,$34,$33,$32,$31
.db $30,$2f,$2e,$2d,$2c,$2b,$29,$28,$27,$26,$25,$24,$23,$21,$20,$1f,$1e,$1d,$1c,$1b,$1a,$19,$18,$17,$16,$15,$14,$13,$12,$11,$10,$0f
.db $0f,$0e,$0d,$0c,$0b,$0b,$0a,$09,$09,$08,$07,$07,$06,$06,$05,$05,$04,$04,$03,$03,$03,$02,$02,$02,$01,$01,$01,$01,$01,$01,$01,$01
.db $00,$01,$01,$01,$01,$01,$01,$01,$01,$02,$02,$02,$03,$03,$03,$04,$04,$05,$05,$06,$06,$07,$07,$08,$09,$09,$0a,$0b,$0b,$0c,$0d,$0e
.db $0f,$0f,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1d,$1e,$1f,$20,$21,$23,$24,$25,$26,$27,$28,$29,$2b,$2c,$2d,$2e,$2f

13
snes/ascii/vsine_2.s Normal file
View File

@ -0,0 +1,13 @@
vsine_2:
.db $30,$2f,$32,$2d,$34,$2b,$37,$28,$39,$26,$3b,$24,$3d,$21,$40,$1f,$42,$1d,$44,$1b,$46,$19,$48,$17,$4a,$15,$4c,$13,$4e,$11,$50,$0f
.db $51,$0e,$53,$0c,$55,$0b,$56,$09,$57,$08,$59,$07,$5a,$06,$5b,$05,$5c,$04,$5d,$03,$5d,$02,$5e,$02,$5f,$01,$5f,$01,$5f,$01,$5f,$01
.db $60,$01,$5f,$01,$5f,$01,$5f,$01,$5f,$02,$5e,$02,$5d,$03,$5d,$04,$5c,$05,$5b,$06,$5a,$07,$59,$08,$57,$09,$56,$0b,$55,$0c,$53,$0e
.db $51,$0f,$50,$11,$4e,$13,$4c,$15,$4a,$17,$48,$19,$46,$1b,$44,$1d,$42,$1f,$40,$21,$3d,$24,$3b,$26,$39,$28,$37,$2b,$34,$2d,$32,$2f
.db $30,$31,$2e,$33,$2c,$35,$29,$38,$27,$3a,$25,$3c,$23,$3f,$20,$41,$1e,$43,$1c,$45,$1a,$47,$18,$49,$16,$4b,$14,$4d,$12,$4f,$10,$51
.db $0f,$52,$0d,$54,$0b,$55,$0a,$57,$09,$58,$07,$59,$06,$5a,$05,$5b,$04,$5c,$03,$5d,$03,$5e,$02,$5e,$01,$5f,$01,$5f,$01,$5f,$01,$5f
.db $00,$5f,$01,$5f,$01,$5f,$01,$5f,$01,$5e,$02,$5e,$03,$5d,$03,$5c,$04,$5b,$05,$5a,$06,$59,$07,$58,$09,$57,$0a,$55,$0b,$54,$0d,$52
.db $0f,$51,$10,$4f,$12,$4d,$14,$4b,$16,$49,$18,$47,$1a,$45,$1c,$43,$1e,$41,$20,$3f,$23,$3c,$25,$3a,$27,$38,$29,$35,$2c,$33,$2e,$31