Natsumi wrote: ↑Sat Jul 15, 2017 9:53 pm
Also something that is at the very least possible, is trying to wait for Z80 to stop when its not in a correct state, I remember getting this issue frequently when ROMs do not properly reset/initialize
Actually i do not initialize z80 in any of my roms. And only this one has this effect.
flamewing wrote: ↑Sat Jul 15, 2017 8:37 pm
A random idea: if you add a read from the VDP control port before doing any writes to it, does the issue still happen?
Already did : (
This simplified version of the program increases this effect. After pressing reset pressing 2 or 3 the console will be completely freezed and will ignore resets after that moment.
If i move the line marked with "<====== This line" at the end of VSYNC the program wontfreeze when being resset. I dont know why because at that infinite loop i disable interrupts.
Vint:
Code: Select all
VSYNC:
MOVE.L A0,-(A7)
MOVE.L D0,-(A7)
MOVE.L D1,-(A7)
LEA.L $00FF0000,A0
BSR GET6BTN ;Function that reads buttons to 00ff0000
MOVE.L (A7)+,D1
MOVE.L (A7)+,D0
MOVE.L (A7)+,A0
RTE
Program:
Code: Select all
START: ;Where the program begin
MOVE.W #$8000,D0
BEGLP NOP
NOP
NOP
NOP
DBRA D0,BEGLP ; Useless dumb loop
BSR DMAWAIT <-Just in case Useless wait until vdp is avaible.
; TMSS Check
MOVE.B $A10001,D0
ANDI.B #$0F,D0
BEQ.B DSTMSS
MOVE.L #'SEGA',$A14000
DSTMSS:
LEA $00FF0000,A0
BSR INITGMPD
STVDPREG 0,%00000100 ;Disable H interrupt and HV counter
STVDPREG 1,%01110100 ;Enable Display enable V interrupt enable DMA 28 cell mode : ( no pal
STVDPREG 2,$30 ;Ascroll DIRECTION
STVDPREG 3,%00000000 ;Wscroll DIRECTION no fucks given cause i wont use this plane
STVDPREG 4,$07 ;Bscroll DIRECTION
STVDPREG 5,$6C ;Sprite table
STVDPREG 6,%00000000 ;Phantom Register. it does nothing?
STVDPREG 7,$0D ;Background color pal0 color 0
STVDPREG 8,%00000000 ;Another phantom Register. it does nothing?
STVDPREG 9,%00000000 ;Another phantom Register. it does nothing?
STVDPREG 10,%00000000 ;Hint every scan
STVDPREG 11,%00000000 ;FULL VSCROLL FULL HSCROLL External interrupt disabled
STVDPREG 12,%10000001 ;40 cell mode
STVDPREG 13,$37 ;hscroll table DIRECTION
STVDPREG 14,%00000000 ;Another phantom Register. it does nothing?
STVDPREG 15,%00000010 ;Autoincrement.Usually 2;
STVDPREG 16,%00010001 ;Scrollplanes 64x64
STVDPREG 17,%00000000 ;Wscroll Hposition i dont care cause i wont use this plane
STVDPREG 18,%00000000 ;Wscroll Vposition i dont care cause i wont use this plane
DMAFVS 20,$00,$0 ;This macro fills vscrollram 20 words, value = 0 destination = 0;
BSR DMAWAIT
DMAFVM 64000,$00,0 ;This macro fills video memory 64000 bytes, value = 0 destination = 0;
BSR DMAWAIT
DMAFVM $5800,$55,96
BSR DMAWAIT
DMAFVM 32,$00,0
BSR DMAWAIT
DMAFVM 32,$AA,32
BSR DMAWAIT
DMAFVM 32,$BB,64
BSR DMAWAIT
BSR DMAWAIT
DMA2CR 16,HUDPAL,0 ;This macro performs DMA from Ram to Cram
BSR DMAWAIT
DMA2VM 16,SPRTEST,$D800 ;This macro performs DMA from Ram to Vram
BSR DMAWAIT
MOVE.L #$00FF0040,A1 ;Copy sprite value to ram
MOVE.L #SPRTEST,A0
MOVE.L (A0)+,(A1)+
MOVE.L (A0)+,(A1)+
MOVE.L (A0)+,(A1)+
MOVE.L (A0)+,(A1)+
MOVE.W #$2000,SR
FNLP:
MOVE.W #$2700,SR
DMA2VM 16,$00FF0040,$D800 <====== This line
MOVE.W #$2000,SR
JMP FNLP
Macro that aparently bugs the code.
Code: Select all
DMA2VM MACRO
STVDPINC 2
MOVE.W #$9400+(((\1)>>9)&$FF),($C00004).l
MOVE.W #$9300+(((\1)>>1)&$FF),($C00004).l
MOVE.W #$9600+(((\2>>1)&$FF00)>>8),($C00004).l
MOVE.W #$9500+((\2>>1)&$FF),($C00004).l
MOVE.W #$9700+((((\2>>1)&$FF0000)>>16)&$7F),($C00004).l
MOVE.L #$40000080|(((\3)&$3FFF)<<16)|(((\3)&$C000)>>14),($C00004).l
ENDM