Jump to content
Sign in to follow this  
yorgle

OK, I give up... HELLLPPP!

Recommended Posts

I'm slowly (read: s...l...o...w...l...y...) learning assembly using one of nukey shay's adventure hack tutorials. I've successfully compiled the code (which includes modifications for an extra castle gate and key) and got it under 4K by eliminating Mr. Robinett's signature. (sorry, Warren). Dasm produces a .bin file and -lxxxx.txt file without errors, but when I try to run the .bin using Stella, all I get is a black screen.

 

The source code I started with was nukey shay's 4k version of his optimized adventure hack. I think it has something to do with the StartGame routine referenced at the end of the code and the memory locations referenced there (since that's about the only real change between the original source and my version). Anyway, here's my version of the code so far. If anyone can point me in the right direction or give me a hint as to what I'm missing, I would be forever grateful.

 

Also, my various 6502 assembly manuals/books I find no mention of the op-code "ORG" as appears at various points in my sourcecode, e.g., "ORG $F87F" Is this a code unique to the VCS or is this something DASM inserts to keep track of memory locations? Are such notations necessary?

 

Note to experienced programmers reading this: this plea is not an effort to ask "how do I make a game for my 2600?" I'm not looking for someone to carry me, just a little nudge in the right direction. Thanks in advance.

file1.txt

Share this post


Link to post
Share on other sites

OK, I think I've answered at least one of my questions, i.e., regarding the "ORG" ops. Am I correct that these are there simply to mark the start of new pages? If so, I think they could be removed without affecting the program, right?

Share this post


Link to post
Share on other sites
OK, I think I've answered at least one of my questions, i.e., regarding the "ORG" ops. Am I correct that these are there simply to mark the start of new pages? If so, I think they could be removed without affecting the program, right?

 

Yes, they mark the location to begin (again) generating the code for... but, a lot of speed-sensitive operations require precise alignment. On the MOS-6500's an operation that crosses a page boundary e.g. from $f8ff to $f900) often costs an extra CPU cycle. Also, there's a bug in the 6502 and 6507 that affects the use of e.g. a jmp instruction at the end of a page, but that's less likely to cause trouble.

Share this post


Link to post
Share on other sites
I'm slowly (read: s...l...o...w...l...y...) learning assembly using one of nukey shay's adventure hack tutorials. I've successfully compiled the code (which includes modifications for an extra castle gate and key) and got it under 4K by eliminating Mr. Robinett's signature. (sorry, Warren). Dasm produces a .bin file and -lxxxx.txt file without errors, but when I try to run the .bin using Stella, all I get is a black screen.

It looks like your problem is the ORG address at the end of the program. There are three vectors that go at the top (or end) of every program, but you actually only need the last two for the 2600. Anyway, most programs set all three vectors to point to the same location. They have to be put in addresses $FFFA/$FFFB, $FFFC/$FFFD, and $FFFE/$FFFF. In your code, they're in the wrong places:

  2808  ffcb						  ORG	$ffcb
  2809  ffcb			   ff ff 00 f0*		  .word.w	$FFFF,$F000,StartGame,$F000
  2810  ffd3
  2811  ffd3

If you change that last ORG to "ORG $FFF8" (since you have four words there, instead of three, so the first word should be in $FFF8/$FFF9), the code should start up correctly.

 

Michael Rideout

Share this post


Link to post
Share on other sites
OK, I think I've answered at least one of my questions, i.e., regarding the "ORG" ops. Am I correct that these are there simply to mark the start of new pages? If so, I think they could be removed without affecting the program, right?
ORG is what's called a "pseudo-op". Instead of generating code, a pseudo-op controls how the assembler generates code. These are generally independent of the CPU being used.

 

The most common ones are:

 

ORG = set the program counter location for code to follow

EQU = assign a value to a label

SET = assign a value to a label, but allow it to be changed later with another SET

END = end of the code, optionally with a start address for the code

DB or BYTE = Define Byte, put one or more bytes into the code

DW or WORD = Define Word, put one or more words (2 bytes each) into the code

DS = Define Space, skip one or more bytes (with DASM this always deposits data unless you use SEGU)

FCB/FDB/RMB = Form Constant Byte / Form Double Byte / Reserve Memory Bytes - Motorola's version of DB/DW/DS

FCC = Form Constant Character - Motorola's version of DB for strings

Edited by Bruce Tomlin

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...