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

Subversion Repositories ssbcc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 sinclairrf
# Copyright 2014, Sinclair R.F., Inc.
2
 
3
def storevalue(ad):
4
  """
5
  Built-in macro to store the top of the data stack in the specified
6
  variable.\n
7
    <v> .storevalue(variable[,op])
8
  where:
9
    <v>         is the value to be stored from the next-to-top of the data
10
                stack
11
    variable    is the name of the variable
12
    op          is an optional instruction to override the default "drop"
13
                instruction at the end of the instruction sequence\n
14
  The effect is:  variable = v\n
15
  ( u_value - )
16
  """
17
 
18
  # Add the macro to the list of recognized macros.
19
  ad.AddMacro('.storevalue', 3, [
20
                                  ['','symbol'],
21
                                  ['drop','instruction','singlemacro','singlevalue','symbol']
22
                                ]);
23
 
24
  # Define the macro functionality.
25
  def emitFunction(ad,fp,argument):
26 5 sinclairrf
    (addr,ixBank,bankName) = ad.Emit_GetAddrAndBank(argument[0]);
27
    ad.EmitPush(fp,addr,ad.Emit_String(argument[0]['value']),argument[0]['loc']);
28 3 sinclairrf
    ad.EmitOpcode(fp,ad.specialInstructions['store'] | ixBank,'store '+bankName);
29
    ad.EmitOptArg(fp,argument[1]);
30 5 sinclairrf
 
31 3 sinclairrf
  ad.EmitFunction['.storevalue'] = emitFunction;

powered by: WebSVN 2.1.0

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