Nonsense - output and print sprites on the Spectrum.

IzhNews #04
                                          
PIXel/BrC 02/11/2000 MED 3.01 __________________________________________ I once needed a procedure print cnpauta, something simple like that sprite, symbolic with attributes, and so As a beginner coder, I didn’t have such a procedure, and I had to write it. First, let's decide on a sprite, what format is it, where, what does it have and how and why? In my opinion, the most convenient sprite editor (from the word edit (emphasis on “and”)) ento Sprite Master v 5. 11, which can find in the journal appendix ZXFortat8 or I have. I chose color sprites c various sizes, i.e. Float Sytbol Graph. Creating different sets of sprites and exploringreceived files on disk doctor, I was able to identify the format of these fucking sprites: Sprite Float Sytbol Graph saved as a file typeCodehas the following format: 2 bytes - offset relative to the current addresses until the next cnpauta. ml. byte st. byte. 1 byte - Height of cnpauta. 1 byte - Length of the sprite. h*l*8 b Himself cnpautuk. h*l byte attributes. Well, let's start coding! ; load sprites to address #C000 ORG #C000 SPRITE LCODE "SPRITES" ;FLOAT.SYMBOL.GRAPH. B.<>F ;main program. Calling the sprite printing procedure. ORG #8000 ENT LD HL,SPRITE ;START OF FILE LD DE,#0A07 ;KOORDS Y=10, X=7 ;UPPER LEFT CORNER. LD A,0 ;NUMBER OF SPRITE CALL PRINT_SPRITE ;CALL PRINT PROCEDURETN RET PRINT_SPRITE ;THIS IS THE SAME PROCEDURE. AND A ;A=0? PRSP1 JR Z,PRSP2 ;YES => NEXT NOT NOW LD C,(HL) INC HL LD B,(HL) ; ;CURRENT ADDRESS TO NEXT, ;SPRITE. ADD HL,BC ;HL ADDRESS NEXT. SPR. DEC A JR NZ,PRSP1 ;IFN NOT THE ONE YOU NEED ;THAT'S NEXT. PRAP2 INC HL INC HL LD A,(HL) LD (HGT),A ;PSITE HEIGHT. LD C,A INC HL LD A,(HL) LD (LEN),A ;LENGTH REF. LD В,A ;В=LEN, C=HGT INC HL PUSH DE ;FOR COLOR PRINT PRSPЗ PUSH DE ;BEGIN KOORDS ;CHECKOUT ADDRESS ON SCREEN NZ COORDINATE. LD A,D AND 7 RRCA RRCA RRCA OR Е LD Е,A LD A,D AND #18 OR #40 LD D,A ;ТЕПЕРЬ В DE,ВМЕСТО KООPДNHАT, АДРЕС. PUSH ВС ;SAVE LEN&HGT PRSPЧ-1 PRSPЧ LD В,8 LD A,(HL) ;PRSPЧ+2 LD (DE),A ;ПРОЦЕСС ПЕЧАTN INC HL INC DDJNZ PRSPЧ+2 ;PRINT CNMVOL. LD A,D SUB 8 LD D,A INC E POP sun DJNZ PRSPЧ-1 ;-/- LINE. LD A,(LEN) LD B,A POP DE INC D DEC C JR NZ,PRSPЗ ;-/- LINE BY LINE THE WHOLE SPRITE. POP BC ;__COLOR BC=COORD. ;CALCULATE WHICH ATPN ADDRESS CORRESPONDS TO THE COORDINATE ;SNMVOLA IN THE UPPER LEFT CORNER OF THE SPANT. LD D,H LD Е,L LD L,В LD H,0 ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL LD В,#58 ADD HL,ВС ;АДРЕС В HL LD A,(HGT) LD В,A NEXTLC PUSH ВС LD A,(LEN) LD В,A LINEC LD A,(DE) LD (HL),A INC HL INC DE DJNZ LINECLD A,(LEN) LD V,0 LD C,A SBC HL,VS POP sun DJNZ NEXTLC RET LEN NOP HGT NOP To print without attributes you need to remove line push de ; for color and delete all lines starting from ...;__color to ret. RET leave. __________________________________________

Share your thoughts about the article