FUNCTION GetChar(VAR Key : Char; Wr : Boolean): Integer;(* by Erik Warren *)BEGIN  GetChar := 1;(* Keep ISO happy *)#A STX _t         ;hold X temporarilyGC EQU 5        ;MSB 6Wr EQU 7        ;this is _sp stuffKey EQU 8       ;MSB 9 LDY #Key       ;stack pointer offset LDA (_sp),y    ;pull from stack STA _t+1       ;...and store temp. INY            ;do same for MSB LDA (_sp),y STA _t+2 LDX #iocb1 LDA #close STA iccmd,x  JSR ciov       ;jump and close IOCB LDA #open STA iccmd,x LDA #read      ;open for read only STA icax1,x LDA #$00       ;zero out auxillary two STA icax2,x LDA #>GC.Name  ;LSB put in buffer STA icbal,x    ;...pointer for CIO LDA #<GC.Name  ;MSB of device name STA icbah,x JSR ciov       ;the big jump to open STY _t+3       ;hold status BMI gc.end     ;end if error LDA #getch     ;read 1 char STA iccmd,x LDA #$00       ;zero out the STA icbll,x    ;...buffer length LSB STA icblh,x    ;...and MSB JSR ciov       ;jump & put char in A STY _t+3       ;hold status BMI gc.end     ;end on error LDY #$00 STA (_t+1),y   ;char into Key VARiable TYA            ;put zero in A STA (_t+2),y   ;zero out useless MSBgc.end LDA _t+3 ;cio error into A LDY #GC        ;from _sp STA (_sp),y    ;...store the error INY LDA #$00 STA (_sp),y    ;zero out MSB of error LDA #close STA iccmd,x JSR ciov       ;jump & close IOCB one JMP gc.exit    ;outtahere, folksGC.Name ASC 'K:' ;Keyboard device         DB $9B  ;Return char (155)gc.exit LDX _t   ;compiler safe again#  IF Wr THEN Write(Key)END;(* GetChar function *)