From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2005-11-28 00:02:28
Since others have taken over the hardware flag, I could finish placing my DTV
in a case:-) After verifying that anything works smoothly (besides the colors
of course), I went on to write an extended memory driver for cc65.
Because I'm one of the good guys, I'm doing something like this:
lda $d03f ; Load current state
pha ; Save it
ora #$01 ; Enable access to extended registers
sta $d03f
... ; Go on doing DMA
pla
sta $d03f ; Restore old state
After lots of try&error I noticed that this piece of code prevents the driver
from working. It seems as if reading register $d03f doesn't give the last
value written to it. Typing in ?PEEK(53311) from BASIC proves this: It prints
255. Can this really be true? There's a similar issue with the register bank:
There's no way to read the old setting. How are subroutines or drivers
supposed to work if they cannot read and save the old settings before changing
anything?
There is one more issue with the register bank. An IRQ or NMI may interrupt
code when has has changed a register assignment. For example:
; Change the location of the zero page
.byte $32, $cc ; Let A point to register $C
(i)->
lda #$01 ; Change segment bank for $0000
.byte $32, $00 ; Let A point to register $0
If an interrupt occurs at (i), it will change the segment bank each time when
it loads A. If A points to register $A (instead of $C), the interrupt handler
will change the zero page location each time it loads A. Of course, there
shouldn't be any interrupts when changing register assignments, so this may be
a theoretical issue. Anyway, this seems like a dangerous feature.
The driver is finally working, but because of the problem with the $d03f
register, it will disable access to the extended registers on each DMA
operation. It is named dtv-himem.emd and will be in the next cc65 snapshot
(which is built nightly).
Regards
Uz
--
Ullrich von Bassewitz uz@musoftware.de
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.