CPCWiki forum

General Category => Programming => Topic started by: Jelonertz on 23:13, 27 February 22

Title: Transfering data from cartridge bank to RAM/Screen
Post by: Jelonertz on 23:13, 27 February 22
Hi,
I'm doing some basic tests with catridges ROM pages. I've created a cartridge with the following structure:
page 0: OS.ROM
page 1: BASIC.ROM
page 2: AMSDOS.ROM
page 3: my_binary.bin (extended to 16KB)
page 4: image.bin (16KB size, with screen data)

So after enabling the CPC+ features, I map cartridge page 4, in HI ROM using:

ld a,4
add 128
ld b,&df
ld c,a
out (c),c

ld b,&7f
ld c,%10000100
out (c),c

After that, I see Cartridge Bank 4, Upper ROM enabled as Read Memory in WinApe debugger.

In the Bank 4 have the data for the screen, so I copy the 16KB from &C000 to &4000:

ld hl,&c000
ld de,&4000
ld bc,&4000
ldir

However, I see that ldir is not copying all the data. It looks like it's interrupted and some point, so, after the LDIR I see:
1) Only partial information from Upper ROM Cartridge bank 4 is transferred to &4000
2) The Upper ROM Cartridged bank 4 is no longer "selected" as Read memory

As a consecuence, I'm not able to copy the whole screen from the cartridge bank to RAM...

Any ideas?

Thanks!
Title: Re: Transfering data from cartridge bank to RAM/Screen
Post by: andycadley on 23:22, 27 February 22
Are interrupts enabled? The BASIC ROM interrupt routines may interfere with ROM selection, putting things back how it "expects" them to be as it won't know about changes you make to the hardware paging directly.
Title: Re: Transfering data from cartridge bank to RAM/Screen
Post by: Jelonertz on 23:32, 27 February 22
Yes, they were... disabling the interrupts before the LDIR did the trick...

Thanks!
Powered by SMFPacks Menu Editor Mod