input:
	push af
	push bc
	push de
	push hl
	xor a
	ld (input_sub_cw),a
input_sub:
	.db $EF,$C4,$45	;naitive hex for bcall 45C4 which is CursorOn but not defined in ion.inc because it is 83+ only
	pop de
	ld a,(de)
	cp 0
	jr z,input_sub_disp
	push de
	ei
	halt
	bcall(_GetKey)
	cp 5
	jr z,input_sub_enter
	cp 2
	jr z,input_sub_backspace
	cp 0
	jr z,input_sub_dotheon
	ld e, a
	ld d, 0
	ld hl,input_sub_yesyes
	ld b,45	;This must equal the number of getkey codes at label input_sub_yesyes
input_sub_checkloop:
	ld c,(hl)
	cp c
	jr z,input_sub_ok
	inc hl
	djnz input_sub_checkloop
	pop hl
	jr input_sub
input_sub_ok:
	.db $EF,$CA,$45	;naitive hex for bcall 45CA which is KeyToString but not defined in ion.inc because it is 83+ only
	push hl
	bcall(_PutPS)
	pop hl
	pop de
	inc hl
	ld a,(hl)
	ld (de),a
	inc de
	push de
	jr input_sub
input_sub_disp:
	.db $EF,$BE,$45	;naitive hex for bcall 45BE which is CursorOff but not defined in ion.inc because it is 83+ only
	pop de
	pop bc
	pop af
	ret
input_sub_dotheon:
	res onInterrupt,(IY+onFlags)
	jr input_sub
input_sub_backspace:
	ld a,(input_sub_cw)
	cp 1
	jr z,input_sub
	dec a
	ld (input_sub_cw),a
	pop de
	dec de
	push de
	jr input_sub
input_sub_enter:
	pop hl
input_sub_loop
	ld (hl),' '
	inc hl
	ld a,(hl)
	cp 0
	jr z,input_sub_disp
	jr input_sub_loop
input_sub_cw:
	.db $00
input_sub_yesyes: ;44 keys allowed
	.db $9A,$9B,$9C,$9D,$9E,$9F,$A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7,$A8,$A9,$AA,$AB,$AC,$AD
	.db $AE,$AF,$B0,$B1,$B2,$B3,$CC,$CB,$CA,$C6,$8F,$90,$91,$92,$93,$94,$95,$96,$97,$8D
	.db $8E,$8B,$85,$86,$99
.end

