by Travis Goodspeed <travis at radiantmachines.com>
with sprites by Eli Skipp,
extending Dave's LCD reversing,
and with thanks to Mike Ossmann.
The GirlTech IMME is a fine platform for radio hacking and embedded programming, but the LCD of the device is by no means designed for lightning fast graphics. In this brief article, I demonstrate the method by which a sprite library can be constructed which abstracts away the less neighborly minutia of the LCD in favor of a row-wise framebuffer that gets flushed to the LCD as appropriate. This isn't fast enough for a port of Sonic the Hedgehog, but it's certainly sufficient for ZombieGotcha, a network disease simulation game that Eli Skipp and I are prototyping.
To quickly recap, the GirlTech IMME is a children's toy powered by the CC1110F32, which combines an 8051 microcontroller with a versatile sub-GHz radio. The toy also includes a text LCD controller and keyboard, making it a delightful platform for embedded systems hacking and prototyping. Thanks to Dave's article on attaching a debugger and reversing the LCD, it is possible to wire a GoodFET into the IMME, allowing for debugging and reprogramming of the device.
Since the days of the first raster displays, computers have been drawing images as rows, because that's the way that a television's electron stream is traced along the display. The IMME draws rows internally, but because it is intended to draw fonts, its rows are eight pixels tall. For example, the bytes {0x7f, 0x08, 0x08, 0x08, 0x7f, 0x00} are pushed to the LCD in order to draw an uppercase letter H in Dave's LCD Demo for the IMME. Drawing this on graph paper or rendering it by Python, it becomes clear that 0x7F represents a side of the letter, 0x08 represents the bar, and 0x00 is the space following the letter.
Rather than attempting to natively store a framebuffer in the LCD's format, I chose to internally index by row, then to translate during the export of the framebuffer to the LCD. My primary reason for doing this is to maintain portability of the ZombieGotcha code to custom hardware. It also simplifies the transcription of sprites from original bitmaps to C structures.
Having an internal framebuffer is not without cost, however. The buffer is 132 pixels wide and 64 pixels tall. Even with bit-packing, this is more than a kilobyte in size, consuming more than a quarter of the CC1110's 4kB of XDATA RAM. (Programs and sprites are stored in CODE Flash memory, of which there is 32kB, so this limit is not quite so severe as it sounds.)
My sprite toolchain is begun with bitmap images submitted by the artist. I cannot stress enough how important it is that your pixel artist understand pixels. Every sprite must be drawn at native resolution, with proper offsets of each frame and an understanding that the LCD is what it is, regardless of what Photoshop might render.
From the original bitmap sprites, PNM files are produced that are more easily parsed by Perl. This format consists of whitespace-delimited words for the format, width, and height of the sprite. In this case, the sprite consists of three frames, each of them being 24 pixels width and 32 pixels tall. Other sizes are possible, of course, but it is convenient for bit packing that the width is an even multiple of 8, so that the old pixels needn't be read back in.
It is then necessary to use an ugly Perl script to convert the sprite from a PNM to a C array of bytes. Pretty Perl won't work, of course, because such a thing doesn't exist. My script, sprite2c.pl, takes a 24-bit color PNM file and converts it to a 1-bit map that is byte-packed. Each of these is included by the preprocessor as a __code unsigned char[], with the __code keyword implying that the object should be stored in Flash rather than RAM.
Sprite animations are performed by storing the frame count along with the width and height in the C structure. Considering the resource constraints of this system, frame counts change very rarely and are stored within the C code.
Dumping the frame-buffer to the LCD is as simple as writing every stripe of data to the screen. Potentially, as an optimization, you could keep track of which stripes have been invalidated across what horizontal range, updating only where necessary.
Keeping in mind that the LCD is updated as stripes of 8 pixels in height, code such as the following will refresh the entire LCD from the frame-buffer. Be sure not to erase the LCD between writes, as that would cause unnecessary flickering.
The framebuffer elements themselves are grabbed by selecting the pixel index divided by 8, then masking off the selected bit. The following functions work admirably for this purpose.
If greater performance is required, a game should certainly be designed with a custom graphics library that optimizes the few things it does most. Performances can be gained by storing sprites and the frame-buffer natively in the row/stripe format that the LCD expects, simplifying conversion. Mike Ossmann used the technique of basing most graphics around vertical lines in his spectrum analyzer firmware, allowing for channels to be redrawned as they are scanned rather than flushed from a frame-buffer.
As the ZombieGotcha game is largely turn-based and the frame-rate is not a dire concern, I don't expect to optimize the sprite library much beyond what is presented here.
One major addition will be that of screenshots, as I'd like to produce animated GIFs of game action for the website. Screenshots can be produced by the method that I outline in CC1110 Instrumentation with Python, dumping the frame-buffer from XDATA with a GoodFET and writing that to disk. Alternatively, full-speed screenshots could be dumped by sniffing the LCD's SPI bus using a Total Phase Beagle or other SPI protocol analyzer.
For those of you with an IMME, Eli and I will be releasing the ZombieGotcha game at the Twenty-Seventh Chaos Communications Congress in Berlin this winter. We'll bring a bed of nails for reflashing IMME units on the spot, as well as GoodFET kits for modifying your IMME to be a development kit. (The ZombieGotcha will also run on full-custom hardware, but we are maintaining IMME support in parallel.)
As a final note, a teaser of the ZombieGotcha opening screen can be found here in the Intel-Hex format. I'll give a GoodFET40 kit to the first neighbor who sends me an animated GIF of it and a script to generate the same, either by a debugger or an emulator.
Subscribe to:
Post Comments (Atom)
59 comments:
http://www.hodgepig.org/zombie.gif
Used the Bus Pirate to sniff SPI, C program on PC to make PNM files, ImageMagick to render GIF.
The SPI bus ran too fast for Bus Pirate, so I had to hack the binary to lower the baud rate.
Will blog sources and method tomorrow.
Thanks for an evening's fun. Must sleep now...
jrt-google is a real man.
Method and source code:
http://blog.hodgepig.org/2010/11/02/zombie-extraction/
Thanks, that was a lot of fun :-)
The GOODFET's microcontroller can be programed with the EZ430F2013??
Howdy Palma,
Every GoodFET is designed to be bootstrapped by USB. You do not need to already have a JTAG programmer of any kind in order to build it; just place the parts on the board and run 'goodfet.bsl --fromweb' to flash it.
--Travis
We know how difficult is to make time for writing assignments or completing your reports, especially when you have to meet a particular deadline. That's why we have assignment writing service, instant assignment help Australia for students. Enroll now!
Thanks for some other informative website. Where else may just I get that type of information written in such a perfect means? I’ve a challenge that I am simply now working on, and I have been at the glance out for such info.
Shop Drawings Preparation in UK
Shop Drawings Preparation in India
Awesome post
Thanks
resellerclub | thesmespace | fstoppers | hubpages | mollysonic
I’m really impressed with your article, such great & usefull knowledge you mentioned here.I love this online platform Assignment help . Their experts helped me in making my Java Assignment help . It was so easy and done faster. Their experts have years of experiences into this fielded. Thank you so much for helping. You can surely check their expert's knowledge and take help from them. They are very genuine and trust worthy.
Best Assignment Writing Help This task help UK gives 24 hours of accessibility to understudies. Through this, the understudies can at whatever point look for help from online associations. Aerospace Engineering Assignment Experts
do my homework for me
Great Blog!
Massage Therapist Services
Maid Services in Toronto
Great Research Solutions Pvt. Ltd. ( GRSoft ) is an IT company with no geographical boundaries and provides all that you can think of around IT including consulting, solutions, applications and outsourcing services.
Hire Software Developers
Great Research Solutions Pvt. Ltd. ( GRSoft ) is an IT company with no geographical boundaries and provides all that you can think of around IT including consulting, solutions, applications and outsourcing services.
Hire Software Developers
GRSoft Gaming is an honor winning, Live Casino game advancement organization of India. We offer curiosity and inventive game development with an exceptionally talented group of developer. Our bleeding edge gaming innovation creates esteem included gaming arrangements. Quality is our real worry for club game development. We offer tweaked Casino game development benefits over the globe and help you furnish with customized development. With our Casino game, individuals couldn't imagine anything better than to chance their gaining and appreciate the advantages. We have created numerous effective games like the video poker game, Sports wagering game, online club game, lottery games, and numerous other common games.
Hire Dedicated Casino Game Developers
GRSoft Gaming is an honor winning, Live Casino game advancement organization of India. We offer curiosity and inventive game development with an exceptionally talented group of developer. Our bleeding edge gaming innovation creates esteem included gaming arrangements. Quality is our real worry for club game development. We offer tweaked Casino game development benefits over the globe and help you furnish with customized development. With our Casino game, individuals couldn't imagine anything better than to chance their gaining and appreciate the advantages. We have created numerous effective games like the video poker game, Sports wagering game, online club game, lottery games, and numerous other common games.
Hire Dedicated Casino Game Developers
This channel has been very prominent due to its productions and other things. characteristics of baroque architecture
Irelandassignmenthelp is a web portal where students get homework help ireland expert help for all the subjects, with the help of our experts. You will get 100% plagiarism free assignment.
GRSoft's Remote IT infrastructure services are custom tailored based upon your business needs. Our Remote IT infrastructure services align network architecture and end-to-end communication, to ensure your company has the best IT solutions. We provide wide array of IT infrastructure services, right from IT infrastructure and consulting support to managing the most complex of IT infrastructural issues, with absolute precision.
Remote IT Infrastructure Support Services
But for all of that to happen properly, you need to be careful and do the installation correctly. So read on and learn how to install and then set up the Epson Workforce WF-3640 for peak performance.Epson Nummer
Are you looking for a Custom eCommerce development company to help your business to grow and expand globally? So, for this, you will need web designers and developers who have great experience and assist you in all the possible ways to build one of the professional websites today. Cefnogi Solutions helps you to bring enormous traffic to your websites with the new strategies and implementing the latest technologies. We have made our name in the leading eCommerce website development agency which offers the portal for eCommerce.once you will get connected with the team you will get your work down without any of the hindrances.
Custom ECommerce development
My friend told me that I could find a girl on a great site. I personally have no such design in the dating russian mail order brides because the site's design is very beautiful. this database I liked from the first second when I just went there. The feature is very simple and it's all clear! I was really happy, because I could find my dreams with a lovely Ukrainian bride! I recommend that everyone register on this website, register as quickly as possible, since your love certainly awaits you!
buy gym trousers for ladies online from Dshred at easy prices delivered at your doorstep. Get free shipping
Thank you for sharing with us, very informative post. Right now, augmented reality is a huge technical trend, and its use is increasing as the demand for AR-ready devices grows. It allows smart gadgets to be easily accessed. Indeed, the market for augmented reality app development is exploding. Augmented Reality allows users to interact with a real-world environment. Computer-generated perceptual information is used to improve real-world things.
Excellent, you are accessible from achieving the highest possible grades on your tasks and assignment. Our assignment experts ensure that your Matlab Assignment Help is completed as quickly as possible, allowing you to improve your writing and comprehension abilities. MATLAB is adapted to your way of thinking and working, so whether you're a student, an individual, or an expert, you can learn.
Thanks in favor of sharing such a nice thinking, article is pleasant, thats why i have read it entirely.
AJIO Corporate Office located in India
nissan contact number
You can free download your sb game from here Descargar SB Game Hacker
nice blog
This is really good blog information thanks for sharing .I am really impressed with your writing abilities
deichmann chat
Hey i really love the stuff you are sharing with us. Keep on sharing it and i'll keep in touch with your site.
square one complaint number
anydesk complaint number
pitney bowes contact number
Qdexi Technology is a WordPress Website Design Company and we create the best lead generation websites.
Awesome Blog..
BookMyEssay offers top notch Thesis Writing Help Online services to students at pocket friendly prices.
One of the most significant advantages of entertainment websites ifovd
is the convenience they offer. Gone are the days of having to wait for a show to air on television or having to physically go to a store to purchase a movie.
A debt of gratitude is in order for sharing it
The data you have posted is extremely valuable. The locales you have alluded was great. A debt of gratitude is in order for sharing...
Freelancing Course
Pleasant to be going by your web journal once more, it has been months for me. Well this articledigital marketing coruse
This is Very very nice article. Everyone should read. Thanks for sharing.slot deposit 5000
We appreciate that you have such an excellent blog. I recommend contacting the experts at BookMyEssay.com if you are a student searching for the best Java Assignment Help at an affordable price.
Good Blog. To find out more about Assignment Help, essays, dissertations, and homework writing just come to No1AssignmentHelp.Com.
"Bitmapped sprites on the GirlTech IMME offer impressive visuals and engaging experiences, pushing the boundaries of interactive fun!" ipad price in bd
Buy Google reviews To generate more Google Reviews, businesses can implement several strategies. Firstly, create awareness among customers about the importance of reviews and how they contribute to the success of your business. Encourage satisfied customers to leave a review by providing clear instructions and convenient platforms for review submission. Offering incentives, such as discounts or exclusive content, can also motivate customers to share their experiences. Additionally, ensure that your business profile is optimised on Google My Business, making it easy for customers to find and review your business.
This is Very very nice article. Everyone should read. Thanks for sharing
Golden Ratio
"Thank you for being you. Your authenticity is a rare and beautiful quality." Iuniversity of Rajshahi
. Once again, many thanks for this excellent project.
Pay Someone To Take My Class Online
This website is a digital oasis in the vast desert of the internet
Global warming
Great post. I have learned a lot Thanks.please try that.Thanks for sharing.Digital marketing IT Center
Great post.
History of Digital Marketing
Great article! I found your insights really informative. I would like to share information about the company. Introducing our cutting-edge Grocery App Development Company, where innovation meets convenience! Elevate your grocery shopping experience with our custom-built mobile applications that seamlessly blend technology and user-friendly interfaces.
Great article! I found your insights really informative. car price usa
Shalamar Hospital is your trusted healthcare destination, offering the expertise of a renowned stomach specialist . Expect top-notch care for gastrointestinal health.
Kudos to your blog for being a beacon of knowledge in the ever-evolving world of web and mobile app development! Your insights on top frameworks have proven invaluable for our team in San Diego , shaping our approach to crafting cutting-edge mobile applications. Your guidance has empowered us to explore new horizons about mobile app development los angeles , delivering exceptional solutions to our clients. The wealth of information here is a game-changer, and we eagerly anticipate more pearls of wisdom in future posts. Cheers to elevating the standards of mobile app development!
Jewelgalore offers a delightful collection of silver rings for girls . Explore our range of beautifully crafted pieces, perfect for adding a touch of elegance and charm to young girls' fashion.
After a long tiring day, you can just sit in front of the computer monitor and place an order as per your need. You can also do the same thing from your beloved Hair oil. No matter where you are,Online Shopping Bangladesh Mosle will send your product at your doorstep within a certain period of time.These products have become my skincare soulmates, providing the hydration and nourishment my skin craves during these colder months.
freegiftcard
After a long tiring day, you can just sit in front of the computer monitor and place an order as per
hi Digital Marketing
Nice
this post click here
Economic Growth
Community Management
Social Media
important this site
Digital Marketing</
Post a Comment