The web based IDE includes an emulator, editor, and assembler so you can develop Kwak-8 programs without having to download anything.

while the assembler is broadly similar to existing AVR assemblers it is not intended to be totally compatible. It includes a number of features designed to assist people coding directly in assembler. It is a straight-to-binary assembler and does not use a linker.

.snips

The most notable enhancements to the assembler are snips and assemble-time functions. Snips allow code to be added to a program conditionally and work well in conjunction to macros.

.snip WaitForFrame vwait_: push r0 push r1 in r1,port_FrameTick .lp: in r0,port_FrameTick cp r0,r1 breq .lp pop r1 pop r0 ret .endsnip

In the snip above. The code implements a loop checking to see if the frame counter has changed. When declared as a snip, the code is not immediately generated in the program but will be appended to the program if a .use WaitForFrame directive occurs in the code. Multiple instances of .use can exist and the code will be included only once.

This make it possible to write macros that can automatically bring in supporting code.

.macro vwait .use WaitForFrame call vwait_ .endmacro

In the case where a macro contains the .use directive, using the macro is enough to include any supporting code. If the macro is never used the support code is also not included in the program.

Constant expressions

While the assembled instructions themselves are limited to using simple operations on fairly small integers, you can have more complexity when it comes to how instruction parameters are calculated.

The Assembler uses mathjs to provide constant expression evaluation. This allows a variety of interesting features

ldi r16, 3*5+1 // assembles as ldi r16,16; numberOfSheep = 28 double(x) = 2x ldi r17, double(numberOfSheep) // assembles as ldi r17,56

You can also perform mathjs expressions in conditional assembly .if conditions

.macro min reg,val .if isRegister(val) cp reg,val brlo .done mov reg,val .else cpi reg,val brlo .done ldi reg,val .endif .done: .endmacro min r16,8 //generates cpi r16,8 | brlo ... | ldi r16,8 min r16,r15 //generates cp r16,r15 | brlo ... | mov r16,r16