VMOS 0.24 - AN AMOS-STYLE LANGUAGE FOR THE VIXEN-32 ==================================================== VMOS is a BASIC in the spirit of AMOS. Programs are written in an editor on the VIXEN-32 itself; F1 compiles them to native RISC-V code and runs them at the full 100 MHz. There is no interpreter and no cross compiler: a loop in VMOS is a loop of real CPU instructions. Programs are plain text .VMS files, so they also open in any PC text editor. CMOS programs (.CMS files, the same text) load, run and save the same way. For syntax highlighting in Notepad++, import VMOS_Notepad++.xml (Language > User Defined Language > Define your language... > Import...). The full reference, with several runnable examples for every command, is doc/basic_command.pdf (and .txt). 1. ON THE SD CARD ----------------- /VIXEN-32/KERNEL.BIN VMOS rides along in it: type VMOS at BASIC's Ready and answer Y (VMOS takes BASIC's memory); the reset button goes back /VIXEN-32/VMOS/... your programs, in any folders below VMOS New to VMOS? doc/VMOS_Beginners_Guide.pdf (and .txt) starts from the beginning; its programs are in doc/Users_Guide_Samples (copy them to /VIXEN-32/VMOS/GUIDE). The EXAMPLES folder holds HELLO, GUESS, STARS, BENCH, SPRITES (with SHIP.BMP, BALLS.BMP and BOOM.WAV), BOBS (with BALLS.BMP and TILES.BMP), SINE (a sine scroller), TYPES (records), STARFLD, STARFLD4 and STARFIX (copper starfields: 12 sprites, 4 sprites, 4 sprites with # numbers), the step tests STEP1-STEP8 (STEP6 plays MADNESS.MOD and DEMO.PST, STEP7 PLUCK.WAV, STEP8 draws BOXC, BOXT, SPHERE and FLOOR8 .OBJ) and six self-tests (TESTCORE, TESTMORE, TESTFIX, TESTFLT, TESTV06, TESTTRIG; each prints PASS/FAIL totals). The examples in the reference use these files: save them in EXAMPLES. 2. THE EDITOR ------------- Three screen modes, F7 goes to the next (default 40 columns): 40 columns the 8x8 font in the 320 x 200 window 63 columns a 6x8 font over the full 384-pixel width 80 columns the hi-res text: the 8x8 font half as wide, 320 pixels wide The last column is the vertical scroll bar and the row below the program the horizontal one, so the program area is 39, 62 or 79 columns wide. F1 run F2 (SHIFT+F1) check (compile only) F3 load F4 (SHIFT+F3) save F5 new F7 40 / 63 / 80 columns F8 (SHIFT+F7) help RUN/STOP stop a running program (F6 does nothing, so a missed SHIFT never clears the program) Cursor keys move. HOME = start of the line. CTRL+HOME end of the line CTRL+UP / CTRL+DOWN page up / down; the cursor keeps its screen row CTRL+LEFT / CTRL+RIGHT start / end of the program SHIFT + cursor keys select text (as on a PC) CTRL+C / CTRL+X / CTRL+V copy / cut / paste CTRL+A select all CTRL+Z undo (repeatable); typing on one line is one step CTRL+F find: type the search text (prefilled with the selection or the last search). The field edits like a line: LEFT/RIGHT, HOME, CTRL+HOME, DEL, SHIFT+DEL, CTRL+V. RETURN finds the next match, SHIFT+RETURN the previous one, wrapping around; case-insensitive. A match is shown white on red and selected. ESC or RUN/STOP closes the field; F keys and CTRL keys close it and do their job. MEGA + a key the character on the key's front: MEGA + / , . = : ; types \ ~ | _ { }; MEGA + left-arrow the backquote (Inkey$ returns them the same way) CTRL+S save to the program's file (as loaded by F3 or saved by F4) without asking; an unsaved program opens the F4 save box CTRL+B build a release: NAME.RVK and NAME.VXA next to the program (see RELEASES below) SHIFT+POUND the network on / off, as at BASIC's READY prompt (see THE NETWORK below) Typing, RETURN, TAB or DEL replace the selection. DEL deletes left, SHIFT+DEL deletes right, CTRL+D deletes the line. RETURN splits the line (keeping the indent), TAB indents by 3. Lines can be 255 characters long; the view scrolls horizontally. LOADING: F3 opens a file box on the current folder: folders first (in [brackets]), then the .VMS and .CMS programs. RETURN or a double click opens a folder or loads a program; DEL (or [..]) goes up. The box never goes above /VIXEN-32/VMOS. F3 reopens on the current program's folder, scrolled as you left it. SAVING: F4 opens the same box in the program's folder, with a name field below the list. RIGHT opens a folder (or double click), LEFT goes up; CTRL+N creates a folder; CTRL+D deletes the selected program (after a question). Type a name (the first key replaces the suggestion), or select a program to overwrite it. RETURN saves; overwriting asks first. A .CMS program is saved as .CMS again, anything else as .VMS; the extension shows after the name. THE MOUSE (port 1): a click places the cursor; drag to select (dragging past the edge scrolls, so a selection can be longer than the screen); SHIFT+click extends the selection. The scroll bars work as on a PC: drag the thumb, click the track to page (hold to keep paging), click an arrow to move one line or column (hold to repeat). Scrolling with the mouse leaves the cursor in place; the next key scrolls back to it. Keywords are capitalized when you leave a line ("print" becomes "Print"). A compile error moves the cursor to the line and shows the message. When a program ends, VMOS returns to the editor at once. A program that should keep its screen visible ends with Wait Key. VMOS also uses BASIC's memory (the kernel stays and does VMOS's file I/O). The reset button returns to BASIC. RELEASES: CTRL+B compiles the program and writes two files into its folder, named after it (SHOOT.VMS -> SHOOT.RVK, SHOOT.VXA): NAME.RVK the program plus the part of VMOS it needs, without the editor. Start it from the file browser: HELP at Ready, pick it, type RUN. NAME.VXA every file the program loads by a quoted name (Load Images, Load Sample, Load Tiles, Track Load, Td Load and the files its .obj and .mtl files name, Td/Bob/Sprite Path ... Play), packed into one file; up to 255 files. Without such files there is no .vxa. A window shows the progress while it works: compiling, packing file n of N, writing the .rvk, with a progress bar, percentage and elapsed time. The program must be saved first. The release looks for its .vxa at the path where it was built (e.g. /VIXEN-32/VMOS/GAMES/SHOOT.VXA), so copy both files to the same folder on another card. When the program ends, the release shows "Program ended" (or the error) and stops; press reset. 3. THE LANGUAGE --------------- No line numbers. Statements are separated by : or a new line. ' or Rem starts a comment. NUMBERS 32-bit integers: 123 -5 $FF (hex) %1010 (binary). Fixed-point (#): 1.5 -0.25 (Q16.16). Floats (!): 1.5! 1E10! True = -1, False = 0. STRINGS "text", up to 32767 characters. VARIABLES SCORE (integer), SPEED# (fixed-point), ANGLE! (float), NAME$ (string). Names up to 23 characters. Variables start as 0 / "". ARRAYS Dim A(100), GRID(20,10), N$(50) - indices start at 0, so A(100) holds 101 elements. Up to 255 dimensions. Large arrays are placed in chip RAM automatically. OPERATORS, highest precedence first: -x * / mod + - (+ also concatenates strings) = <> < > <= >= (strings compare too) not and or xor Integer / truncates toward zero. Comparisons give -1 or 0; and/or/xor/not are bitwise, as in AMOS. ASSIGNMENT X=5 A$="hi" A(3)=X*2 Let X=1 Inc X Dec X Add X,10 PRINTING Print "a";B;C$ ; = no separator, , = next 10-column tab stop. A trailing ; or , keeps the cursor on the line. Locate x,y Cls Home Pen c Paper c (colors 0-255) Print writes in the text window: 40 x 25 characters of the 8x8 font at pixel 32,12 by default. Window x,y,w,h text window at pixel x,y, w x h characters (inside 512 x 256): Locate, wrap and scrolling stay inside it. Border Dims 0,0,0,0 then Window 0,0,48,28 = the whole display. Text x,y,s$ s$ at any pixel position (clipped); the cursor does not move. BORDER Border c border color (0-255) Border Dims l,r,t,b border size in pixels on each side of the 384 x 224 display (0-255; default 32,32,12,12). 0,0,0,0 = the whole display (the hardware keeps 1 line top and bottom: 0,0,1,1). Nothing moves; the mouse can reach the whole visible area. COLORS Color n,r,g,b palette entry n (0-255), r,g,b 0-255 Color n,$RRGGBB the same as one number; Color(n) reads it Color Back c the background color behind all layers Default palette: 0-15 the C64 colors, 16-31 a grey ramp, the rest black. EIGHT PALETTES of 256 (0-7), all the default at the start: Palette n the one Color, Color( ), Copper Color, Load Images, Load Tiles and Td set (default 0) Screen Palette n the one the screen shows (default 0) Tiles Palette n Border Palette n the same for those Sprite Palette n,p sprite n in palette p Tile x,y,t,f,p a tile's own p, added to Tiles Palette Copper Palette y,n the screen in palette n from line y THE DISPLAY Raster the raster line now (0-311; 0-223 visible) Wait Raster n wait until just before line n starts, so the next change shows from its first pixel Screen Hide / Show hide / show the program's screen Screen Offset x,y display the 512 x 256 screen from pixel x,y (wraps; changes during vertical blank) TYPES Type ENEMY a record type (like a C struct): numeric X, Y, SPEED and string fields, on as many lines as NAME$ needed End Type Dim E(20) As ENEMY an array of records; Dim HERO As ENEMY E(3).X = 100 fields work anywhere a variable does. Define a Type before its first Dim, outside procedures. SCREENS Screen Open n screen n (0-7) with its own 512 x 256 pixels; it becomes current and displayed Screen n draw and print into screen n Screen To Front n display screen n (the bobs move with it) Screen Copy a,x1,y1,x2,y2 To b,x3,y3 copy a rectangle between screens (overlap allowed) Each screen has its own text cursor. Double Buffer applies to screen 0. DRAWING Ink c drawing color (default 1, white) Plot x,y [,c] a pixel Point(x,y) read its color Draw x1,y1 To x2,y2 a line Draw To x,y continue a line Box x1,y1 To x2,y2 a rectangle outline Bar ... filled Circle x,y,r a circle outline Polygon x1,y1 To x2,y2 To x3,y3 [To ...] a filled polygon, 3 to 64 corners (triangles and convex shapes on the triangle unit, others filled even-odd) Paste Bob x,y,i [,w,h [,a]] image i drawn permanently into the screen, optionally scaled to w x h and turned by angle a (0.23) Get Image i,x1,y1 To x2,y2 copy screen pixels into image i (1-240 up to 64 x 64, 241-1024 up to 1024 x 1024): images without a BMP All drawing uses screen pixel coordinates, is clipped to the screen, and goes into both buffers with Double Buffer. Drawing under a bob is lost when the bob moves (as with Print). FLOATS a name ending in ! holds an IEEE single-precision float, computed on the FPU: X! = 1.5! Y! = 1E10! Z! = X! / 3 A decimal like 0.1 is converted from its exact text when it meets a float; converted to an integer, a float is rounded down. Print / Str$: 6 significant digits, E+nn for very large/small. End Proc[x!] sets Param, Param# and Param!. FIXED POINT a name ending in # holds a Q16.16 fixed-point number: -32768 to 32767.9999 in steps of 1/65536. SPEED# = 0.5 X# = X# - SPEED# Dim X#(100) integer with fixed = fixed (X# + 2, 3 * A#); 7/2 = 3, 7.0/2 = 3.5 converted to an integer (Sprite 0, X#, Y#) it is rounded down. Print / Str$: up to 4 decimals. End Proc[x#] sets Param (integer part) and Param#. Input A#, Read A#, For A# = 0 To 1 Step 0.25, Inc A#, Add A#,n SID MUSIC BASIC 65's (the MEGA65) music commands, on the SID's 3 voices: Play "O4T0QCDEFG" [, s2$ [, s3$]] plays in the background A-G # $ . R, W H Q I S, O0-6 T0-9 U0-9 X0-1 M0-9 P0-9 L Play (no arguments) stops all Rplay(v) True while v plays Tempo 1-255 (whole note = 24/t s) Envelope n,a,d,s,r,wave,pulse Filter freq,lp,bp,hp,res Sid r,v Sid Volume 0-15 Sound v,freq,frames[,dir,min,sweep,wave,pulse] Sound Clr Beep hz / Beep Off the hardware beeper Play s1$,s2$,s3$, s4$ ... s7$: voices 4-7 are the PCM voices, playing samples: Instrument t, s [, "A4"] makes sample s instrument Tt, recorded at pitch A4 (default C4; T0-T9 default to samples 1-10). s8$ ... s15$: voices 8-15 are the YM2151's eight (FM), T0-T9 the same ten instruments in FM. Play v, s$ [, s2$ ...] starts at voice v: Play 8, "O4T0QCDE". Rplay(1-15). Fm Instrument t [, algorithm, feedback, pms, ams, slide] Fm Envelope t, op [, ar, dr, sr, sl, rr] op 1-4 (M1 C1 M2 C2) Fm Operator t, op [, tl, mul, dt, dt2, ks, am] the chip's own values, as Furnace and DefleMask show them; Play alone resets Fm r, v a YM2151 register (LFO, noise) A YM2151 song (Track Play) has the chip: voices 8-15 wait. 3D OBJECTS Wavefront .obj files, AMOS 3D's command names: Td Load "BOX.OBJ" (+ its .mtl and 8-bit BMP textures) Td Object n,"BOX",x,y,z,a,b,c without a camera: x, y on the screen, z behind it Td Move n,x,y,z Td Move Rel n,dx,dy,dz Td Angle n,a,b,c Td Size n,s Td Kill n Td Redraw Td Cls Td Clip x1,y1 To x2,y2 / Off Td Camera x,y,z,a,b,c / Off Td Focus f eye distance in pixels (default 256) Td Center x,y / Off the projection center Td Color n,c / n Off object n's flat faces unlit, in color c Td Color n,m$,c / n,m$ Off only material m$ (newmtl name) Td Cull n Off / On Off also draws back faces (flat objects) Td Order n,"ZYX" rotation order (default "ZXY") A hardware Z buffer resolves visibility (no sorting); textures are perspective-correct; 3D is drawn inside the 384 x 224 display. Textures with power-of-two sizes (up to 256) repeat when vt goes beyond 0..1; "map_Kd -clamp on NAME.BMP" in the .mtl disables that. Up to 32 definitions and 64 textures. "map_Kd VIC20" (no file) is the VIC-20's picture (THE VIC-20), "map_Kd C64" the C64's (two textures, each face cut at u = 0.5). PATHS an object, bob or sprite moved automatically, one step per frame, as AMOS's AMAL moves sprites: Td Path n, "M x,y,z,f T a,b,c,f MT x,y,z,a,b,c,f W f L" move by / rotate by (degrees) over f frames, wait f frames, L = restart Td Path n, Play "SPIN.PTH" [, scale [, times]] a recording (times 0 = forever), starting where it was recorded (with Td Camera: where the object is) Td Path n Off Td Moving(n) Td X(n) Td Y(n) Td Z(n) (#) Bob Path n, "M x,y,f ..." / Sprite Path n, ... the same in x,y; Bob Moving(n), Sprite Moving(n) Path Record "SPIN.PTH" record the mouse once per frame, with a trail in the Ink color, until SPACE (right button held: y movement goes to z); editor only. Paths run on the frame counter: Wait Vbl, Td Redraw and the reading functions bring them up to the current frame. THE VIC-20 the core's own 6502, VIC and two VIAs, running the original KERNAL and BASIC at the VIC-20's speed beside the program: Cpu8 6502 Load "F" [, address] a file into the 8-bit CPUs' Cpu8 Z80 Load "F" [, address] 64 KB (one 64 KB for both) no address: a .prg, a VICE .crt and a cartridge dump of a whole KB + 2 bytes carry their own; .crt and .rom files are read-only for the CPU Vic20 Ram None / 3k / 8k / 16k / 24k / Full expansion RAM Vic20 On start it (waits for READY. with BASIC loaded) Vic20 Off stop it; its last picture stays Vic20 Run the last .prg as BASIC's program, then RUN Vic20 Border l, r, t, b pixels of its border the texture shows round the screen (default 0; t + b <= 72) Its picture is the Td texture VIC20 (map_Kd VIC20 in a .mtl); palette 240-255 are its colors; the keyboard and joystick port 2 go to it too. Example: Cpu8 6502 Load "KERNAL.ROM", $E000 Cpu8 6502 Load "BASIC.ROM", $C000 Cpu8 6502 Load "CHAR.ROM", $8000 Vic20 Ram 8k Vic20 On Cpu8 6502 Load "GAME.PRG" Vic20 Run On their own (no VIC-20 chips), beside the program: Cpu8 6502 Run [address] no address: its reset vector ($FFFC) Cpu8 Z80 Run [address] no address: $0000 Cpu8 Stop it stands between two instructions Cpu8 Speed hz 1 to 25000000 Hz (default 1000000) Cpu8 Poke address, byte Cpu8 Peek(address) its 64 KB THE C64 (0.24) the core's C64 chips: the 6502, the VIC-II, two CIAs, the PLA and the machine's SID, its ROMs loaded as the VIC-20's (Cpu8 6502 Load): BASIC $A000, characters $D000, KERNAL $E000 C64 On the ROMs into the C64's ROM memory, the 64 KB as at power-on, then start it (waits for READY. with BASIC and the KERNAL loaded) C64 Off stop it; its last picture stays C64 Run the last .prg (at $0801) as BASIC's program, then RUN C64 Border l, r, t, b the same (l, r <= 64; t + b <= 56) Its picture is the Td texture C64 (map_Kd C64 in a .mtl); palette 240-255 are its colors; the keyboard (key for key) and joystick port 2 go to it too. Example: Cpu8 6502 Load "C64/KERNAL.ROM", $E000 Cpu8 6502 Load "C64/BASIC.ROM", $A000 Cpu8 6502 Load "C64/CHAR.ROM", $D000 C64 On Cpu8 6502 Load "GAME.PRG" C64 Run THE NETWORK switched on with SHIFT+POUND (in the editor, or at BASIC's READY prompt before VMOS or a release), never by a program; NETWORK.TXT gives the address, no file = DHCP. A host is a name ("example.com") or an address ("192.168.5.1"). Net Ip$ this machine's address, "" = the network is off (every other command stops the program with "Network is off") Net Lookup$(host$) a name's address, "" = no such name Ping(host$) round trip in ms, -1 = no answer in 1 s Udp Open port the program's UDP port: 16 packets wait Udp Close Udp Send host$, port, s$ one packet, up to 1472 characters Udp Recv$ the oldest packet waiting, "" = none Udp Ip$ Udp Port who sent it Tcp Open(host$, port) a connection, 1 or 2; 0 = no answer in 5 s, refused, or no such name Tcp Send c, s$ all of s$, block by block Tcp Recv$(c) what has come, "" = nothing; never waits Tcp Connected(c) True while open (Tcp Recv$ still gives what came before it closed) Tcp Close c A program that uses the network calls Udp Recv$, Tcp Recv$, Tcp Connected or Wait Vbl every frame: the machine holds one arriving packet at a time. The program's end closes its port and connections. TRACKER MUSIC ProTracker MODs, PROSID TRACKER songs (.PST), PROSIDYM TRACKER songs (.PSY, with eight YM2151 tracks) and YM2151 songs (.VGM, .VGZ) on the machine's FM chip: Track Load "SONG.MOD" load into chip RAM (1 MB max) Track Play [position] play in the background Track Stop Track Loop On / Off (Off: once) Track Playing True while a song plays (False after Track Stop or the end of a Track Loop Off song) Track Pos order position playing, -1 = none A playing song owns the 4 PCM voices (a .PST with SID notes the SID too): Sam Play (Play, Sound ...) give an error until Track Stop. SID sound effects over MOD music work. A YM2151 song has the YM2151 only: Sam Play, Play and Sound all work over it. Its one position is 0; it loops from its loop point. A .PSY with notes on its FM tracks has the YM2151 too: Play's voices 8-15 wait for Track Stop. THE COPPER writes a value into a display register at a given raster line, while the picture is drawn. y = raster line in sprite coordinates. Copper Border y,c Copper Back y,c raster bars Copper Color y,n,r,g,b (or $RRGGBB) gradients Copper Palette y,n palette bands Copper Offset y,x[,sy] waves, bands Copper Screen y,n split screens Copper Sprite y,n,x,sy[,i] reuse a sprite further down (multiplexing; a starfield: STARFLD) Copper Tile Scroll y,x,ty parallax tiles Copper Clear empty the list Copper On / Off start / stop the list The list is handed to the copper at Copper On and at every Wait Vbl (during vertical blank: rebuild it each frame, then Wait Vbl). Above its first entry everything is as the program set it. Up to 1020 entries. INPUT Input "Name ";A$ Input A,B (comma-separated) Wait Key K$=Inkey$ ("" if no key) Scancode Key State(k) Curs On / Curs Off (the Input cursor) TIME Wait Vbl (one frame, 1/50 s) Wait 50 (50 frames) Timer (frames since the start) Timer=0 Randomize n Rnd(n) (0 to n) IF If X>5 Then Print "big" Else Print "small" (one line) If X>5 Print "big" Else If X>2 Print "middle" Else Print "small" End If LOOPS For I=1 To 10 [Step 2] ... Next [I] Repeat ... Until X=0 While X<10 ... Wend Do ... Loop Exit leaves the loop, Exit 2 leaves two loops Exit If X=5 (and Exit If X=5,2) JUMPS A label is a name followed by a colon at the start of a line: START: Goto START Gosub DRAW ... DRAW: ... Return End or Stop ends the program. PROCEDURES Procedure MOVE[X,Y$] ... End Proc Call: MOVE[10,"left"] or Proc MOVE[10,"left"] Up to 8 parameters, numbers or strings. Result: End Proc[X*2] or Pop Proc[X] (return early); the caller reads Param, Param#, Param! or Param$. Variables in a procedure are local (recursion works). Global A,B$ in the main program shares them with all procedures; Shared A in a procedure uses the main program's A. Labels inside a procedure are local to it. Every n Proc NAME: the frame interrupt runs NAME (no parameters) every n frames, whatever the program is doing (loading, a long loop). Every Off / Every On. NAME may only use integers, fixed- point, variables, arrays, loops, the copper, Sprite and Color (no strings, floats, waits, drawing or calls); its copper commands build their own list, merged with the program's (the program's entry wins on a shared line). DATA Data 10,20,"thirty" Read A,B,C$ Restore [LABEL] FUNCTIONS Abs(n) Sgn(n) Min(a,b) Max(a,b) Rnd(n) Sin(a) Cos(a): float angle gives a float, others fixed-point Pi# Pi! Degree / Radian: the angle unit (default Radian) Len(s$) Left$(s$,n) Right$(s$,n) Mid$(s$,p[,n]) Instr(a$,b$[,p]) (position from 1, 0 = not found) Upper$(s$) Lower$(s$) Space$(n) String$(s$,n) Str$(n) Val(s$) ($FF and %101 work) Chr$(n) Asc(s$) Hex$(n[,digits]) = "$FF" Bin$(n[,digits]) = "%101" Inkey$ Scancode Key State(k) Timer Param Param$ FILES A program's files (pictures, sounds, objects, songs) are read from its own folder, e.g. Load Images "GFX/SHIP.BMP",1 for a subfolder. Each file can be up to 1 MB. IMAGES Load Images "SHIP.BMP", 1 Load Images "SHEET.BMP", 10, 16, 16 An 8-bit (256-color) BMP, as VPaint saves it. Without w,h the whole picture is one image; with them it is cut into w x h images, left to right, top to bottom, numbered from the given number. Images 1 to 240 are up to 64 x 64 each, for sprites and bobs; images 241 to 1024 (0.22) are the bobs' own, up to 1024 x 1024 each, in chip RAM. Color 0 is transparent. The BMP's palette entries 16-255 are copied to the palette; 0-15 stay the C64 colors. SPRITES Sprite n, x, y, i sprite n (0 to 14) at x,y with image i Sprite n, x, y move it, same image Sprite Off n Sprite Off (all) Sprite Flip n,h,v mirror (h) / flip (v); position unchanged Sprite Behind n behind the screen and tiles; Sprite Front n Sprite Col(n) True if sprite n overlapped another sprite (or the mouse pointer) in the last frame x,y is the image's top-left corner, as on the C64: coordinates cover the whole display, 0,0 is its top-left corner under the border. The border never moves anything. With the default border the 320 x 200 visible area is x 32 to 351, y 12 to 211. Hardware sprites cost no CPU time; higher numbers are in front. Move them right after Wait Vbl for smooth motion. They are turned off when the program ends. JOYSTICK Joy(2) port 2 as a bit mask: 1 up, 2 down, 4 left, 8 right, 16 fire (Joy(1) is 0: port 1 has the mouse) Jup(2) Jdown(2) Jleft(2) Jright(2) Fire(2) True or False MOUSE X Mouse Y Mouse pointer position in sprite coordinates (Sprite n, X Mouse, Y Mouse puts a sprite on it) Mouse Key 1 = left button, 2 = right, 3 = both Show Hide the pointer (default hidden) SOUND Load Sample "BOOM.WAV", 1 A WAV file, 8 or 16 bits, mono or stereo (stereo is mixed to mono), any rate. Samples 1 to 64. Sam Play s play sample s on the next voice in turn Sam Play v, s on voice v (0 to 3) Sam Play v, s, rate at another rate in Hz (higher = higher) Sam Loop On samples started from now on loop Sam Loop Off ... and from now on play once (default) Sam Stop v Sam Stop (all four voices) Volume n 0 to 63 (default 63) Sounds play in the background; the program continues at once. Sound stops when the program ends. BOBS Bob n, x, y, i bob n (0 to 63) at x,y with image i Bob n, x, y, i, w, h the same, the image scaled to w x h (0.22; 0 hides it) Bob n, x, y, i, w, h, a ... and turned by angle a about its middle, clockwise (0.23; radians, or degrees after Degree, as for Sin) Bob n, x, y move it, same image, size and angle Bob Off n Bob Off (all) Bob Col(n) True if bob n's rectangle overlaps another's Reserve Bob n allocate bobs 0 to n-1 (1 to 1024), once, before the first Bob; default 0 to 63. Each bob's saved background is the size it covers (16 x 16 = 256 bytes of chip RAM). Double Buffer a second buffer: bobs are drawn into the hidden one and displayed at Wait Vbl, so they never tear; text goes into both. 128 KB, and each bob's background is saved twice. A bob is an image (Load Images: 1-240 shared with sprites, 241-1024 the bobs' own) that the blitter draws into the program's screen, color 0 transparent. A scaled bob or Paste Bob comes from the blitter's 256 x 256 texture cache; a bigger image is scaled in pieces of 256 x 256. A turned one is two textured triangles from the same cache; what is kept under it is the box around its corners. Bobs are redrawn at every Wait Vbl, during vertical blank: the saved backgrounds are restored first, then each bob is drawn at its current position (higher numbers on top). So a program that moves bobs ends each frame with Wait Vbl. x,y are in sprite coordinates (the visible area starts at 32,12); a bob may be partly off screen. Text printed under a bob is lost when the bob moves. Cls and screen scrolling remove the bobs first. TILES Load Tiles "TILES.BMP", 1 An 8-bit BMP cut into 8 x 8 tiles, left to right, top to bottom, numbered from the given number (1 to 1023). Tile 0 is always empty; color 0 in a tile is transparent. The BMP's palette entries 16-255 are copied to the palette, as with Load Images. Tile x, y, t [, f [, p]] map cell x,y = tile t (f flips, p its palette, added to Tiles Palette); the map is 64 wide (0-63) and 128 high (0-127); 64 high (0-63) with Double Buffer, which shows the changes at Wait Vbl, never half-done Tile(x, y) the tile at a map cell Tiles On / Off show / hide the tile layer Tiles Back tiles behind the program's screen (default): Paper 0 lets them show through; text and bobs appear on top Tiles Front tiles in front of the program's screen Tile Scroll x, y map pixel x,y at the display's 0,0 (under the border, like sprites); wraps at 512 x 1024. Changes during vertical blank, so it never tears; with Double Buffer at the Wait Vbl that shows the bobs. The tile layer is drawn and scrolled by hardware: it costs the program nothing. It is turned off when the program ends. 4. ERRORS --------- Syntax errors are found when the program is compiled (F1/F2), e.g. "For without Next in line 12". Run-time errors stop the program and report the line: division by zero, array index out of range, an array used before its Dim, a string longer than 32767 characters, out of Data, too many nested procedure calls, and more (reference appendix E). RUN/STOP stops any program, even one stuck in a loop, and reports the line it was on. 5. LIMITS --------- 64000 lines of up to 255 characters compiled code: the fast RAM VMOS leaves free, then 256 KB of Trapdoor RAM, then chip RAM strings up to 32767 characters; arrays of 1 to 255 dimensions 15 sprites, 64 bobs (up to 1024 with Reserve Bob), 240 images of up to 64 x 64 and 784 bob images of up to 1024 x 1024, 64 samples, 4 PCM voices, 3 SID voices 1023 tiles of 8 x 8 and a 64 x 128 tile map (64 x 64 with Double Buffer) 3D: 32 object definitions, 64 textures, 256 objects, 65000 triangles per Td Redraw paths: 64 at a time, 64 steps each, 16 recordings loaded files of up to 1 MB each; a release packs up to 255 files network: one UDP port (16 packets waiting), two TCP connections (a client) 6. FOR AMOS PROGRAMMERS ----------------------- - Plain text files, no line numbers, labels as in AMOS. - Procedures, Param, Global/Shared, Pop Proc as in AMOS. - Number types: integers, # fixed-point (Q16.16) and ! floats. - Str$ gives no leading space for positive numbers. - Input without a prompt shows "? ". - No banks: images come from BMP files (Load Images), samples from WAV files (Load Sample), 3D objects from .obj files (Td Load). - Sprite numbers are 0 to 14 and higher numbers are in front. - Sprites, X Mouse and Y Mouse use hardware coordinates, as in AMOS, but the VIXEN-32's: 0,0 under the top-left border, the screen at 32,12. - Sam Play's voice is a number 0 to 3, not a bit mask; without one the voices rotate. - Bobs are drawn at Wait Vbl (no Bob Update, no Autoback); Bob Col compares the images' rectangles. - Tiles are the VIXEN-32's own tile layer (AMOS has none). - Td Path / Bob Path / Sprite Path are VMOS's take on AMAL.