Famicom World

Family Computer => Famicom / Disk System => Topic started by: ramidavis on October 15, 2012, 09:58:55 pm

Title: peeking and poking around family basic.
Post by: ramidavis on October 15, 2012, 09:58:55 pm
I have been peeking and poking around with an idea, the idea of a program that can modify its self. :crazy:
This picture will show you what i have tried.
(http://img.photobucket.com/albums/v140/dudeofcube/peeking_zps34493a9e.png)
The first 3 lines are my original program that i entered, from a fresh cold boot.
On the next line, i did some peeking, until i found a value of 34, preceeded by a value of 39, my  ' "  . (the '  is short hand for rem, or remark)
Then i poked in the value of "?", 63, to &h6009, the location of the ' , and relisted line 10. There is our ?, which should be short hand for "print". 8)
I decide to give it a go, but do not like the results. I relist line 10, the ? is still there. ???
I move the cursor back up to the relisted line 10, press return, and again relist line 10.
Now, the ? has expanded into a full "print".
Is there any specific value i could have poked in there that would have done what i thought it should of done?
(Have the program its self turn line 10 from a rem line to a print statement)
I was going to add the peek and poke on the next line, if they were to work, but since it did not work... :'(
Am i just going about it the wrong way? Or would i have had to shift the whole program line and make room for individual "p" "r" "i" "n" "t" characters?
(If it matters, i was doing this with v3... No idea about 2.0 or 2.1) :help:
Title: Re: peeking and poking around family basic.
Post by: 80sFREAK on October 16, 2012, 02:53:10 am
1) You put "?" character, not token "?"
2) Family Basic storing all operators as 1byte value.
Title: Re: peeking and poking around family basic.
Post by: ramidavis on October 16, 2012, 10:39:44 am
what would i poke for the token "?", and not the character "?"  ?

Post Merge: October 16, 2012, 03:40:07 pm

I have found a list of BASIC tokens on a web site (for c64, mind you). It has listed that the "print" command token is 139/$99 (decimal/hex. they use $ for hex on c64).
i decided to poke &h99 (same as $99) into family basic, and i got the clear command!
If any one knows anymore &Hxx values for other family basic tokens, i would be interested!  :)
(http://img.photobucket.com/albums/v140/dudeofcube/FamilyBASICJV30_001_zps7464589d.png)
Title: Re: peeking and poking around family basic.
Post by: 80sFREAK on October 16, 2012, 03:42:39 pm
You can find by peeking ;)
Tokens list specific for each variation of basic
Title: Re: peeking and poking around family basic.
Post by: ramidavis on October 16, 2012, 03:46:57 pm
could you give any clue where to start peeking? are all the tokens stored together, one after another at certain address?
;D ;D GOT IT!
&H8b == "print"
(http://img.photobucket.com/albums/v140/dudeofcube/FamilyBASICJV30_002_zps5e0c5c8f.png)
Title: Re: peeking and poking around family basic.
Post by: 80sFREAK on October 16, 2012, 03:54:43 pm
All tokens stored as list, so you can scan ROM with PEEK
Title: Re: peeking and poking around family basic.
Post by: ramidavis on October 16, 2012, 04:02:21 pm
getting there  8)
(http://img.photobucket.com/albums/v140/dudeofcube/FamilyBASICJV30_003_zpsda2fbeb0.png)
Title: Re: peeking and poking around family basic.
Post by: UglyJoe on October 16, 2012, 08:50:50 pm
Commands start at &H80.  You can start iterating at 0 if you want to see a bunch of character data and other corrupt output.

(http://i.imgur.com/cyTK5.png)