Difference between revisions of "Virtual Machines"

From SizeCoding
Jump to: navigation, search
Line 17: Line 17:
  
 
Or if you are just curious you can just start doodling online at http://tic80.com/
 
Or if you are just curious you can just start doodling online at http://tic80.com/
 +
 +
=== Getting started ===
 +
Most TIC-80 programs are coded using the LUA Scripting language. However it is possible to select different scripting language like javascript at the cost of a couple of bytes/characters like so:
 +
<syntaxhighlight lang="lua">
 +
</syntaxhighlight>
 +
 +
  
 
=== Video display ===
 
=== Video display ===
Line 22: Line 29:
  
 
==== Draw functions ====
 
==== Draw functions ====
Here is a bit of code to get you started:
+
There are a couple of built-in drawing functions you can use:
 +
 
 +
cls(color=0)
 +
pix(x,y[color]) [-> color]
 +
circ(x,y,r,color) -- filled circle
 +
circb(x,y,r,color) -- border circle
 +
rect(x,y,w,h,color) -- filled rect
 +
rectb(x,y,w,h,color) -- border rect
 +
line(x0,y0,x1,y1,color)
 +
tri(x1,y1,x2,y2,x3,y3,color)
 +
textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,
 +
use_map=false,colorkey=-1)
 +
print(text,x=0,y=0,color=15,fixed=false,
 +
scale=1,smallfont=false) -> width
 +
 
  
 
==== Getting something on screen ====
 
==== Getting something on screen ====
Line 45: Line 66:
 
==== Make some noise ====
 
==== Make some noise ====
 
To be added soon.
 
To be added soon.
 +
 +
=== Compression And Release ===
 +
Sizecoding on the Atari ST is not very huge yet, so resources are sparse. Here are some bytetros with source code:
 +
 +
=== Online version: Metadata and Thumbnail image ===
 +
When uploading the intro to the TIC80 website for an playable online version, you will need to build a new TIC file with some added some meta-data and Thumbnail image (You can take this snapshot using the F7 key) and use this as you online version.
 +
 +
The Meta data is added at the top of your intro as follows
 +
<syntaxhighlight lang="lua">
 +
-- title: My intro
 +
-- author: scener
 +
-- desc: my first sizecoded TIC-80 intro
 +
-- script: lua (or moon/wren/js/fennel)
 +
</syntaxhighlight>
  
 
=== Additional Resources ===
 
=== Additional Resources ===
Sizecoding on the Atari ST is not very huge yet, so resources are sparse. Here are some bytetros with source code:
+
Sizecoding on the TIC-80 is still in its infancy, but luckily there is already plenty of information to get you started!
  
 
* TIC-80 Wiki page https://github.com/nesbox/TIC-80/wiki
 
* TIC-80 Wiki page https://github.com/nesbox/TIC-80/wiki
 
* TIC-80 One page cheat sheet (PDF) https://zenithsal.com/assets/documents/tic-80_cheatsheet.pdf
 
* TIC-80 One page cheat sheet (PDF) https://zenithsal.com/assets/documents/tic-80_cheatsheet.pdf
 
* TIC-80 Intros and demos on Pouet (Press F1 for code): https://www.pouet.net/prodlist.php?platform%5B%5D=TIC-80
 
* TIC-80 Intros and demos on Pouet (Press F1 for code): https://www.pouet.net/prodlist.php?platform%5B%5D=TIC-80
 +
* TIC-80 TIC Cartridge File Format (from TIC-80 Wiki) https://github.com/nesbox/TIC-80/wiki/tic-File-Format
  
 
== Javascript ==
 
== Javascript ==

Revision as of 09:50, 2 January 2021

Introduction

Welcome to the virtual machine section of the website, where we will cover virtual machine (VM) languages and platforms like the TIC-80 and Javascript.

TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games and demos.

There are built-in tools for development: code, sprites, maps, sound editors and the command line, which is enough to create a mini retro game. At the exit you will get a cartridge file, which can be stored and played on the website.

Also, the game can be packed into a player that works on all popular platforms and distribute as you wish. To make a retro styled game the whole process of creation takes place under some technical limitations: 240x136 pixels display, 16 color palette, 256 8x8 color sprites, 4 channel sound and etc.

Setting up

As the TIC-80 fantasy computer is an all-in-one creation and execution platform, setting up TIC-80 is very easy:

Just go to the https://github.com/nesbox/TIC-80/releases page

and download the package for your platform of choice (Windows, OSX, Linux and even Raspberry Pi).

Or if you are just curious you can just start doodling online at http://tic80.com/

Getting started

Most TIC-80 programs are coded using the LUA Scripting language. However it is possible to select different scripting language like javascript at the cost of a couple of bytes/characters like so:


Video display

The TIC-80 has a 240x136 pixel display with 16colors which can be accessed via a wide range of graphics functions or by writing directly to VRAM at memory address 0x0000 using the poke4 instruction.

Draw functions

There are a couple of built-in drawing functions you can use:

cls(color=0) pix(x,y[color]) [-> color] circ(x,y,r,color) -- filled circle circb(x,y,r,color) -- border circle rect(x,y,w,h,color) -- filled rect rectb(x,y,w,h,color) -- border rect line(x0,y0,x1,y1,color) tri(x1,y1,x2,y2,x3,y3,color) textri(x1,y1,x2,y2,x3,y3,u1,v1,u2,v2,u3,v3,

use_map=false,colorkey=-1)

print(text,x=0,y=0,color=15,fixed=false,

scale=1,smallfont=false) -> width


Getting something on screen

Here is a bit of code to get you started:

function TIC() 
t=time()/99
for y=0,136 do for x=0,240 do
pix(x,y,(x>>3~y>>3)+t)
end;end;end

Which will display an animated XOR pattern.

Setting colors

Unfortunately for us sizecoders, the pre v0.8 TIC-80 came with a different palette than the now standard (and much more friendly) sweety16 palette. And because of backwards compatibility, this old palette is also the default palette that is being used when now palette chunk is defined in the TIC cart.

Sound

The TIC-80 has soundregisters and 32 byte waveforms to access

Make some noise

To be added soon.

Compression And Release

Sizecoding on the Atari ST is not very huge yet, so resources are sparse. Here are some bytetros with source code:

Online version: Metadata and Thumbnail image

When uploading the intro to the TIC80 website for an playable online version, you will need to build a new TIC file with some added some meta-data and Thumbnail image (You can take this snapshot using the F7 key) and use this as you online version.

The Meta data is added at the top of your intro as follows

-- title: My intro
-- author: scener
-- desc: my first sizecoded TIC-80 intro
-- script: lua (or moon/wren/js/fennel)

Additional Resources

Sizecoding on the TIC-80 is still in its infancy, but luckily there is already plenty of information to get you started!

Javascript

The Javascript sizecoding community has been quite active for years now.

Setting up

  • Tools: -
  • Execution environment(s): Browser, Dwitter

Video display

No information yet

Sound

No information yet

Additional Resources

Here are some additional links with source code:

Prod name (Pouet link) Source code
128b Palette Starfield by Gaston https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/Gaston/starfield_128b_src/STARFLD.S
Fractal Landscape bootsector by Gaston https://github.com/ggnkua/Atari_ST_Sources/blob/master/ASM/Gaston/fractal_boot_src/FRACTAL.S