Chris!
|
 |
« 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
|
|
|
|
LD
Played Munchkin once...
 
Posts: 98
|
 |
« 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!
|
 |
« Reply #2 on: November 11, 2014, 02:53:53 AM » |
|
The decreasing code doesn't work, but the increasing code does.
|
|
|
Logged
|
|
|
|
Rene_G7400
|
 |
« 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: 98
|
 |
« 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!
|
 |
« 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
|
|
|
|
Chris!
|
 |
« 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
|
|
|
|
Rene_G7400
|
 |
« 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!
|
 |
« Reply #8 on: November 13, 2014, 04:04:47 PM » |
|
It should reach 007h instead of 000h.
|
|
|
Logged
|
|
|
|
Rene_G7400
|
 |
« 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
|
|
|
|
|
timdu
|
 |
« 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!
|
 |
« Reply #12 on: January 03, 2015, 12:33:23 AM » |
|
Here is a picture from the newest version:
|
|
|
Logged
|
|
|
|
TomBeck
|
 |
« 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
|
 Killed the Killer Bees 
|
|
|
|
|