Videopac / Odyssey2 forum
September 20, 2017, 08:22:13 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Al lot of attachments from Nov 2011 till april 2012 are damaged. Please ask the original poster to re-upload if you need them.
 
   Home   arcade Help Login Register links videopac.nl  
Pages: [1] 2 3   Go Down
  Print  
Author Topic: Aaron the Aant (was: Multiplication)  (Read 3734 times)
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« on: November 10, 2014, 09:57:32 PM »

Is there an easy way to multiply numbers? Like say I want a value to increase from 003h to 007h then to 00fh and so on until it gets to 0ffh? And also, is there a way to decrease numbers the same way?
« Last Edit: January 16, 2015, 11:23:02 PM by Chris! » Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
LD
Played Munchkin once...
**
Posts: 96



« Reply #1 on: November 11, 2014, 01:48:20 AM »

hm....

03h is 00000011b
07h is 00000111b
0Fh is 00001111b

My suggestion is rotate to the left (RL A) and ORL A with 001h
rotating A = 00000001 goes to 00000010, orl 001h set 1 to bit 0 : 00000011
(R0 holds the var, starting in this case as 003h)

   mov a,@R0
   cpl a          ;<- if var is 0ffh, cpl changes to 000h
   jz VarIsFull ;So if A is zero, R0 is 0ffh. jump the code
   cpl a          : return to the original value
   rl a
   orl a,#001h
   mov @R0,a
VarIsFull


I think it works.

To decrease just rotate to the right using RR A :

   mov a,@R0
   jz  VarIsZero ;Assuming you wanna check if var is zero, if is, jump
   rr a
   mov @R0,a
VarIsZero

« Last Edit: November 11, 2014, 01:57:05 AM by LD » Logged
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #2 on: November 11, 2014, 02:53:53 AM »

The decreasing code doesn't work, but the increasing code does.
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Rene_G7400
I'd sell my mother for a Videopac
********
Posts: 2481



WWW
« Reply #3 on: November 11, 2014, 09:35:20 AM »

For decreasing you can use:

mov a,@r0  ; get value from intram
clr c    ; clear carry flag
rrc a    ; rotate right with carry
mov @r0,a

For increasing you can use a similar code:

mov a,@r0
clr c
cpl c     ; complement carry flag
rlc a     ; rotate left with carry
mov @r0,a
Logged
LD
Played Munchkin once...
**
Posts: 96



« Reply #4 on: November 11, 2014, 12:44:56 PM »

The decreasing code doesn't work, but the increasing code does.

Sorry the bit 0 goes to 7 if RR. You need to ANL with 07Fh.
But René code is more optimized.
You still need to use the "jz" part for my code to check if var is 0FFh.

For decreasing you can use:

mov a,@r0  ; get value from intram
clr c    ; clear carry flag
rrc a    ; rotate right with carry
mov @r0,a

For increasing you can use a similar code:

mov a,@r0
clr c
cpl c     ; complement carry flag
rlc a     ; rotate left with carry
mov @r0,a


Interesting use of carry. Too bad there isn't a "Set Carry" instruction, to save a byte.
Logged
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #5 on: November 11, 2014, 07:27:38 PM »

Thank you. It works great now. I'll reveal what I'm working on a little later.
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #6 on: November 13, 2014, 04:28:34 AM »

So I added a few things and discovered that I need to make it so once it reaches 007h to start over again instead of 001h. How would I do this?
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Rene_G7400
I'd sell my mother for a Videopac
********
Posts: 2481



WWW
« Reply #7 on: November 13, 2014, 09:28:48 AM »

So I added a few things and discovered that I need to make it so once it reaches 007h to start over again instead of 001h. How would I do this?

What should start over again? During increasing or decreasing?
Logged
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #8 on: November 13, 2014, 04:04:47 PM »

It should reach 007h instead of 000h.
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Rene_G7400
I'd sell my mother for a Videopac
********
Posts: 2481



WWW
« Reply #9 on: November 14, 2014, 09:36:40 AM »


With XRL A,#007h you can compare the value and then use JZ (true) or JNZ (false) to jump to the right piece of code.
Logged
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #10 on: December 25, 2014, 09:27:39 AM »

OK, here's what I've been working on and why I needed to ask the question. Merry Christmas.
http://www.atari2600land.com/aaron/
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
timdu
Freedom Fighter
****
Posts: 282



« Reply #11 on: December 26, 2014, 06:20:02 AM »

I am happy to report the news that we ( the 2600 Connection ) will be publishing and releasing AARON THE AANT on cartridge sometime in 2015.

Logged
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #12 on: January 03, 2015, 12:33:23 AM »

Here is a picture from the newest version:
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
TomBeck
Post Axe Pete!
*****
Posts: 840



« Reply #13 on: January 03, 2015, 04:56:24 PM »

I like that game, also the idea with an ant as the hero!

I have some suggestions:

So maybe the trees can grow and disappear at an random place (animation like in KC Krazy Chase). They can also grow between the coins and the ant. That would it make not so easy to get they. It would look better when Aaron looked in the direction he walk. Also a little smile at Aaron face would be great.(Like the dratpillar in KC Krazy Chase - picture) There can be also appear a little fruit with some extra points every 25 or 50 points. Were some plus graphics possible?  This were a great game for it. Maybe two trees, one on the left and one of the right site.
But again, only suggestions. What ever you use, much fun to finish the game.
Logged

Wink  Killed the Killer Bees  Wink
Chris!
Give this man a Jopac!
******
Posts: 1079



WWW
« Reply #14 on: January 06, 2015, 06:41:02 PM »

The latest version is now at the Aaron the Aant website:
http://www.atari2600land.com/aaron/
Logged

All my Odyssey2 projects, now in one place!
http://www.atari2600land.com/odyssey2.html
Pages: [1] 2 3   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!