Speccy #07
31 декабря 1996 |
|
Programming - The program is proportional to the press and Windows (allows to display 4 types of windows).
PROGRAMMING (C) Kuzma Fes'kov As the files of the traditional to improve your style, I propose today program is proportional to the press. What is proportional print - is when each letter on the screen is exactly the space as it needs to "M" - 6 points, such as "I" is sufficient only 4. The text, printed this font looks nice and aesthetically pleasing. No unnecessary spaces between the letters. What's the difference this program from other similar? In an unusual storage format your text. It is stored in the rotated 90 degrees to form each letter takes in memory as much space as she must, as a result, we would like compressing character set, which requires at 768 bytes and less. Those of you who read ZX-Review, already familiar with a similar format font, I can only say that this program has been developed entirely me, it is much faster than suggested in the magazine, although not is unnecessary in my opinion additional effects. Of course, that for this program, the font should be specially prepared, and because the manual is extremely difficult to drive you will find a program that automatically converts a font that is created in any editor, the format desired program. Those of you who acquired the company Inforkom my Professional font program editor, can use an option that is built into the editor, that much easier. Next comes program with comments. The program connects to Channel 4 print, which you should run it from the address to which you assemble it. After the program returns to BASIC you can print proportional fonts operator PRINT # 4; AT Y, X; "text". Also you have the three control code: 128-proportional font includes Latin, 129 includes Russian proportional font, the 130 includes a sub-press ROM. This code characters UDG graphs that are the number keys (128-G +8, 129-G +1 - G type of cursor, etc.). You can enter them as CHR $ 128 (129), or directly from klaviotury as PRINT # 4, "Code Text. "The code is replaced with print space! Number of codes within the same operator PRINT is not limited. After receiving the code 130 to include the printing ROM, but any time you can disable it by filing a codes 128 or 129. If you come across the program codes with numbers from 131 to 164, that is, characters UDG, automatically turns on printing program ROM as the program is not proportional to Print be able to print them herself. Including proportional print can be suppressed codes 128 or 129. If you go to print the edge of the screen, the caption SCROLL? will not, and print pauses until you press any keys. If you press BREAK, program will be released in BASIC. You can give the command LIST # 4, but in TR-Dos this team hang your computer. On what should be the font, as it is stored, See the description of the program - "Modifier font. ORG 30000 UNPHASE (or ENT) ; Connecting to Channel 4 press. INITPRO LD DE, (# 5C4F) LD HL, # 5C25 SBC HL, DE LD (# 5C1E), HL LD HL, CANINF LD DE, # 5C24 LD BC, 5 LDIR RET DOWN INC H; Throws LD A, H; address AND 7, the following RET NZ; ing peak LD A, L; selnoy ADD A, 32; line LD L, A; below. RET C LD A, H SUB 8 LD H, A RET ; Processing of incoming characters. GENERAL PUSH AF LD A, (CONTROL) LD B, A POP AF DEC B JR Z, PRINTS CP 128, Code 128, JR C, CODE128; transition. CP 165; Token JP NC, 2548; BASIC. To the address in ROM 2548 , Is a program , Which will translate the code ; BASIC token in the set ; Characters for printing. CP 129; Code 129, JR Z, CODE129; transition. CP 130, Code 130, JR Z, CODE130; transition. CALL CODE130; If 131 , And more. PRINTS PUSH BC; Transfer PUSH DE; symbol PUSH HL; procedure LD HL, (ADRESS); re ne CALL L111; chati, LD HL, (23633); address LD BC, GENERAL; which LD E, (HL); in transition LD (HL), C; variable INC HL; ADRESS. LD D, (HL) LD (HL), B LD A, B CP D JR NZ, CHNG LD A, C CP E JR Z, QUIT CHNG LD (ADRESS), DE QUIT POP HL POP DE POP BC RET L111 JP (HL) CODE128 LD HL, L_PRO LD (FONTS), HL LD HL, PRTPIX JR CODE130 +3 CODE129 LD HL, R_PRO LD (FONTS), HL LD HL, PRTPIX JR CODE130 +3 CODE130 LD HL, 2548 LD (ADRESS), HL RET ; Proportsiodalnaya printing. PRTPIX CP 13; If the code is JP Z, ENTER1; ENTER. CP 22; If the code is JP Z, ATT1; AT. CP 32; If the code is RET C; <32. LD HL, (FONTS); Address ; Font. AND A SBC A, 1932 CP 0 JR Z, PRTPIX1 LD D, 0; Looking LD B, A; address PRTPIX2 LD E, (HL); character. ADD HL, DE INC HL DJNZ PRTPIX2 PRTPIX1 CALL PROWER; Challenge ; Check coordinates ; Print. LD B, 8; Clear LD DE, FBUF; buffer. PRTPIX5 XOR A LD (DE), A INC DE DJNZ PRTPIX5 LD B, (HL); Pereno PUSH BC; sim sim INC HL; parish in LD DE, FBUF +7; buffer. PRTPIX6 LD A, (HL) LD (DE), A DEC DE INC HL DJNZ PRTPIX6 CALL ROTATE; cooks ; Ourselves to clipboard, then by ; Gate symbol will be ; Buffer 2 in the normal ; Form, but upside down. LD DE, (COORDY); Vyschi LD B, E; Pipeline LD C, D; address in LD A, B; screen. CALL # 22B1 LD IX, FBUF1 +7; Since , The symbol upside down, we , We take the data from ; Buffer from the bottom up. LD A, (COORDX); Print AND 7; character EX AF, AF '; on the screen LD C, 8; not naRRMS1 LD DE, 0; position EX AF, AF '; to XOR LD B, A; ie in EX AF, AF '; mode DEC B; OVER 1. INC B LD D, (IX +0) JR Z, PRMS21 PRMS2 SRL D RR E DJNZ PRMS2 PRMS21 LD A, (HL) XOR D LD (HL), A INC L LD A, (HL) XOR E LD (HL), A DEC L DEC IX CALL DOWN DEC C JR NZ, PRMS1 POP BC LD A, (COORDX); Expand ADD A, B; Vai X LD (COORDX), A; the length of ; Character. RET ; If you went over the edge of the screen. WAITCLS PUSH BC; If you PUSH HL; followed the PUSH DE; edge eq LD BC, 0; wound, then CALL 7997; waiting for CALL 8020; zhatiya JR NC, BREAK; any LD DE, 16385, key LD HL, 16384; then LD BC, 6143, clearing the LD (HL), 0; screen LDIR; (without am POP DE; ributov) POP HL POP BC XOR A LD (COORDY), A LD (COORDX), A RET ; Check coordinates printing. PROWER LD A, (COORDY) CP 185 JR NC, WAITCLS LD (COORDY), A LD A, (COORDX) LD E, A LD A, (HL) ADD A, E RET NC XOR A LD (COORDX), A LD A, (COORDY) ADD A, 8 LD (COORDY), A RET ; Output when BREAK. BREAK POP HL POP HL POP HL JP 7035 ; Rotate buffer at 90 degrees. ROTATE SUB A LD DE, FBUF1 +7 LD C, 8 ROTATE1 LD HL, FBUF LD B, 8 ROTATE2 RR (HL) RRA INC HL DJNZ ROTATE2 LD (DE), A DEC DE DEC C JR NZ, ROTATE1 RET ; Processing code 1913-ENTER. ENTER1 LD A, (COORDY) CP 185 JR NC, WAITCLS ADD A, 8 LD (COORDY), A XOR A LD (COORDX), A RET ; Operator AT. ATT1 LD HL, PRTPIX AT LD (ATCLOSE), HL LD DE, AT1 LD A, 1 LD (CONTROL), A JR L0A80 AT1 LD DE, AT2 JR L0A7D AT2 LD DE, (ATCLOSE) CALL L0A70 LD HL, (23566) LD (COORDY), HL XOR A LD (CONTROL), A RET L0A7D LD (# 5C0E), A L0A80 LD HL, (# 5C51) LD (HL), E INC HL LD (HL), D RET L0A70 LD (# 5C0F), A JR L0A80 CONTROL NOP FBUF DEFS 8 FBUF1 DEFS 8 FONTS DEFW L_PRO COORDY EQU 23728 COORDX EQU 23729 ADRESS DEFW PRTPIX CANINF DEFW GENERAL DEFB 192,21,83 ATCLOSE DEFW 0 L_PRO INCBIN l.pro; Latin America. ; Font. R_PRO INCBIN r.pro; Russian ; Font. Team INCBIN allows you to load into memory block codes with disc. After it should be written in the name of downloadable file, this case l.pro for Latin and r.pro for the Russian font. If your assembler does not have such a team (Eg GENS, ZEUS), you should remove those lines and then aasemblirovaniya download the fonts themselves. Lines can be replaced as follows: L_PRO DEFS length of the font, 0 R_PRO DEFS length of the font, 0 That's all, so far, waiting for your letters. The next time we'll talk to you about the sprites. (C) Fes'kov Kuzma The programs of native authors often can be found window interface, which, Unfortunately, not always on the level. As an application, I propose to your attention a little Program WINDOWS, you can find on the disk as a text for an assembly with the same name. Also on the disk is to demonstrate the possibilities of this program. WINDOWS.A The program allows you to display on Figure 4 shows the form of windows. To draw window, 6 bytes of data: 1 - X coordinate of window (in characters places). 2 - Y coordinate of window (in characters places). 3 - the length of the window (familiarity). 4 - window height (in znakomes max). 5 - window color (ink, paper, brig ht, flash). 6 - window type: 0 - sanctioned by the shadow. 1 - overlap, shadow, over heads. 2 - without imposing without shade, with a title. 3 - no overlapping, no shadows, without a title. Subprograms: SCRBF - a service subroutine. It preserves part of the screen which will be spoiled with the window type 0, 1. Direct call is not subject. ADR - calculates the address on the screen. ADRATTR - calculates the address in attributes. BFSCR - restores the screen, After drawing a box with a type 0, 1. Called by the user. COL - X, ROW - Y, LEN - length, HGT - Height, ATTR - attribute ATTR +1 - the type of menu. STEK - prog Ramm can remember up to 8 windows overlay on each window assigned to 6 bytes. BFSCR restoring windows establishes the principle stack - last in, first leave. DOWN - the address should be reduced pixel line. WINDOW - window paints. In HL should be addressed to the data menu. Called to the line. SETW - fills in the specified window attribute. Service. CLSW - clears the screen. Service. BOX - draw frame and title. Service. BUFER1 - starting with this address data is stored perishable window. WARNING! Make sure that Had the label is in the end programs and free memory enough to keep your menu, or when restoring will be distorted screen. Screen remains incomplete, and in a sprite with the size of the window! B `How to use For windows with type 0, 1. PROG LD HL, MENDAT CALL WINDOW; DRAW WINDOW CALL BFSCR; restored ; LEBANON WINDOW RET MENDAT DEFW # Y, X, # HGT, LEN, # TIP DEFW ATTR MENDAT DEFW # 0000, # 0D06, # 0128 ; Draw a box with the coordinates, with coordinates 0, 0 height, 13 ; Length of 6, with conservation , With the shadow, with the headline, ; Paper - 5, Ink - 0, ; Bright - 0, Flash - 0. Window 2, 3, all the same, but necessary to remove the command CALL BFSCR. *
Other articles:
Similar articles:
В этот день... 21 November