PDA

Просмотр полной версии : EXTENDED MEMORY DETECTION



VELESOFT
04.04.2010, 20:45
As I see - all ZX clones with more than 128kB memory use port #7FFD only (Pentagon 256,512,1024) or #7FFD+NEXT PORT.

For example:
Scorpion 256/1024 : 7FFD + 1FFD
Kay 1024 : 7FFD + 1FFD
ZXM Phoenix : 7FFD + 1FFD
ZX PROFI 1024 : 7FFD + DFFD

Programs/games/utilities can use software autodetection of memory paging port. But access to ports #DFFD or x1FFD can on different ZX clones/models write value to other ports. Broblem is uncomplette ports adressation in hardware.

Example:
LD BC,#7FFD
LD A,#40
OUT (C),A
LD B,#DF
LD A,#01
OUT (C),A
This code set on ZX PROFI memory bank 8, but on real ZX Spectrum 128/+2A/+3 or Pentagon 128/256/512/1024 write value #01 to AY register port #FFFD.

Next example:
LD BC,#7FFD
LD A,#40
OUT (C),A
LD B,#1F
OUT (C),A
This code set on Scorpion 256 memory page 0 and on Scorpion 1024 page 16. On real ZX Spectrum 128/+2/Pentagon 128 write value #40 for port #7FFD = set memory page 0 + 128 editor + videoram 0. On Pentagon 256/512 write value #40 to paging port #7FFD = set memory page 8 + 128 editor + videoram 0. On ZX PROFI 1024 write value #40 to port #7FFD and parallel to port #DFFD = memory page 6 in area #8000-#BFFF and page 0 from #C000.

Result:
- access to port #1FFD is dangerous for using in ZX PROFI 1024
- access to port #1FFD change port #7FFD on some ZX models/clones
- access to port #DFFD set AY register value on some ZX models/clones

Correct way for memory detection is:
1) as first can be detected ZX PROFI memory
2) detect high bits D6 and D7 on port #7FFD (Pentagon 256/512)
3) if bit D2 of port #EFF7 can disable and enable high memory on port #7FFD then also bit D5(1MB ram) can be tested = Pentagon 1024 detected
4) test Scorpion port 1FFD (as first bust be set port #1FFD and as second port #7FFD !!!).
If extra memory is detected, you can't continue in test memory port for other ZX clones !!!

Any other idea ? :v2_wink2:

Keeper
04.04.2010, 22:50
Any other idea ?

Sure :)

1. Setup
2. Conditional compilation

Higher memory detection is not the best way, for example, because of probable locks of the port #7FFD...