Cliff Hacks Things.

Tuesday, January 01, 2008

PropellerForth v8.01 alpha; HYDRA tidbit

After my winter sprint, PropellerForth v8.01 alpha has been posted on the project page. (I'm using Ubuntu-style version numbers, so 8.01 is the January 2008 release.)

As it says in the release notes, the version currently available there is an alpha release. It's been tested, it works, and it's probably close to the final release, but I reserve the right to make changes in the near future before pronouncing it official. In particular, the docs are not nearly complete -- I'm working on it.

Source hasn't been posted yet; still trying to figure out how best to do that.

A HYDRA PropellerForth Tip



The HYDRA board is one of PropellerForth's officially supported targets. One of its slick (but undocumented) features is how it handles the on-board EEPROM when a cartridge is inserted: it gets remapped to a higher address space, but remains accessible.

PropellerForth's EEPROM words (included in the v8.01 'full' release) support addressing multiple EEPROMs on the I2C bus, using Atmel-style device and page addressing. The visible address space is:

  • No cartridge: onboard EEPROM at 0x00000 - 0x1FFFF

  • Cartridge: onboard EEPROM at 0x20000 - 0x3FFFF, cartridge at 0x00000 - 0x1FFFF



This opens some interesting possibilities:

  • Programs could use both EEPROMs together, for 256KiB of bulk data storage.

  • A reasonably simple Forth word could copy one EEPROM to the other, to clone a cartridge or back up the on-board software.



I'll leave those as exercises to the reader; for now, here's a word, ?cart, that checks whether a cartridge is currently inserted in the HYDRA.

hex \ the base of champions
: ?cart ( -- flag )
\ Try to read base of remapped on-board EEPROM.
20000 ['] eeread catch \ Guard with catch to intercept failure
nip \ Discard the address (if failed) or the result (if succeeded), leaving exception
0= ; \ If the exception is 0 (none caught), return 'true', otherwise 'false'.


To help you test it, here is the cartridge monster. (Hey, I can only type in so many dry source examples before I try to make one funny.)

: O_O \ See, it's a face. ... well, I thought it was funny. :-P
?cart if exit then \ Don't bug the user if a cartridge is present
begin \ Loop and complain...
." CARTRIDGE MONSTER WANT CARTRIDGE" cr
1 seconds wait
?cart until \ ... until a cartridge appears
." NOM NOM NOM BURP" cr ;


(Hot-swapping cartridges on the HYDRA should work fine as long as the EEPROM is not being accessed when it happens -- just be careful to insert the cartridge straight.)

Labels: ,

3 Comments:

  • Thanks pleased to find this site. I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
    thai brides

    By Blogger chinese girl, at 10:22 PM  

  • CIITN is the Best Php training institute in Noida and delhi Ncr. You will get Live Project Training on PHP by our PHP expert who have 5+ year industrial experience.Focus on practical and live project training. In our PHP training, we you will learn core PHP, advance PHP, HTML, CSS, JavaScript, jQuery, Bootstrap, Cake PHP and Wordpress.CIITN provides 100% job assistance in PHP training. CIITN is well known PHP coaching center because our 100% PHP students are placed now.


    Ciitnoida provides Core and java training institute in noida. We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-oriented, class-based build of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an all-time high not just in India but foreign countries too.

    By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13 years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best Java training in Noida.


    php training in noida
    java training institute in noida
    javascript training in noida
    linux training in noida
    linux institute in noida
    red hat linux training in noida

    By Blogger CIIT Noida, at 11:51 PM  

  • Nice looking sites and great work. Pretty nice information. it has a better understanding. thanks for spending time on it.

    Hadoop Training Institute in Noida

    Best Hadoop Training in Noida

    By Blogger CIIT Noida, at 12:24 AM  

Post a Comment

<< Home