* IFLS * * * * * *** *** ****** ***** ** ********** * ** * * ** ** * ** * ** * ** * * ** * * ** ** ** ** ** ** * ** * ** ***** ** ** ** ** * ** ** ** ** ** ** ** * ** ** ** * ** * ** ** * ** ** ****** ***** ** ** * * * * A machine language (memory) editor for use with * the SOL computer and a Helio disk. * Version 2.0 (Mod 0) * * For McVideo 24x80 screen moduele with Solos at F000H * * Written by: * * Steve and Joe Maguire * 2321 Foxhall Drive * Anchorage, AK 99504 * * Copyright (C) 1983 * All rights reserved * * * * ORG 100H XEQ START Do all the one time stuff * SCREEN EQU 0F800H Upper left-hand corner of the screen CHCR EQU 0DH A carriage return CHLF EQU 0AH A linefeed CHDEL EQU 7FH A delete * SUOL EQU 05H Control/E Scroll up one line SDOL EQU 18H Control/X Scroll down one line SUS EQU 12H Control/R Scroll up 7/8 screen (21 lines) SDS EQU 03H Control/C Scroll down 7/8 screen * CUP EQU 17H Control/W Move cursor up one line CDWN EQU 1AH Control/Z Move cursor down one line CRGT EQU 13H Control/S Move cursor right one byte CLFT EQU 01H Control/A Move cursor left one byte CULC EQU 0EH "HOME CURSOR" Move cursor to upper left corner CEOL EQU 09H "TAB" Move cursor to end of current line CBNL EQU CHCR "RETURN" Move cursor to beginning of next line CBNL1 EQU CHLF "LINE FEED" ditto SPACE EQU 20H Bump cursor to next memory location * INSRT EQU 14H Control/T Insert one byte DELT EQU 08H Control/H Delete one byte SRCH EQU 0FH Control/O Search for specified set of bytes CSRCH EQU 0CH Control/L Continue search SBCMD EQU 16H Control/V Enter sub-command mode ABRT EQU 1BH "ESCAPE" Abort edit EXIT EQU 06H Control/F Exit from the editor ASHX EQU 0 "MODE" ASCII/Hex toggle * * Copy in all of the system equates * COPY NPTDEFS * JMP INIT Reentry point * *----------------------------------------* * Read in the file now. Abort if the * * file is too long to fit in the buffer * *----------------------------------------* * READ SHLD FREE Save the highest legal address * LXI D,BUFFER Find the length of the buffer CALL SBTRCT MOV B,H Put it in BC MOV C,L * LDA FILEN Get the file number LXI D,BUFFER Point to the recieving buffer CALL SYS Go read in the file DB RBLOP JMP ALLDNE * LXI H,FTBIG If we got here, the file is too big JMP ABTERR * *----------------------------------------* * If the read was okay, continue here * *----------------------------------------* * ALLDNE CPI EREOF If EOF has been reached, ignore it JNZ ERROR * PUSH D Save the end of file address CALL CLOSE Close the input file * LHLD OUTFIL Go open the output file XCHG . CALL OPEN Do it now * POP D * LXI H,ILGOFN Abort if illegal output file name JZ ABTERR * *----------------------------------------* * Put some value in text messages that * * will be printed at some time or other * *----------------------------------------* * MES LXI H,EOFADR Put the EOF value in a text message CALL PRDE for printing later DCX D * LXI H,LLADR Put the last-load value in a text message, too CALL PRDE * LXI H,ENDADR Turn the end address into ASCII and put CALL PRDE it in the end-address message * XCHG . Save the end-address SHLD BFFNS * XCHG . Calculate the number of free bytes LHLD FREE Compute: highest-memory minus end-address CALL SBTRCT DCX H Subtract one to account for the End-of-file XCHG . Put the value in a message LXI H,BYTFRE Go do it CALL PRDE * LHLD BFSTT Put the buffer-start address in a XCHG . Message also LXI H,BEGADR CALL PRDE * CALL LNGTH Calculate the file length MOV A,D Is the file length zero? ORA E JNZ ALL0 No, print the sign on message * LXI H,BUFFER Put in an end of file byte MVI M,1 Go back and fake a one byte program load INX H Here's the one byte XCHG . It must be in DE JMP MES Go start over * ALL0 LXI H,SGNON Print the sign on message CALL LNEOUT * ALL1 CALL INPUT Wait for a carriage return CPI CHCR JNZ ALL1 * CALL CLEAR Clean up the screen * JMP INIT Go start working * *----------------------------------------* * Abort with an error message pointed * * to by HL. * *----------------------------------------* * ABTERR PUSH H Save the message location LXI H,EDTABT Send out the abort message CALL LNEOUT POP H Get back unique message location CALL LNEOUT Now, send that out JMP RABT1 Go abort * *----------------------------------------* * If there is an error, abort here. * *----------------------------------------* * ERROR LXI H,DVCFL Screen out device driver errors CPI ERDRI JC ERR1 Not a device driver error, abort here CPI ERNCT JC ABTERR It is a device driver error, abort elsewhere * ERR1 STA ERRCDE Otherwise setup for abort * CALL CLOSE Close the file in case it was open * XRA A Set registers before aborting LXI H,-1 CALL UTIL Do the abort DB UXOP BADABT JMP BADABT Loop forever if bad abort DB -1 ERRCDE DB -1 * *----------------------------------------* * Open the file whose name is pointed * * to by the register pair DE. * * * * On return, zf=1 if error * *----------------------------------------* * OPEN LXI H,0 Give it a static buffer CALL SYS DB OPEOP XRA A Set the zero flag if any errors occur RET . NOP . Don't delete this NOP. It's needed!! * STA FILEN Save the file number in case it was open * MOV A,B Get the file type ORA A If it's zero, then it is a device file LXI H,DVCFL Go abort if so JZ ABTERR * RET . * *----------------------------------------* * Close the current file. * *----------------------------------------* * CLOSE LDA FILEN Close the file CALL SYS DB CLOOP JMP BADABT * CALL REOCMD Go scratch any of the unused command string * RET . * *----------------------------------------* * Calculate the length of the file. * *----------------------------------------* * LNGTH LHLD BFSTT Get the buffer start address XCHG . LHLD BFFNS And subtract it from the end address CALL SBTRCT Do it now INX H Zero, one,... is no good. Make it one, two,... SHLD FLNGTH Store the length * XCHG . Print the length in various message * LXI H,LCADR Put it in a sign on message CALL PRDE * LXI H,FLECNT Put it in a sign off message JMP PRDE * *----------------------------------------* * GETAT -- get the file attributes of * * the file name pointed to by DE. The * * attribute byte is returned in A. * *----------------------------------------* * GETAT LXI H,BOTTOM Point to receiving area CALL SYS Go get the information DB INFOP STC . On error, return with the carry reset CMC . RET . * LDA BOTTOM+14 Get the attribute byte * STC . Set the carry for no error return RET . * *----------------------------------------* * DELM -- check for a legal delimeter. * * Abort if no good. * *----------------------------------------* * DELM LDA LSTCHR Get the character CPI CHCR If it's a carriage return, then okay RZ . CPI ';' If a semicolon, still okay RZ . CPI ',' If it's not a comma, then it's an illegal character RZ . * LXI H,SYNTX Give a syntax error JMP ABTERR * *----------------------------------------* * Read in the unused portion of the * * command. * *----------------------------------------* * REOCMD LDA LSTCHR Get the last character read * CPI CHCR If it's a carriage return, then all done RZ . CPI ';' A semicolon does it too RZ . * MVI A,PSONE Get the next character LXI D,STORAGE CALL PSCAN JMP REOCMD+3 Loop until the end of the command has been found * *----------------------------------------* * Sign off information/verify message. * *----------------------------------------* * SGNOFF DB CHCR,CHLF ASC "*** Meditor exit" DB CHCR,CHLF,CHCR,CHLF BEGADR ASC "0000 " ASC "File start address" DB CHCR,CHLF ENDADR ASC "0000 " ASC "File end address" DB CHCR,CHLF FLECNT ASC "0000 " ASC "File count" DB CHCR,CHLF,CHCR,CHLF ASCZ 'OK to write to "' QUESTN ASCZ '"? ' * *----------------------------------------* * User invoked abort verify message. * *----------------------------------------* * ABORT DB CHCR,CHLF ASCZ "Abort? " * *----------------------------------------* * Various sign on/off messages. * *----------------------------------------* * ASCF 0 Assemble with short ASCII printout * FDNE DB CHCR,CHLF ASCZ "File does not exist, create? " * SGNON DB CHCR,CHLF,CHLF ASC "MEDIT 2.0 (mod 0)" DB CHCR,CHLF ASC "PROTEUS Software Library" DB CHCR,CHLF ASC "Written by: Steve & Joe Maguire" DB CHCR,CHLF ASC "********" DB CHCR,CHLF ASC "Last load address: " LLADR ASC "0000" DB CHCR,CHLF ASC "Load count: " LCADR ASC "0000" DB CHCR,CHLF ASC "End of file at: " EOFADR ASC "0000" DB CHCR,CHLF ASC "Bytes free: " BYTFRE ASC "0000" DB CHCR,CHLF,CHCR,CHLF ASCZ "C/R to continue: " * *----------------------------------------* * All of the message printed upon abort * *----------------------------------------* * EDTABT DB CHCR,CHLF,CHCR,CHLF ASC "Medit aborted" DB CHCR,CHLF,0 * FTBIG ASCZ "The file is too large" IFLPRT ASCZ "The input file is read protected" * OFLPRT ASC "The output fale is protected." DB CHCR,CHLF ASCZ "Load input file for viewing only? " *