[MZ-SD2CMT] GitHub link

User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

If it helps you, the explanations are here:
transfert_rapide_docs.tar.gz
(103.47 KiB) Downloaded 430 times
I forgot "/" in front of MOTOR and SENSE in the comments.
hlide
Posts: 681
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-SD2CMT] GitHub link

Post by hlide »

Have a look at https://en.wikipedia.org/wiki/Intel_825 ... (BSR)_mode. When you write at $E002 (Port C), it is not the same as reading at the same port. I don't understand how setting 0 to this port will set PC1 to 1 (should be $03 instead).

I don't understand your code because of that and I'm puzzled it may work for you.
User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

FR:
???
Le 8255 possède 3 ports (A, B et C) qui peuvent être dans 3 modes :
Mode 0 : Entrée/Sortie de base
Mode 1 : Entrée/Sortie validées
Mode 2 : Bus Bidirectionnel

Quand les directions sont initialisés, elle représentent soit une valeur postionnée (sortie) soit une valeur lue (entrée).

Seul le mode 0 est utilisé par le sharp, lors du boot du moniteur 1Z-013A nous avons :
004F CALL ?MODE

?MODE :
073E LD HL, E003H
0741 LD (HL), 8AH 10001010
1 : Activation mode (Bit 7)
00 : Mode 0 Port A (Bits 6-5)
0 : Port A en sortie (Bit 4)
1 : Port C supérieur en entrée (Bit 3)
0 : Mode 0 Port B (Bit 2)
1 : Port B en entrée (Bit 1)
0 : Port C inférieur en sortie (Bit 0)

Les 2 instructions qui suivent permettent d'initialiser les bits du port C (BSR)
et ne sont utilisés qu'après une configuration des ports en E003H et seulement
puisqu'il s'agit d'une initialisation des bits
avec D3-D2-D1 : Numéro de bit
D0 : Set/Reset

0743 LD (HL), 07H PC3=1
0745 LD (HL), 05H PC2=1
0747 RET

Ensuite pour accéder aux bits du port C il faut utiliser l'adresse E002H classique avec un demi port en entrée (read) et
un demi port en sortie (write).

En fonction de la lecture ou de l'écriture sur le 8255, il n'y a aucune raison d'avoir deux comportements différents.

EN:
The 8255 has 3 ports (A, B and C) that can be in 3 modes:
Mode 0: Basic Input / Output
Mode 1: Validated Input / Output
Mode 2: Bidirectional Bus

When the directions are initialized, they represent either a posited value (output) or a value read (input).

Only mode 0 is used by the sharp, when booting the monitor 1Z-013A we have:
004F CALL ?MODE

?MODE :
073E LD HL, E003H
0741 LD (HL), 8AH 10001010
1: Activation mode (Bit 7)
00: Mode 0 Port A (Bits 6-5)
0: Port A output (Bit 4)
1: Upper input port C (bit 3)
0: Mode 0 Port B (Bit 2)
1: Port B input (Bit 1)
0: lower output port C (bit 0)

The following 2 instructions allow to initialize the bits of port C (BSR)
and are only used after a port configuration in E003H and only
since it is a bit initialization
with D3-D2-D1: Bit number
D0: Set / Reset

0743 LD (HL), 07H PC3 = 1
0745 LD (HL), 05H PC2 = 1
0747 RET

Then to access the bits of the port C it is necessary to use the classic address E002H with half a port in input (read) and
a half output port (write).

Depending on the reading or writing on the 8255, there is no reason to have two different behaviors.
User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

FR:
Ne pas oublier qu'il y a aussi un MOS4069 (IC 3C) qui inverse les signaux qui transitent dans un sens et dans l'autre : /READ et /WRITE.
Enfin le TTL7474 (IC 7E) qui est un flip/flop avec le preset reliée sur une porte inverseuse (NON ET) au signal SENSE d'où le /SENSE en entrée.

EN:
Do not forget that there is also a 4069 (IC 3C) which inverts the signals that pass in one direction and the other: / READ and / WRITE.
Finally the LS74 (IC 7E) which is a flip / flop with the preset connected to an inverting gate (NAND) to the SENSE signal from where the / SENSE input.
hlide
Posts: 681
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-SD2CMT] GitHub link

Post by hlide »

Pacman wrote: Tue Jul 10, 2018 6:40 am 073E LD HL, E003H
0741 LD (HL), 8AH 10001010
1 : Activation mode (Bit 7)
00 : Mode 0 Port A (Bits 6-5)
0 : Port A en sortie (Bit 4)
1 : Port C supérieur en entrée (Bit 3)
0 : Mode 0 Port B (Bit 2)
1 : Port B en entrée (Bit 1)
0 : Port C inférieur en sortie (Bit 0)

Les 2 instructions qui suivent permettent d'initialiser les bits du port C (BSR)
et ne sont utilisés qu'après une configuration des ports en E003H et seulement
puisqu'il s'agit d'une initialisation des bits
avec D3-D2-D1 : Numéro de bit
D0 : Set/Reset

0743 LD (HL), 07H PC3=1
0745 LD (HL), 05H PC2=1
0747 RET

Ensuite pour accéder aux bits du port C il faut utiliser l'adresse E002H classique avec un demi port en entrée (read) et
un demi port en sortie (write).
FR:
Bien vu, j'étais persuadé que le port $E002 avait un comportement différent selon que l'on était en lecture ou écriture alors qu'en fait, c'est le port $E003 qui héberge le mode BSR. Donc, `LD A, $02` revient à mettre à 1 le PC1 et à 0 les PC0, PC2 et PC3 (je n'aime pas cette idée) en sortie du 8255. Et `XOR A` revient à mettre à 0 les PC0, PC1, PC2 et PC3 (je n'aime toujours pas l'idée qu'on touche aux trois autres). Mais bon j'ai enfin peut-être trouvé pourquoi j'avais un interblocage - c'est l'adresse que j'utilise qui en cause.

Waouh ! je n'avais pas remarqué les inversions faites par les IC 3C ! je pensais naivement que c'était des diodes pour éviter que le courant passe dans l'autre sens sans tenir compte du petit rond signifiant l'inversion. Du coup, ça peut aussi expliquer beaucoup de problèmes que je rencontrais en LEP qui me laissaient perplexe !

Ok, je pense que les choses seront plus claires pour ce weekend prochain et il faudra que je prenne en compte cette inversion ! dire que j'ai probablement perdu beaucoup de temps à cause de genre de détails électroniques.

Merci, cette discussion m'a ouvert les yeux sur des erreurs potentiels dans ma version.

EN:

Good point, I was convinced that port $E002 had a different behavior depending on whether you were reading or writing when in fact port $E003 hosts BSR mode. So, `LD A, $02` is like setting PC1 to 1 and PC0, PC2 and PC3 to 0 (I don't like this idea) out of 8255. And `XOR A` is like setting PC0, PC1, PC2, and PC3 to 0 (I still don't like the idea of touching the other three). But maybe I finally figured out why I had an interlock - it's the address I use that's at issue.

I had not noticed the inversions made by the IC 3C! I naively thought that they were diodes to avoid that the current passes in the other direction without taking into account the small circle meaning the inversion. So that can also explain a lot of problems I was having in LEP that left me perplexed!

Ok, I think things will be clearer for this next weekend and I will have to take into account this inversion! say that I probably lost a lot of time because of some kind of electronic details.

Thank you, this discussion has opened my eyes to potential errors in my version.
User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

hlide wrote: Tue Jul 10, 2018 9:48 am Donc, `LD A, $02` revient à mettre à 1 le PC1 et à 0 les PC0, PC2 et PC3 (je n'aime pas cette idée) en sortie du 8255. Et `XOR A` revient à mettre à 0 les PC0, PC1, PC2 et PC3 (je n'aime toujours pas l'idée qu'on touche aux trois autres).
FR:
Je pense que ça n'a pas d'importance car PC4, PC5, PC6 et PC7 sont en entrée donc écriture impossible, et PC0 et PC1 sont non utilisés, reste PC2 qui permet d'inhiber les interruptions horloge toutes les 12H à partir du démarrage de la machine donc très peu de chance d'avoir un problème.
Maintenant je suis d'acoord pour ne toucher que les bist concernés : ça suppose sauvegarder la valeur en mémoire, la récupérer pour l'utiliser en l'ayant modifiée. Bref beacuoup d'opérations lourde en cycle machine qui ralentisse la transmission pour rien.

EN:
I think that it does not matter because PC4, PC5, PC6 and PC7 are in input thus impossible to write, and PC0 and PC1 are not used, remains PC2 which makes it possible to inhibit interruptions clock every 12H starting from starting the machine so very unlikely to have a problem.
Now I am here to touch only the concerned bist: it supposes to save the value in memory, to recover it to use it having modified it. In short, a lot of heavy operations in the machine cycle that slow down the transmission for nothing.
hlide
Posts: 681
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-SD2CMT] GitHub link

Post by hlide »

PC0 = ?
PC1 = WRITE
PC2 = INTMSK <--- masque interruption 12h ? ouais bon...
PC3 = MOTOR ON/OFF TOGGLE <--- cela a une influence sur le signal MOTOR reçu par l'Arduino - enfin sur un front montant. Ouais bon...

A voir si le PC0 est utilisé en interne ou sinon si on peut l'utiliser.

Dans les faits, pas besoin de sauvegarder les valeurs pour les modifier. En utilisant $E003, ça le fait atomiquement pour toi. Et vu que l'activité d'Arduino passe certainement plus de temps à lire le SD, je doute fort que cela fasse une différence.
User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

hlide wrote: Tue Jul 10, 2018 1:58 pm Et vu que l'activité d'Arduino passe certainement plus de temps à lire le SD, je doute fort que cela fasse une différence.
Là je parle du côté Z80 pas côté arduino. Je pense que l'on peut arriver à une transmission 2 fois plus rapide avec une autre méthode et je suis en cours d'expérimentation et c'est prometteur.
User avatar
Pacman
Posts: 172
Joined: Mon Feb 05, 2018 2:59 pm

Re: [MZ-SD2CMT] GitHub link

Post by Pacman »

FR:
Je viens de mettre en oeuvre un autre méthode et j'arrive a un taux de transfert fulgurant : sideroll-F se charge en moins de 2s !
Je paufine l'assembleur et vais le publier dans l'espace "sharpentiers" très bientot, dès qu'une version exploitable facilement sera finie.

EN:
I just implemented another method and I arrive at a lightning transfer rate: sideroll-F is loaded in less than 2s!
I paufen the assembler and will publish it in the space "sharpeners" very soon, as soon as an exploitable version easily will be finished.
hlide
Posts: 681
Joined: Thu Jan 25, 2018 9:31 pm

Re: [MZ-SD2CMT] GitHub link

Post by hlide »

I have an issue with reading PC4: my oscilloscope shows me the signal is not working as a perfect square wave signal but something like that:
PC4.png
PC4.png (26.5 KiB) Viewed 11235 times
if the period is small, PC4 has no chance to reach the high level (1), the more I grow period, I'm getting more chance to reach it but it seems to be around 3s for my "UltraFast" mode in MZ-700 to be able to capture all the transmitted bits and to run loaded program (you need to keep the high and low levels stable a consistent time).
Post Reply