3Bit #01
03 января 2005 |
|
Programming - a collection of codes: Draw a window frame in the color processing of disk errors TR-DOS, a universal procedure Scroll'a screen.
Draw a box with a border in color. (C) Ivan Roshchin (C) Cooper/RSM/P7S The author of the basic algorithm is Ivan Roshchin. Cooper, tobish I added a very procedure for printing the symbol 8x8 (optimized in a hurry. Who's supposed to - the do it faster;) and color support. Yes, and yet, I made the call box by the vector but can do so as it is more convenient for you. When you call it (the label OPEN_W) in the DE register pair to specify the coordinates of the left upper corner of the frame, the register B - height, in C - the width of the window (in characters). Cell COLOR should contain color. LD IX, VEKT CALL OKHO RET OKHO LD D, (IX +0) LD E, (IX +1) LD B, (IX +2) LD C, (IX +3) LD A, (IX +4) LD (COLOR), A OPEN_W LD A, ""; upper left corner of the frame. LD L, ""; left bottom corner of the frame. CALL OPEN_W2 OPEN_W1 LD A, ""; horizontal borders of the frame. LD H, ""; This symbol fills the window. LD L, A CALL OPEN_W3 DJNZ OPEN_W1 LD A, ""; upper right corner of the frame. LD L, ""; the lower right corner of the frame. OPEN_W2 LD H, ""; horizontal borders of the frame. OPEN_W3 PUSH DE CALL PRSYM INC D LD A, H LD H, C OPEN_W4 CALL PRSYM INC D DEC H JP NZ, OPEN_W4 LD A, L CALL PRSYM POP DE INC E RET ; Print character 8x8 color ; In: DE - coordinates, A - character code PRSYM PUSH BC PUSH AF PUSH DE PUSH HL LD L, A LD H, 0 LD BC, 42048, the address of your font ADD HL, BC LD A, D AND 7 RRCA RRCA RRCA OR E LD E, A LD A, D AND 24 OR 64 LD D, A DUP 7 LD A, (HL) LD (DE), A INC H INC D EDUP LD A, (HL) LD (DE), A LD A, D RRCA RRCA RRCA AND 3 OR # 58 LD D, A LD A,% 00001111 COLOR EQU $ -1 LD (DE), A POP HL POP DE POP AF POP BC RET ; --- Vector window ----; +00 - Y coordinate ; +01 - X coordinate ; +02 - X-Size ; +03 - Y-size ; +04 - Window color ;------------------ ; Example of the vector window VEKT DB 1,1,10,10,15 Handling disk errors TR-DOS (C) Max If your program does not need to do more error handling to throw out the menu with a choice of Retry Abort / Ignore, but you want to avoid cleaning screen and the appearance of vile inscriptions TR-DOS "Disk error", then this will help you I have developed a short protsedurka that blocks all attempts to TR-DOS print error, it, in this case, no ill effects return control program with an error code in register A (a copy of the system variable # 5D0F (23,823). If you need to handle the RIA, it on this protsedurku without any problems you can hang a driver error handling For example, such as published in the newspaper ECHO 3 (author VfNG). In case you have can not find this newspaper, I cite this driver, once connected to my program that I it was made only determine the type of error DISK ERROR or READ ONLY. Instead, # 3D13 call TR-DOS, obrabotka errors without menus RIA TRDOS: ... PUSH HL LD HL, (23613) Save. ERR_SP LD (ERR +1), HL LD HL, ERR EX (SP), HL LD (23613), SP EX AF, AF ' XOR A LD (23823), A LD (23824), A LD (23570), A EX AF, AF ' JP 15635 ERR LD HL, 0 LD (23613), HL; Restore. ERR_SP LD A, 6 LD (23570), A LD A, (23823) AND A TRD1 RET Z PUSH AF LD IX, W1; box ERROR! CALL OPWIN; open POP AF RET Note: if you use beysikovskie channels to print characters or any other purposes, then insert error handling procedure before opening window with an error message initializing desired channel. For example: LD A, 2 CALL 5633 By the way, one way to break fast programs - is opening the latch drive at boot time, and the preservation of MAGIC'u or entry into the monitor, and then just need to find LOADER. So, if you want to properly protect the program, then hang one or another error handling procedure. Again Scroll ... (C) cooper/RSM/P7S Bring to your attention a little protsedurku to shift the screen. What are its advantages over the others? Firstly, it is universal, ie suitable for how to scroll down or up. It all depends from the addresses that you specify it at startup. Secondly, it moves one at a time line, ie, if you need to move, not all screen, but let's say 2 / 3, respectively, to cause it to loop 16 times (maybe it and not rational, but it handy). Third, it moves and graphics, and attributes. And does this tricky way:) Well, I think, will understand how. Here is its listing: LD DE, # 4000; from LD HL, # 4020; to LD B, # 17; number of rows MAIN PUSH BC CALL SCROLL; call prots.sdviga CALL LL693E; office procedures (page up) CALL LL6949; office procedures (page down) POP BC DJNZ MAIN RET , But it actually is official procedures , Where some, figure it out, ok? LL692A LD A, L SUB # 20 LD L, A RET NC LD A, H SUB # 08 LD H, A RET LL6934 LD A, E SUB # 20 LD E, A RET NC LD A, D SUB # 08 LD D, A RET LL693E INC H LD A, L SUB # E0 LD L, A RET NC LD A, H SUB # 08 LD H, A RET LL6949 INC D LD A, E SUB # E0 LD E, A RET NC LD A, D SUB # 08 LD D, A RET Directly scroll screen SCROLL PUSH HL PUSH DE LD A, D RRCA RRCA RRCA AND # 03 OR # 58 LD D, A LD A, H RRCA RRCA RRCA AND # 03 OR # 58 LD H, A DUP 1932 LDI EDUP POP DE POP HL LD BC, # 00F8 JP LOOP2 LOOP1 INC H INC D LOOP2 DUP 31 LDI EDUP LD A, (HL) LD (DE), A INC H INC D DUP 1931 LDD EDUP LD A, (HL) LD (DE), A JP PE, LOOP1 RET And another point - it is used in our journal, ie, you can assess its performance on a live example. Incidentally, the magazine she runs slower original. Themselves understand the music, scroll bar, scrolling line and other muck in the interrupt ...
Other articles:
Similar articles:
В этот день... 21 November