Review request: ppislots.com

Pagina 2/3
1 | | 3

Van Louthrax

Prophet (2082)

afbeelding van Louthrax

05-03-2017, 12:08

Yeah, that might explain the problem Smile I'd be surprised there's no direct way to read an input port in SDCC.

Van user888

Expert (66)

afbeelding van user888

05-03-2017, 12:24

And fixed... this makes more sense now Wink

Van Louthrax

Prophet (2082)

afbeelding van Louthrax

05-03-2017, 17:36

You could try to display the subslots now, but the interest is a bit limited as you usually always have the same RAM slots under MSX-DOS... And this will be way trickier to code (you need to set the main-slot you want to get the subslots for in page C000-FFFF before reading FFFF, so be sure the stack is not accessed when you do that).

Van user888

Expert (66)

afbeelding van user888

05-03-2017, 20:28

Yes, I worked on that today. I indeed found out with the help of http://map.grauw.nl that I need to select page 3 for each slot to get the subslots.

Can you elaborate on the stack. It's not multithreaded :) so I was wondering how I could access it accidentally during reading.

Van Louthrax

Prophet (2082)

afbeelding van Louthrax

05-03-2017, 20:45

user888 wrote:

Can you elaborate on the stack. It's not multithreaded Smile so I was wondering how I could access it accidentally during reading.

Not talking about multithreading, just be sure to be in "DI" mode when changing the slot at 0xC000-0xFFFF, and not using "push / pop / call" and all stack-related operations inside your function. Might looked like an obvious advice but I don't know how experienced you are with assembly (and it's anyway easy to get distracted and forgot about that !).

Van Alcoholics_Anonymous

Resident (39)

afbeelding van Alcoholics_Anonymous

05-03-2017, 20:45

Louthrax wrote:

I'd be surprised there's no direct way to read an input port in SDCC.

The z80's i/o space is mapped to "special function registers" or sfrs.
Info here: https://www.z88dk.org/wiki/doku.php?id=libnew:target_embedde...

There was a bug fix not too long ago concerning i/o and sfrs so make sure your version of SDCC is recent-ish.

Van user888

Expert (66)

afbeelding van user888

05-03-2017, 22:09

@Louthrax thanks for the advice, not much experience with assembly indeed.
@AA thanks, will look into it.

Van user888

Expert (66)

afbeelding van user888

06-03-2017, 19:50

@Alcoholics_Anonymous I'm using SDCC (3.6.0) instead of z88dk, and using some ioport library I found somewhere. Do you know perhaps if SDCC itself offers a way to read/write ports directly?

update: reading the SDCC manual now. I was looking for a supplied intrinsic.h header file, but it seems I have to use something like:

__sfr __at 0xa8 ppi8255Port;

update: yep. It was that easy.

Van Alcoholics_Anonymous

Resident (39)

afbeelding van Alcoholics_Anonymous

06-03-2017, 23:14

user888 wrote:

@Alcoholics_Anonymous I'm using SDCC (3.6.0) instead of z88dk, and using some ioport library I found somewhere.

Sorry I should have been more specific. That page is z88dk documentation but Method 1 is sdcc's port mapping and will work with native sdcc too. As you found out Smile The code generated will be much better if you use that.

Van user888

Expert (66)

afbeelding van user888

06-10-2019, 09:30

Pagina 2/3
1 | | 3