The Kaliber Project is a project I started awhile ago to create a virtual machine programming language, and currently I have a working virtual machine and an assembler. I've decided to attempt to bring the virtual machine to the TI-84+CE.

Here's an example of a piece of assembly code for the Kaliber virtual machine:
Code:
main:
   ;Output "What is your name?: "
   GET msg1
   MVU $1
   MOV $4
   EXP B
   DST A
   SYSCALL

   ;Input name
   GET name
   MVU $0
   MOV $A
   EXP B
   MOV $1
   SYSCALL
   
   ;Output "Hello, "
   GET msg2
   MVU $0
   MOV $7
   EXP B
   MOV $0
   SYSCALL

   ;Print the inputted name
   GET printName
   CAL
   
   ;Output "!\n"
   GET msg3
   MVU $0
   MOV $2
   EXP B
   MOV $0
   SYSCALL
   
   HLT
   
;Prints the inputted name
printName:
   ;Get the address of the name and store it on the stack
   GET name
   IMP32
   PUSH32
printNameLoop:
   ;Pop the address from the stack
   POP32
   
   ;Load a character at the address
   EXP32
   LOD
   
   ;Compare it to 0
   DST B
   CMP B
   
   ;If it equals 0, exit
   IMP32
   PUSH32
   GET printNameExit
   JPE
   
   ;Pop the address from the stack
   POP32
   EXP32

   ;Print a single character at that address
   MVU $0
   MOV $1
   EXP B
   DST A
   SYSCALL
   
   ;Increment it by 1
   IMP32
   INC32
   EXP32
   
   ;Store the address on the stack and repeat
   PUSH32
   GET printNameLoop
   JMP

   ;End the loop
printNameExit:
   POP32
   RET
   
name:
   $r11
msg1:
   $"What is your name?: "
msg2:
   $"Hello, "
msg3:
   $"!"
   $0A


It's a bit long but basically it asks you for your name, lets you type it in, then says "Hello, x!" where x is your name.

Here's the compiled program running on my PC:


Here's the same exact program running on the TI-84+CE


Here's a more complex program running on my Windows PC, my Raspberry Pi, and the Nintendo 3DS:


The idea behind this is basically the same as Java, you compile your program to the virtual machine and it runs everywhere. The Windows/Linux/Mac version of the virtual machine (including the assembler and eventual compiler) is being written in C, using GTK+3 for the graphics. The TI-84+CE I actually am building in eZ80 Assembly. The 3DS version is slow because I made it in SmileBASIC, which is an officially supported scripting language, but it works.

So far, the TI-84+CE virtual machine supports all the instructions of the virtual processor, but I still am working on the "system calls", which are system specific operations, although so far I've made them standard across all platforms. These include basic input and output of text, date/time, random number generation, graphics etc.

The virtual machine is 8-bit with registers A-H, but registers A-D and E-H can be combined for 32-bit numbers which you can do 32-bit operations on, and E-H is used for 32-bit memory addressing allowing for up to files 4.3 gigabytes large, although on the TI-84+CE the it is limited 65.5 kilobytes. You are basically limited to whatever you can fit in the 8xv.

Here's all the operations:


The idea behind the this is you can compile a single program and it'll run on Windows, Mac, Linux, Android, iOS, you can embed it in web pages, and, well, it'll run on the TI-84+CE as well for some reason.

Is this going to be some amazing Java-destroying language? No, I'm one person who is mostly self-taught in programming. But maybe some people will find a use for it once it's finished. The language is so abstracted from the hardware it doesn't really take advantage of the hardware, so it's slow. Although fast enough for a lot of things.

Edit: Github
amihart wrote:
The Kaliber Project is a project I started awhile ago to create a virtual machine programming language, and currently I have a working virtual machine and an assembler. I've decided to attempt to bring the virtual machine to the TI-84+CE.

Here's an example of a piece of assembly code for the Kaliber virtual machine:
Code:
main:
   ;Output "What is your name?: "
   GET msg1
   MVU $1
   MOV $4
   EXP B
   DST A
   SYSCALL

   ;Input name
   GET name
   MVU $0
   MOV $A
   EXP B
   MOV $1
   SYSCALL
   
   ;Output "Hello, "
   GET msg2
   MVU $0
   MOV $7
   EXP B
   MOV $0
   SYSCALL

   ;Print the inputted name
   GET printName
   CAL
   
   ;Output "!\n"
   GET msg3
   MVU $0
   MOV $2
   EXP B
   MOV $0
   SYSCALL
   
   HLT
   
;Prints the inputted name
printName:
   ;Get the address of the name and store it on the stack
   GET name
   IMP32
   PUSH32
printNameLoop:
   ;Pop the address from the stack
   POP32
   
   ;Load a character at the address
   EXP32
   LOD
   
   ;Compare it to 0
   DST B
   CMP B
   
   ;If it equals 0, exit
   IMP32
   PUSH32
   GET printNameExit
   JPE
   
   ;Pop the address from the stack
   POP32
   EXP32

   ;Print a single character at that address
   MVU $0
   MOV $1
   EXP B
   DST A
   SYSCALL
   
   ;Increment it by 1
   IMP32
   INC32
   EXP32
   
   ;Store the address on the stack and repeat
   PUSH32
   GET printNameLoop
   JMP

   ;End the loop
printNameExit:
   POP32
   RET
   
name:
   $r11
msg1:
   $"What is your name?: "
msg2:
   $"Hello, "
msg3:
   $"!"
   $0A


It's a bit long but basically it asks you for your name, lets you type it in, then says "Hello, x!" where x is your name.

Here's the compiled program running on my PC:


Here's the same exact program running on the TI-84+CE


Here's a more complex program running on my Windows PC, my Raspberry Pi, and the Nintendo 3DS:


The idea behind this is basically the same as Java, you compile your program to the virtual machine and it runs everywhere. The Windows/Linux/Mac version of the virtual machine (including the assembler and eventual compiler) is being written in C, using GTK+3 for the graphics. The TI-84+CE I actually am building in eZ80 Assembly. The 3DS version is slow because I made it in SmileBASIC, which is an officially supported scripting language, but it works.

So far, the TI-84+CE virtual machine supports all the instructions of the virtual processor, but I still am working on the "system calls", which are system specific operations, although so far I've made them standard across all platforms. These include basic input and output of text, date/time, random number generation, graphics etc.

The virtual machine is 8-bit with registers A-H, but registers A-D and E-H can be combined for 32-bit numbers which you can do 32-bit operations on, and E-H is used for 32-bit memory addressing allowing for up to files 4.3 gigabytes large, although on the TI-84+CE the it is limited 65.5 kilobytes. You are basically limited to whatever you can fit in the 8xv.

Here's all the operations:


The idea behind the this is you can compile a single program and it'll run on Windows, Mac, Linux, Android, iOS, you can embed it in web pages, and, well, it'll run on the TI-84+CE as well for some reason.

Is this going to be some amazing Java-destroying language? No, I'm one person who is mostly self-taught in programming. But maybe some people will find a use for it once it's finished. The language is so abstracted from the hardware it doesn't really take advantage of the hardware, so it's slow. Although fast enough for a lot of things.

Edit: Github


I've done something similar in TI-Basic (wow that seems like FOREVER ago, but it was only ~3 mos) , but this is awesome! I will try to keep up on any progress, as stuff like this intrigues me.

Just an idea, how about a (separate and optional) program that lets you select what command you want to use, instead of memorizing a bunch of commands. I think that would add some more appeal to some non-programmers, too!
Like a pre-assembly translator that takes intelligable long commands and just swaps them with their proper short-code counterparts? If Amihart completes the project, I could easily make a seperate program to do that on the PC. All it would take is combing through the original source, translating it to another file in proper syntax, then pointing it at the assembler and telling it what to do. Easy stuff for me.

Course, its an assembly-like language, its gonna look messy no matter what you do.
Luxen wrote:
Like a pre-assembly translator that takes intelligable long commands and just swaps them with their proper short-code counterparts? If Amihart completes the project, I could easily make a seperate program to do that on the PC. All it would take is combing through the original source, translating it to another file in proper syntax, then pointing it at the assembler and telling it what to do. Easy stuff for me.


Yeah, it's pretty easy for anyone with a decent amount of computer programming experience. The suggestion was just an idea to make it easier for people who don't want to spend time learning all the syntax.

[edit]
This is also incredibly easy on the TI-84+ CE, one could have some nested menu( commands that feed to labels that simply run the same code as you would run from the Home Screen

Code:

:Menu("Commands","Specify name",01.....
:Lbl 01
:"NAME":asm(prgmKALIPER
:Stop
...
_iPhoenix_ wrote:
Just an idea, how about a (separate and optional) program that lets you select what command you want to use, instead of memorizing a bunch of commands. I think that would add some more appeal to some non-programmers, too!

I really don't know what you're asking for. "NAME" is a compiled program, it's not a command. I compile it on the PC then converted it to an 8xv using someone's Python script then the virtual machine runs the program. Your program isn't written in TI-BASIC, it's written in Kaliber assembly.
He is asking for a menu-driven program for this language; in effect, a simple IDE.
This is a really cool project! I like how it is able to run on so many platforms at once. Looking at your code I see some intense 32 bit operations in asm, that probably took quite some time to write. Keep up the nice work!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement