Help!!!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi all,
here again dealing with peeks and pokes.The following program
works fine under Linux but not under Dos.For some reason I'm not
able to peek/poke above the lower memory.

Please,send me any suggestion ...

thanx and regards,
Luis

------------------------------------- Buggy code
---------------------------------------
include machine.e
include get.e
include graphics.e
include abrir.e
include commas.e

without profile
without type_check
without warning

object Data_in_RAM,
       allocation_result,
       pointer,
       bar,
       buffer_size,
       tecla

integer Byte

       buffer_size = 256 -- bytes

sequence progress_bar
         progress_bar = { '|','/','-','\\' }

procedure free_buffer( object memory_address )
          -- liberar el buffer
          free( memory_address )
          puts(1,"\nbuffer removed from memory")
end procedure

function put_buffer( integer buffer_length )
         object buffer_address
         allocation_result = allocate( buffer_length )
      if allocation_result = 0 then
         puts(1,"\nUnable to allocate buffer...")
      else
         buffer_address = allocation_result
         printf(1,"\n%d-byte buffer allocated in address %s",
                               {buffer_size,
                                add_commas(buffer_address,".0")})

      end if

      return buffer_address

end function

global procedure analizar_memoria( integer Offset_1,
                                   integer Offset_2,sequence Pos )

          object allocation_address
          bar = 0
          -- posicionar el buffer
          allocation_address = put_buffer( buffer_size )
          -- leer memoria
          for Offset = Offset_1 to Offset_2 - 1 by 256 do

              Data_in_RAM = peek( { Offset, 256 } )
              -- escribir en el buffer
              poke(allocation_address,Data_in_RAM)
              bar += 1
              if bar = 5 then
                 bar = 1
              end if
              position(Pos[1],Pos[2])
              puts(1, progress_bar[bar]&" " )
              puts(1,add_commas(Offset,".0"))
              puts(1, ":"&Hex(Offset))
          end for

       -- liberar la memoria
       -- print(1,Data_in_RAM)
       free_buffer(allocation_address)
end procedure

------------------------------- Test procedure
----------------------------------
clear_screen()

---it's suposed to read the whole 32MB ram of my computer
-- but it crashes when Offset arrives to 1208319 or similar
-- values... ? :-[
analizar_memoria(0,32*1024*1024,{1,1})
-------------------------------- End test
**************************************
* Luis Campos - lcampoar8 at far.ub.edu *
* LCASOFTWARE S.L                    *
* LCASOFT at teleline.es                *
**************************************

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu