mirror of
https://github.com/robmcmullen/asmgen.git
synced 2025-02-19 08:30:25 +00:00
Added -n argument to specify name of generated subroutine so I don't have to keep changing my test source when changing sprites
This commit is contained in:
parent
3fd63c71d4
commit
9b9ebfcb0f
@ -167,7 +167,7 @@ class Listing(object):
|
||||
|
||||
|
||||
class Sprite(Listing):
|
||||
def __init__(self, pngfile, assembler, screen, xdraw=False, processor="any"):
|
||||
def __init__(self, pngfile, assembler, screen, xdraw=False, processor="any", name=""):
|
||||
Listing.__init__(self, assembler)
|
||||
self.screen = screen
|
||||
|
||||
@ -176,7 +176,9 @@ class Sprite(Listing):
|
||||
|
||||
self.xdraw = xdraw
|
||||
self.processor = processor
|
||||
self.niceName = slugify(os.path.splitext(pngfile)[0])
|
||||
if not name:
|
||||
name = os.path.splitext(pngfile)[0]
|
||||
self.niceName = slugify(name)
|
||||
self.width = pngdata[0]
|
||||
self.height = pngdata[1]
|
||||
self.pixelData = list(pngdata[2])
|
||||
@ -627,6 +629,7 @@ if __name__ == "__main__":
|
||||
parser.add_argument("-a", "--assembler", default="cc65", choices=["cc65","mac65"], help="Assembler syntax (default: %(default)s)")
|
||||
parser.add_argument("-p", "--processor", default="any", choices=["any","6502", "65C02"], help="Processor type (default: %(default)s)")
|
||||
parser.add_argument("-s", "--screen", default="hgrcolor", choices=["hgrcolor","hgrbw"], help="Screen format (default: %(default)s)")
|
||||
parser.add_argument("-n", "--name", default="", help="Name for generated assembly function (default: based on image filename)")
|
||||
parser.add_argument("files", metavar="IMAGE", nargs="*", help="a PNG image [or a list of them]. PNG files must not have an alpha channel!")
|
||||
options, extra_args = parser.parse_known_args()
|
||||
|
||||
@ -652,7 +655,7 @@ if __name__ == "__main__":
|
||||
|
||||
for pngfile in options.files:
|
||||
try:
|
||||
listings.append(Sprite(pngfile, assembler, screen, options.xdraw, options.processor))
|
||||
listings.append(Sprite(pngfile, assembler, screen, options.xdraw, options.processor, options.name))
|
||||
except RuntimeError, e:
|
||||
print "%s: %s" % (pngfile, e)
|
||||
sys.exit(1)
|
||||
|
11
Makefile.rob
11
Makefile.rob
@ -1,12 +1,15 @@
|
||||
COLORSPRITE = apple.png
|
||||
BWSPRITE = apple.png
|
||||
|
||||
all: bwtest.dsk colortest.dsk
|
||||
|
||||
bwtest.dsk:
|
||||
python HiSprite.py -a mac65 -p 6502 -s hgrbw apple.png -t -c -r > apple.s
|
||||
bwtest.dsk: HiSprite.py bwtest.s $(BWSPRITE)
|
||||
python HiSprite.py -a mac65 -p 6502 -s hgrbw $(BWSPRITE) -n bwsprite -t -c -r > bwsprite.s
|
||||
atasm -obwtest.xex bwtest.s -Lbwtest.var -gbwtest.lst
|
||||
atrcopy bwtest.dsk boot -b bwtest.xex --brun 6000 -f
|
||||
|
||||
colortest.dsk: colortest.s boxw_mix.png
|
||||
python HiSprite.py -a mac65 -p 6502 -s hgrcolor boxw_mix.png -t -c -r > boxw_mix.s
|
||||
colortest.dsk: HiSprite.py colortest.s $(COLORSPRITE)
|
||||
python HiSprite.py -a mac65 -p 6502 -s hgrcolor $(COLORSPRITE) -n colorsprite -t -c -r > colorsprite.s
|
||||
atasm -ocolortest.xex colortest.s -Lcolortest.var -gcolortest.lst
|
||||
atrcopy colortest.dsk boot -b colortest.xex --brun 6000 -f
|
||||
|
||||
|
4
bwtest.s
4
bwtest.s
@ -47,7 +47,7 @@ draw
|
||||
lda #100
|
||||
sta PARAM0 ; x coord
|
||||
|
||||
jsr APPLE
|
||||
jsr BWSPRITE
|
||||
|
||||
wait
|
||||
jmp wait
|
||||
@ -71,4 +71,4 @@ clr1
|
||||
bcc clr1
|
||||
rts
|
||||
|
||||
.include apple.s
|
||||
.include bwsprite.s
|
||||
|
@ -47,7 +47,7 @@ draw
|
||||
lda #100
|
||||
sta PARAM0 ; x coord
|
||||
|
||||
jsr BOXW_MIX
|
||||
jsr COLORSPRITE
|
||||
|
||||
wait
|
||||
jmp wait
|
||||
@ -71,4 +71,4 @@ clr1
|
||||
bcc clr1
|
||||
rts
|
||||
|
||||
.include boxw_mix.s
|
||||
.include colorsprite.s
|
||||
|
Loading…
x
Reference in New Issue
Block a user