Forum > FPC development
Argument can`t be assigned to
nitinjain:
Hi,
I am trying to implimenting the below code but there are showing error that is : "Argument can`t be assigned to ".
**Implimenting Code
-------------------------------------------------------
type Pbyte = ^Byte, Pword = ^Word, Pdword = ^LongWord;
function GetMem( addr: LongWord ) : Byte;
begin
var ptr : PByte;
ptr := PByte(addr)
GetMem := ptr^
end;
procedure SetMem( addr: LongWord; value: Byte );
begin
var ptr: PByte;
ptr := PWord(addr);
ptr^ := value
end;
-----------------------------------------------------
**And My code is shown below, where i want to implement the above code.
--------------------------------
BEGIN
MEMW[$B800:(width_offset-1)*2
+(height_offset-1)*160]:=current_locatio...
current_location:=current_location^.next...
END;
-----------------------------------
BEGIN
offset:=(top_left_x-1)*2
+(top_left_y-1)*160;
MEM[$B800:offset]:=top_left_corner[style...
MEM[$B800:offset+1]:=back*16+fore;
---------------------------------------...
marcov:
That code
1) doesn't compile, and fails basic syntax checks on several places.
2) will never be any use in implementing the bottom code anyway, since the textmode screen is not memory mapped in linear addres space in any modern system. (and even in Dos, there it is in the first MB)
nitinjain:
Yes, I agreed and i have fixed those basic errors and after that I got this error "Argument can`t be assigned to" on both places (at MEM and MEMW starting point)
**Implimanting Code after changed
----------------------------------------------------
TYPE Pbyte = ^Byte; Pword = ^Word; Pdword = ^LongWord;
FUNCTION GetMem( addr: LongWord ) : Byte;
var ptr : Pbyte;
BEGIN
addr :=$B800;
ptr := PByte(addr);
GetMem := ptr^;
END;
PROCEDURE SetMem( addr: LongWord; value: Byte );
var ptr: Pbyte;
BEGIN
addr :=$B800;
ptr := Pbyte(addr);
ptr^ := value;
END;
FUNCTION GetMemW( addr: LongWord ) : Word;
var ptr : Pword;
BEGIN
addr :=$B800;
ptr := Pword(addr);
GetMemW := ptr^;
END;
PROCEDURE SetMemW( addr: LongWord; value: Word );
var ptr: Pword;
BEGIN
addr :=$B800;
ptr := Pword(addr);
ptr^ := value;
END;
------------------------------------------
2) actually this code used for formating. If I commented this code (as you said), my messages box borders and colors not appeared.
typo:
http://www.freepascal.org/docs-html/user/userse63.html
nitinjain:
could you please guide me what and where I need to change in my code.
Navigation
[0] Message Index
[#] Next page