How to assemble a bigger (>8 KB) cartridge image?

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How to assemble a bigger (>8 KB) cartridge image?

Post by Mike »

MrSterlingBS wrote:I will take a look at the other assemblers.
Yes, please definitely do that! See below:
ChibiAkumas is not the biggest expert for the 6502 and VIC, but his videos, source code and tools are good for me at the moment.
I also made a quick look of the YT video regarding bitmap graphics.

I am sorry, but this video is a strain to watch. They're approaching the VIC-20 hardware with a mindset belonging to platforms with a Z80 CPU. The few parts of the source code concerning the VIC-20 are buried within lots of preprocessor #ifdefs for other platforms, which is not helpful to get an overview. In the name of "portability", they arrive at the lowest common denominator, and what they tell about VIC-20 graphics has been superceded by improved methods (shown here in Denial) that have been around for more than one decade. For API level, OS conformant bitmap graphics on the VIC-20, MINIGRAFIK and its assorted tools are still State of the Art.
If i am a better 6502/VIC coder in the future, maybe, i think i change the tool.
You should probably make the switch immediately, before your current tool set lets you strand on an island, so to speak. When it comes to (cross-)assemblers, ACME, xa65, ca65, DASM ... for any of them you can ask questions here, and you will get an answer. And there is nothing wrong about taking other people programs, dissecting them, and then transferring the findings to new, own code.

It should go without saying, that one good way to learn programming is actually doing it. Preferably with reliable sources and examples. One book I seriously recommend is "VC-20 intern" from Data Becker, in German. It contains lots of info about the VIC-20 hardware and software, about the memory map (zeropage, OS workspace, application memory, I/O registers, etc.) and a fully commented listing of the ROM (BASIC and KERNAL). Over at Forum64, they provide the "F64 Wolke" where that book can be downloaded as *.pdf (you'll need to do a few introductory postings though to be granted access).
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: How to assemble a bigger (>8 KB) cartridge image?

Post by chysn »

I'm not sure what tools you're using, but xa has this cool trick for generating padding:

Code: Select all

; Start code at Block 1
* = $2000
Welcome: etc...

end_of_code:
* = $a000
.dsb (*-end_of_code)
* = $a000

.word Welcome       ; Welcome Screen
.word Restart       ; NMI Address
.byte $41,$30,$c3,$c2,$cd

Restart: etc...

MaybeAdditionalCode: etc...
It works like this... the label end_of_code is defined as (of course) the end of your code. The next line sets the program counter to the start of Block 5. The next line puts a number of data bytes equal to $a000 minus end_of_code. If no additional parameters are provided to the .dsb pseudo-op, it just uses $00 for the padding. This will pad over character ROM, etc., but that doesn't matter. The next line resets the program counter to $a000, and you add the auto-start data. What you wind up with is a binary file that's up to 40K, with an 8K "hole" in it.

The auto-start code will be in the right place, as long as the emulator starts the image at $2000.

For my cartridge game The Archivist (which is 24K), I used a shell script to chop up the program and lay it out for an MCes Jolly Cartridge, but that's only required for physically burning an image onto a 27C512 chip.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5

WIP: MIDIcast BASIC extension

he/him/his
User avatar
MrSterlingBS
Vic 20 Enthusiast
Posts: 174
Joined: Tue Jan 31, 2023 2:56 am
Location: Germany,Braunschweig

Re: How to assemble a bigger (>8 KB) cartridge image?

Post by MrSterlingBS »

Thank you very much for your help.
My tools are Not so common here in the Forum and i like to Change it. What do you mean with xa?
WaX Assembler?
User avatar
chysn
Vic 20 Scientist
Posts: 1205
Joined: Tue Oct 22, 2019 12:36 pm
Website: http://www.beigemaze.com
Location: Michigan, USA
Occupation: Software Dev Manager

Re: How to assemble a bigger (>8 KB) cartridge image?

Post by chysn »

MrSterlingBS wrote: Tue Mar 07, 2023 9:34 am Thank you very much for your help.
My tools are Not so common here in the Forum and i like to Change it. What do you mean with xa?
WaX Assembler?
For cross assembly (development for VIC on a modern computer), I use Andre Fachat's xa: https://www.floodgap.com/retrotech/xa/

Different folks will recommend different ones, but I got used to xa, and it gets my job done. And it's still actively maintained, which is a huge bonus. It nicely supports my shell-script-oriented toolchain and build process. There's also an accompanying disassembler, dxa, but I've only used that a handful of times.

Lots of people like CBM Studio, but I'm on a Mac so I can't use it (or... at least it's not a compelling reason to virtualize Windows).

Somewhere around here, there are one or more discussions about cross assemblers.

wAx, on the other hand, is a native assembler/disassembler. I usually use it for two things: (1) debugging code that I already wrote with xa, and (2) whipping up proofs-of-concept that I want to try right now. When I post code examples in Denial, I'll usually bash them out with wAx first to avoid dumb errors, even if they're just a few lines.
Post Reply