KrNews #05
24 июля 1998 |
|
Coder - Quick procedure point.
CODING (C) Viper / Techno Laboratory After seeing other computer paper, I found there sections on programmers. I think that our (VASHA!) Newspaper is not worse (in my opinion, even better than many) and it's time to fill this gap. Today there will be 4 treatments, which are often used for programming: 1) rapid procedure point 2) exchange of the two memory areas 3) the rapid division 4) the rapid multiplication 1) Over this procedure, a long time I broke head and invented (as it turned out later) bicycle. But then I thought procedure even faster (69 cycles), but its I will not give you, if anyone should, that he come up with. :-) This version takes 73 clock cycles for its work must be 1024 bytes continuous memory. Sub-create the tables call names CRT. Point coordinates are given by in DE (XY). Tables are falling down, that is if PTY = # FE00, then another 3-sector below will be used. In the procedure itself points (ZIP) second team LD H, 'PTY is nothing but an operation selection High Byte (ALASM). Such a team Available STORM, and as far as I known ZXASM3. If your assembler does not supports such things, ask byte directly, although it is uncomfortable. ; ZIP PLOT 1.4 ; Author: Viper of TechnoLab , 73 Tacts, 4 Tables take four sectors ; PTY - Down HiB, LEN = 192 ; PTX - Down LoB, LEN = 192 ; ADX - Div8 Lin, LEN = 256 ; PTB - BitSet N, LEN = 256 PTY EQU # FF00 ; PTX EQU # FE00 ; ADX EQU # FD00> for help ; PTB EQU # FC00 / ORG 40000 ENT CALL CRT LD DE, # 0909; coordinates of a point CALL ZIP RET ZIP LD L, E LD H, 'PTY LD B, (HL) DEC H LD A, (HL) DEC H LD L, D ADD A, (HL) LD C, A DEC H LD A, (BC) XOR (HL) LD (BC), A RET CRT LD HL, PTY; creating tables LD DE, # 4000; main screen LD BC, # C020 CR1 LD (HL), D DEC H LD (HL), E INC L INC H INC D LD A, D AND 7 JR NZ, $ +12 LD A, E SUB # E0 LD E, A JR NC, $ +6 LD A, D SUB 8 LD D, A DJNZ CR1 LD L, H; only for those addresses DEC H; in general LD L, # FF DEC H CR3 DEC C LD B, 8 CR2 LD (HL), C DEC L DJNZ CR2 INC C DEC C JR NZ, CR3 DEC H INC A CR4 LD (HL), A RLCA DEC L DJNZ CR4 RET
Other articles:
Similar articles:
В этот день... 23 November