'-----------------------------------------------------
'              (c) 1998-2003 MCS Electronics
'                   PEEK.BAS
' demonstrates PEEk, POKE, CPEEK, INP and OUT
'
'-----------------------------------------------------
Dim I As Integer , B1 As Byte
'dump internal memory
For I = 0 To 31                                               'only 32 registers in AVR
  B1 = Peek(i)                                                'get byte from internal memory
  Print Hex(b1) ; "  ";
  'Poke I , 1                            'write a value into memory
Next
Print                                   'new line
'be careful when writing into internal memory !!

'now dump a part ofthe code-memory(program)
For I = 0 To 255
  B1 = Cpeek(i)                         'get byte from internal memory
  Print Hex(b1) ; "  ";
Next
'note that you can not write into codememory!!

Out &H8000 , 1                          'write 1 into XRAM at address 8000
B1 = INP(&H8000)                        'return value from XRAM
Print B1

End