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 / BEEHIVE / UTILITYS / C10CPM.ARC / CPM.Z80 < prev    next >
Text File  |  1990-07-21  |  4KB  |  134 lines

  1. ; CPM program for the Cromemco C-10 running CDOS vers 3.07
  2. ; written by Brett and John Hunter.
  3. ;         
  4. ; Version :- 1.01
  5. ;            02/06/86
  6.  
  7. DEST:     EQU    0E100H    ;Destination    
  8. CDOS:    EQU    0005H
  9. WARMBT: EQU     0000H
  10. NEWCDOS:EQU     0E1H    ; New CDOS bottom
  11. CDOSC:  EQU     0E409H  ; CDOS call routiner
  12. CDOSB:  EQU     0E418H  ; CDOS warm boot routine
  13. CDOSR:  EQU     CDOSB-1 ; CDOS 'RET' address (it happens to be the thing
  14.                         ; just before the warm boot routine)
  15. CDOSJA: EQU     0ECBFH  ; Address of .abrtad
  16. WBOOT:  EQU     0E503H  ; Location 0000-0003h jump
  17. LF:    EQU    0AH
  18. CR:    EQU    0DH
  19.  
  20.     ORG    100H
  21.  
  22. BEGIN:    LD    DE,MESSAGE    ;print the messasge 'CP/M overlay...'
  23.         LD    C,09        ;
  24.     CALL    CDOS        ;
  25.           LD    C,97H             ;do a 151 cdos system call to reset
  26.     LD    E,NEWCDOS       ;the new bottom of cdos at NEWCDOS
  27.     CALL    CDOS            ;
  28.     LD    A,195           ;Putting a JP MODS at 10H (setting it
  29.         LD    (10H),A         ;up for the RST 10)
  30.     LD    HL,MODS         ;
  31.     LD    (11H),HL     ;
  32.         LD    A,215        ;jump location. And now changing the
  33.         LD      (CDOSR),A       ;RET in cdos for a RST 10.
  34.  
  35.  
  36. MOVEUP:    LD    BC,PEND-START+1    ;number of bytes to move
  37.      LD    HL,DEST+PEND-START+1;end of moved code
  38.      LD    DE,SOURCE+PEND-START;end of source code
  39.  
  40. MVLP:    LD    A,(DE)        ;get byte
  41.      DEC    HL        ;bump pointers
  42.      LD    (HL),A        ;new home
  43.      DEC    DE
  44.       DEC    BC        ;bump byte count
  45.      LD    A,B        ;check if zero
  46.      OR    C
  47.      JP    NZ,MVLP        ;if not, do some more
  48.  
  49. SOURCE:    EQU    $     
  50. OFFSET:    EQU    DEST-SOURCE
  51.  
  52. START:  EQU     $+OFFSET
  53.         JP    FIRSTJ         ;Change the jump table to redivert a system
  54.         JP      CDOSB         ;call
  55.         JP    FIRSTJ
  56.  
  57. FIRSTJ: EQU    $+OFFSET
  58.         LD    (STCAL),BC    ;stores the system call
  59.     JP    CDOSC  
  60.  
  61. MODS:   EQU     $+OFFSET
  62.         LD      (TEMP),HL    ;fixs the stack, because of RST instead of
  63.         POP     HL        ;the normal RET
  64.         LD      HL,(TEMP)
  65.         JP      PUSHER        ;saves all registers: it has just returned
  66.  
  67. MOD2:   EQU     $+OFFSET
  68.         LD      BC,(STCAL)    ;from the system call.
  69.     LD      A,C
  70.         CP      15
  71.         JP      Z,M18        ; if 15,16,17,18 or 22 then goto M18
  72.         CP      16
  73.         JP      Z,M18
  74.         CP      17
  75.         JP      Z,M18
  76.         CP      18
  77.         JP      Z,M18
  78.         CP      22
  79.         JP      Z,M18
  80.         CP      27        ; if 27 then goto M27
  81.         JP      Z,M27
  82.      POP     AF
  83.         POP     HL
  84.         POP     DE
  85.         POP     BC
  86.  
  87.         RET            ;returns to user program
  88.  
  89.  
  90. M18:    EQU     $+OFFSET
  91.         POP     AF        ; if A <> FF then A := A and 03
  92.         CP      255
  93.         JP      Z,POPER+1
  94.         AND     03
  95.         JP      POPER+1
  96.  
  97. M27:    EQU    $+OFFSET
  98.     POP    AF        ; pops them but in a different order
  99.     POP    BC        ; as so to make the allocation map
  100.     POP    DE        ; address be return in the HL instead
  101.     POP    HL        ; of the BC.      
  102.         RET
  103.  
  104. PUSHER: EQU     $+OFFSET
  105.         PUSH    BC
  106.         PUSH    DE
  107.         PUSH    HL
  108.         PUSH    AF
  109.         JP      MOD2
  110.  
  111. POPER:  EQU     $+OFFSET
  112.         POP     AF
  113.         POP     HL
  114.         POP     DE
  115.         POP     BC
  116.         RET
  117.  
  118. STCAL:  EQU    $+OFFSET
  119.     DEFW    0
  120.  
  121. TEMP:    EQU    $+OFFSET
  122.     DEFW    0
  123.  
  124. EXTRA:  EQU     $+OFFSET
  125.         DEFW    0,0,0,0              ;spares in case
  126.  
  127. PEND:    EQU    $+OFFSET
  128.     JP    WARMBT
  129.  
  130. MESSAGE DEFB    'CP/M OVERLAY for the CROMEMCO C-10.  Vers 1.01',cr,lf
  131.         DEFB    'Copyrighted by Brett and John Hunter.',cr,lf,'$'
  132.  
  133.         END    BEGIN
  134.