Crossware

Table of Contents        Previous topic       Next topic       

C COMPILER LIBRARY FUNCTIONS->Detailed Descriptions->getch()

Summary

#include <conio.h>

int getch(void);    Read a character from console


Description

This function gets a character from the console.  The routine is implementation specific and will need to be created to suit your target system.  The example version included in the library consists of the following code which will run on the SBC5206 and SBC5307 evaluation boards:

int getch()
{
    // d0 and d1 will be free
    _asm("wait");
    _asm(" move.l #$14,d0");
    _asm(" trap #15");
    _asm(" tst.l d0");
    _asm(" beq.s wait");
    
    _asm(" move.l #$10,d0");
    _asm(" trap #15");
    _asm(" move.l d1,d0");
}


Return Value

The return value is the value retrieved.