DOJO PROJECT: TESTING FUJINET ON ATARI

This example will allow to show how to make applications communicate each other using FujiNet. For more information: https://dojo.ugbasic.iwashere.eu/

source compile sandbox issues? back to examples

SOURCE CODE ()

CLS

PRINT "============"
PRINT "DOJO EXAMPLE"
PRINT "============"
PRINT

DO
	PRINT "Digit ID or leave blank for new:"
	INPUT roomId$
	digits = LEN(roomId$)
	IF digits <> 8 AND digits <> 0 THEN
		PRINT "ID must be of eight hex digits."
	ELSE
		IF digits = 0 THEN
			port = CREATE PORT()
			myChannel = 0
			otherChannel = 1
		ELSE
			port = OPEN PORT(roomId$)
			myChannel = 1
			otherChannel = 0
		ENDIF
		IF DOJO ERROR > 0 THEN
			PRINT "Invalid port or unavailabe service."
		ELSE
			PRINT "ID: ";port
			PRINT
			EXIT
		ENDIF
	ENDIF
LOOP	

IF myChannel = 0 THEN
	PRINT "Please, send this ID to the other party"
	PRINT "and type a word to send to the other"
	PRINT "application."
	INPUT "> ",message$
	PRINT
	PRINT "Sending..."
	PUT MESSAGE port, otherChannel, message$
	PRINT "... sent!"
ELSE
	DO
		IF PEEK MESSAGE(port, myChannel) THEN
			PRINT GET MESSAGE(port, myChannel)
		ENDIF		
	LOOP
ENDIF

How to compile and run the example

The instructions here refer to compiling the example from the command line. For Microsoft Windows users we suggest using UGBASIC-IDE, which allows you to download and compile each single example with just one click.



Are instructions for your specific home computer / console missing? First of all, check if your computer is supported by clicking here. If so, since ugBASIC is a language which does not provide abstractions, it is possible that this example will not work on your target. If you think this is an issue, please click here.

Atari 400, Atari 800

In order to compile the example, type this command on the command line:

Linux

ugbc.atari -O xex -o dojo_example.xex dojo_example.bas

Windows

ugbc.atari.exe -O xex -o dojo_example.xex dojo_example.bas

For Microsoft Windows users we suggest using UGBASIC-IDE, which allows you to download and compile this example with just one click.

TRS-80 Color Computer, TRS-80 Color Computer 2

In order to compile the example, type this command on the command line:

Linux

ugbc.coco -O bin -o dojo_example.bin dojo_example.bas

Windows

ugbc.coco.exe -O bin -o dojo_example.bin dojo_example.bas

For Microsoft Windows users we suggest using UGBASIC-IDE, which allows you to download and compile this example with just one click.

Any problem?

If you have found a problem trying to run this example, if you think there is a bug or, more simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!

open an issue BACK TO EXAMPLES