RosettaCodeData/Task/Terminal-control-Cursor-mov.../Action-/terminal-control-cursor-mov...

41 lines
1.0 KiB
Plaintext

PROC Wait(BYTE frames)
BYTE RTCLOK=$14
frames==+RTCLOK
WHILE frames#RTCLOK DO OD
RETURN
PROC Main()
BYTE
d=[50],
CH=$02FC, ;Internal hardware value for last key pressed
ROWCRS=$0054 ;Current cursor row
CARD COLCRS=$0055 ;Current cursor column
Graphics(0)
Position(2,2)
Print("Press any key to start demonstration.")
Position(20,10)
Put(28) Put(29) ;trick to show the new cursor pos
DO UNTIL CH#$FF OD
CH=$FF
Wait(d) Put(30) ;move cursor left
Wait(d) Put(31) ;move cursor right
Wait(d) Put(28) ;move cursor up
Wait(d) Put(29) ;move cursor down
Wait(d) Position(0,ROWCRS) ;move to the beginning of the line
Put(28) Put(29) ;trick to show the new cursor pos
Wait(d) Position(39,ROWCRS) ;move to the end of the line
Put(28) Put(29) ;trick to show the new cursor pos
Wait(d) Position(0,0) ;move to the top-left corner
Put(28) Put(29) ;trick to show the new cursor pos
Wait(d) Position(39,23) ;move to the bottom-right corner
Put(29) Put(28) ;trick to show the new cursor pos
Wait(d)
RETURN