Posted on Leave a comment

key basic concepts

Are you read to program? Can you answer these questions?
Who’s mom makes the best mustard pie?

Concepts

Memory locations are expressed in hexadecimal notation. While data and variables are often expressed in decimal notation.

$ indicates hex value

Lockers

Each memory location is one byte and can hold only one thing. Each is individually numbered in hexadecimal. They can hold either data, or program instructions.

You’ve got 32k to work with, that’s 32768 “lockers” sequentially numbered from

Cartridge ROM:
$0000 to $7FFF

Available RAM:
$C880 to $CBFF or $C800 to $C8FF if you’d like to direct address all your RAM using double plays.

6809 built-in instructions

Format
Locker # instruction ;for example
$1000 deca ;deca is a mnemonic for a numbered instruction.

?: is the locker # essentially a line number?
Most locker ##’s are left out for the assembler to deal with. It can count, and account for instructions that take up more than one byte. We just tell it where to start.

ORG $0000 ;tells assembler to begin putting program code in mem location $0000

Constants

user_RAM        EQU     $C880 ;"EQU

EQU simply means equals. In this example, user_RAM is now a defined constant.

Registers

Registers are Vecto’s pockets. When data are in lockers, you can’t manipulate them, but once inside your pockets, you can play pool.

A,B,D,X,Y,U,S,PC,DP and CC

A = 1 byte, general-purpose register
B = 1 byte, general-purpose register
D = 2 byte combo of A & B
X & Y, both 2 byte registers used as pointers for for indexed-mode instructions
U & S, stack pointers
PC = program counter
DP = double play for direct addressing
CC = condition code (0, negative, carry, or borrow.)

Some Instructions

LD = load
LDA means load a value into register A
Putting the number “3” in register A would be done thusly: LDA #3

ST = store
STA $C880 means store contents of register A into mem loc $C880

DECA decreases the value of Reg A by 1
INCA increases Reg A by 1
These only work directly on registers A and B, in so-called “inherent” addressing mode.”

Addressing modes for instruction data handling

(alternate targets for the instruction)

  • Inherent (self-contained and takes no further arguments)
  • Immediate (target of the instruction is an actual value that will follow the instruction immediately)
  • Extended (means target is a memory location)
  • Direct (uses a 1 byte shortcut)
  • Indexed

Addressing mode examples:

LDA #$00 = immediate (loads value 0 into register A)

LDA $C880 = extended (loads contents of locker $C880 into register A)

DECA = inherent (decreases the A register by 1)

LDA #$C8
TFR A,DP
LDA $80

the above code demonstrates the use of direct mode. By transferring the memory location prefix $C8 into double play mode (DP,) LDA$80 saves two strokes and is equivalent to LDA $C880.

Program counter flow-altering instructions

  • BCC
  • BCS
  • BEQ
  • BGE
  • BGT
  • BHI
  • BHS
  • BLE
  • BLO
  • BLS
  • BLT
  • BMI
  • BNE
  • BPL
  • BRA
  • BRN
  • BSR
  • BVC
  • BVS
  • JMP
  • JSR

JMP is jump. BRA is branch. Both are unconditional jumps. BRA is preferred when possible because it saves 1byte (jump takes 3, branch takes 2) but BRA only works for locations 127 bytes ahead or behind.

My gut is telling me to always use JMP because as the program expands locations close to the 127 limit may later get pushed beyond that 127. I would save changing JMP to BRA for final code optimization if the finished .bin maxes out 32k.

JSR = “jump to subroutine.”
BSR = “branch to subroutine.” (has same 127 byte ‘ahead or behind’ limit as BRA)
RTS = “return from subroutine.”

All the remaining program counter manoeuvre’s are conditional.

Condition codes

Condition code bits are:  Half Carry (H), Negative (N), Zero (Z), Overflow (V) and
Carry (C).

BEQ = Branch on equal
BNE = Branch if NOT EQUAL

Relative vs. Absolute
BRA, BEQ, and anything that starts with “B” or “LB” for long branch is RELATIVELY positioned while JMP and JSR are ABSOLUTEly positioned.

The number of bytes to jump is determined at the time of assembly.

Weirdness alert!

You cannot branch (BRA) and jump (JMP) to the same labeled address within the same program. Chose one or the other but don’t mix. The assembler can’t deal. Chris T saved you from a mindless troubleshooting nightmare with that tip.

Looping

Here are Chris’s instructions for performing a loop 5 times.

loop_variable EQU $C880 ;Create a variable for looping
LDA #$05 ;Initialise our loop
STA loop_variable ;variable with a value of 5
loop_start: ;This is the label at the start of the loop
LDA $C880 ;These are the instructions we want to repeat 5 times
STA $C881 ;These are the instructions we want to repeat 5 times
DEC loop_variable ;Subtract the loop_variable by 1
BNE loop_start ;If the loop variable is not Zero, jump to loop_start

I’m guessing line 2 doesn’t need the dollar sign and it should really be LDA #05 (?)

 

Posted on Leave a comment

John Dondzila

An Interview with John Dondzila by Michael Thomasson, retrieved from GoodDealGames.com.

John Dondzila of Classic Gaming Creations is a  modern day programmer of classic gaming consoles. He has coded for the Vectrex, Odyssey2, and the Colecovision.

Describe a memorable game-related anecdote?

Uhh, probably not good for my PR, but in my teen years I broke into a “Breakout”.

What inspired you to start creating new titles?

I was tired of listening to loads of “talk” from all the individuals
who were going to build RAMCarts, development systems, yadda yadda
yadda and write their own games.

I am a do’er, not a talker.

What is the typical development time for your creations?

Depends on time and motivation. Vector Vaders took 4 days (with no Vectrex
programming experience), Patriots about a month, Vecmania has
been on and off for the past year and a half (has it been that
long ?) I’m a lot busier than I used to be and don’t have much
free time.

What differences have you found between programming for the Vectrex
and the Colecovision?

Both have their ups and downs. I’ve always been more fond of Motorola
CPUs over Intel. Vectrex sound is easier to code, graphics are
more or less easy as well. Coleco graphics are nasty. 3 different
screen modes and the only source of reference was the graphics
chip programming manual which is as confusing as why Donny & Marie
are still so popular.

You didn’t ask about the Odyssey 2 – did I mention it’s almost as
painful to program as an Atari 2600 ?

Your Odyssey 2 multicart is a nice piece of work. Have you done
any further O2 programming?

Just AMOK! although I will eventually do another O2 game.

What is your production run for each title? Is there a finite
amount? Do you keep track of who owns which cartridges?

I’ll keep building carts for as long as people want to buy them. I
don’t believe in limited runs. The only people I kept track of
were the original owners of Patriots who got the serialized versions
of the cart.

How does one tell if they own a serialized version of Patriots?

The cart has a signed label with the number, and the number appears
on the title screen with the owner’s name.

What are your favorite Colecovision and Vectrex games?

Colecovision – There aren’t any. I despised those controllers the day the system
was released and thought most of the games looked “rushed”. Wait,
I take some of that back – I seem to recall spending a lot of
time as a salesman in JC Penney playing “Miner 2049’er”. If there
are any favorites, I’d say they are my own.

Vectrex – Star Castle, Rip Off, Armor Attack

What current endeavors are you working on?

Vectrex – Vecmania (it will be done by the fall or it won’t get done at
all).

What type of Game is Vecmania?

My next Vectrex game release, including a Star Wars style shooter,
a Phoenix style shooter, a new updated version of my Rockaroids
game and a few other surprises.

Any Future plans for other classic systems?

Atari 2600 – A bit of code lying around somewhere for a game which was
said could never be done, which I did anyway, which will probably
never get finished due to the incredible amount of time it takes
to write code for the machine. Another more feasible project is
on the drawing board, and will be the next project after Vecmania.

So what is this mysterious game for the 2600, which was said “could
never be done?” (Tempest?) And, if you never take the time to
complete it, wouldn’t “they” be right?

Tempest was done (well, a playable prototype at least). My mystery game
was QIX. Maybe I’ll finish it some day.

Coleco – No more plans or desire to continue programming.

Odyssey 2 – A few ideas bouncing around now that I know how to program
the thing. Nothing immediate though.

Studio II – In my early programming days (mid 70’s) I always wanted a
Cosmac ELF (more or less the same system) to write games on. If
I live to be old and grey (or at least retire) I’d like to finish
reverse engineering my Studio II and do a game for it (Studtris
?).

For those not so savvy, what was the Cosmac ELF?

A very, very primitive computer based on the old SLOW RCA 1802 CPU.

How does one obtain the secrets programmed into your games?

They wouldn’t be secrets if I disclosed them, would they? If you really
need to know, In Patriots, pause the game with
a score of 150 to play Breakout; In All Good
Things
, hold down button 1 while selecting the games to
play an old TRS80 puzzle game.

In Spike Hoppin’, hold down 1,2 and 4 at the Vectrex
intro screen and a space ship will pass by and destroy the GCE
copyright logo (an eye sore for Vectrex programmers). Also at
the title screen, press 1,3 then 4 in order to play Vectrepede.