Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         .org 100h
  2. mloop:
  3.     ;draw underscore to screen
  4.     mvi a, 0x5F
  5.     out 4
  6. tloop:
  7.     ;check buffer
  8.     in 0
  9.     cpi 1
  10.     jnz tloop
  11.  
  12.     ;remove underscore
  13.     call remlet
  14.  
  15.     ;put character out
  16.     in 1
  17.     mov b, a
  18.     ;b now has our input
  19.     cpi 0x08
  20.     jnz skip1
  21.     ;if backspace, remove a letter
  22.     call remlet
  23.     jmp mloop
  24. skip1:
  25.     mov a, b
  26.     cpi 0x09
  27.     jnz skip2
  28.     ;if tab, put a couple spaces in
  29.     mvi a, 0x20
  30.     out 4
  31.     out 4
  32.     jmp mloop
  33. skip2:
  34.     mov a, b
  35.     cpi 0x0D
  36.     jnz print
  37.     ;if enter, go to new line
  38.     in 3
  39.     inr a
  40.     out 3
  41.     xra a
  42.     out 2
  43.     jmp mloop
  44.  
  45. print:
  46.     out 4
  47.  
  48.     ;check if at end of screen
  49.     in 3
  50.     cpi 24
  51.     jnz mloop
  52.     in 2
  53.     cpi 40
  54.     jnz mloop
  55.  
  56.     ;if we are, reset the vram address
  57.     xra a
  58.     out 2
  59.     out 3
  60.    
  61.     ;loop back
  62.     jmp mloop
  63.  
  64.  
  65. remlet:
  66.     call backlet
  67.     mvi a, 0x00
  68.     out 4
  69.     call backlet
  70.     ret
  71.  
  72. backlet:
  73.     ;moves the current vram position back one
  74.     ;load the current position
  75.     in 2
  76.     sui 1
  77.     out 2
  78.     ;if FF subtract one from y position
  79.     jnc exit
  80.     mvi a, 39
  81.     out 2
  82.     in 3
  83.     sui 1
  84.     out 3
  85.     jnc exit
  86.     mvi a, 24
  87.     out 3
  88. exit:
  89.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement