From
Vitaly Gavrilov
→
To
All
21 January 2007
Hello Alex Crush
┌─- CODE ───
;SRC - source map
;DST - destination map, 256-aligned
ld de,SRC
ld hl,DST
fillloop;
ld; (hl),-1
inc l
jr nz,filloop
ld c,1 ;step
cpyloop;
ld; a,c
cpl
ld l,a
ld b,c
fillal;
ld; a,(de)
and (hl)
ld(hl),a
dec l
djnz fillal
ld a,l
sub c
ld l,a
jr nc,fillal
inc de
rl c
jr nc, cpyloop
└── CODE ───
I threw it in hastily. Not sure if it works correctly :)
The algorithm, I think, is clear.
From
Krasheninnikov Alexander
→
To
All
21 January 2007
Hello, All
I was once (4 years ago) creating a PS/2 keyboard controller based on
second spec ;-). The controller was wait-free by reading the key code
the main spec directly from the memory of the spec controller (yes, I’m probably a pervert
:) ). Consequently, the task was to generate a 256-byte keyboard table.
That is, the 0th byte is what the main spec will receive when reading from port #00FE, the 1st -
#01FE... Etc..
If anyone doesn’t know, each byte in this table is calculated as AND of those rows
keyboards whose numbers in the number of this byte are zero.
That is, the value of cell number #D6= %11010110 is equal to the AND of the 0th, 3rd and 5th rows
keyboards. The value of the last cell is port #FFFE, ess = #FF
So, I propose (as a study, perhaps) to write a procedure for calculating
such a table. Naturally, you want the procedure to be as quick as possible.
Input data - 8 bytes (keyboard rows, only the 5 least significant bits have meaning, but
this is kind of on the side), the output is 256 bytes. There are no more restrictions.
P.S. I remember I got a result of about 7000 cycles. Today's
reflections seem to allow us to reduce this number to ~4500 cycles (although I
I thought for sure and didn’t check my thoughts at all).
Go for it if anyone is interested :-)
From
Krasheninnikov Alexander
→
To
All
21 January 2007
Hello Vitamin
Vit> I think the algorithm is clear.
The algorithm never caused any problems initially :-). I suggest quickly
practice ;-) . And you can do it (although I can’t already at 3 a.m.
it’s normal to count something) approximately “quite a lot of ticks”
From
Witch Doctor
→
To
All
21 January 2007
Hello Alex Crush
Speaking of keyboards, a few years ago I disassembled AT keyboards for repairs
(!) (yes, they were repaired once...) so there was actually something there as a controller
VERY similar in appearance and with the inscription Z80... So it doesn’t look like a pervert AlexCrush
pulls and can sleep peacefully :)))) and if I’m lucky, I’ll try to find a rarity and
take a picture.
From
Kamil Karimov
→
To
All
21 January 2007
Hello, Witch Doctor
> there really was something VERY similar in appearance and with the controller
> labeled Z80...
Zilog released keyboard controllers Z8602/14/15/C15/E23
Used in many AT keyboards.
From
Peter Kitsun
→
To
All
21 January 2007
Hello caro
2caro - as I understand it in your ZXMC when the spec keyboard is polled by wait
used, does it slow down much when loading from a cassette, for example?
From
Krasheninnikov Alexander
→
To
All
22 January 2007
Hello caro
I suggest not going off topic.
Isn't anyone interested in trying to come up with a quick way? Or is everything too strong?
Are you busy with something?
From
Vitaly Gavrilov
→
To
All
23 January 2007
Hello Alex Crush
Well, you can do this...
┌─- CODE ───
ld de,dst
allkc;
ld; hl,src
ld a,-1
exa
ld a,e
cpl
keyc;
and; a
jr z,nokey
rra
jr nc,nochk
exa
and (hl)
exa
nochk;
inc; l ;??
jr keyc
nokey;
exa;
ld(de),a
inc e
jr nz,allkc
└── CODE ───
I admit, I forgot whether rra affects the zero flag. If yes, then you can
reduce.
I didn’t count how much it weighs in cycles :)