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

Subversion Repositories ssbcc

[/] [ssbcc/] [trunk/] [core/] [9x8/] [macros/] [fetchvalue.py] - Blame information for rev 3

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

Line No. Rev Author Line
1 3 sinclairrf
# Copyright 2014, Sinclair R.F., Inc.
2
 
3
def fetchvalue(ad):
4
  """
5
  Built-in macro to copy the value from the specified variable to the top of the
6
  data stack.\n
7
  Usage:
8
    .fetchvalue(variable)
9
  where
10
    variable    is a variable\n
11
  The effect is:  T = variable\n
12
  ( - u_mem )
13
  """
14
 
15
  # Add the macro to the list of recognized macros.
16
  ad.AddMacro('.fetchvalue', 2, [ ['','symbol'] ]);
17
 
18
  # Define the macro functionality.
19
  def emitFunction(ad,fp,argument):
20
    variableName = argument[0]['value'];
21
    (addr,ixBank,bankName) = ad.Emit_GetAddrAndBank(variableName);
22
    ad.EmitPush(fp,addr,ad.Emit_String(variableName),argument[0]['loc']);
23
    ad.EmitOpcode(fp,ad.specialInstructions['fetch'] | ixBank,'fetch '+bankName);
24
  ad.EmitFunction['.fetchvalue'] = emitFunction;

powered by: WebSVN 2.1.0

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