!****************************************************************
!*                                                              *
!*      IBOL:   EYEBALL board (ZAP  version) test program       *
!*                                                              *
!*                  Version 1.1 23 Jan 1989                     *
!*                                                              *
!****************************************************************

%include "inc:util.imp"
%begin

@16_420 %routine pstr(%string(255)s)
@16_41c %routine psym(%integer k)

!Interface addresses
%constinteger camera = 16_400FF0
@camera+16_00 %byte acia cont;  @camera+16_02 %byte acia data

%byteinteger b,c,cont,data
%integer i

%routine printline(%string (255) s)
   pstr(s); psym(13)
%end

%routine newline
   psym(13)
%end

%routine wait(%integer msec)
   %integer i
   %for i = 1,1,msec*100 %cycle; %repeat
%end

%predicate wait for(%byte char)
   %integer c
   %string(255) s
   %if char = ' ' %then s = "space" %elseif char=10 %then s = "return" %c
   %else s = tostring(char)
   printline("Press <".s."> to continue, <space> to stop, <return> to skip to next test")
   char=char-' ' %if 'a'<=char<='z'
   %cycle
     c=testsymbol; c=c-' ' %if 'a'<=c<='z'
     %false %if c=10
   %repeatuntil c=char
   %true
%end

%routine open acia
   %constinteger acset = 16_03, {master reset}
                 acopt = 16_14  {div 1, 8 bits 1 stop bit}
   acia cont = acset
   acia cont = acopt
%end

printline("EYEBALL board test program.")

newline
printline("Master reset ACIA, set control to 16_14 (div 1,8 bits 1 stop bit)")
printline("then read status and data registers twice.  Results: ")
open acia
printstring("st="); phex2(acia cont)
printstring(" da="); phex2(acia data)
printstring(" st="); phex2(acia cont)
printstring(" da="); phex2(acia data); newline
cont = acia cont; data = acia data
printline("Hard loop reading camera port 0")
%while wait for(' ') %cycle
   %while testsymbol#' ' %cycle
      b=acia cont
   %repeat
%repeat

%endofprogram

