💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › MiscInfo › Programmin… captured on 2023-01-29 at 10:13:59.
-=-=-=-=-=-=-
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: integer; begin p:= Pointer($0c030); for i:= 1 to 27000 do begin s:= p^; 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)