Software for the 65Org16.x (formerly 6502 SoC Project)

Topics relating to PALs, CPLDs, FPGAs, and other PLDs used for the support or creation of 65-family processors, both hardware and HDL.
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

Way above my head, sorry.
I assume you're talking about modifying an .exe file?
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Post by Arlet »

ElEctric_EyE wrote:
Way above my head, sorry.
I assume you're talking about modifying an .exe file?
No. You mentioned nmake, so I figured you were already using a makefile. The makefile is a small text file that nmake uses to figure out what to build, when to build it, and what tools to use.
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

Ok, yes I see that now.
Bitwise has shown me how to modify it to extend the pure binary file size. Now I'll try what you suggested. Doesn't like the syntax I've entered from your example, but I'll mess with it for abit..

EDIT: Added link, corrected link, recorrected.
Last edited by ElEctric_EyE on Wed Oct 26, 2011 5:15 pm, edited 3 times in total.
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

I forgot the TAB...
Something is working, no errors. But it isn't creating the .bin or .coe
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

Ok, here is the Makefile:

Code: Select all

#===============================================================================
# Portable 6502/65C02/65816 Assembler Definitions
#-------------------------------------------------------------------------------

# Update the followiung line to reflect where you have installed the ZIP file
# containing the JAVA classes.

65016_DIR	=	.

#===============================================================================

65016_JAR	=	$(65016_DIR)/65016.jar

AS65_CLASS	=	org.x6502.x65016.As65016

LK65_CLASS	=	org.x6502.x65016.Lk65016

LB65_CLASS	=	org.x6502.x65016.Lb65016

AS65		=	java -cp $(65016_JAR) $(AS65_CLASS)

LK65		=	java -cp $(65016_JAR) $(LK65_CLASS)

LB65		=	java -cp $(65016_JAR) $(LB65_CLASS)

RM		=	erase

#===============================================================================
# Rules
#-------------------------------------------------------------------------------

.asm.obj:
	$(AS65) $(AS65_FLAGS) $<
	
#===============================================================================
# Configuration
#-------------------------------------------------------------------------------

OBJS	= \
	boot.obj
	
LK65_FLAGS = \
	-bss $$00010000-$$EFFFFFFF -code $$FFFFE000-$$FFFFFFFF

#===============================================================================
# Targets
#-------------------------------------------------------------------------------

all:	boot.s19 boot.hex boot.bin boot.coe


boot.s19: $(OBJS)
	$(LK65) $(LK65_FLAGS) -s19 -output $@ $(OBJS)

boot.hex: $(OBJS)
	$(LK65) $(LK65_FLAGS) -hex -output $@ $(OBJS)

boot.bin: $(OBJS)
	$(LK65) $(LK65_FLAGS) -bin -output $@ $(OBJS)

#===============================================================================
# Utilities
#-------------------------------------------------------------------------------

clean:
	$(RM) $(OBJS)
	$(RM) *.bin
	$(RM) *.s19
	$(RM) *.lst
	$(RM) *.map
	$(RM) *.coe
#===============================================================================
# Dependencies
#-------------------------------------------------------------------------------

boot.obj: \
	boot.asm

boot.bin: boot.coe
	bin2coe -2 boot
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

I'm tempted to say that should be the other way around:

Code: Select all

boot.coe: boot.bin
because makefiles take the form

Code: Select all

to make something: you need this and that
      mangle this and that making something
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

BigEd wrote:
I'm tempted to say that should be the other way around:

Code: Select all

boot.coe: boot.bin
because makefiles take the form

Code: Select all

to make something: you need this and that
      mangle this and that making something
You are correct BigEd! It finally works!!!
Putting Arlet's bin2coe.exe inside of Bitwises' 65016 Folder, with the following Makefile does indeed create an 8Kx16 "boot.coe" file necessary for generating a ROM for the ISE Core Generator. Using the "nmake" command will now make the .bin file and the .coe file as Arlet originally suggested. So anyone can check the .bin in a hex editor, and check the .coe in a text editor and compare against the original boot.asm...
Many Thanks Gentlemen!

Code: Select all

LB65_CLASS	=	org.x6502.x65016.Lb65016

AS65		=	java -cp $(65016_JAR) $(AS65_CLASS)

LK65		=	java -cp $(65016_JAR) $(LK65_CLASS)

LB65		=	java -cp $(65016_JAR) $(LB65_CLASS)

RM		=	erase

#===============================================================================
# Rules
#-------------------------------------------------------------------------------

.asm.obj:
	$(AS65) $(AS65_FLAGS) $<
	
#===============================================================================
# Configuration
#-------------------------------------------------------------------------------

OBJS	= \
	boot.obj
	
LK65_FLAGS = \
	-bss $$00010000-$$EFFFFFFF -code $$FFFFE000-$$FFFFFFFF

#===============================================================================
# Targets
#-------------------------------------------------------------------------------

all:	boot.s19 boot.hex boot.bin boot.coe


boot.s19: $(OBJS)
	$(LK65) $(LK65_FLAGS) -s19 -output $@ $(OBJS)

boot.hex: $(OBJS)
	$(LK65) $(LK65_FLAGS) -hex -output $@ $(OBJS)

boot.bin: $(OBJS)
	$(LK65) $(LK65_FLAGS) -bin -output $@ $(OBJS)

#===============================================================================
# Utilities
#-------------------------------------------------------------------------------

clean:
	$(RM) $(OBJS)
	$(RM) *.bin
	$(RM) *.s19
	$(RM) *.lst
	$(RM) *.map
	$(RM) *.coe

#===============================================================================
# Dependencies
#-------------------------------------------------------------------------------

boot.obj: \
	boot.asm

boot.coe: boot.bin
	bin2coe -2 boot
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

It does work, but I have to delete all the files it makes before I run it again.
User avatar
BitWise
In Memoriam
Posts: 996
Joined: 02 Mar 2004
Location: Berkshire, UK
Contact:

Post by BitWise »

ElEctric_EyE wrote:
It does work, but I have to delete all the files it makes before I run it again.
Make checks the timestamps of the referenced files to determine of anything has changed. It only rebuilds when it needs to.

To force a rebuild you need to update the timestamp on the source file (e.g. make a simple edit and re-save - On unix there is a 'touch' command to update a file's timestamp)
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
User avatar
Arlet
Posts: 2353
Joined: 16 Nov 2010
Location: Gouda, The Netherlands
Contact:

Post by Arlet »

ElEctric_EyE wrote:
It does work, but I have to delete all the files it makes before I run it again.
Yes, that's the idea behind 'make'. You write a 'makefile' with all the dependencies in the form Ed suggested, and the 'make' program figures out what to do.

So, if you say that 'file.coe' depends on 'file.bin', and 'file.bin' hasn't changed, it knows that 'file.coe' is still valid, and it won't build it again.

As long as you've correctly stated all your dependencies, you don't have to delete any files to force a remake.
Tor
Posts: 597
Joined: 10 Apr 2011
Location: Norway/Japan

Post by Tor »

ElEctric_EyE wrote:
It does work, but I have to delete all the files it makes before I run it again.
In addition to what Arlet said about getting dependencies right, you also have a 'clean' target in your makefile, which means you can delete all the files in one go: 'make clean' (or is it 'nmake clean' on your platform? Anyway, that's the method for executing a specific target in the makefile. If you don't specify any then it'll choose the first (topmost) one, which is that 'all:' target in your case.)

-Tor
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

I think also you can use

Code: Select all

  NMAKE /A
or, if you're using GNU make

Code: Select all

  make -B
to ask it to do everything regardless of timestamps - in a small case like this, that's reasonable. In a bigger project, that means it's time for a cup of tea or a walk around the block.

(You wouldn't normally need to do this, if you've written your rules right, but it can be useful.)

Cheers
Ed
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

Ok, I understand now. I did a couple of tests... I guess I didn't realize before running NMAKE that it would not have "gone through the paces" if the code was not modified, since I was always modifying the boot.asm and running NMAKE as a normal procedure.
It's nice to know this part of the project is all running as it should. Now I'll go back to concentrating on problems I am having elsewhere.
Trying to bring a few parts together here, but it's good to have knowledgeable help, thanks for all the input. :)
ElEctric_EyE
Posts: 3260
Joined: 02 Mar 2009
Location: OH, USA

Post by ElEctric_EyE »

I'm focusing now on a 4Kx8 bit of programming called HESMON. It has the same features as Micromon and SuperMON and after skimming through it quickly now many times, I'll feel more comfortable trying to modify it. I've run the image I have through VICE and it works.

It has a couple calls to the C64 Basic ROM. I will have to look at these first and foremost....
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

A word of caution: these VIC20 and C64 monitors might make assumptions about having a certain layout of display, especially if they offer scrolling views of memory. You'll be fine if you have a layout just like a C64 of course.

(Over the weekend I had a quick look at 'sykes', an obfuscated C PET emulator for the 2005 contest. It has a small 6502 test suite, but sadly that doesn't have a readily separable I/O routine: it expects to handle a character-mapped display at $8000.)

Cheers
Ed
Post Reply