Aspect #05
29 января 1998 |
|
Programming - Text output terminal means on the background running the squares.
Fast and not too fast graphics Well Well, as I promised in the past, once Today we will be subverted to procedures fast graphics. Well, the first misrepresent, respectively, we can offer text output terminal on the way running background tiles, and, to life honey may seem, with the imposition of 5 screen on the seventh. And here is its code: ORG # 8000 DI; includes 7-th bank LDA, # 17 LDBC, # 7FFD OUT (C), A LDHL, VORON; throws the picture on the LDDE, # C000; screen LDBC, 6912 LDIR LDA, # 10; includes 0-th bank LDBC, # 7FFD OUT (C), A EI CALLZAPTAB; fill in the address table CALLZAPOUT; construct a procedure for deriving CALLZAPBUF; fill in the shadow screen DI LDHL, INTERR; reassign interrupts CALLIMON LDIX, TABLE LDBC, # 000 LDHL, TRTEXT CALLT_TAPE; text printing terminal HALT XORA LD (23560), A WAITER EI; wait for keystroke HALT RST56 LDA, (23560) ANDA JRZ, WAITER RET , INPUT ; HL - TEXT OF ADDRESS ; B, C - STARTING COLUMN ; IX - TABLE T_TAPE LDA, (HL); Take a byte INCHL ANDA JRZ, T_TAPE0; end end text = O CP # 0D JRZ, NEXTLINE0; process ENTER CALLPRINS; print symbol INCC; following position LDA, C; if we went beyond the screen, BIT5, A; would be nice to go back JRZ, T_TAPE1 JRNEXTLINE; but on the line below T_TAPE0 LDA, 32; erase the cursor CALLPRINS RET; end crowns the work NEXTLINE0 LDA, 32; processing ENTER CALLPRINS; and delete the cursor NEXTLINE LDDE, 48, go to the next ADDIX, DE; line LDC, B; load the column T_TAPE1 LDA ,"@"; derive the cursor CALLPRINS EI; wait ... HALT; and very long ... HALT HALT JRT_TAPE; repeat again ; Character output 8X24 ; LOG: IX - TABLE ; C - COLUMN ; A - Character code PRINS PUSHIX PUSHBC PUSHHL FONT32 LDDE, 15616, Address 32-th font SUB # 20; symbols 0 - # 1F does not derive LDL, A LDH, 0 ADDHL, HL; multiply the character code for 8 ADDHL, HL; - the number of bytes in the symbol ADDHL, HL ADDHL, DE; calculate the address of the symbol EXDE, HL LDH, (IX +1); address output HL LDA, (IX) ADDA, C LDL, A LDB, 0 DUP2; derive the first third of the symbol LDA, (DE) INCDE LD (HL), A INCH LD (HL), A INCH LD (HL), B INCH EDUP LDA, (DE) INCDE DUP2 LD (HL), A INCH EDUP PUSHDE LDDE, 1916 ADDIX, DE POPDE LDH, (IX +1); address of the second third of the output LDA, (IX) ADDA, C LDL, A LD (HL), B; derive the second third of the symbol INCH DUP2 LDA, (DE) INCDE DUP2 LD (HL), A INCH EDUP LD (HL), B INCH EDUP LDA, (DE) LD (HL), A INCH PUSHDE LDDE, 1916 ADDIX, DE POPDE LDH, (IX +1); Ades output of the last third of the LDA, (IX) ADDA, C LDL, A LDA, (DE) INCDE LD (HL), A; withdrawal of the last third of the INCH DUP2 LDA, (DE) INCDE LD (HL), B INCH DUP2 LD (HL), A INCH EDUP EDUP POPHL POPBC POPIX RET; Uff is now possible to retire ; Interrupt servicing routines INTERR PUSHHL; is protected PUSHBC; pah persists PUSHDE PUSHAF PUSHIX EXX PUSHHL PUSHBC PUSHDE EXAF, AF ' PUSHAF INTER0 LDA, 16; click screens LDBC, # 7FFD OUT (C), A XOR8 LD (INTER0 +1), A LDHL, TABEL LDA, 1, moving in a positive TAGEQU $ -1; or ANDA JRZ, DECREASE; negative direction LDA, 0, number of procedures in the table SETTLER EQU $ -1 LDE, A LDA, 1918 ZADER EQU $ -1; while driving in a given DECA; direction LD (ZADER), A LDA, E JRNZ, INT1 LDA, 1918 COEFF EQU $ -1; the same but does not change LD (ZADER), A LDA, E INCA LD (SETTLER), A CP9; number of procedures in Table 9 JRNZ, INT1 DECA LD (SETTLER), A LDA, 0 LD (TAG), A INT1LDD, 0, we find that the procedure ADDHL, DE; table ADDHL, DE LDA, (HL) INCHL LDH, (HL) LDL, A LDDE, INT2 PUSHDE; return address on the stack JP (HL); execute procedure DECREASE LDA, (ZADER); movement DECA; otitsatelnom on the board LD (ZADER), A; on the table JRNZ, INT3 LDA, (COEFF) LD (ZADER), A LDA, (SETTLER) DECA LD (SETTLER), A CP # FF JRNZ, INT3 INCA LD (SETTLER), A INCA LD (TAG), A INT3LDA, (SETTLER) LDE, A LDD, 0 JRINT1 INT2LDDE, BUFFER; derive torment clipboard CALLOUTPROC POPAF; rehabilitating EXAF, AF ' POPDE POPBC POPHL EXX POPIX POPAF POPDE POPBC POPHL EI RET; the end of the interruption: ( , OFFSET BUFFER LEFT LEFTLDHL, BUFFER +1 LDDE, BUFFER LDA, (DE) EXAF, AF ' LDA, 1916 LEFT1 EXAF, AF ' DUP15; It's faster to LDI EDUP LD (DE), A LDA, (HL) INCDE INCHL EXAF, AF ' DECA JPNZ, LEFT1 RET , OFFSET BUFFER UP UPLDHL, BUFFER LDDE, BUFF1 DUP256; quickly and without pain LDI EDUP LDHL, BUFF1 DUP16 LDI EDUP RET , OFFSET BUFFER DOWN DOWNLDHL, BUFEND-1 LDDE, BUFF2-1 DUP256; Similarly to the previous LDD; procedure EDUP LDHL, BUFF2-1 DUP16 LDD EDUP RET , OFFSET BUFFER RIGHT RIGHT LDHL, BUFEND-2 LDDE, BUFEND-1 LDA, (DE) EXAF, AF ' LDA, 1916 RIGHT1 EXAF, AF ' DUP15 LDD EDUP LD (DE), A LDA, (HL) DECDE DECHL EXAF, AF ' DECA JPNZ, RIGHT1 RET ; Buffers Squares ZAPBUF DI LD (ZAP_SP +1), SP LDHL, # 4F4F; COLOR BLUE, COLOR TONE , WHITE, BRIGHT INCLUDED LDDE, # 4747, BUT ALSO BACK COLOR BLACK LDB, 8 LDSP, BUFEND ZAPBUF1 PUSHHL; fill up quickly PUSHHL PUSHHL PUSHHL PUSHDE PUSHDE PUSHDE PUSHDE DJNZZAPBUF1 LDB, 8 ZAPBUF2 PUSHDE PUSHDE PUSHDE PUSHDE PUSHHL PUSHHL PUSHHL PUSHHL DJNZZAPBUF2 ZAP_SP LDSP, 0 EI RET , Makes the procedure OUTPUT ZAPOUT LDHL, OUTPROC1 LDDE, # 5800 LDC, 8 ZAPOUT2 LDB, 8 ZAPOUT1 LD (HL), # E1; POP HL INCHL LD (HL), # 22; LD (ADDR), HL INCHL LD (HL), E INCHL LD (HL), D INCHL LD (HL), # 22; LD (ADDR), HL INCHL LDA, E ADDA, # 10 LD (HL), A INCHL LD (HL), D INCHL LD (HL), # 22; LD (ADDR), HL INCHL LD (HL), E INCHL LDA, D ADDA, 2 LD (HL), A INCHL LD (HL), # 22; LD (ADDR), HL INCHL LDA, E ADDA, # 10 LD (HL), A INCHL LDA, D ADDA, 2 LD (HL), A INCHL INCDE INCDE DJNZZAPOUT1 PUSHHL LDHL, # 10 ADDHL, DE EXDE, HL POPHL DECC JRNZ, ZAPOUT2 LDDE, # 5900 LDC, 8 ZAPOUT4 LDB, 8 ZAPOUT3 LD (HL), # E1; SAME INCHL LD (HL), # 22 INCHL LD (HL), E INCHL LD (HL), D INCHL LD (HL), # 22 INCHL LDA, E ADDA, # 10 LD (HL), A INCHL LD (HL), D INCHL INCDE INCDE DJNZZAPOUT3 PUSHHL LDHL, # 10 ADDHL, DE EXDE, HL POPHL DECC JRNZ, ZAPOUT4 LD (HL), # EB; EX DE, HL INCHL LD (HL), # F9; LD SP, HL INCHL LD (HL), # C9; RET RET ; TABLE ARRANGEMENTS TABEL DEFWLEFT, LU, UP, UR, RIGHT, RD, DOWN, DL DEFWLEFT ; PROCEDURES FOR MOVEMENT diagonally LUCALLLEFT JPUP URCALLUP JPRIGHT RDCALLRIGHT JPDOWN DLCALLLEFT JPDOWN ; Procedure for changing the interrupt mode ; ENTRY: HL - address of the procedure PROCESSING ; INTERRUPTION IMONXORA; includes 0-th bank DI LDBC, # 7FFD OR16 OUT (C), A LDA, 24; JR 65524 LD (65535), A LDA, 195; JP ADDR LD (65524), A LD (65525), HL LDHL, # FE00; 256 bytes # FF LDDE, # FE01; for those with vector ; Interrupt Rides LDBC, 256 LDA, H LD (HL), # FF LDIR DI; own set interrupt LDI, A IM2 EI RET The text on your screen TRTEXT DEFB "HELLO EVERYBODY !!!!!" DEFB # 0D, # 0D DEFB "TRSOFT PRESENT", # 0D DEFB "SPECIAL FOR ASPECT NEWSPAPER", # 0D DEFB # 0D DEFB "THIS 2SCREEN SHIT", # 0D DEFB # 0D DEFB "PRESS ANY KEY FOR MORE", 0 TABLE DEFS2000 BUFF1 DEFS16 BUFFER DEFS256 BUFEND DEFS16 BUFF2 ; PROCEDURE FOR WITHDRAWAL WILL BE HERE OUTPROC LDHL, 0 ADDHL, SP EXDE, HL LDSP, HL OUTPROC1 ; FILLS address table ZAPTAB LDIX, TABLE LDHL, # 4000 CALLZAPADR LDHL, # 4800 CALLZAPADR LDHL, # 5000 CALLZAPADR LD (IX), # FF LD (IX +1), # FF LD (IX +2), # FF RET ZAPADR LDDE, # 20 LDC, 8 ZAPAD2 PUSHHL LDB, 8 ZAPAD1 LD (IX), L LD (IX +1), H INCIX INCIX INCH DJNZZAPAD1 POPHL ADDHL, DE DECC JRNZ, ZAPAD2 RET VORON INCBIN "VORON. C"; In XAS WILL ; LCODE ... These are the pies. By the way the background color rekomenduetsya choose to taste (sm.listing). If you do not like the two pictures, you can make one: Remove xor 8 in the procedure interrupt handler. Unfortunately I do not I can now give inference procedures sprites 2X2, 4X4, 8X8, 16X12 full screen (Scoring a sprite of the entire screen) and other distortions associated with a fast graphics because all my ishodnyaki covered, but Next time I will tell you about them (and, naturally, will give listings), and until one of the fastest procedures clear the screen: ; FAST-CLEANING PROCEDURE SCREEN CLSLD (CLS1 +1), SP LDHL, 0 DI LDSP, # 5800 LDB, 252 CLS2DUP16 PUSHHL EDUP DJNZCLS2 CLS1LDSP, 2000 EI RET There seems to explain nothing, for Sim enable otklanyatsya ... (C) Trusov Ilya ----------------------------------------- From the Editors: All ishodnyachki these procedures, you will find in the annex to the newspaper, more We have tried and moved them into a format assembler XAS. -----------------------------------------
Other articles:
Similar articles:
В этот день... 3 December