( a blank file ) %DEBUG { ;print-hex/byte JSR2 #0a18 DEO } %DEBUG2 { ;print-hex JSR2 #0a18 DEO } %RTN { JMP2r } %10/ { #04 SFT } ( devices ) |00 @System &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 |10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |80 @Controller &vector $2 &button $1 &key $1 &func $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 ( variables ) |0000 @kalama &module $2 ( pointer to start of module file ) &loopflags $1 ( if different channels are set to loop ) &instruments $2 ( address that instruments start at ) &tick $1 &line $1 &speed $1 &songpos $2 ( position in song table ) ( program ) |0100 ( -> ) #0fe5 .System/r DEO2 #0fc5 .System/g DEO2 #0f25 .System/b DEO2 ;module ;k-init-module JSR2 #00 #00 ;k-load-instrument JSR2 ;on-frame/run .Screen/vector DEO2 BRK @on-frame ( -> ) &run ;k-tick/run JSR2 BRK @print-hex ( value* -- ) SWP ,&byte JSR &byte ( byte -- ) STHk #04 SFT ,&parse JSR #18 DEO STHr #0f AND ,&parse JSR #18 DEO RTN &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD RTN &above #57 ADD RTN RTN @print-dec ( value* -- ) #2710 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2 #03e8 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2 #0064 DIV2k DUP #30 ADD #18 DEO MUL2 SUB2 #000a DIV2k DUP #30 ADD #18 DEO MUL2 SUB2 #30 ADD #18 DEO POP RTN @print-str ( string* -- ) #0001 SUB2 &while INC2 LDAk DUP #18 DEO ,&while JCN POP2 RTN ~engine.tal @module 8f 02 02 ( file header - speed 8, loop on, 2 patterns, 2 instruments ) 0008 ( size ) 00 ff ff ff 01 ff ff ff ( song table, 2 rows ) @DEBUG-patterns ( pattern 00 ) 54 02 00 ( C-3 I00 ) 52 00 00 54 00 00 4f 00 00 4b 00 00 4f 00 00 48 00 00 ff 00 00 54 02 00 52 00 00 54 00 00 4f 00 00 4b 00 00 4f 00 00 48 00 00 ff 00 00 ( pattern 01 ) 54 00 00 56 02 00 ( C-3 I00 ) 57 00 00 56 00 00 57 00 00 54 00 00 56 00 00 54 00 00 56 00 00 52 00 00 54 00 00 52 00 00 54 00 00 50 00 00 54 00 00 ff 00 00 @DEBUG-instruments ( instrument 00 ) 0002 ( sample length ) ff ( volume ) 80 ( flags - loop sample ) 50f0 ( ADSR ) ff 00 ( square wave sample data ) ( instrument 01, unused ) 0008 ( sample length ) 60 ( volume ) 00 ( flags - no loop ) 10f0 ( ADSR ) ff de 21 32 fa 43 aa 04 ( 8 random bytes )