Generating a hi res display using flat assembler

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
Bukster
Posts: 93
Joined: Wed Sep 12, 2018 9:44 am

Generating a hi res display using flat assembler

Post by Bukster »

I've been trying to produce a Hi Res system so I can try my hand at hi res games next. I've copied some published hi res routines to make my own basic hi res on the flat assembler FASMW-ZX. Have a play with it until I get the hang of it and then try programming something using it.

The system to switch in and out of hi res works fine. However, when the hi-res display is generating, the ULA does not seem to be resetting to line zero. So when the JP (HL) instruction is executed, the processor simply processes a load of NOP instructions before returning when it hits a RET instruction at the end of each hi-res line. I've been using the EightyOne emulator and can using the debugger to see the problem. I can also load a hi-res game like Forty Niner and see the same routine executing except the the NOP instrutions get a '#' symbol on each side to show that the ULA is using them to generate the picture. I've also looked through Forty Niner's, and some other hi res games to see the picture generation code being executed and it looks absolutely identical.

The emulator can clearly handle hi res, so it's not the emulator. The code seems fine and the port in/outs seem the same too so I'm running out of ideas as to what could be wrong. My gut feeling is that there is something very simple I'm doing wrong and that I'm not triggering the ULA properly. I've attached the code and a compiled .p file. Is there anything really obvious that anyone can see that I'm doing wrong?

If I've understood pseudo hi res correctly then the screen should display the bit pattern for the ROM address C00 which is binary 01001111. So what I'd expect to see is a series of thin and thick vertical lines with gaps between them going down the screen if it was working properly. What I still don't understand properly is how the ULA suddenly takes over and a JP (HL) instruction suddenly generates a line (and under what conditions will it do it).

Sorry if the code looks like a load of copy and paste. The plan was to get a basic system going and them make something a little more elegant. However, I've hit a stumbling block and thought it might be a better idea to post the issue here rather than just floundering around and not getting anywhere.
Attachments
My HiRes.p
(7.25 KiB) Downloaded 212 times
My HiRes.ASM
(28.96 KiB) Downloaded 223 times
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Generating a hi res display using flat assembler

Post by dr beep »

You don’t need the IN and OUT but you need to seed I and R before displaying a line of TRUE HIRES
Your screen is a full screen so you need to set the registers.

Second, you need to point to the data but the displaybuffer is also needed.

Your routine is a pseudohires routine.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Generating a hi res display using flat assembler

Post by dr beep »

This is where I started with TRUE HIRES
1D76773B-54E9-44AF-AADD-E3D8B1C402BA.png
User avatar
mrtinb
Posts: 1906
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Generating a hi res display using flat assembler

Post by mrtinb »

If you want pseudo hires, then download “Lightning Driver” at the bottom this page.

http://www.fruitcake.plus.com/Sinclair/ ... ration.htm

This driver supports all the pseudo hires modes there exists.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Generating a hi res display using flat assembler

Post by dr beep »

Your HL isn’t pointing to screen+32K.

See the routine here.

http://www.user.dccnet.com/wrigter/inde ... torial.htm
User avatar
1024MAK
Posts: 5101
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Generating a hi res display using flat assembler

Post by 1024MAK »

Bukster wrote: Sat Feb 16, 2019 1:56 am What I still don't understand properly is how the ULA suddenly takes over <snip>
The ULA only “intercepts” the Z80 CPU instruction fetch when the CPU attempts to execute code in the upper area of RAM. That is, when the address is 0xC000 or above. If the CPU tries to execute the display file in the normal RAM address range, then the ULA will not respond.

To understand this, you need to understand that the hardware does not use address line A15 in decoding and selecting any of the memory. So from the CPU’s point of view, everything above 0x8000 is a copy of everything below 0x7FFF. But the ULA sees CPU instruction fetches above 0xC000 (from RAM) as screen data.

For memory decoding and memory map details see these posts/threads:
viewtopic.php?f=5&t=936&p=9592#p9592

viewtopic.php?f=7&t=2614&p=27846&hilit= ... map#p27846

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
Bukster
Posts: 93
Joined: Wed Sep 12, 2018 9:44 am

Re: Generating a hi res display using flat assembler

Post by Bukster »

The ULA looks for bit 15 of the address line. That explains it. Thanks.

I changed the line

LD HL,SCREEN_DATA-$21

to

LD HL,SCREEN_DATA+$8000-$21

It worked first time. So that was ten seconds work to fix it. I knew I was on the edge of success.
Post Reply