; Cursor service contract for PB-2000C / AI-1000.
; Implementation: sysv540.s at &H7000, using ROM0 &H0197 LCD writer.
;
; CAL SYS540_INIT : one-time per app entry; cursor initially inactive.
; CAL SYS540_PLACE : $6=absolute display cell 00..7F; $16=underlying
; ASCII 20..7E (or 00h for blank). Atomic hide,
; reposition and show of temporary '_' (5Fh).
; CAL SYS540_POLL : nonblocking; $18=1 when blink transition due,
; $18=0 otherwise; never writes screen.
; CAL SYS540_TOGGLE : render transition AFTER POLL has returned.
; CAL SYS540_HIDE : restore underlying character (safe if already off).
; CAL SYS540_SHOW : show underline if active.
; CAL SYS540_STOP : hide and mark inactive; before exiting application.
;
; These are the ONLY supported sysv540 entry points. No external code
; may read/write its private RAM1 2F20..2F2B or call private _SYS5_*.
; All calls return UA14h, including POLL. Caller must restore UA54h if
; it needs the monitor RAM1 bank. All except POLL preserve $0..$29 and
; IX; POLL preserves $0..$17,$19,$29,IX, and returns event in $18.
; Condition flags not preserved. SSP must be valid.
; The first TM edge synchronizes/discards the partial second; the first
; toggle occurs after the next complete interval, then half-second
; midpoint events use the measured polling cadence. No blocking waits.
; When an editor changes the character beneath cursor, HIDE first, then
; commit the edit, then PLACE with the new underlying character.