This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Lignum's profile picture

CCPU 1.0 - An emulated CPU for ComputerCraft

Started by Lignum, 04 March 2014 - 04:20 PM
Lignum #1
Posted 04 March 2014 - 05:20 PM
CCPU v1.0


What is it?
An emulated CPU.
Its main purpose is to allow programming in an assembly language in ComputerCraft.
It comes with an entire development toolset which includes an assembler used to
produce machine code for the CCPU.

What can I do with it?
Addition, subtraction, comparison, jumping, the basics…
I'm hoping that this will eventually be able to replace Lua.
But we're on v1.0, so it won't change the world as of now :)/>.

Got any code examples?
Of course!

Spoiler

acu_is_zero:
   mov 79, gp1
   ret
end

loop:
   mov 111, gp1

   cmp acu, 0
   jc acu_is_zero

   mov gp1, pr1
   wrt

   add acu, 1
   mov ret1, acu

   lt acu, 5
   jc loop

   ret
end

jmp loop

mov 104, pr1
wrt

mov 33, pr1
wrt

mov 10, pr1
wrt

This prints "Oooooh!". Don't ask. Please.

This is an example program that ships with the development tools.
So if you have them installed, you can run this program.
In your root directory, do this:

cd ccpudev
ccasm example.asm example
pccpu example

Where do I get it from?
Type these in CraftOS to get the core:
pastebin run TGU43NWP
pastebin get qmrXGnV4 pccpu

If you also wish to install the developer tools, type this after the previous ones:
pastebin run rMrXRH3Y

This uses oeed's awesome Package Maker!


How do I use it?
I wrote a tutorial. You can find it here. I'm not a skilled web designer, but it does its job.

Known Bugs
  • Nested labels cause errors.
Edited on 06 March 2014 - 10:49 AM
TurtleHunter #2
Posted 04 March 2014 - 06:03 PM
Your installer doesnt work, dropbox gives a 404 error. Have you tested it?
Lignum #3
Posted 04 March 2014 - 08:47 PM
Your installer doesnt work, dropbox gives a 404 error. Have you tested it?
Yes, I have tested it. It works fine for me right now. Try again.
sci4me #4
Posted 06 March 2014 - 01:03 AM
Your installer doesnt work, dropbox gives a 404 error. Have you tested it?
Yes, I have tested it. It works fine for me right now. Try again.

nope it doesnt work…
Lignum #5
Posted 06 March 2014 - 10:01 AM
nope it doesnt work…
I'll try to reproduce the issue.
Could you please post a more detailed error description along with what steps you took to install the program?
It would help me a lot.


EDIT: Switched to oeed's Package Maker. Since pastebin always seems to work, there shouldn't be any problems anymore.
Edited on 06 March 2014 - 10:45 AM