Sprinter print code...

ZXNet echo conference «code.zx»

From Ivan Mak To All 9 July 1998

Greetings, All! First of all, I must say something about the assembler I use. I didn’t notice any restrictions on the length of the marks. Probably 31 characters... Hexadecimal numbers are understood only as 0FE23h, 73Ah... Normal and REPT macros - code repetition Macros contain local labels, declared via LOCAL When specifying labels, a colon symbol is required at the end. It's not part of the name. And one more note. JR on Sprinter runs with about the same speed as well as JP due to whites when accessing RAM. ;======= Start code ======= ; LOW PRINT for Sprinter program LP_OPEN_PG MACRO IN A,(PAGE3) ; to save the page number LD C,A LD A,SYS_PAGE ; page with system variables OUT (PAGE3),A LD A,C LD(COPY_PAGE3),A IN A,(RGADR) ; video RAM pageLD(COPY_RGADR),A ENDM LP_CLOSE_PG MACRO ; page recovery LD A,(COPY_RGADR) OUT(RGADR),A LD A,(COPY_PAGE3) OUT (PAGE3),A ENDM ; Printing the character shape M_PRINT_SYM MACRO EXX; switch to variables << LOW PRINT >> LD E,A ; symbol - in E - DE - symbol from character generator REPT 7 ; symbol output!!! LD A,(DE) ; repeat seven timesLD(HL),A INC H INC D ENDM; this is the end for REPT LD A,(DE) ; last line of character LD(HL),A ; symbol is printed. LD A,D ; restore D SUB 7 LD D,A LD A,H ; restore H SUB 7 LD H,A ENDM ; Printing attributes M_PRINT_ATR MACROLD A,E ; load attribute EXX; switch to variables << LOW PRINT >> LD E,H ; save register H LD H,C ; put in H part of the address for attributes LD(HL),A ; display attribute LD H,E ; restore register H ENDM ; Determining the next location to print. M_NEXT_PLACE MACRO LOCAL L1,L2 EX AF,AF' ; switch to page information JR NC,L1 ; transition if mode 40 XOR 1 OUT(RGADR),A ; switching page for printingSCF ; CF recovery BIT 0,A ; page check JR NZ,L2 ; transition if no change to HL is needed L1: ; next HL INC L; new location HL L2: EX AF,AF' ; hide page information DEC B; number of characters per line CALL Z,LP_TAB_HL ; if last place, calculate new HL,C EXX ENDM ; Next, the actual code using macros. ; Print B characters A with attribute E LP_PRINT_ALL: CALL LP_BEG_P ; remember all print variables LP_PR_ALL_L:LD C,A ; save symbol M_PRINT_SYM ; symbol shape printing EXX; M_PRINT_ATR ; print character attribute M_NEXT_PLACE ; determining the next place LD A,C ; remember symbol DJNZ LP_PR_ALL_L ; repeat B times CALL LP_END_P ; remember all print variables RET ; Print B characters A without attributes ; everything is the same as in the previous code ; There is a subprogram for printing some attributes :) Denis asked LP_PRINT_SYM: CALL LP_BEG_P LP_PR_SYM_L: LD C,AM_PRINT_SYM M_NEXT_PLACE LD A,C DJNZ LP_PR_SYM_L CALL LP_END_P RET ; Program for printing a character string (HL) of length B with attributes E ; In principle, everything is clear here. There are similar programs for printing characters ; without attributes and attributes without symbols, as well as print programs ; lines up to the delimiter specified in D LP_PRINT_LINE: CALL LP_BEG_P LP_PR_LN_L: LD A,(HL) INC HL M_PRINT_SYM EXX M_PRINT_ATRM_NEXT_PLACE DJNZ LP_PR_LN_L LP_PR_LN_L1: CALL LP_END_P RET ; Subroutine for determining the next row from the window table LP_TAB_HL: ; calculating new location LD HL,(WIN_TAB_SC) ; load current position in table LD A,(HL) ; load table flags BIT S_BIT_END,A ; flag of the end JR Z,LP_TAB_H1 ; if 0 is not the end LP_TAB_H2: LD HL,(WIN_MAP_SC) ; load the initial position into the table. LP_TAB_H3: LD A,(HL) ; and new flags LP_TAB_H1: CALL LP_PG1 ; switch pageINC HL; (HL) - new number of characters BIT S_BIT_MOD,A ; bit 40/80 LD A,(HL) ; load number of characters JR Z,LP_NO_MUL ; if 80, then you need to multiply by 2 ADD A,A ; A=A*2 LP_NO_MUL: LD B,A ; number of characters in B INC HL; loading new HL LD A,(HL) ; The table contains the following address INC HL; to display characters on the screen INC HL LD (WIN_TAB_SC),HL ; maintaining the following position DEC HL LD H,(HL) ; HL - position on the screen LD L,A LD A,H RRCA; calculate position RRCA; attributeRRCA AND 003h ORH OR 018h LD C,A ; and put in C RET LP_PG2: LD A,(HL) ; Get flags (this was needed somewhere) LP_PG1: LD E,A ; save flags AND 1Fh ; allocate video RAM pages OUT(RGADR),A ; switch BIT S_BIT_MOD,E ; bit 40/80 JR Z,LP_N_84 ; if 40 then do not install CF SCF ; 80 mode LP_N_84:EX AF,AF' ; hide flags and value for output to port LD A,E ; A must contain a byte with flags RET ; Program for restoring saved print registers LP_BEG_P: EX AF,AF' EXX LP_OPEN_PG ; open all pages for printing LD HL,(WIN_SAV_HL) ; old print position LD DE,(WIN_SAV_DE) ; character generator address LD BC,(WIN_SAV_BC) ; old values of B and C ; in B - character counter in the drain ; in C - position of attributes LD A,E ; stored value for page AND A RRA ; restoring flag C OUT(RGADR),A ; opening the desired video RAM pageEXX ; all print variables in altern. EX AF,AF' ; registers RET ; Initializing Printing LP_INI_P: EXX LP_OPEN_PG ; open pages LD DE,(WIN_ZG) ; take the character generator from the system variable LD B,0 ; put the number of characters equal to zero and call CALL LP_TAB_H2 ; subroutine for calculating HL,BC from the beginning EXX; screen table ; JR LP_END_P ; Print finishing program LP_END_P: EX AF,AF' EXXRLA ; save flag C LD E,A ; and pages in E LD (WIN_SAV_HL),HL ; save HL LD (WIN_SAV_DE),DE ; DE LD (WIN_SAV_BC),BC ; B.C. LP_CLOSE_PG ; close pages EXX EX AF,AF' RET ;======= End of code ========== The window table is a list of four-byte row descriptors. The first byte contains the video page and some flags. The second byte represents represents the number of _familiarities_! in line. For 80-character mode it is two times less than the number of characters in this line. The third and fourth bytes contain the direct address of the screen output. The window opener uses this table to set familiarity modes. The program for setting the print position also uses this table. Scrollingwindow up/down is done by rearranging the descriptors in the table and subsequent launch of the program for opening the window using the new descriptor. Scrolling left-right is somewhat more difficult. For this purpose, tables with double line descriptors, in which the first describes the end of the line, the second its beginning, and the number of characters from the beginning and end adjusts the scroll size left-right. If anyone writes a program that works _obviously_ faster, please send it :) Simple unrolling of loops and subroutines is not suitable. It's still in ROM. P.S. I don't pretend that the code is cool. :) Ivan, with Big Greetings. - Divorce the scheme, big and small... E-mail: ivan_mak@yahoo.com

From Yaroslav Kozlov To Ivan Mak 10 July 1998

Hello Ivan! IM> First of all, I must say something about the assembler I use. IM> I didn’t notice any restrictions on the length of labels in it. Probably 31 characters.. IM> Hexadecimal numbers are understood only as 0FE23h, 73Ah... IM> Normal and REPT macros - code repetition IM> Macros contain local labels declared via LOCAL IM> When specifying labels, a colon character is required at the end. This is not part IM> name. And one more note. JR on Sprinter runs something like this IM> same speed as JP due to whites when accessing RAM. Here's another "monster". And it's interesting where did it come from (this assm)? =========== cut ===== ; LOW PRINT for Sprinter program LP_OPEN_PG MACRO IN A,(PAGE3) ; to save the page number LD C,A LD A,SYS_PAGE ; page with system variables OUT (PAGE3),A LD A,C LD(COPY_PAGE3),A IN A,(RGADR) ; video RAM page LD(COPY_RGADR),A ENDM LP_CLOSE_PG MACRO ; page recovery LD A,(COPY_RGADR) OUT(RGADR),A LD A,(COPY_PAGE3) OUT (PAGE3),A ENDM ; Printing the character shapeM_PRINT_SYM MACRO EXX; switch to variables << LOW PRINT >> LD E,A ; symbol - in E - DE - symbol from character generator REPT 7 ; symbol output!!! LD A,(DE) ; repeat seven times LD(HL),A INC H INC D ENDM; this is the end for REPT LD A,(DE) ; last line of character LD(HL),A LD A,D ; restore D SUB 7 LD D,A LD A,H ; restore H SUB 7 LD H,A ENDM ; Printing attributes M_PRINT_ATR MACRO LD A,E ; load attribute EXX; switch to variables << LOW PRINT >> LD E,H ; save register H LD H,C ; put in H part of the address for attributes LD(HL),A ; display attribute LD H,E ; restore register H ============ cut =============== (^) swap B and C and LD C,L LD(BC),A; 8 measures and use register C as buffer (^^) LD C,H [print with repeats] LD H,C LD D,HX; 16 bars LX-cycle HX- content D 24 bars - (DEC LX:JR NZ,xxxx - DJNZ xxxxx) = Slight acceleration [] Here are the collected pennies. And a penny... IM> P.S. I don't pretend that the code is cool. :)In almost every procedure there are different shortcomings and oversights. It's somewhat similar on the chessboard. You can also notice that chess players rarely praise themselves. Good luck! PHOENIX.

From Michael Kondratyev To Alexandr Knyzev 6 August 1998

Hi Alexandr, In a message of to Kirill Frolov (), you wrote: AK> А каков стандарт ANSI ? это не полный список, но большинство. ANSI Console Escape Codes In the following list, items in this color are parameters (usually numeric values in decimal) and the  character is an ESC (ASCII 27 or 1bH). Sequence ( is ESC) Function ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ █▌Cursor Motion▐█ ow;clmH positions the cursor. Default is 1;1 (top left corner) ow;clmf (same as above) owsA moves the cursor up. Default: 1. Won't go above top. owsB moves cursor down. Default: 1. Won't go below bottom. lmsC moves the cursor forward (to the right) Default: 1 lmsD moves the cursor backward (to the left) Default: 1 █▌Erase Operations▐█  erases the screen and homes the cursor  erases to the end of the current line █▌Miscellaneous▐█  outputs the current line and column in the form: ow;clmR  saves the current cursor position (see )  restores cursor to last position saved by  █▌Screen Control▐█ ttr;...;attrm sets display attributes. attr values are: 0 normal (white on black) 1 bold (character colors are high-intensity) 4 underline (IBM Monochrome monitor only) 5 blink (foreground blinks) 7 reverse (black on white) 8 no display (foreground = background) 30 BLACK foreground 40 BLACK background 31 RED foreground 41 RED background 32 GREEN foreground 42 GREEN background 33 YELLOW foreground 43 YELLOW background 34 BLUE foreground 44 BLUE background 35 MAGENTA foreground 45 MAGENTA background 36 CYAN foreground 46 CYAN background 37 WHITE foreground 47 WHITE background [=modeh sets screen width and mode where mode values are: 0 40x25 text mode black and white 1 40x25 text mode color 2 80x25 text mode black and white 3 80x25 text mode color 4 320x200 graphics mode color 5 320x200 graphics mode black and white 6 640x200 graphics mode black and white 7 Causes cursor to wrap to new line at end of line. [=7l stops cursor from wrapping at end of line █▌Keyboard Redefinition▐█ um;num...nump redefines a keystroke so it yields different values. or The first num (or first character of string) is ["string"p the key being redefined. The following values are the or new value for the key. um;"string"p The following redefines Ctrl-D key to be: DIR C:[Enter] or [4;"DIR C:";13p various combinations Certain keystrokes must be defined with two nums. For example, [F1] is: 0;59; and [Home] is: 0;71; The following redefines the F10 key to be: DIR [Enter] [0;68;"DIR";13p See Extended ASCII Keystrokes for a full listing. Note: To reset a key to its original value, use its num code(s) twice. The following resets [F10].  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ One way to find if ANSI.SYS is installed, is to display the  function and immediately read standard input. It should yield a value in the form: ow;clmR. Bye, Michael.

From Valentin Pimenov To Aleksandr Majorov 7 August 1998

I'm joining the conversation Aleksandr Majorov and Yaroslav Kozlov on the topic "Sprinter print code..." Hello, Alexander! KF>>> Once again - if you don’t know, don’t tell. Hypertext is .htm files KF>>> for HTML from a pussy. YK>> Hypertext word is clearly not from the PC, and not from there. So let it be YK>> it will mean what is implied. AM> 1) where did you get the idea that the word is not from the PC? AM> In the computer world, "hypertext" is a word associated with I-net AM> (htm-standard), And no, this is 70...90% of the PC. AM> So the word is clearly “from PC” and from there. [skip driver] Let me quote a magazine like this: "Monitor 5'92 / magazine for practicing programmers": "The idea of hypertext (HT), like any other sound idea, is simple and consists in giving a person the opportunity perceive information in a sequence determined by himself importance...", "The temptation to develop GT products has captured many tives and individual programmers...", "GT is a form of organization of textual material in which a swarm of its units are not presented in a linear sequence tality, but as a system of explicitly indicated transitions, connections between them" "GT - in American publications it is called asthe very form of organization of textual material (nonlinear), and technology, without which such an organization is impossible material on a large scale." And also "PC World 4'97 / magazine for personal computer users": "...in 1986 an international organization Standardization Authority (ISO) has adopted the ISO-8879 "Standard Generalized Markup Language (SGML)", which is dedicated to description of the SGML metalanguage that allows you to build logical systems logical, structural marking of any types of texts." "The creators of SGML sought to abstract as much as possible from the problems of presenting electronic text in different programs frames and on different platforms and output devices." "...the most famous of the SGML applications was called HTML (HyperText Markup Language, "hypertext markup language"). "The HTML3 project was an attempt to solve what was already obvious time, the contradiction between the ideology of structural marking and the needs of users interested in flexible and rich visual possibilities." And now I’ll allow myself a “gag” (imho): 2KF&AM: 1. HTML was created specifically for the needs of the Internet, HO! Hypertext can also be used in applications absolutely unrelated to it (for example, various reference books/encyclopedias). 2. Inet is not just a PC - let's be objective. 2YK: 1. Hypertext is great, but I think that there is no need to integrate this into the mail viewer,and especially to the editor. (maybe I misunderstood?) 2All: 1. I find it very pleasant and convenient to use help from STS (c) Stalker. Isn't this really hypertext? Those. The question is broader: “Is hypertext really just HTML?” I have a completely different opinion. Bye, √a└e┌┐┼!┌┐ P!┌┬┐e┌┐0√