OpenCores
URL https://opencores.org/ocsvn/forwardcom/forwardcom/trunk

Subversion Repositories forwardcom

[/] [forwardcom/] [libraries/] [clear_input_light.as] - Blame information for rev 101

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 72 Agner
/****************************  clear_input_light.as ***************************
2
* Author:        Agner Fog
3
* date created:  2021-05-31
4
* Last modified: 2021-05-31
5
* Version:       1.11
6
* Project:       ForwardCom library libc_light.li
7
* Description:   clear_input: Clear input buffer for stdin
8
* This version is for small CPUs with limited capabilities
9
* The following instructions are avoided: mul, div, push, pop, sys_call.
10
* Input comes directly from input port 8
11
* Output to stdout goes directly to output port 10
12
*
13
* C declaration:
14
* void clear_input();
15
*
16
* Copyright 2021 GNU General Public License http://www.gnu.org/licenses
17
*****************************************************************************/
18
 
19
// define input and output port numbers
20
%stdin_port = 8
21
%stdin_status_port = 9
22
%stdout_port = 10
23
 
24
 
25
code section execute
26
 
27
_clear_input function public reguse = 0, 0
28
  // save r1
29
  int64 sp -= 1*8
30
  int64 [sp] = r1
31
 
32
  int r1 = 1
33
  int output(r1,r1,stdin_status_port)  // clear input buffer
34
 
35
  // restore r1
36
  int64 r1 = [sp]
37
  int64 sp += 1*8
38
  return
39
 
40
_clear_input end
41
 
42
code end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.