= ASM =

ZXNet echo conference «zx.spectrum»

From Vyacheslav Mednonogov To All 18 October 1997


Get Msg, Yurok!

15 Oct 97 11:06, Yurok Merkulov reported to All about {= ASM =}:


YM> Tell me how to _quickly_ mirror register A in assembler. This
YM> we need to mirror the sprites.. The fact is that in principle

Happily everyone will tell you what you need with a sign:

...
LD L,A ;original byte
LD H,Inv_Tabl/256
LD A,(HL) ;inverted byte
...
...
Inv_Tabl DEFB %00000000 ;table of inverted bytes,
DEFB %10000000 ;aligned to 256 byte boundary
DEFB %01000000
...
DEFB %01111111
DEFB %11111111

C hot Hello, Slava!


From Oleg Stoljarov To All 18 October 1997

YM> We need this to mirror the sprites.. The fact is that in
YM> in principle we know one way:
IHMO current by shifting one back and forth, but nothing else:((

Best wishes, always yours Oleg!


From Max Romanoff To All 18 October 1997


Yurok is that you?
...why did you tell All about = ASM = ?

YM> a total of 100 clock cycles, and this is very slow :((

make a table.

ld a,F0 - value for rotation
ld hl,table
ld l,a
ld a,(hl)
ret

table
...

nu, precalculate the table :)

the only thing is that the table must be aligned to 356 bytes, i.e.
the starting address should not contain numbers in the low byte
from 0. otherwise. you will have to do with addition, which will take longer.

YM> I would really like everything to be faster..

spit, if possible - make copies of the sprites.

Good Luck...

... Running a Pentium emulator on my Sinclair ZX-81, that's kicking ass ...

From Leonid Potehin To All 20 October 1997

[ if the address is 23296 (#5b00), then #5b
ld l,a
ld a,(hl)

Is this option suitable?

YM> [ Wing Commander Fans ] yur...@portal.infocom.ru

So long!
Potekhin Leonid. 2:5056/24.5 AKA 2:5056/23.10


From Vladimir Yudin To All 22 October 1997


Hello Yurok!

19 Oct 97 10:23, Yurok Merkulov wrote to Vyacheslav Mednonogov:

YM> In this case, I will have to save the registers.. That is, again
YM> time is wasted :(
In your method, register C was spoiled, here H and L. Not a big difference.
B In an extreme case, PUSH and POP will take 21 clock cycles, a total of 39 clock cycles - more than twice as fast. Moreover, you won’t process one byte at a time? And in the chain there are 11 clock cycles, and the restoration of
registers is at the input and output.

YM> Is it possible to somehow flip a byte through logical
YM> operations, such as: CPL, NEC, SUB, ADD?
It’s possible, but it will take even longer than shifts.
Sincerely
┬ ┬┌┐┬┐ ┐┬┬
╨╜╨╙╜╨╙ ╨ ╨


From Vyacheslav Mednonogov To All 22 October 1997


Get Msg, Andrew!

21 Oct 97 00:27, Andrew Usachov reported to Vladimir Yudin about {= ASM =}:

AU>>> The table pointed to by ix

VY>> And how are you going to get elements
VY>> from this, sorry, table through IX? :)

AU> Damn. Well, the table. You write into the memory where the instruction is located,
AU> the offset - and forward.

This is practiced when there are no free registers (except IX). Cons: low
performance and the need to add additional. offset (everyone remembers that the index
should be in the range -128..+127). Pros: the table can be located from any address,
not necessarily a multiple of 256

Then it’s better this way (if you really strained with registers):

LD (GET_BT+1),A
GET_BT LD A,(INV_TAB) ;INV_TAB is aligned to 256 bytes

than (via IX):

SUB 128
LD (GET_IX+2),A
GET_IX LD A,(IX+?) ;IX already points to the beginning of the INV_TAB table in advance


Warm greetings, Slava!


From Max Romanoff To All 25 October 1997


Yurok is that you?
...why did you tell Vyacheslav Mednonogov about = ASM = ?

YM> In this case, I will have to save the registers.. That is, again
YM> time is wasted :(

LD (point+1), A ; initial byte
point LD A,(table) ;table

table ;reversed bytes
....

The only thing is that the table must be located on a 256-byte boundary.
i.e. the low byte of the address must contain 0 (to start the table).

Good Luck...


...Iraq has won the toss, and has elected to recieve.

From Max Romanoff To All 25 October 1997


Vladimir is that you?
...why did you tell Andrew Usachov about = ASM = ?


VY> LD (SAddr+2),A 13
VY> SAddr: LD A,(IX+0) 19

VY> Total 32 bars - not a lot. When you need speed, it’s better to forget about index
VY> registers. Compare:

VY> LD H,Table 7
VY> LD L,A 4
VY> LD A,(HL) 7

VY> Total 18/11 clock cycles.

it should be noted that in the second option HL is damaged, and if
add save/restore, then Option 2 will be slower.


Good Luck...


... "PC users are Anoraks. Amiga users are creative individuals."

From Andrew Usachov To All 26 October 1997


¥ [”]                        [šHellošVyacheslav!š]       €€€€€€€€€--€--€-
22 Oct 97 12:34, Vyacheslav Mednonogov wrote to Andrew Usachov:

VM> LD (GET_BT+1),A
VM> GET_BT LD A,(INV_TAB) ;INV_TAB ×ÙÒÏ×ÎÅÎÁ ÎÁ 256 ÂÁÊÔ
ëÏÎÅÞÎÏ, ÔÁË ÌÕÞÛÅ ;)

VM> SUB 128
üÔÏ ÚÁÞÅÍ? ix ÍÏÇ ÕËÁÚÙ×ÁÔØ × ÓÅpÅÄÉÎÕ ÔÁÂÌÉÃÙ ;)

VM> LD (GET_IX+2),A
VM> GET_IX LD A,(IX+?) ;IX ÕÖÅ ÚÁÒÁÎÅÅ ÕËÁÚÙ×ÁÅÔ ÎÁ ÎÁÞÁÌÏ ÔÁÂÌÉÃÙ
VM> INV_TAB

« [šAndrewšUsachovš]                     [š26 Oct 97,š01:02š]  €€€-€-


From Vladimir Yudin To All 26 October 1997

VY>> Total 18/11 cycles.

MR> it should be noted that in the second option HL is damaged, and if
MR> you add saving/recovery, then the 2nd option will be
MR> slower.

And if you add initialization and preservation,
restoration IX? :))
Sincerely
┬ ┬┌┐┬┐ ┐┬┬
╨╜╨╙╜╨╙ ╨ ╨


From Yurok Merkulov To All 27 October 1997


Andrey,

@Date Vladimir Yudin wrote to Andrey Mihaylow, and I read and decided to add:

AM> Actually the conclusion itself:
AM> ld hl, address on the screen
AM> ld d,table

AM> ld e,(hl) ;7
AM> ld a,(de) ;7
AM> ld (hl),a ;7
AM> inc l ;4
AM> ;25

HA !!
Who displays sprites in games this way.
This is what I got:
ld hl, sprite address+mask
ld de, screen address.
inc de
inc de
inc de
ld bc,ekran+3 ;+bc->next line of the pseudo screen.
exx
ld h,table
ld b,40 ; sprite size by Y
loop: exx
dup 4
ld a,(de)
exx
ld l,a
ld a,(de) ;mirror A
exx
and (hl)
inc hl
or (hl)
exx
ld l,a
ld a,(hl)
exx
ld (de),a
inc hl
dec de
edup
org $-1 ;delete the last dec de
ex de,hl
add hl,bc ; de=de+bc
ex de,hl
exx
djnz loop
exx
ret

TOTAL: about 14000 clock cycles for a 4x40 sprite. 8( )
and I have 168 sprites on the screen and theirNeed to constantly pepеpisovyvat.
And quickly not is obtained.


Gladiators Soft [Wing Commander Fans]