Pure Pascal MEM MEMW

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

Post Reply
artik-wroc
Captain Atari
Captain Atari
Posts: 212
Joined: Fri Jan 06, 2006 1:30 pm
Location: Wroclaw - POLAND
Contact:

Pure Pascal MEM MEMW

Post by artik-wroc »

How to read a byte from a specific address (e.g. $12345) ?
There is a STPASCAL library in Maxon Pascal which has PEEK and POKE.
Pure Pascal..... ???
czietz
Hardware Guru
Hardware Guru
Posts: 2122
Joined: Tue May 24, 2016 6:47 pm

Re: Pure Pascal MEM MEMW

Post by czietz »

In the same way you would do it in C. By having a pointer of the appropriate type pointing to the address you like to write/read:

Code: Select all

program peekpoke;

type PLongInt = ^LongInt;

begin
	PLongInt($10000)^ := 42;
	writeln(PLongInt($10000)^);
end.
artik-wroc
Captain Atari
Captain Atari
Posts: 212
Joined: Fri Jan 06, 2006 1:30 pm
Location: Wroclaw - POLAND
Contact:

Re: Pure Pascal MEM MEMW

Post by artik-wroc »

Thanks. A simple example works. I still have a problem with write to the card registers. I'll have to check it out, maybe I made a mistake somewhere.

EDIT: It depended on compiler settings and it's working now :)
Post Reply

Return to “C / PASCAL etc.”