* *------------------------------------------* * COPY CAT version 1.3 March 78 * * written by Stephen Maguire * *------------------------------------------* * ORG 100H XEQ 100H * SINP EQU 0C01FH SOLOS/CUTER input routine SOLOS EQU 0C000H * SCREN EQU 0CC00H Screen parameters TOP EQU 0CBH Just above screen LSIDE EQU 03FH Just to the left of left side RSIDE EQU 03CH Just to the right of right side BOTOM EQU 0D0H Just below the screen * ESCPE EQU 1BH TAB EQU 09H LF EQU 0AH UP EQU 17H RIGHT EQU 13H LEFT EQU 01H DOWN EQU 1AH CENTR EQU 0CD0EH * BEGIN LXI SP,STACK Initialize the program LXI H,SCREN Put cursor at the top SHLD POINT * START LXI H,SCREN Blank the screen CALL CLEAR LXI B,MESG1 Let's print the name of the LXI H,CENTR program in the center CALL PRINT INX B LXI H,CENTR+80H CALL PRINT INX B LXI H,CENTR+100H CALL PRINT INX B LXI H,CENTR+180H CALL PRINT INX B LXI H,CENTR+200H CALL PRINT * STRT1 CALL INPUT Wait for any key to be hit JZ STRT1 If no key has, keep waiting * FILL LXI H,SCREN Blank the screen CALL CLEAR LXI B,BUFFR Point to the internal buffer LXI H,SCREN And, point to the screen FIL1 LDAX B Put the buffer on the screen CPI 01H Are we through moving the buffer? JZ THRU Yep, so stop MOV M,A Nope, keep putting buffer on INX B Increment the buffer pointer INX H Increment the screen pointer JMP FIL1 * THRU LHLD POINT Get present cursor location MOV A,M Get character in that position STA CHAR and save it ADI 80H Inverse the character MOV M,A Now put it on the screen * MOVE LXI H,0700H Set time length between blinks SHLD COUNT of cursor MOV1 CALL INPUT Did someone type a key? JNZ MOV2 If so go process it LHLD COUNT Nope, subtract one from blink count DCX H SHLD COUNT Save the new count MOV A,H Is it time to blink? ORA A Let's check JNZ MOV1 Nope, go check the input * LDA COLOR Get the present state of cursor ADI 80H Change its color (inverse <-> normal) STA COLOR Save the new state LHLD POINT Get the character at cursor position ADD M Change the character now MOV M,A Put it to the screen JMP MOVE Go check for input * MOV2 PUSH PSW Save the character LXI D,OFFST Distance between screen and buffer LHLD POINT Get the present cursor position LDA CHAR Put original character to the screen MOV M,A POP PSW Now get the character back * CPI UP Are we moving the cursor up? JZ CURUP CPI LEFT How about left? JZ CURLF CPI RIGHT Let's check for right JZ CURGT CPI DOWN Are we moving down? JZ CURDO CPI TAB Do we want inversed print? JZ INVRS CPI ESCPE Are we finished? JZ SOLOS /CUTER CPI LF Do we want Menu again? JZ BEGIN CPI 0BH Are we clearing the old picture? JNZ POKE Nope, must be a printable character * LXI H,BUFFR Point to the buffer CALL CLEAR Clear the buffer MVI M,01H Put an end-of-file mark down JMP BEGIN Go start over * POKE LHLD POINT Get old cursor position MOV B,A Get character LDA INVOP Inverse it if wanted ADD B Now put it to the screen MOV M,A PUSH H Save the cursor position DAD D Now get the buffer position MOV M,A Put the character in the buffer POP H Get the screen location back INX H Advance the cursor MOV A,H Are we off the bottom? CPI BOTOM Let's check JNZ POK1 Nope, we're okay MVI H,0CCH Oops, we have to fix it POK1 SHLD POINT JMP THRU Go put cursor on the screen * * This clear routine does a dual function, * it starts to clear at the location pointed to * by HL and goes BC times. This allows for * both screen clearing and buffer clearing. * CLEAR XRA A Clear A OUT 0FEH Set the Sol screen parameters OUT 0C8H Set the VDM also LXI B,400H CLR MVI M,' ' Push in a blank DCX B Subtract one from the count INX H Increment the pointer MOV A,B Are we through yet? ORA A Let's check JNZ CLR Nope, keep blanking MOV A,C Maybe ORA A JNZ CLR Nope, continue RET Yes * CURUP LHLD POINT Get the cursor position LXI D,0FFC0H Move it up DAD D SHLD POINT Now save it MOV A,H Are we off the top? CPI TOP JNZ THRU Nope, so print the cursor MVI H,0CFH Yes, put it at the bottom SHLD POINT JMP THRU And print the cursor * CURLF LHLD POINT Get the cursor position DCX H Move left one space SHLD POINT Save new location MOV A,L Are we over the edge? ANI 3FH Set up for checking CPI 3FH JNZ THRU No, we're okay LXI D,0040H Yes, so wrap around DAD D Do it now SHLD POINT JMP THRU Go print the cursor * CURGT LHLD POINT Get the cursor position INX H Move right once SHLD POINT Save the location MOV A,L Are we on this edge? ANI 3FH JNZ THRU No, so print the cursor LXI D,0FFC0H Yes, wrap around DAD D SHLD POINT JMP THRU Go print the cursor * CURDO LHLD POINT Get the cursor position LXI D,0040H Move down once DAD D SHLD POINT MOV A,H CPI BOTOM Are we off the bottom? JNZ THRU No MVI H,0CCH Yes, so put it at the top SHLD POINT JMP THRU Go print the cursor * INPUT CALL SINP Go check the keyboard ANI 7FH Strip MSB RET * PRINT LDAX B Get character to be printed CPI 01H Are we through? RZ If so stop MOV M,A If not get next character INX H INX B JMP PRINT And print it * INVRS LDA INVOP Change color of characters ADI 80H This will change it from inversed STA INVOP to normal, or vice versa JMP MOV1 * POINT DW 0 COUNT DW 0 CHAR DB 0 INVOP DB 0 COLOR DB 0 BUFFR DS 400H DB 01H DS 10H STACK EQU $ OFFST EQU BUFFR-SCREN MESG1 ASC 'COPY CAT -- written by Stephen Maguire' DB 01H MESG2 ASC 'ESC = monitor CLEAR = Clean buffer' DB 01H MESG3 ASC 'LF = return to menu (any key restore)' DB 01H MESG4 ASC ' TAB = inverse next characters typed' DB 01H MESG5 ASC ' GET and SAVE from 16CH to 56CH' DB 01H * END