BASCOM-ban array kontra string
hwsw famulus
hwsw at famulus.hu
Tue Jul 5 00:53:50 CEST 2005
>> Adot tegy ilyen:
>>
>> Dim Puffer_uart1 As String * 28
>>
>> ..hogy tudnék ugyanerre memoria teruletre
>> RADEFINIALNI egy ilyet is
>>
>> Dim Mbuffer_x(28) As Byte
>>
>> Igencsak jo lenne hol igy , hol ugy hasznalni
>> es cimezgetni a hasznalt memoria tartalmat...
>
> Ha nem lenne union: BASCOM-ban nem lehet direkt címre tenni változót?
> (kódszegmens pragma vagy furmány, mittomén...)
>
> pl. mint C-ben:
>
>> Dim Puffer_uart1 As String * 28 @ 0x100
>>
>> Dim Mbuffer_x(28) As Byte @ 0x100
>
> Azaz mindkettő ugyanarra a címre kerül.
azt mondja sajna ahelp, hogy:
------------------
The optional AT parameter lets you specify where in memory the variable must
be stored.
When the memory location already is occupied, the first free memory location
will be used.
-----------------
> Vagy dinamikus változóként deklarálod őket, és két pointerrel turkálsz
> bennük?
> (már ha van pointer)
> Papp Zoltán
az OVERLAY a pointer szeruseg, de az meg ugytunik nem muxik
osszetett valtozokra (string,tomb).....
(lasd a vegen)
Ezert is kivancsiskodom hatha mas BASCOM tudoroknak van otlete erre.
Lehetne meg az INP-el varialni, egy pointert mozgatva
de az meg béna modon hex cimet var mikozben
a VARPTR persze, hogy decimalis word-t ad vissza...
es innen fogy az orajel erosen :-((
----------------
INP
Returns a byte read from a hardware port or any internal or external memory
location.
----------------
Egyre inklabb haragszom a BASCOM-ra az ilyen kovetkezetlensegek miatt,
Latszik, hoyg menetkozben lett ossze hajigalva es soha nem volt tervezve...
A mostani gond is azert van mert a CRC8 fuggveny az byte tombon ertelmezett
a HEXVAL meg persze csak stringen.....
Most aztan dontsem el, hogy az uart_puffer az string legyen vagy bytetomb ?!
..mikozben az egyik beepitett fuggveny igy a masik ugy tudna
ertelmezni.....grrr....
Ha meg konvertalok mindig ide-oda az maga a halal...
KJ
---------a help-bol-------
The OVERLAY option will not use any variable space.
It will create a pointer:
Dim x as Long at $60 'long uses 60,61,62 and 63 hex of SRAM
Dim b1 as Byte at $60 OVERLAY
Dim b2 as Byte at $61 OVERLAY
B1 and B2 are not real variables! They point to a place in memory. In this
case to &H60 and &H61. By assigning the pointer B1, you will write to memory
location &H60 that is used by variable X.
You can also read the content of B1: Print B1
This will print the content of memory location &H60.
By using a pointer you can manipulate the individual bytes of real
variables.
Another example
Dim L as Long at &H60
Dim W as Word at &H62 OVERLAY
W will now point to the upper two bytes of the long.
---------------------
More information about the Elektro
mailing list