LittleBigForum Archive
LittleBigForum Archive
LittleBigForum Archive
Archive: 20 posts
Over the last couple of months I've developed an 8-bit CPU and 256-byte RAM chip. Together I believe they represent the fastest and most versatile 2015-03-07 14:32:00
computer made in LBP to date. I call this system the Lodestar. Author:
Ayneh
http://i.imgur.com/iOpsaVv.jpg
1 INTRODUCTION
Posts: 152
1.1 SPECIFICATION
1.2 DESIGN AND INTERFACE
1.3 INSTRUCTION SET
2 PROGRAMMING
2.1 YOUR FIRST PROGRAM
2.2 ADDITION
2.3 MULTIPLICATION
2.4 INPUT AND OUTPUT
2.5 GRAPHICS
2.6 SOUND
3 WHERE TO GET IT
1 INTRODUCTION
The Lodestar is an 8-bit microcomputer that supports arithmetic, logic, conditional jumps, a stack, subroutines, serial I/O and interrupts. It can also
generate music.
The most challenging part of developing the CPU were signal timing issues. To make the best use of each frame the system runs unclocked at 30 Hz,
resulting in speeds of around 3 instructions per second.
One of the problems with past computers in LBP is how poorly documented they were by their authors. With this post I hope to provide a
comprehensive guide to the system.
1.1 SPECIFICATION
- Accumulator architecture
- 256 bytes of memory
- 2 addressing modes
- Serial I/O ports
- 3 bars of thermo
Internally the system is split into 2 chips: the CPU and RAM. Together they use 4000 components total.
http://i.imgur.com/eBHmNTj.jpg
The Lodestar's front panel has 20 lights and 12 flip switches. Since I'm a fan of vintage computers the front panel is inspired by machines like the PDP-
8 and Altair 8800.
http://i.imgur.com/N2rwbME.jpg
There are 4 control switches: RUN starts and stops a program, EXA examines a memory address, DEP deposits a value into memory, DAT toggles
display of the accumulator or data bus.
The address lights show the current memory address. The data lights show either the contents of memory or the accumulator depending on the
position of the DAT switch. The status lights indicate the internal state of the machine, such as overflow and I/O port activity.
On the right side of the machine are the serial input and output ports.
http://fs1.directupload.net/images/150419/4beky8gk.png
There are two addressing modes for the LDA, STA, ADD, SUB and bitwise instructions: immediate and absolute. This is determined by the 1th bit of
the instruction as demonstrated below.
http://fs1.directupload.net/images/150419/8q92abea.png
2 PROGRAMMING
A Lodestar program is a series of instructions. When you flip the RUN switch the program will begin executing from the current memory address.
To input the value 44 at address 08 for instance you would first examine 08 and then deposit 44.
What follows is a tutorial that introduces the instruction set through 6 programs. All the programs begin from address 0.
http://fs2.directupload.net/images/150419/orqdp4nm.png
This program uses the jump instruction to jump to itself, creating an infinite loop.
2.2 ADDITION
http://fs2.directupload.net/images/150419/whjqdvgg.png
As the name implies the accumulator accumulates the result of all operations. To see the result of this program displayed on the data lights flip the DAT
switch up.
2.3 MULTIPLICATION
http://fs2.directupload.net/images/150419/t53dixve.png
This program performs 5 x 4. There are two variables used: x and i. The variable x is initially set to zero and accumulates the result with each iteration
of the loop. The variable i is decremented once per iteration and acts as a counter, when it reaches zero the program halts.
Located on the right side of the Lodestar are both the serial input port and serial output port. These can be used to connect peripherals or to create
networks of Lodestar systems.
On receiving a byte via the input port an interrupt is triggered. An interrupt pushes the current memory address to the stack and the CPU jumps to
address 0. After an interrupt has been handled a RTI instruction can be used to return the CPU to the prior address.
http://fs2.directupload.net/images/150419/3u6yenl7.png
This is a powerful program that listens to the input port, copying whatever it receives to memory. This means we can hook up a keyboard to the
system, so programs can be entered easier and
faster. In fact, all the programs in this tutorial were written using this program and a keyboard.
Although not necessary, this program uses the stack to temporarily store the interrupt. The stack starts at address FF and decrements down. This is a
handy way to pass data around without using lots of LDA and STA instructions.
2.5 GRAPHICS
Using the serial output port it's possible to communicate with peripherals such as a monitor.
http://fs2.directupload.net/images/150419/wgkt3ojh.png
This program sends a region of memory to the serial output port, byte by byte. The monitor treats these bytes as pixel coordinates and updates the
screen. In this case, the pixel data is 3 bytes long and draws a triangle.
https://i.imgur.com/LKKAIFa.jpg
By combining this program with the program in the previous section it's possible to copy programs and data from one Lodestar system to another.
2.6 SOUND
Lastly, the Lodestar is also capable of generating music. The lowest 4 bits of the accumulator determine the pitch when the SPK instruction is used.
http://fs2.directupload.net/images/150419/bv2yhvin.png
3 WHERE TO GET IT
https://lbp.me/v/qvz2ch0
Simply complete the level to collect the Lodestar, monitor and keyboard as shareable prizes.
Author:
gurren009
Posts: 617
Author:
Hope you end up getting the "awesomesauce" pin for this. JellyBellyScout
Posts: 467
Author:
dakrrs
Posts: 561
yep @dakrrs. I have a few logic friends that have made logical masterpieces like this. but dang this looks like quite the accomplishment! i'll have to 2015-03-07 20:47:00
queue this because I really wanna see this logic in action. Very impressive indeed! Author:
nerd_dog
Posts: 1483
Wow, I actually just took a computer architecture class last semester in university (I am in Software Engineering), and learned all about this stuff, and 2015-03-07 22:47:00
was considering doing something like this myself, but this blows out even what I had in mind. Mind if I ask, are you in computer science, or Author:
computer/software engineering fields. THE-73est
Posts: 39
It seems while this level is stable on LBP2 it crashes LBP3 on PS3. I've narrowed down the issue to a single chip and hope to publish a fix shortly. 2015-03-08 16:31:00
Nah, I'm just a hobbyist. Author:
Ayneh
Posts: 152
It's not lbp any more. Just. Woah. I can't even believe how much time this would of took. 2015-03-08 16:46:00
Author:
Kid_code
Posts: 90
Author:
Sound Friction
Posts: 437
The game keeps crashing when loading the level, so I'm not able to play it... 2015-03-09 10:03:00
Author:
mmm good lbp3 211Nickey
Posts: 337
I was having the same problem. i'll have to check it out on lbp2 2015-03-09 11:17:00
Author:
i'll check out the fix to see if it works first though nerd_dog
Posts: 1483
Holy crap, I am definitely queuing this up to try out. Awesome work! 2015-03-09 12:02:00
Author:
dragonicfire
Posts: 85
I've republished the level with an update. It won't crash LBP3 now.
Sorry to you both and anyone else who had their console crash before.
Posts: 152
I had to move the contents of the CPU to a piece of material and make the inputs wireless to stop the crashes. My guess is LBP3 can't resolve the
internal state of the chip somehow.
That is just fantastic! How long did it take you to program this? 2015-03-10 19:33:00
Author:
Fox
Posts: 211
2015-03-10 20:34:00
Was about to put this in my queue until I saw this comment. Now I'm afraid. Author:
dakrrs
COMMENTS
Zupaton
Posts: 561
"Possibly wasn't created with this in mind but the level crashed my ps3 in lbp3 2 times in a row, obviously the second after a clean restart"
I think I may need your help with programing a card game called the eye of judgement haha part way through it got the feild logic setup done just need 2015-03-10 21:18:00
to work on the cards and creatures plus a system to give and take mana from both players during turns and summoning creatures BTW is this level Author:
published would love to check it out samuasp
Posts: 73
The first level backup for the CPU was made on 2015/1/19, so about 2 months. 2015-03-11 16:44:00
Author:
The RAM chip was made last year along with the switches, so I already had a bunch of stuff to work with. Ayneh
That has been fixed with an update. The level won't crash LBP3 now.
Have you written about your level anywhere on here? If you have all the mechanics you have in mind written up I can help out.
Posts: 152
And yeah, it's published here: https://lbp.me/v/qvz2ch0
Yeah there is a post on here somewhere I recently published a showcase showing how it works sort of thinghttp://lbp.me/v/qv0e7ew the logic is need 2015-03-12 19:03:00
to try and sort is a round based thing using selectors to switch between player 1 and 2, at the start of each players turn they gain two mana. Check this Author:
youtube video out from the original game as this will give you an oversight on the complexity and size of this project plus what kind of logic setups are samuasp
needed https://youtu.be/ni3UvCJUXXE
Posts: 73
Link me to your thread so we can talk about stuff there. 2015-03-14 10:37:00
Author:
You're right in that you'd likely control the flow of the game with selectors. After reading this the flow of the game appears relatively simple: Ayneh
http://db.gamefaqs.com/console/ps3/file/eye_of_judgement.txt
What I imagine is an adder/subtractor circuit that takes 2 cards (from 2 sets of 7 card slots) and performs some operation on them. Which cards are
fed into the circuit is determined by the grid and whether the current player's mana is above 0.
Posts: 152
A lot of the attributes the cards have, like being poisoned, their cardinal direction, etc, I would discard initially since it introduces a lot of complexity.
The eye of judgement i have most of the feild logic setup as i think i mentioned before i have been working on a few of the spell cards and have a basic 2015-03-14 11:39:00
chip for the cards which indicates health.attack power their ability to counter attack if they can gain any health from beijg placed on a correct feild and if Author:
they lose health from being placed on the wromg feild ect gonna have a quick look at a mana system now just send me a message on psn - samuasp
blockbuster95 (sorry for the lack of grammer in this post typing it on my phone)
Posts: 73
Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.