Info Guide #01 |
|
Programming - A few short and fast procedures.
Etudes Alone Coder In this section we will publish short and quick procedure that we recommend to use instead of the ancient and gromozdkih.Takzhe will include small changes in the old procedures, which give some advantage over the latter. Change in the seemingly already classical procedure DOWN HL, which is known to expects a byte address on the screen, lying on a pixel is below this in the HL: Was: It was: INC H INC H LD A, H LD A, H AND 7 AND 7 JR NZ, EXIT JR NZ, EXIT; CY = 0 LD A, L LD A, L ADD A, 32 ADD A, 32 LD L, A LD L, A JR C, EXIT JR C, EXIT; CY = 1 LD A, H LD A, H 8 SUB ADD A, -8 LD H, A LD H, A; CY = 1 EXIT ... EXIT ... In this version everything was still, except that the flag CY is now points to the current border crossing familiarity. In the procedure UP HL can produce a similar change: instead of ADD A, 8 put SUB -8.: the coordinates specified by in the registers L = y, E = x, in any place screen (and even off the screen) over 58 (!) cycles put tochka.Registr C is the high byte address table ('TABLE), the register D = C +2. LD H, C LD A, (DE); x / 8 INC D gives the least significant byte OR (HL); L (y) INC H LD H, (HL); H (y) LD L, A LD A, (DE); byte (x) (X) OR (HL); method of staging points LD (HL), A If, instead of the last 2 Paste AND (HL), it will feature POINT. To procedure has worked many times at the end of its Put DEC D. Tables are generated the following program: LD HL, TABLE +256 LD DE, # 4000 GEN0 LD (HL), D DEC H LD (HL), E INC H DOWN DE 1-I LD A, D and SUB 88 2-I JR NZ, $ +3 LD D, A INC L JR NZ, GEN0 INC H LD A, 128 GEN1 LD (HL), E INC H LD (HL), A DEC H 3rd RRCA and JR NC, $ +3 4-I INC E INC L JR NZ, GEN1 Fragment program, which allows for some and the same 19 bars of yes / no semitaktovuyu command (Z - perform, NZ - not to perform): JR NZ, $ +4 JR EXIT EXIT ... Fast print letters 6x8 (screen DE): PUSH DE LD L, A LD B, C LD A, 2 RRCA DJNZ $ -1 LD (PRN +1), A LD H, 'FONT LD B, 8 PRGO PUSH HL LD L, (HL) PRN LD H, 1 PR1 ADD HL, HL ADD HL, HL JR NC, PR1 LD A, (DE) OR H LD (DE), A INC E LD A, L LD (DE), A DEC E INC D POP HL INC H DJNZ PRGO POP DE If the font is limited by 0, then remove the LD B, 8, and DJNZ PRGO to replace JR NZ, PRGO. Register C should contain 7,5,3 or 1 and 7 corresponds to the zero coordinate letters inside the familiarity (x mod 8 = 0). Letters in font 256, and they are all pressed to the left (Can be shifted by one point right). As have to change C: LD A, C SUB 6 JR NC, $ +5 INC E AND 7 LD C, A And, finally, touch on all the already zadolbavshego ZXrevyushnogo address calculation letters in ROM: Was: So: LD L, A LD L, A LD H, 0 ADD HL, HL ADD HL, HL LD H, 15 ADD HL, HL ADD HL, HL ADD HL, HL ADD HL, HL LD BC, 15360 ADD HL, BC Make sure you all my life hung to deceive
Similar articles:
В этот день... 21 November