*** ZERO_2 Control program *** For QL running in QPCII emulator ============================================= Notes ----- WINDOW width, depth, @ x, y in pixels BORDER [channel,] size [, colour] CSIZE [channel,]- width, height width size height size· 0 6 pixels 0 10 pixels 1 8 pixels 1 20 pixels 2 12 pixels 3 16 pixels full_win, 512,256, 0, 0 0, 440, 38, 37,218 'command window 1, 370,170,110, 46 'same as help_win 2, 370,170,110, 46 'same as help_win title_win,388, 24, 60, 4 'program name mind_win, 68, 18, 35, 32 'top LHS step_win, 66, 14,110, 30 'top left inf_win, 230, 14,179, 30 'top middle edit_win, 68, 14,412, 30 'top right list_win, 68,162, 35, 52 'at LHS drg_win, 370,170,110, 46 'window 2 help_win, 370,170,110, 46 'window 2 ============================================= *** INITIALISATION *** init_globals coldinit zinit 'USER - initialise robot noRobot 'USER - run program with no robot doRobot 'USER - connect to robot --------------------------------------------- *** ERROR RECOVERY *** oops 'USER ErrorMsg(errortxt$,errorval) --------------------------------------------- *** USER ASSISTANCE *** QUIT 'USER help 'USER exit_help waitNoKey fn_wait_key$(msg$) strip_spaces$ ( word$ ) 'strip leading spaces alert 'USER - PC sound buzz 'USER - PC sound --------------------------------------------- *** PROCESSING LINK *** processing_link (cmnd$,cmnd_code,cmnd_value) (link robot control procedures to other processes) --------------------------------------------- *** ROBOT-SENSE *** sen(addr) 'needs work [4] - never called --------------------------------------------- *** ROBOT-CONTROL *** robot_whereabouts (cmnd_code, cmnd_value) waitZrdy 'wait '>' emptyZchan 'emptyy serial input buffer * ROBOT CMNDS * zz 'USER - stop robot s (cmnd_value) 'USER - speed play 'USER head (heading) 'USER home 'USER - go home unwind 'USER ihome 'USER - initialise home position sb(cmnd_value) 'USER - not implemented jc 'USER - joystick control msg (msg$) 'USER - send msg$ to Arduino FD 'USER - millimetres BK 'USER - millimetres RT 'USER - degrees LT 'USER - degrees peninit 'USER - for old Zero2 pd 'USER - pen down pu 'USER - pen up rl <0.1> 'USER - right LED ll <0.1> 'USER - left LED ls <0-3> 'USER - LEDs hl <0.1> 'USER - horn high tone hh <0,1> 'USER - horn high tone ho 'USER - horn off hn <0-3> 'USER - horn tones wt 'USER - 50ths second hoot 'USER flsh 'USER flht 'USER --------------------------------------------- *** SHORT-TERM-MEMORY *** learn 'USER nolearn 'USER forget 'USER remember_move (cmnd$) rlist 'USER ralter 'USER rfix 'USER rsave 'USER * SHORT-TERM MEMORY TESTING * replay 'USER - select step range to play bplay 'USER - select step range to reverse play do_steps ( direction ) play_steps ( direction, step_dir, first_step, last_step ) rstep 'USER unlearn 'USER jump 'USER - '!' insert a jump to another Act dopling --------------------------------------------- *** LONG-TERM-MEMORY *** mind 'USER - '/' insert a change to another Mind doMind mlist 'USER list_cmnds (title_msg$, cmnd_list$) exec_cmnd (cmnd_string$) get_cmnd_num ( cmnd$, name_len ) get_cmnd_val (cmnd$,cmnd_num,name_len) exec_reverse_cmnd (cmnd_string$) mnames 'USER - list names in current Mind (in memory) mexec 'USER - execute an Act in current Mind exec_Act (cmnd_num) get_Act_start ( cmnd_num ) get_Act_length (cmnd_num ) mget 'USER - copy the commands in an Act to short term memory getAct$ (name$) 'USER - '^' insert an upload Act command doGetAct (name$) get_cmnd_list$ (name$) mclear 'USER - clear current Mind get_mind (name$) mZmem 'USER - change mind to Zmem mhanoi 'USER - change mind to Hanoi --------------------------------------------- *** DISPLAY PROCESING *** init_windows display_moves (cmnd$) learning_screens (state) learning_msg no_learning_msg help_scrn help_scrn_1 help_scrn_2 help_scrn_2a help_scrn_3 help_scrn_3a imap 'USER - redraw with robot at centre smap 'USER - scale map cmap 'USER - clean map drg_scrn draw_move (cmnd_code, cmnd_value) print_robot_position draw_robot --------------------------------------------- *** DEBUG *** h - load mind Hanoi, exec_Act "hanoi" =============================================