[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing 2GS slots with Orca Pascal?



Neat, I'll try it on a genuine 2gs :) I will add a delay function call or delay loop just after toggling the speaker.

Yves

Jalapeno wrote:

In article <1fma705.ovpquf1mdrc0eN%dempson@actrix.gen.nz>,
 dempson@actrix.gen.nz (David Empson) wrote:


Yves McDonald <""yves.mcdonald\"@NO SPAM sympatico.ca> wrote:


Ok, the situation so far is:
a) i/o address is located in first 64 kb memory segment in GS memory map

They are also in the $01Cxxx, $E0xxxx and $E1xxxx areas, but $00Cxxx is
the easiest area to deal with it because the numbers will be the same as
the (unsigned version of the) Applesoft BASIC PEEK and POKE addresses.


b) a byte pointer could be used to access I/O address, thanks to ORCA
Pascal pointer arithmetics.

This assumes that accessing memory through a byte pointer will actually
perform an 8-bit memory access.  ORCA/Pascal might be taking a shortcut
and using 16-bit mode even for a nominal 8-bit read operation, and
discarding the high order byte of the result (this avoids two CPU mode
switches).  It must switch to 8-bit mode for writing via a byte pointer.

I haven't use ORCA/Pascal for this sort of low level operation, but
probably tried it using ORCA/C, which has similar low-level code, but
don't recall whether I ever did direct access to I/O locations.


<snip>

Out of curiosity I tried this trivial program to see if I could click the speaker in Bernie to the Rescue:

 + - + - + Cut click.pas + - + - +

{$keep 'click'}
program click(output);
var
  s: byte;
  p: ^byte;
  i,j: integer;
begin
  p:= Pointer($0c030);
  for i:= 1 to 27000 do begin
     s:= p^;

       {slight improvement: kill time between two references.}
       for j:=1 to 1000 do
       begin
          {do nothing}
       end;

  end;
end.

 + - + - + End click.pas + - + - +


It caused Bernie to click the speaker. Cool, I learned something else new today :o) It's been so long since I wrote a Pascal program I hope I didn't do something wrong ;o)