The next program demostrates ACTION!'s Ability to run 2 or more procedures at the same time. The Move_cursor routine runs independent of Main Proc. This Program is extra for Action Programers. ----------------------------(Cut Here)--------------------------------- ;TRACK4.ACT ;Rudimentary PM cursor positioning ;using Track-Ball peripheral ;PM routines added ;Single line rez. ;Vertical blank ;9/87 DEFINE SPEED="2" DEFINE JMP="$4C", XITVBV="$E462", SAVETEMPS= "[$A2 $07 $B5 $C0 $48 $B5 $A0 $48 $B5 $80 10 dF1 $A5 $D3 $48]", GETTEMPS= "[$68 $85 $D3 $A2 $00 $68 $95 $A8 $68 $95 $80 $68 $95 $A0 $68 $95 $C0 $E8 $E0 $08 $D0 $EF]" CARD OldVbi,VBIvec=$224 BYTE critic=$42 BYTE ARRAY player_base BYTE ARRAY shposp(4) ;pm horiz shadow array. CHAR ARRAY imagep=[ $0 $90 $90 $90 $90 $90 $90 $F0 $00 $18 $18 $7E $7E $18 $18 $00 ] INT x=[0],y=[0] ;************************************ ;Move specified player to the ;ABSOLUTE x location (0 to ?). PROC MovePlayerHor(BYTE pl_num BYTE pl_x) BYTE ARRAY hposp=53248 shposp(pl_num)=48+pl_x hposp(pl_num)=shposp(pl_num) RETURN ;************************************ MODULE BYTE ARRAY old_pl_y(4)=[0 0 0 0] ;Move specified player to the ;ABSOLUTE y location. (from 0 to ?.) PROC MovePlayerVer(CARD pl_num BYTE pl_y) BYTE playery CARD pl_offset pl_offset=player_base+$400+pl_num LSH 7 Zero(pl_offset+old_pl_y(pl_num),8) playery=15+pl_y MoveBlock(pl_offset+playery, imagep+pl_num LSH 3,8) old_pl_y(pl_num)=playery RETURN ;************************************ ;Move player to absolute x,y ;x=0 to ?, y=0 to ? PROC MovePlayer(BYTE pl_num,pl_x,pl_y) MovePlayerHor(pl_num,pl_x) MovePlayerVer(pl_num,pl_y) RETURN ;************************************ PROC PlayerCursor() BYTE pmbase=54279,gractl=53277, gprior=623 BYTE ARRAY pl_color=704, PMWidth(5)=$D008 BYTE ramtop=106,sdmactl=$22F ramtop=$A0-8 ;presumes 40K of memory Graphics(0) player_base=(ramtop)*256 pmbase=player_base/256 sdmactl=32+8+2+16 ;no missles... gractl=2 ;again no missles. Zero(player_base,$800) pl_color(0)=110 ;pl_color(1)=70 gprior=1 MovePlayer(0,0,0) ;MovePlayer(1,4,10) RETURN ;************************************ PROC ClearPM() BYTE ramtop=106,sdmactl=$22F BYTE cursor=752 BYTE pmbase=54279,gractl=53277, gprior=623 cursor=0 gractl=0 sdmactl=32+2 ;Zero(hposp,4) ramtop=$A0 Graphics(0) RETURN ;************************************ PROC Move_Cursor() BYTE lastx=[0],lasty=[0], vx=[0],vy=[0],st INT oldx=[0],oldy=[0] SAVETEMPS st=stick(0) vx=st&$02 vy=st&$08 IF lastx<>vx THEN IF st&$01 THEN x==+SPEED ELSE x==-SPEED FI FI IF lasty<>vy THEN IF st&$04 THEN y==+SPEED ELSE y==-SPEED FI FI lastx=vx lasty=vy IF x>157 THEN x=157 FI IF y>201 THEN y=201 FI IF x<0 THEN x=0 FI IF y<17 THEN y=17 FI IF oldx<>x OR oldy<>y THEN MovePlayer(0,X,Y) FI oldx=x oldy=y GETTEMPS ; get temp registers [JMP XITVBV] ; exit the VBI ;************************************** PROC ClearVB() critic=1 VBIvec=OldVBI critic=0 RETURN ;************************************** PROC VBinst(); install the VBI critic=1 ; turn off the interrupts OldVBI=VBIvec VBIvec=Move_Cursor ; VBI routine. critic=0 ; turn the interrupts back on RETURN ;************************************ PROC Main() BYTE cursor=752,consol=53279, left_margin=82 PlayerCursor() cursor=1 left_margin=0 SetColor(2,9,0) PutE() PrintE("This is a line of normal text.") PutE() PrintE("This is a line of inverse text.") VBinst();This is where we start the Move_Cursor proc WHILE consol&$01 DO Position(0,10) PrintF("X=%I %EY=%I %E",X,Y) OD ClearVB();This is where the Move_Cursor is terminated ClearPM() Graphics(0) left_margin=2 cursor=0 RETURN