; ======================================================================
; XANDRIAN LABS  /  CS617 CHAPTER 02
; ======================================================================
; Program    : Chapter 02 Sorting
; Source     : app/vt26_compat.inc
; Revision   : x0.31a-dev / comment-harmonization pass
; Target     : Casio PB-2000C / HD61700
; Role       : Provide app-owned compatibility and input adapters.
; Interface  : K540_RAW, KEY_WAIT, LCD_*, SYS540_* bindings.
; Maintainer : Xandrian Labs
; ----------------------------------------------------------------------
; SYS540 overlay stubs do not implement the VT26 :l blink.
; ======================================================================

SRC_RAM: EQU 0
KEYQ:    EQU &H51
KEYQLC:  EQU &H71

; Raw key polling retains the normal application INKEY contract.
K540_RAW:
        JP      INKEY

; KEY_WAIT can be called directly from command mode, without RAW.
; $0 is returned key; $17=0 (no BRK classification in this shim).
KEY_WAIT:
VTK_SCAN:
        CAL     INKEY
        AN      $17,$17
        JR      Z,VTK_SCAN
        LD      $24,$0
        CAL     WAIT_RELEASE
        LD      $0,$24
        LD      $17,0
        RTN

; SYS540 hooks are inert; VT26 owns the :l blinking cursor.
SYS540_INIT:
SYS540_HIDE:
SYS540_STOP:
SYS540_TOGGLE:
SYS540_PLACE:
SYS540_SHOW:
CUR_OFF:
        RTN
SYS540_POLL:
        LD      $18,0
        RTN

; Fallback LCD wrappers use the app firmware text service.
LCD_ROM32:
LCD_PUTZ:
        JP      PRINTZ
BLANK32:
        DB      "                                ",0
; end of include
