Frank the Fruit Fly

PM development, programming, hacking and all that fun stuff.
User avatar
RazorLeafAttack
PM.net Staff
Posts: 138
Joined: May 9th, 2017, 00:58

Re: Frank the Fruit Fly

Post by RazorLeafAttack » March 15th, 2019, 01:34

Got it updated. You should seriously join the Discord, it's specifically for people like you. I actually kinda had you in mind when I thought of making it in the first place. Some VERY experienced PM devs in there.

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » March 26th, 2019, 05:36

I was looking around, and the only homebrew program that went over 64k was the "Indestructible" video thing. In it was the line

Code: Select all

.orgfill 0x4000
What does this do? Do I need to use this to go over 64k? I remember seeing something that said I needed to do something special to do that, but I can't find it.

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » April 16th, 2019, 00:41

Help me learn how to save something! I'm using assembly and I want to save three variables at the beginning of a level: the [levelnumber] variable, the [health] one and the [health10] one. And then when the user turns it off, the game stores the info and when it turns back on, you can go right to where you left off. Wouldn't that be cool? I tried looking at the EEPROM browser code and I couldn't understand any of it. I ran the EEPROM browser. All I got were Fs. I pressed every button, but I couldn't change the Fs. I don't understand any of this. :cry:

zoranc
Posts: 293
Joined: August 13th, 2010, 18:13
Contact:

Re: Frank the Fruit Fly

Post by zoranc » April 17th, 2019, 17:55

VirtualChris wrote:Help me learn how to save something! I'm using assembly and I want to save three variables at the beginning of a level: the [levelnumber] variable, the [health] one and the [health10] one. And then when the user turns it off, the game stores the info and when it turns back on, you can go right to where you left off. Wouldn't that be cool? I tried looking at the EEPROM browser code and I couldn't understand any of it. I ran the EEPROM browser. All I got were Fs. I pressed every button, but I couldn't change the Fs. I don't understand any of this. :cry:
The eeprom browser code just reads the data, so you can't change it at all. Once you save a game you'd be ale to see how it's stored. Saving it very often isn't such a great idea, as the flash wears of with lot of writes, hence saving only when user wants is much better strategy - it is the console that'd go bad eventually. Also you'd need GUI to ask what slot to delete in case all 6 are already used.

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » April 17th, 2019, 22:23

I guess I'll just use passwords then.
Attachments
passwordscreenftff.png
The password screen for "Frank the Fruit Fly."
passwordscreenftff.png (2.66 KiB) Viewed 504 times

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » April 24th, 2019, 01:55

I can't seem to get the password screen cursor (Frank) to move correctly. It works on PokeMini, but on a real Pokemon Mini, if you press left or right it sometimes skips a number for no reason. Here is the code I have for testing if right is pressed, for example:

Code: Select all

	call read_keys
	test a, KEY_RIGHT
	jnz right_pressed
	jmp test_left
	
right_pressed:
	call password_key_pressed1
	call read_keys
	test a, KEY_RIGHT
	jz cursor_right
	jmp right_pressed
If 0 indicates that the button is not pressed and 1 indicates it is pressed, why wouldn't this work right?

zoranc
Posts: 293
Joined: August 13th, 2010, 18:13
Contact:

Re: Frank the Fruit Fly

Post by zoranc » April 26th, 2019, 11:31

VirtualChris wrote:I can't seem to get the password screen cursor (Frank) to move correctly. It works on PokeMini, but on a real Pokemon Mini, if you press left or right it sometimes skips a number for no reason. Here is the code I have for testing if right is pressed, for example:

Code: Select all

	call read_keys
	test a, KEY_RIGHT
	jnz right_pressed
	jmp test_left
	
right_pressed:
	call password_key_pressed1
	call read_keys
	test a, KEY_RIGHT
	jz cursor_right
	jmp right_pressed
If 0 indicates that the button is not pressed and 1 indicates it is pressed, why wouldn't this work right?
It's called button debounce. basically when you press a button on physical device is makes a contact but that contact on first might not be so reliable. Like the conductive parts just touching briefly and then losing the connection again. The net effect is that instead of one press and release you might read out several. If your button press trigger is front based (on the press/release event), you might experience several of those events. In order to correct it you would need to check the state of the button for a longer period of time. And only if the reading is the same (pressed) for several checks in a row then consider it a real press. Now for how long those checks should be and how many of them it's up to experimentation. In general not very long should be fine. I personally like to have the press for three frames in a row. Some people do two reads sequentially...

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » April 29th, 2019, 06:48

This sucks. I tried this, for pressing right:

Code: Select all

	call read_keys
	test a, KEY_RIGHT
	jnz waiting_for_press_right
...
waiting_for_press_right:
		mov a,2
		mov [ticker3],a	

		jmp waiting_for_press	
...
waiting_for_press:
		call password_key_pressed2

		mov		a, [buttonpress]
		inc 	a
		mov		[buttonpress], a	
		
		mov		a, [buttonpress]	
		cmp		a, 254
		jz		get_key_press		
	
		jmp waiting_for_press
...
get_key_press:
		call password_key_pressed2
	
		mov a,0
		mov [buttonpress],a	

		mov		a, [ticker3] 
		cmp		a, 2
		jz		cursor_right	

		cmp		a, 3
		jz		enter_a_number
...		
		
cursor_right:

	call password_key_pressed1

		mov a,0
		mov [buttonpress],a
		mov [ticker3],a	

	call read_keys
	test a, KEY_RIGHT
	jnz cursor_right

	
<stuff that happens when right is pressed.>
As you can see, I made it wait for a few frames, have two read_keys calls and it still does the same stupidity as before. What do I have to do here? I'm so frustrated.

zoranc
Posts: 293
Joined: August 13th, 2010, 18:13
Contact:

Re: Frank the Fruit Fly

Post by zoranc » April 29th, 2019, 12:41

VirtualChris wrote:This sucks. I tried this, for pressing right:
As you can see, I made it wait for a few frames, have two read_keys calls and it still does the same stupidity as before. What do I have to do here? I'm so frustrated.
Can you please add more comments to the code. I have hard time understanding what are you trying to achieve. Some subroutines are missing and the label names are not helping to guess what those are supposed to do... Maybe try to explain what each chunk of code is handling, it would ease others looking at your the code. That also often has a side effect of you spotting the problem (a rubber duck testing). You can also try to run it in a emulator and trace those parts of your code.

VirtualChris
Posts: 147
Joined: February 21st, 2015, 22:53
Location: United States
Contact:

Re: Frank the Fruit Fly

Post by VirtualChris » May 2nd, 2019, 01:33

I think I fixed it. I added a second variable to keep track of which button I selected. That led to the discovery of the key being used when the key wasn't being pressed. So I added another round of key pressing determining code and that seemed to help a lot.

Post Reply