home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / F / RAMTOOLS.ARK / RT1.ASM < prev    next >
Assembly Source File  |  1988-02-04  |  4KB  |  135 lines

  1. ;Program:  RamTools(file 2)
  2. ;Version:  1.0
  3. ;Author :  Sam Weiss(Alias Mad@Kaypro)
  4. ;Date   :  May 1 1987.
  5.  
  6. ;See the DOCS for modiifying & Joining the 2 files together into
  7. ;1 file
  8.  
  9. ;This BIOS address is for CP/M.  BIOS address for Zcpr3=E200
  10. BIOS    EQU    0F400H        ;BIOS ENTRY POINT
  11.  
  12.     ORG    0FF10H
  13. ; main body of screen saving code..............................
  14. ;
  15. VIDOUT    EQU    BIOS+0CH    ;a call to this will print a char on the screen
  16. PRINT    EQU    BIOS+0FH    ;'' ''  ''  ''   ''   ''  ''  ''  '' '' printer
  17.  
  18. ENTRY:    DEFB    0CDH        ; call op code
  19. KBDIN:    DEFS    2        ; the address of the code from conin goes here
  20.  
  21. ;This is our "Jump Table" for the different commands
  22.  
  23.     CP    00H        ; if ^@, we will do the famous SC!!!
  24.     JR    Z,SC
  25.     CP    1EH        ;if ^^ we will turn cursor into a solid block
  26.     JR    Z,BLOCK
  27.     CP    1FH        ;if ^_ we will do a cold boot
  28.     JR    Z,CBOOT
  29.     CP    1DH        ;if ^] we will clear the screen
  30.     JP    Z,CLS
  31.     CP    1CH        ;if ^\ we will echo stuff to the printer
  32.     JR    Z,PTE
  33.     RET            ; else will return normally
  34.  
  35.  
  36. ;Can you guess what this does...  That's right this is our famous Screen Saver
  37. ;(it clears the screen, waits for user to type a character, and returns control
  38. ;back to original program)
  39.  
  40. SC:    LD    IY,CMSG        ;printing beginning message
  41.     CALL    PRTST
  42.     CALL    ENTRY        ;wait for a key    
  43.     LD    IY,EMSG        ;printing ending message
  44.     CALL    PRTST
  45.                 ;we will let block take care of the exit
  46.  
  47. ;This turns the cursor into a block.
  48.  
  49. BLOCK:    CALL    UNBL        ;This just sets the cursor into a block
  50.     JR    ENTRY
  51.  
  52. ;This does the Cold Boot.
  53.  
  54. CBOOT:    LD    IY,SMSG        ;ask user if he wants to cold boot
  55.     CALL    PRTST        
  56.     LD    IY,RMSG
  57.     CALL    PRTST
  58.     CALL    ENTRY
  59.     CP    059H        ;TEST FOR "Y"
  60.     JP    Z,RST
  61.     CP    079H        ;test for "y"
  62.     JP    Z,RST
  63. EXIT:    LD    IY,BMSG        ;cancel boot... erase msg.
  64.     CALL    PRTST
  65.     JP    ENTRY
  66.  
  67. RST:    IN    A,(14H)        ;here we start our cold boot.
  68.     SET    7,A
  69.     OUT    (14H),A
  70.     JP    0
  71.  
  72. ;This will ECho stuff to the printer.
  73.  
  74. PTE:    LD    IY,SMSG        ;This will echo chars to printer
  75.     CALL    PRTST
  76.     LD    IY,PMSG
  77.     CALL    PRTST
  78. LOOPP:    CALL    ENTRY        ;This makes it continuous
  79.     CP    1AH        ;Exit if user pressed a ^Z
  80.     JR    Z,EXIT
  81.     CP    13        ;do a CR,LF if a return is encountered
  82.     JR    Z,PLF        ;and clear the status line for new input
  83.     LD    C,A
  84.     PUSH    AF
  85.     CALL    PRINT
  86.     POP    AF
  87.     LD    C,A
  88.     CALL    VIDOUT
  89.     JR    LOOPP
  90.  
  91. PLF:    LD    C,0AH        ;This sends the CRLF to the printer,
  92.     CALL    PRINT        ;and clears the status line.
  93.     LD    C,0DH
  94.     CALL    VIDOUT
  95.     LD    C,18H
  96.     CALL    VIDOUT
  97.     JR    LOOPP
  98.  
  99. CLS:    LD    IY,CLSMSG    ;this just clears the screen
  100.     CALL    PRTST
  101.     JP    ENTRY
  102.  
  103. ; This little bit of code turns the cursor into a solid block.
  104.  
  105. UNBL:    LD    A,10        ;Loading the video register # for cursor
  106.     OUT    (28),A        ;OUTing it to port 28.
  107.     LD    A,0        ;Loading the cursor # for a no blink cursor.
  108.     OUT    (29),A        ;OUTing it to port 29.
  109.     RET            ;That's it.. returning now.
  110.  
  111. ; This is our Message Printing Routine.
  112. ; Messages MUST end with a NULL character (0) or "^@"
  113.  
  114. PRTST:                ;This prints the messages below.
  115. LOOP:    LD    A,(IY)        ;get char
  116.     LD    C,A        ;put A into C for VIDOUT
  117.     CP    00        ;is char 0?
  118.     RET    Z        ;if yes, return
  119.     CALL    VIDOUT        ;output char through bios vidout routine
  120.     INC    IY        ;point to next char
  121.     JP    LOOP        ;anymore characters?
  122.  
  123. ;This is the message area
  124. ;last byte MUST be 0!!
  125.  
  126. CMSG:    DEFB    27,'C7',26,27,'C4',0    ;clear screen&off cursor
  127. EMSG:    DEFB    26,0            ;clear screen&on cursor
  128. SMSG:    DEFB    1BH,'B6',1BH,'B7',1BH,'=',56D,32D,18H,0 ;puts cursor a bottom
  129. RMSG:    DEFB    'Reset? ',7,0    ;ask user if he wants a cold boot
  130. BMSG:    DEFB    1BH,'=',56D,32D,18H,1BH,'C6',0 ;Return to previous cursor pos.
  131. CLSMSG:    DEFB    27,'C7',26,0        ;Clear screen
  132. PMSG:    DEFB    'Print> ',0        ;Prompt for the print echo
  133.  
  134.     END
  135.