MMBasic for Windows - betas


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2543
Posted: 03:31am 23 Dec 2023      

I gave up on INPUT$(), INPUT works ok.
Yes, it is very easy to make MMB4W crash.
'test 2.bas
clear
dim integer characters = 4, joystick 'data from controller/joystck
dim integer flag, trigger = characters - 1
dim a$
open "com7:460800" as #3 'purge buffer (thanks Jim)
pause 1
do:
 a$ = input$(255,#3)
loop until loc(#3) = 0
close #3
pause 1

open "com7:460800,, buffer, trigger" as #3
pause 1

do
 If flag then
  if len(a$)=characters then joystick = val("&H"+a$)
  ? a$, bin$(joystick,characters*4)
  flag = 0
 endif
loop

sub buffer 'read buffer
 input #3, a$
 inc flag
end sub

' Program running on PicoMiteVGA
'
'dim integer m,n
'm=2^16
'do
'  inc n
'  n=n mod m
'  pause 50
'loop

Edit.
Data is received at 50mS intervals. Will see if it can go faster.

Edit 2. Seems ok at 5mS intervals, some errors at 1mS. (change Pause 50 in the VGA program)

Edit 3. Correction, on closer inspection there are occasional missing packets below 30mS.
Edited 2023-12-23 14:19 by phil99