VG5000 ROM console output

Discussion about other targets
Post Reply
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

VG5000 ROM console output

Post by stefano »

I take the opportunity to ask about the way the console output defaults are configured.
Is it enough to spot the TAR-* flags in the crt0 startup files?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: How do I get z88dk to work on a completely new target system?

Post by dom »

stefano wrote: Thu Mar 02, 2023 11:18 am I take the opportunity to ask about the way the console output defaults are configured.
Is it enough to spot the TAR-* flags in the crt0 startup files?
It should be...

Code: Select all

	defc    TAR__fputc_cons_generic = 1
Switches the default over to gencon if the user hasn't defined a preference at compilation time.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: How do I get z88dk to work on a completely new target system?

Post by stefano »

I see, what if I'm willig to add, say, the NATIVE console support to the VG5000 ?
Should it be changed to '0' ?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: VG5000 ROM console output

Post by dom »

I've split this out into a new topic to avoid confusion.

I've just refreshed my memory about the VG5000. I half wish I hadn't - it looks like we skipped implementing the ROM console printer because of some issue?

If you change that value to 0 then the ROM (well fputc_cons_native) as the default printer.

Even with the setting as it currently is, you could compile with a ROM printer with --pragma-redirect:fputc_cons=fputc_cons_native
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: VG5000 ROM console output

Post by stefano »

Basing on my recent ROM analysins I'm now confident enough to propose a workaround:

https://github.com/z88dk/z88dk/pull/2204

The problem was on the interrupt code, which we disabled to preserve IX, but necessary to provide the display refresh.
My current workaround is very basic but works.

I wonder if it could be worth to rewrite it and guarantee a constant speed independently on the ROM versions, but before developing this target furtherly I'd ask you to undo the IXIY workaround, I'm a bit scared to break something ! Similarly, if you find time to add the code for the custom interrupt handling, you're welcome.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: VG5000 ROM console output

Post by dom »

I'm similarly nervous about this one!

The gencon has a refresh display routine here: https://github.com/z88dk/z88dk/blob/mas ... e.asm#L208 which is used for scrolling and clearing - for normal printing we call $0092 which I'm assuming deals with the hardware.

I've just looked at the ROM and your PR. That really is spectacularly evil - I was wondering why there was a weird pop iy in there, but it's to stop the rest of the ROM interrupt code from running. I'm a bit worried about the ei in the ROM code - whether we might end up interrupting the tailend of the interrupt routine in the crt0 (I think we have a similar-ish theoretical issue in +cpc as well)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: VG5000 ROM console output

Post by stefano »

Generally, the entry point and BASIC system variables positions were strictly respected, thus also a jump in the scrolling or clearing code is acceptable (it is advisable to init IX everytime first, perhaps we can provide a simple ROM interposer).

Thus, what I know so far is that this trick should be valid on all the existing ROM versions (there are 3 versions out there, in my information).
A next, better version of the interrupt hook can easily adjusted to be more elegant, e.g. avoiding to touch the index register in the frequent situation of the simple counters increment and directly entering the DISPLAY refresh code after a simple, clean, PUSH IX (after removing IXIY).
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: VG5000 ROM console output

Post by stefano »

I think I'll try myself.. feel free to blame me soon :D
Post Reply