Menu

2constant, 2variable

2010-10-10
2012-11-19
  • Mikael Nordman

    Mikael Nordman - 2010-10-10

    OM1ZZ, Igor,
    also asked how to define 2constant and 2variable in FlashForth

    It is as follows.

    2variable create 2 cells allot ;  ok<$,ram>

    ram 2variable 2qq  ok<$,ram>

    2qq  ok<$,ram>f0a8

    here  ok<$,ram>f0a8 f0ac  \ You can see that 2 cells have been alloted

    eeprom 2variable 2eepromVar  ok<$,eeprom>
    2eepromVar  ok<$,eeprom>ec0c
    here  ok<$,eeprom>ec0c ec10          \ Also here you can see that 2 cells have been alloted

    see 2variable
    3d1a ec12 f011 call  create
    3d1e 0e02
    3d20 6eec
    3d22 6aec
    3d24 ec7b f00a call  cells
    3d28 ef62 f00b goto  allot

    2constant flash create , , ram does> dup @ swap cell+ @ swap ;   ok<$,ram>

    2345 6789 2constant 2kk  ok<$,ram>
    2kk  ok<$,ram>2345 6789

    see 2constant
    3d44 ec1d f00a call  flash
    3d48 ec12 f011 call  create
    3d4c ec49 f00a call  ,
    3d50 ec49 f00a call  ,
    3d54 ec2a f00a call  ram
    3d58 ec6b f011 call  (does>)
    3d5c ec94 f009 call  (d)
    3d60 ecb7 f00b call  dup
    3d64 ecf7 f009 call  @
    3d68 ec70 f00b call  swap
    3d6c ec75 f00a call  cell+
    3d70 ecf7 f009 call  @
    3d74 ef70 f00b goto  swap
    ok<$,ram>

    Mikael

     
  • om1zz

    om1zz - 2010-10-10

    Mikael, thanks a lot!
    I do assume the higher word is on tos.
    73 Igor

     

Log in to post a comment.