Argument can`t be assigned to lazarus / 64-FPC development ---------------------------------------------------------------------- nitinjain · 2014-05-15 12:45 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 · 2014-05-15 13:43 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 · 2014-05-15 14:11 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 · 2014-05-15 14:25 http://www.freepascal.org/docs-html/user/userse63.html ---------------------------------------------------------------------- nitinjain · 2014-05-15 14:29 could you please guide me what and where I need to change in my code. ---------------------------------------------------------------------- typo · 2014-05-15 14:36 In fact I can compile your code with no error messages, but with these hints: Code: [Select]type Pbyte = ^Byte;      Pword = ^Word;      Pdword = ^LongWord; // Hint: Local type "Pdword" is not used FUNCTION GetMem( addr: LongWord ) : Byte; var   ptr : Pbyte; BEGIN   addr :=$B800;   ptr := PByte(addr);  // <<<<< Hint: Conversion between ordinals and pointers is not portable   GetMem := ptr^; END; PROCEDURE SetMem( addr: LongWord; value: Byte ); var   ptr: Pbyte; BEGIN   addr :=$B800;   ptr := Pbyte(addr);  // <<<<< Hint: Conversion between ordinals and pointers is not portable   ptr^ := value; END; FUNCTION GetMemW( addr: LongWord ) : Word; var   ptr : Pword; BEGIN   addr :=$B800;   ptr := Pword(addr); // <<<<< Hint: Conversion between ordinals and pointers is not portable   GetMemW := ptr^; END; PROCEDURE SetMemW( addr: LongWord; value: Word ); var   ptr: Pword; BEGIN   addr :=$B800;   ptr := Pword(addr);  // <<<<< Hint: Conversion between ordinals and pointers is not portable   ptr^ := value; END; ---------------------------------------------------------------------- marcov · 2014-05-15 14:37 Quote from: nitinjain on May 15, 2014, 04:11:02 pmYes, 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) See point (2).   memw is never going to work on something else than dos.   The whole "screen is at $B800" concept is a DOSism.