Electronics > Beginners
Assembly code Help! PIC16F57
KL27x:
--- Quote ---I love how you encapsulated that so I can see what was changed and what to put back if it doesn't work. brilliant.
--- End quote ---
When the changes get more involved, you need to get more serious and start using IDE directives (#include, if/else/endif) to blink code in/out of existence but leave it intact. It will get tedious adding and erasing scores of semicolons. :)
--- Quote ---just testing now, so far so good. will report back.
--- End quote ---
:-+
Mind that without my fully unraveling the code, this is just a hack. If this were anything important, I would encapsulate the added code rather than mucking with a variable that is used in other places. IF it works, it is because counter_hi gets redefined/reloaded before all those other places it gets used. If it ends up causing other bugs, no problem. We can fix that.
Electrofinn:
ok this seems much, much better than before, I did have one instance where on a win it seemed like it displayed the first 8 of the correct "pattern2" table before going back to my credit led's but I can't seem to get it to do it again. being playing for ages now. but then I guess if it did it once it could do it again.
KL27x:
Ok, I suspected this. Because it's a slot machine it might take years to confirm a bug in w/e is called "win2" lol.
We can either
1. do a bit mask in every other instance counter_hi is used. And in this case, it would be trivial, because it's only a short code. This is what we just did, btw. The last bit of code you added is called a bit mask.
2. we can allocate 1 bit of memory only accessed by feature/pattern and add a bit of confoculated code to inject this into feature. But the current registers end at 1F, and now I have to look up the memory map to make sure there's more memory. grr.
I'll report back in a bit.
Well, this decision was made for me. Every byte of memory is already in use.
The general memory goes from 0x07 through 0x1F. And the code uses them all. (oddly, 0x07 is defined as portC, lol. Which even though it doesn't exist, it is used by the code. I don't know if is being used as more than an output, so I shall not mess with it).
So there end up more than 4 places this counter_ hi is used. So because I don't want to map out the entire code loop, this may take a bit and I just have to hope we don't run out of code space. Because this is not going to be elegant.
KL27x:
Hah, ran out of program memory.
And time. Gotta eat dinner.
I'll take another look, later. I'm sure there is some unused program memory if I look at the list file and shuffle things around.
But one weird thing is that counter_hi is used in one area
incfsz counter_hi
And it will never roll over to 0, unless it goes beyond 16. So now it makes it much more iffy where and when to bitmask this register.
This would be sooo much easier if there was a free byte of memory. I might look for some bit that is unused and do it that way.
Electrofinn:
Lol yeah I would imagine confirming a bug on a full sized machine would be nothing short of an absolute nightmare. Looking over the conversation I have saved from the forum seven odd years ago, their recollection is they kept adding features until they run out of program memory and ended up with just 3 bytes to spare! Would of been interesting to know how different the code is on the protected chip.
When I was talking to him back then I had all these wild ideas of expanding on the project but he quickly brought me back down to planet earth with what would be involved. I was going change things like how much gets paid out for a given win, but I am not going to bother, I'm just after the original result now.
Incidentally if you wondered what the "odds" table was for, its contains the hex codes that when converted to decimal, is the number of servo actuations made when paying out coins.
As for the PORTC output thing you mentioned, not sure if this is relevant or not but the machine has things like a servo I mentioned earlier for the payout mechanism, a piezo speaker which generates a clicky sound to imitate the reels spinning and beeps when there's a win, the hold/collect and gamble/start buttons have leds in them that flash when an option to hold arises or a when a gamble game appears if all three reels match (this doesn't happen every time and I believe is randomly generated)
When the option to hold is available the flashing buttons stay solid when pressed to indicate the reel has been held. There is also break beam sensor (Phototransistor and infrared led) for detecting inserted coins.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version