DIY Laptop v2

laptop_frontview

Well, after a far-too-long hiatus, I’m back with a new Picaxe-based laptop! This project was born of a desire to see how far I can push the lowly Picaxe microcontroller. A friend of mine likened it to “spending over a year to reinvent the square wheel.” The specs, you ask? This thing is decked out to the max:

Hardware specs:

  • Storage: 256 kilobytes total, in a 4 x 64 kilobyte  configuration. It uses 4 24FC512 i2c EEPROM chips formatted with the ChrisFS file system.
  • RAM: 16 kilobytes of i2c FRAM, in a 2 x 8 kilobyte configuration. Fully accessible from within programs through the use of pointers.
  • CPU:  Picaxe 28X-1 Microcontrollers. The main CPU runs at a blistering 16 Mhz, and has a whopping 4 kilobytes of onboard storage for the processor’s firmware/OS.
  • I/O Controller: Another Picaxe 28X-1 Microcontroller serves as an i2c slave and I/O controller for the main CPU. It primarily provides a keyboard FIFO interface to support asynchronous keypresses during programs (can you say PONG?!).
  • Sound: Dual-mono sound is driven by the main  CPU and supports a wide range of tones, beeps, bops and bloops. It drives 2 x 1-inch, 8-ohm speakers mounted on either side of the display. Volume knob or headphone jack, you ask? I say, play it loud and play it proud!
  • Display: A giant 24 x 8 serial character display provides a much-needed upgrade over the previous 20 x 4 display. It also takes in data at a blistering 19200 bits-per-second, drastically improving update speeds.
  • Case: Beautiful, hand/laser crafted wooden case, with a touch of steampunk. My friend Pat showed me how to build a simple box, and I finally learned how to use the CNC laser! Tip: Never try to use real laptop hinges when working with wood. Way too much hassle!
  • Battery pack: 4 x AAA batteries keep this humming for hours. Think your pathetic EEE will make it on that flight to Japan? Pack this laptop and keep hacking while your neighbors are stuck watching the third showing of “You’ve Got Mail.”

Now that I’ve explained about the hardware, you’re thinking to yourself, “Great, a microcontroller, it’s been done…but what can it *do*?” Well, the answer is a resounding “more than the last version!” My goal is to eventually reach parity with an early 1980’s home computer, and this one is getting pretty darned close. And now, the software specs of the “Linaxe” OS (all crammed into 4 kilobytes!):

Software Specs:

linaxe

  • Full Command-Line interface: I’m done with the silly numbered “menus.” This baby’s got a CLI your bearded sys-admin could be proud of. Built-in commands, you ask?
  • -> “ls”: List all of the files currently on the drive. Includes automatic pausing when the file list takes up more than one screen.
  • -> “rm”: Delete files like it’s nobody’s business.
  • -> “wipe”: Reformats the storage area. Think “rm -rf.”
  • -> “mk”: Create an empty file
  • “EMX”: The EMAXE text editor: This baby’s got it all. 8 beautiful lines of text, *automatic line numbering* (!?!?), drastically improved load/save times. The days of slots and menus from v1 are gone, this one has full file-system support!
  • “CC”: The Chris# Compiler. It takes in a text file as an input, and spits out tokenized code for the Chris# interpreter. Now supports limited compiler directives!
  • “PONG”: Why not? I had ~150 bytes of free space left over, and who doesn’t love a little entertainment after a long night of coding? Try and beat the computer to 10 in this port of the old classic.
  • “HELP”: Handy way to look up the built-in command list. This one is actually coded in Chris#!
  • CHRIS#: This is a drastically improved version of Chris++. It supports a much improved instruction set (23 different instructions!), pointers, 25 built-in variables for each program (A-Y), support for variable and immediate values, a 3-entry stack for gosubs and while-loops… This guy is probably turing-complete (minus the infinite-tape, of course)! It’s so useful, in fact, I actually replaced some of the built-in programs with CHRIS# versions to save on firmware space! It’s so advanced, it nearly qualifies as an awful variant of BASIC (and it’s written entirely in the Picaxe’s awful variant of BASIC…how ‘meta’!). On top of all that, it finally has support for in-program comments. Documentation-city, here I come.
  • ChrisFS: The Chris File System. It divides the 256 kilobytes of EEPROM into 8 kilobyte ‘sectors’, with the first sector being dedicated to the File Allocation Table. Each sector holds an 8-character file descriptor, along with a single-byte file extension (currently only supporting system, text and executable file types).

Enough with the chit-chat, I know what you all are after, and it’s shots of this majestic computational sloth in action:

emaxe_closeupThe Emaxe Text editor

pong_closeupPong!

ls_closeupThe file listing after typing ‘LS’

v2_vs_dellNext to my shiny Dell laptop

v2_vs_t1000Next to my Toshiba T1000 laptop from 1987

v1_vs_v2Next to the ‘classic’ DIY Laptop v1

top_back_closeupJust a shot of it with the lid closed

cpu_closeup_smallThe main CPU board with dual 28X-1’s

laptop_internal_smallThe bottom half of the laptop with the lid off

laptop_top_internal_smallThe internals of the top half of the laptop. Screen and Speakers.

In case anyone is wondering, here are details on the new and improved Chris# instruction set:

DO – part of do-while loop
WHILE – part of do-while loop
IF – If condition true, jump to location
PRINTI – “print immediate” – print up to 6 characters
ADD – addition
SUB – subtraction
AND – logical AND
OR – logical OR
XOR – logical XOR
MULT – multiply
DIV – divide
TG   – Play the “Eye of the Tiger” theme song . . . best. . .opcode. . .ever
GOTO – jump to a location
GOSUB – jump to a location, place next address on stack
RTN – return from a gosub
SND – play a sound
PEEK – read value from ram
POKE – place value in ram
GETKEY – get the last-pressed key, 0 if no key pressed
SETPTR – set pointer value to 0x0000-0xffff
PRINTV – print variable (a-z)
END – exit program
REM – comment

And for those wishing to build their own…

Source Code:

The Main 28X-1v Firmware (“LinaxeOS”, embedded applications, interpreter)

Linaxe.bas

The I/O controller firmware (keyboard FIFO)

kbfifo.bas

Schematic

schematic