Let's communicate with MSX on Windows "Joy Joy File System"

ページ 1/2
| 2

By ocitygate

Expert (72)

ocitygate さんの画像

08-02-2021, 22:20

What is "Joy Joy File System"?

  • It is a system that connects the joystick terminal of MSX and the USB terminal of PC with a self-made cable and sends and receives files to each other.
  • It consists of a Windows tool "Joy Joy File Server" and a "Joy Joy File System" installed on MSX from that tool.
  • You can "load files on PC" and "save to files on PC" with the extended commands of MSX-BASIC.
  • You can send text and binary data by connecting MSXs.
  • Works on MSX with 64KB or more of RAM. (If you burn it to ROM, it will work on all MSX with 8KB or more of RAM ...)

Please see the following address for how to use
https://jjfs.ocitygate.com (English)

ログイン/登録して投稿

By sdsnatcher73

Enlighted (4298)

sdsnatcher73 さんの画像

09-02-2021, 04:14

Impressive work!

By larsthe18th

Master (192)

larsthe18th さんの画像

13-02-2021, 15:52

Have crammed together the 'RS232 to TTL' cable just for testing, and using a USB to RS232 converter.
it works like a charm.
Very fun project...

By nihirash

Rookie (21)

nihirash さんの画像

13-02-2021, 18:20

Can you share assembly routines?

I'd like try it(and enable simple flow control).

By ocitygate

Expert (72)

ocitygate さんの画像

13-02-2021, 19:58

This code is actually better... runs at 57600bps. Credits: https://github.com/rolandvans/msx_softserial
Ported by me to SDCC.

Also was thinking about flow control.
any pin 2,3,4 can be used as to receive RTS and Pin 7 can be used to send CTS.
Was thinking of using the VDP interrupt to check if RTS is active, then signal CTS, and receive data.

void recv(char* data, int bytes)
{
	__asm
	
	    LD IY,#2
		ADD IY,SP
		LD L,0(IY)
		LD H,1(IY)
		LD C,2(IY)
		LD B,3(IY)
	
		;TRANSFER 'BC' BYTES FROM JOY2, 'UP', PIN1 TO [HL]
		;MSX, Z80 3.58MHz 57600bps
		;SETS CARRY BIT ON ERROR. A HOLDS ERROR CODE:
		;A=1 RS232 LINE NOT HIGH,A=2 STARTBIT TIMEOUT
		RECBYTES:	
			DI			;NO INTERRUPTS, TIME CRITICAL ROUTINE
			LD A,#0x0F	;PSG REGISTER 15, SELECT JOYSTICK PORT 2
			OUT (0xA0),A
			IN A,(0xA2)
			SET 6,A		;SELECT JOY2
			OUT (0xA1),A

			LD A,C	; FAST LOOP WITH BC (GRAUW, FAST LOOPS)
			DEC BC	; COMPENSATION FOR THE CASE C=0
			INC B
			LD C,B	; SWAP B AND C FOR LOOP STRUCTURE
			LD B,A

			LD A,#0x0E	;SET PSG #14
			OUT (0xA0),A
			LD E,#0x01	;FOR FASTER 'AND' OPERATION 'AND r'(5) VS. 'AND n'(8)
			IN A,(0xA2)
			AND E
			JR NZ,.FIRSTSTARTBIT	;RS232 LINE SHOULD BE HIGH, OTHERWISE STOP
			LD A,#0x01	;ERROR, RS232 LINE NOT READY
			SCF
			EI
			RET
		;THE NEXT PART IS TIME CRITICAL. EVERY CYCLE COUNTS
		.FIRSTSTARTBIT:		;WAIT FOR FIRST STARTBIT
			IN A,(0xA2)
			AND E
			JP NZ,.FIRSTSTARTBIT
			JP .READFIRSTBIT	;START READING BIT0, COMPENSATED FOR 12 CYCLES, 1 JP
		.RECVSTARTBIT:	
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITS
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITS
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITS
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITS
			LD A,#0x02	;ERROR, STARTBIT TIMEOUT
			SCF
			EI
			RET
		.READBITSNEXTBLOCK:
			INC HL
			DEC C	
			JR NZ,.INITBITLOOP	;NEXT BLOCK UNLESS WE ARE DONE (C=0)
			JR .RECVEXIT
		.READBITSNEXTBYTE:
			INC HL 
			NOP	;DUMMY
			JR .INITBITLOOP
		.READBITS:
			IN A,(0xA2)	;DUMMY
		.READFIRSTBIT:	;ALT TIMING TO COMPENSATE FOR 1 JP
			ADD A,#0x00	;DUMMY
			NOP	;DUMMY
		.INITBITLOOP:
			LD D,B
			LD B,#0x08
		.RECVBITLOOP:	
			INC HL	;DUMMY
			DEC HL	;DUMMY
			IN A,(0xA2)
			RRCA		;SHIFT DATA BIT (0) -> CARRY
			RR (HL)		;SHIFT CARRY -> [HL]
			DJNZ .RECVBITLOOP
			LD B,D
			DJNZ .RECVSTARTBITNEXTBYTE	;NEXT BYTE, SKIP STOPBIT AND WAIT FOR STARTBIT
			NOP	;DUMMY
		.RECVSTARTBITNEXTBLOCK:
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBLOCK
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBLOCK
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBLOCK
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBLOCK
			DEC C	;POSTPONED CHECK
			JR Z,.RECVEXIT	;IF C=0, WE ARE DONE SO EXIT OTHERWISE ERROR
			LD A,#0x02;	ERROR STARTBIT TIMEOUT
			SCF
			EI
			RET
		.RECVSTARTBITNEXTBYTE:	
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBYTE
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBYTE
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBYTE
			IN A,(0xA2)	;WAIT FOR THE HIGH->LOW TRANSITION (STARTBIT)
			AND E
			JP Z,.READBITSNEXTBYTE
			LD A,#0x02
			SCF
			EI
			RET
		.RECVEXIT:
			OR A	;RESET CARRY
			EI
			RET
	__endasm;
}

void send(char* data, int bytes)
{
	__asm

	    LD IY,#2
		ADD IY,SP
		LD L,0(IY)
		LD H,1(IY)
		LD C,2(IY)
		LD B,3(IY)
		
		;SEND 'BC' BYTES FROM [HL] TO PIN6, JOY2
		;MSX, Z80 3.58MHz 57600bps
		SENDBYTES:	
			DI	;NO INTERRUPTS
			LD A,#0x0F	;SELECT PSG REG #15
			OUT (0xA0),A
			IN A,(0xA2)	;SAVE VALUE
			PUSH AF
			SET 6,A		;JOY2
			RES 2,A		;TRIG1 LOW
			LD E,A		;0V VALUE (0) IN E
			SET 2,A		;TRIG1 HIGH
			LD D,A		;5V VALUE (1) IN D
		.BYTELOOP:	
			PUSH BC
			LD A,E
		.SENDSTARTBIT:	
			OUT (0xA1),A
			LD C,(HL)
			LD B,#0x08
		.SENDBITLOOP:	
			RRC C
		;ASSUME BIT=1		
			LD A,D
			JR C,.SETBIT
		;NO, BIT=0		
			LD A,E
		.SETBIT:	
			ADD A,#0x00	;DUMMY
			OUT (0xA1),A
			DJNZ .SENDBITLOOP
			LD A,E
			POP BC
			DEC BC
			NOP	;DUMMY
			ADD A,#0x00	;DUMMY
		.STOPBIT:	
			LD A,D
			OUT (0xA1),A
			INC HL
			LD A,B
			OR C
			NOP	;DUMMY
			JP NZ,.BYTELOOP
		.SENDEXIT:
			NOP	;DUMMY
			POP AF
			OUT (0xA1),A		
			EI
			RET
	__endasm;
}

By nihirash

Rookie (21)

nihirash さんの画像

13-02-2021, 20:07

Thank you!

By Louthrax

Prophet (2496)

Louthrax さんの画像

13-02-2021, 20:23

Very interesting project... Could we imagine a Nextor driver using it ? MSX would send sector number to read / write to PC, and PC would reply / apply the change ? A common hard-disk image could be stored on PC.

By ocitygate

Expert (72)

ocitygate さんの画像

19-02-2021, 20:47

Louthrax wrote:

Very interesting project... Could we imagine a Nextor driver using it ? MSX would send sector number to read / write to PC, and PC would reply / apply the change ? A common hard-disk image could be stored on PC.

The only problem I have just a 64KB MSX for testing. Nextor kernel is 128KB. Maybe MSX-DOS1.

By ocitygate

Expert (72)

ocitygate さんの画像

20-02-2021, 19:54

larsthe18th wrote:

Have crammed together the 'RS232 to TTL' cable just for testing, and using a USB to RS232 converter.
it works like a charm.
Very fun project...

https://youtu.be/pLSxEonacbc
Do you want LEDs?

By larsthe18th

Master (192)

larsthe18th さんの画像

20-02-2021, 22:34

Yes please... Wink

By ocitygate

Expert (72)

ocitygate さんの画像

21-02-2021, 22:49

larsthe18th wrote:

Yes please... Wink

ページ 1/2
| 2