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 / CPM / TERM / ADM3-150.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  2KB  |  88 lines

  1. ;
  2. ;            termemu1.asm
  3. ;            by charles shoemaker
  4. ;            published in 4/81 byte mag.
  5. ;
  6. ;    the lear siegler adm-3 emulator for the hazeltine
  7. ;    1500 terminal.
  8. ;
  9.     org    7fb4h    ;fix cpm outch routine to jump here
  10.     jmp    entry
  11. ;
  12.     org    8000h    ;put after bios
  13. ;
  14. entry:    lda    mode    ;are we in the middle of something?
  15.     ora    a
  16.     mov    a,c    ;get character to send, for compares
  17.     jz    norm    ;ordinary
  18.     jpe    xy    ;if jump taken, norm contains either 3 or 255
  19.     cpi    '='    ;middle of xy address sequence
  20.     mvi    a,0    ;preset error condition
  21.     sta    mode
  22.     jnz    zap    ;something's wrong--print it and give up
  23.     mvi    a,3    ;fix up
  24.     sta    mode    ;tell us next time
  25.     ret        ;and back
  26. ;
  27. norm:    cpi    30    ;test for home character
  28.     jc    nthome
  29.     jnz    zap    ;not a control character--send it
  30.     mvi    c,18    ;get hazel's home character
  31.     jmp    specl    ;do it
  32. nthome: cpi    11    ;is it up-cursor?
  33.     jz    specl-1    ;quick trick
  34.     cpi    12    ;is it right-cursor?
  35.     jnz    ntrght    ;no---
  36.     mvi    a,16    ;hazel's right-cursor
  37.     jmp    zap
  38. ntrght:    cpi    27    ;is it escape-address cursor?
  39.     jnz    ntesc
  40.     mvi    a,1    ;tell us next time through
  41.     sta    mode
  42.     ret
  43. ;
  44. ntesc:    cpi    26    ;is it clear screen?
  45.     jnz    outch    ;no, must be some other control character
  46.     inr    c    ;make 28, hazel's clear screen character
  47.     inr    c
  48. specl:    mvi    a,126    ;get her attention
  49.     call    zap    ;send the first character right away
  50. outch:    mov    a,c    ;retrieve original character
  51.     push    psw    ;stow it away
  52.     in    10h    ;gotta check status
  53.     ani    2
  54.     jz    outch+2
  55.     pop    psw    ;get it back
  56. zap:    out    11h    ;send it
  57.     ret        ;finally, return to caller
  58. ;
  59. xy:    jm    final    ;we know we have 'esc' '=' sequence
  60.             ;see if this is x or y character
  61.             ;take the jump if this is x
  62.     mov    a,c    ;just get y character
  63.     sta    y    ;and save it
  64.     mvi    a,0ffh    ;let us know what to do next time
  65.     sta    mode
  66.     ret
  67. ;
  68. final:    push    b    ;save x character a minute
  69.     mvi    c,17    ;get hazel's attention
  70.     call    specl
  71.     pop    b    ;get'm back
  72.     mov    a,c    ;get x coordinate
  73.     sui    32    ;get rid of adm-3 bias
  74.     cpi    31    ;fix hazel's bias
  75.     jnc    sendx    ;ok as is
  76.     adi    96    ;hazel likes this better
  77. sendx:    call    outch+1    ;send x
  78.     xra    a    ;fix mode up--back to normal
  79.     sta    mode
  80.     lda    y    ;adm-3 bias ok for hazel
  81.     jmp    outch+1    ;send it and go home
  82. ;
  83. mode:    db    0
  84. y:    db    0
  85. ;
  86.     end
  87.  
  88.