#define CUR_COUNT_RESET 23 _IsA2ByteTok = 42A3h keyflags = 35 shift = 0 alpha = 1 shiftprev = 2 alphaprev = 3 holdmod = 4 cursorblink = 7 curcount = scrap+8 penTemp = curcount+1 textRow_base= penTemp+2 input_end_text = textRow_base+2 input_head = input_end_text+2 input_top = input_head+2 input_curptr= input_top+2 input: ;Inputs: DE points to the ending string ;Save the location of the ending string ld (input_end_text),de ;Save the text pointer for when we clear input. ld hl,(textRow) ld (textRow_base),hl ;set up the input buffer ld hl,(input_base) ld (input_head),hl ld (input_curptr),hl xor a ld (hl),a ld bc,(input_size) add hl,bc dec hl ;make room for ending NULL ld (input_top),hl ;Clear the input call input_clear ;clear input mode xor a ld (flags+keyflags),a ;Set text mode to overwrite, but save original settings ld a,(OutputLogic) push af xor a ld (OutputLogic),a ;Clear out any keypresses out (1),a _: in a,(1) inc a jr nz,-_ ;write 0xFF to the key port to flush ; dec a ; out (1),a ; ;Save the user flags since we'll be modifying them for text ; ld a,(flags+UserFlags) ; push af ;Print the current input call inp_dispstr ; ;Restore the user flags ; pop af ; ld (flags+UserFlags),a ;Restore text coords ld hl,(penTemp) ld (textRow),hl ;Get input call inputloop ;Restore text logic pop af ld (OutputLogic),a ;redraw the screen to show cursor removed and modebox removed call inp_disp ;append a null byte to end the input string. ld hl,(input_head) ; ld (hl),0 ld (hl),$3F ;Grammer needs a newline token ld hl,(input_base) ret inputloop: ld hl,(textRow) ld (penTemp),hl res cursorblink,(iy+keyflags) ld a,CUR_COUNT_RESET>>1 ld (curcount),a input_key_loop: in a,(4) and 8 jp z,input_ON ;blink the cursor ld hl,curcount dec (hl) jr nz,+_ ld (hl),CUR_COUNT_RESET ld a,(flags+keyflags) xor 1<252 jr nc,+_ inc h _: #endif ld a,(hl) ret