Started by nitrofurano, 19:17, 12 August 14
0 Members and 1 Guest are viewing this topic.
Quote from: andycadley on 12:04, 16 August 14You wouldn't want that happening on an interrupt, there are 6 per frame (unless you switch to the PRI or use DMA interrupts) so it'd slow things down massively. Trying to use HALT for v-blank on the Amstrad isn't really a good idea. You could put it on one of the other restart points and call it with a RST instead (assuming that's accessible from Pismo/Boriel) if you really want a single instruction way of doing it.
Quote from: andycadley on 23:04, 16 August 14Not particularly hard no. With the ASIC registers paged in, just load the PRI register at &6800 with a value just larger than the number of scanlines in the display, say 201. That will replace the default interrupts with a single one that's triggered just after the display has been drawn. It's not quite v-blank, but it's probably functionally equivalent for most purposes.
QuoteLooking at your code, I also can't see anywhere that sets up the colour palettes, which is probably another reason the display just looks black (I'd assume emulators default to an all zero palette, not sure that's true of real hardware). So you probably also want to set that up by loading the ASIC palette registers too.
Quote from: andycadley on 14:35, 17 August 14No problem, I've attached a couple to this post.The first, ASIC PRI Sample, sets up a PRI just after the screen and then alternates the border colour a few times when it fires (so you can see where it is)The second, ASIC colours sample, draws a pattern of stripes on the screen in each INK colour and then resets the palette into a series of incrementing yellow/cyan colours. It dynamically sets the PRI to trigger at a couple of points on the screen as a way of getting more onscreen colours (and is why I wouldn't recommend think of HALT as a frame syncing mechanism)Note that both the above examples leave the ASIC registers paged in at &4000 (the Plus hardware is memory mapped rather than IO mapped). In a real world piece of code, you're more likely going to want to switch the ASIC on/off so that you can use the RAM in that address space.
QuoteSetting colours the old-school way is just a matter of OUT-ing the correct values to port &7fxx (a PEN select then an INK set), although I really wouldn't recommend it if you're running from a cartridge, the Plus palette is just so much nicer. :-)
Quote from: andycadley on 16:18, 17 August 14I didn't bother fully configuring the CRTC, so the screen wouldn't be enabled, because I was just calling it from BASIC. You'll need to include the CRTC setup code from your previous boot code if you want to put it in a cartridge.
QuoteSetting up colours the old school way is jut a matter of doing something like:Ld bc, &7f00Out (c), c ; Select Pen 0Ld a, &40Out (c), a ; Select White
QuoteThe wiki details the bit combinations required to select functions when writing to the gate array.
QuoteEDIT: Also when I setup Mode 0, it's disabling the ROMs, you'll need to tweak that slightly if you're running it from cartridge too (otherwise the code will be paged out from under itself!). Probably also need to set the stack up somewhere sensible too, between &8000 and &bfff to avoid the ROM, ASIC and display area.
Quote from: andycadley on 01:29, 18 August 14No problem, I've not used Pasmo or ZXBasic (really must give them a go) as I tend to stick to pure asm using the built in assembler in WinAPE these days. But hopefully I can point you in the right direction.
QuoteDetails on the Gate Array for colour manipulation the old way is at Gate Array - CPCWiki - the GA is also used for things like ROM/RAM banking and changing Mode, so it's worth a bit of a read.
QuoteFor the stack pointer, your safest bet is to initialise it to &c000 (although you should probably put it in your boot code). The stack grows downwards in memory and doesn't use the byte at the address you first load so it'll go from &bfff down towards 0. That's probably the safest bit of memory as things stand since you have the Lower ROM enabled in 0-3fff, the ASIC enabled at 4000-7fff and the screen located at c000-ffff. :-)
QuoteI'm not sure what you're trying to do by writing to &d008 and &d009, that doesn't seem to accomplish anything at all.
QuoteWhat I really can't understand though is why the compiled code in the cpr file has placed a JP &00b8 at &00b8, right after you set SP. That just ends in an infinite loop, so the rest of your code is never getting run.
Quote from: andycadley on 22:51, 18 August 14You may find the colour thing is just down to the encoding of pixels in the screen ram, as it's not necessarily as obvious as you might first think.Overscan is a tricky one, you have to put the CRTC in 32K mode and the memory arrangement gets a bit tricky. As it stands with the Lower ROM turned on and the ASIC paged in, you'll find it tricky to do. You kinda need to get used to the whole paging mechanism to be able to work effectively with such a large amount of the RAM dedicated to the display.
QuoteThe Plus colour palette, along with all the other new functionality, isn't IO mapped so you can't access it via OUT instructions. Instead you have to page in the ASIC registers (your boot code already does this). The palette registers are then located between &6400 and &641f, two bytes per PEN. They're followed by the Border colour at &6420 and &6421. More details of the ASIC registers is at "Arnold V" Specification - Issue 1.5 - 10th April 1990
Quote from: andycadley on 00:29, 19 August 14Yeah, in theory you can use the unused bits of the display memory for other things, but because the display storage isn't entirely linear it's takes a bit of effort to figure out where the "holes" are. I'd stick to a 16K display to start with. No point overcomplicating things to begin with.
QuoteAs it stands, your memory map looks a bit like this:&0000 - &3fff - ROM (writes will go to the underlying RAM page though)&4000 - &7fff - ASIC registers&8000 - &bfff - RAM (with the stack at the top end)&c000 - &ffff - Screen RAM
QuoteSo, as you can see any write to say &6400 will write into the ASIC and change the palette. Normally you'd not leave the ASIC paged in, so that the RAM there is usable to. And you just switch it in and out when you're actually making changes to the registers.
QuoteThe Plus can support a maximum of 512k cartridge ROM, split into 16K chunks. The first 8 of which can paged in at &0000 or &c000, the rest can all be paged in at &c000. No existing cartridges are actually that large however.
QuoteReading the keyboard/joystick is a bit of a pain on the CPC/GX, because it all involves a slightly convoluted mapping via the PPI. You should be able to get by with a generic routine though (I'm sure there is one around here). On the GX you only need worry about the joysticks and the P key, which is what the pause button maps to.
Quote from: arnoldemu on 10:54, 19 August 14@nitrofurano:I like what you are doing. I like that you are investigating the gx4000, cartridges and writing code using zxbasic. I think it's a good plan and I look forward to seeing the results of your work.Keep going.
QuoteMyself I work with either assembler (I use pasmo) or C (I use sdcc).As you can see from the forum we are all willing to help!
sub cpcscreensize(txsz as uinteger,tysz as uinteger): asm ld bc,$bc01 out (c),c ld a,(ix+4) // for the crtc register value it must be $bdxx not $bcxx inc b // so inc b, or ld b,$bd out (c),a ld bc,$bc06 out (c),c ld a,(ix+6) // same here inc b out (c),a end asm end sub
Quote from: Xifos on 22:26, 19 August 14Hi,I wrote corrections in your sub cpcscreensize.When you select crtc register, it's ok.ld bc,$bcNNout (c),cBut when you write the value, it must be on $bdNN...Code Select Expandsub cpcscreensize(txsz as uinteger,tysz as uinteger): asm ld bc,$bc01 out (c),c ld a,(ix+4) // for the crtc register value it must be $bdxx not $bcxx inc b // so inc b, or ld b,$bd out (c),a ld bc,$bc06 out (c),c ld a,(ix+6) // same here inc b out (c),a end asm end sub
Quote from: nitrofurano on 13:05, 20 August 14testing the joystick, and writing some text (btw, i guess Mess doesn't emulate pause button from GX4000 hardware)
Page created in 0.110 seconds with 52 queries.