Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .org 100h
- mloop:
- ;draw underscore to screen
- mvi a, 0x5F
- out 4
- tloop:
- ;check buffer
- in 0
- cpi 1
- jnz tloop
- ;remove underscore
- call remlet
- ;put character out
- in 1
- mov b, a
- ;b now has our input
- cpi 0x08
- jnz skip1
- ;if backspace, remove a letter
- call remlet
- jmp mloop
- skip1:
- mov a, b
- cpi 0x09
- jnz skip2
- ;if tab, put a couple spaces in
- mvi a, 0x20
- out 4
- out 4
- jmp mloop
- skip2:
- mov a, b
- cpi 0x0D
- jnz print
- ;if enter, go to new line
- in 3
- inr a
- out 3
- xra a
- out 2
- jmp mloop
- print:
- out 4
- ;check if at end of screen
- in 3
- cpi 24
- jnz mloop
- in 2
- cpi 40
- jnz mloop
- ;if we are, reset the vram address
- xra a
- out 2
- out 3
- ;loop back
- jmp mloop
- remlet:
- call backlet
- mvi a, 0x00
- out 4
- call backlet
- ret
- backlet:
- ;moves the current vram position back one
- ;load the current position
- in 2
- sui 1
- out 2
- ;if FF subtract one from y position
- jnc exit
- mvi a, 39
- out 2
- in 3
- sui 1
- out 3
- jnc exit
- mvi a, 24
- out 3
- exit:
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement