library.
ZXNet echo conference «code.zx»
From Aleksey Malov → To All 30 March 2000
Greetings, All!
Here's what I personally think about the subject:
1. It is needed. If not me, then someone for sure. I can practically write it myself
that’s all I need at the moment, but I’m ready to share my experience with everyone,
and even more so learn something new.
2. Sending the item in the form of a dump, in my opinion, is useless, because... precisely the presence of text
allows a beginner to understand the operating algorithm, and, when
opportunities to improve it.
3. Submissions must be sent in the form of ordinary assembler text; it is advisable to avoid
application of the syntax features of various assemblers, such as:
exa, rept, dup, etc.
if necessary, you can replace directives like dup with a comment: repeat
so many times
4. Stop arguing over the same issues. Decide right away: to be or not to
be? And send the fruit of your insanity... Ugh, damn, brilliant mind.
I myself, so as not to be considered unfounded, will one of these days throw into the echo something different from
sprite printing procedures.
I wish you health, happiness and creative Uzbeks.
Aleksey Malov aka VIVID/Brainwave.
From Aleksey Malov → To All 31 March 2000
Greetings, All!
Instead of arguing over the subject there, and over the same issues as
a month ago, it would be better if they threw in useful information in the same quantity as
useless - it would be much more useful.
Well, okay, so as not to be like you, I’ll throw in a very quick procedure
constructing circles using the algorithm named after Alexey Malov ;)
The procedure is written so that it can be easily adapted to any
assembler, perhaps xh and xl to hx and lx.
The speed of the procedure is as follows: on Scorpion (69886 tacts per int) for 1 frame
a circle of radius 113 is constructed.
************* beginning *****************
;tables for constructing points can be moved to any address divisible by 256.
ADRTB EQU #C000 ;[#200]
ADRTB2 EQU ADRTB+#200 ;[#800]
ORG #6000
ENT $
CALL INIT; initialization of tables for plotting points
;demonstration procedure for drawing circles
DRAWING HALT
LD A,7
OUT(254),A
;center coordinates
LD BC,#6080
;and radius
LD A,#71
CALL CIRCLE
XOR A
OUT(254),A
LD A,#7F
IN A,(254)
RRCA
JR C,DRAWING
RET
;procedure for constructing a circle
;there is no check for dots leaving the screen, if you want, you can insert
;B-Y,C-X,A-RADIUS
CIRCLE OR A ;circles with zero radius are not displayed
RET Z
LD XH,A;small snowflake,snowflake,snowflake and snowflake
ADD A,C
LD H,ADRTB/256:LD L,B:LD D,(HL)
INC H:LD H,(HL):LD L,A:LD E,(HL)
INC H:LD A,(DE):XOR (HL);subject to xor, spontaneous, p
;snake and snowflake or (hl)
LD (DE),A
LD A,C
SUB XH
LD H,ADRTB/256:LD L,B:LD D,(HL)
INC H:LD H,(HL):LD L,A:LD E,(HL)
INC H:LD A,(DE):XOR(HL)
LD (DE),A
LD A,B
ADD A,XH
LD H,ADRTB/256:LD L,A:LD D,(HL)
INC H:LD H,(HL):LD L,C:LD E,(HL)
INC H:LD A,(DE):XOR(HL)
LD (DE),A
LD A,B
SUB XH
LD H,ADRTB/256:LD L,A:LD D,(HL)
INC H:LD H,(HL):LD L,C:LD E,(HL)
INC H:LD A,(DE):XOR(HL):LD(DE),A
LD XL,1
LD A,XH
EXX
ADD A,A
LD C,A
RRCA
DEC A
RET Z
LD B,1
EXA
;this snowflake snowflake
CIR1 EXA
DEC B ;State of the Nation
DEC B ;КООРДИНАТ ТОЕК
ADD A,B
JR C,OBHOD
DEC C
DEC C
ADD A,C
DEC XH
OBHOD EXA
EXX
;ПЕАТЬ ТОЧК
LD A,B
ADD A,XH
LD L,A
LD A,C
ADD A,XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR(HL):LD(DE),A
LD A,B
ADD A,XHLD L,A
LD A,C
SUB XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XH
LD L,A
LD A,C
SUB XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XH
LD L,A
LD A,C
ADD A,XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
ADD A,XL
LD L,A
LD A,C
ADD A,XH
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XL
LD L,A
LD A,C
ADD A,XH
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
ADD A,XL
LD L,A
LD A,C
SUB XH
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XL
LD L,A
LD A,C
SUB XH
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
EXX
;проверка на окончание вывода
INC XL
LD A,XHSUB XL
RET Z
DEC A
JP NZ,CIR1
EXX
;ставим 4 диагональные точки
LD A,B
ADD A,XL
LD L,A
LD A,C
ADD A,XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
ADD A,XL
LD L,A
LD A,C
SUB XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XL
LD L,A
LD A,C
ADD A,XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
LD A,B
SUB XL
LD L,A
LD A,C
SUB XL
LD H,ADRTB/256:LD D,(HL):INC H
LD H,(HL):LD L,A:LD E,(HL):INC H
LD A,(DE):XOR (HL):LD (DE),A
RET
;инициализируем таблицы точек
INIT LD HL,ADRTB
LD DE,#4000
LD B,#C0
INIT1 LD (HL),D
INC H
LD A,L
RRA:RRA
AND #0E
ADD A,ADRTB2/256
LD (HL),A
DEC H
CALL DNDE
INC L
DJNZ INIT1
INIT10 LD (HL),B
INC L
JR NZ,INIT10
LD C,#80
LD H,ADRTB2/256-1
INIT11 INC H
INIT2 LD (HL),B
INC H
LD (HL),C
RRC C
JR NC,INIT3
INC B
RET ZINIT3 INC L
JR Z,INIT11
DEC H
JR INIT2
DNDE INC D
LD A,D
AND 7
RET NZ
LD A,E
ADD A,32
LD E,A
RET C
LD A,D
SUB 8
LD D,A
RET
************* end ******************************
Try optimizing for speed (maybe it will work).
It’s easy to optimize in terms of volume: separate the printing procedure into a subroutine
points.
Well, next time, my dear TV viewers, a quick procedure awaits you
drawing filled circles.
I wish you health, happiness and creative Uzbeks.
Aleksey Malov aka VIVID/Brainwave.