Jump to content
Sign in to follow this  
Mike Harris

Pointers, Pointers, Pointers

Recommended Posts

Remember kids, there is a huge difference between XYZ and (XYZ) in Assembly and other programing languages.


I sat for hours staring at my code until I took a break.

 

That's the other tip...

Walk away from your code for a couple of hours instead of getting frustrated.

I had one issue that I wanted to punch the monitor so I took a day's rest and ended up reevaluating my code, rewrote the part needed and it was more compact, more precise and worked better.

Today I ran into the same problem which came down to a pointer.

 

I wanted to evaluate if two sprites were colliding and instead I ended up comparing garbage. WHY, WHY, WHY!!!
It is not my code, it must be the assembler. @$%@$%$%$%@$%@

So in the end I should have pointed to SpriteTable+1 and SpriteTable+2 but ended up pointing to (SpriteTable+1) and (SpriteTable+2)

 

Hopefully this will be a great tip for up and coming programmers.

 

Now, I have collision detection for all actors in the game. Actors being NPC and loot.

Rom is now 7.93k before optimization, sound data, test and debug if any.

Edited by Mike Harris
  • Like 1

Share this post


Link to post
Share on other sites

I'm a crap programmer, but I still recognize the advice about walking away from the computer is good (and applies to a lot of computer-user situations).

 

I recall my Dad telling me that many years back. It really does help.

 

The first hint that you need to take a break is when you try to think and thoughts just won't form. Sort of a kind of stunned brain-freeze brought on by fatigue.

Share this post


Link to post
Share on other sites

OK, taking tomorrow off to do some house work or my wife will beat my %%% but this time it will not be because I asked her too, Giggity.

 

 

I have reached my goals to the point where I can take 5.

I have successfully picked up objects from one room and placed them in another.

 

They are in the same exact spot where I left them.

 

For you budding programmers out there this is the table I created

 

Room #, X, Y and Carried by? Player 1, NPC 2 or None 0

 

001, 150, 200, 0

002, 020, 040, 0

 

And so on.

 

After you define objects in Ram with

 

objects: DS 4

 

Then you need to initialize RAM with starting values such as Starting Room, Starting X,Y

 

You can then load values on the fly as in

LD A, Room #

LD (objects), A

LD A, X

LD (objects+1), A

LD A, Y

LD (objects+2), A

LD A, 0

LD (objects+3), A

 

Once I put in NPC logic any one of the NPC's can grab the treasure by placing 2 in (objects+3)

 

 

For this game I have enough RAM despite being 1k.
If I plan to expand and need more I can change the data down to bits or share a byte or 2.

Such as Room 40+127 would be Room 40 + Player Carry or 40+128 would be Room 40 + NPC Carry.

 

You get the idea.

 

Save space if you need to for larger games in order to use a stock Colecovision.

 

 

There you go.... I learn something, you learn something.

Edited by Mike Harris
  • Like 1

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.

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...