I have a beginners question regarding VDP programming for MSX1. When I try to copy a 8x8 pattern to VRAM, not all data arrives on certain MSX1 machines. I'm really puzzled by this.
- Line `$0005` is skipped on e.g. Philips VG8020, Canon V-20, CBIOS MSX1 (EU). If I change the order of color/pattern copying, a byte in the color pattern is missing.
- In this tiny example, the problem does not occur on CBIOS MSX1 (JP), CBIOS MSX2 (EU) or Sony HB-700P
- If I add di before copying data and ei after copying data, the problem does not occur.
Should interrupts be disabled when copying to VRAM? I thought that was only needed when writing to the registers.
Result from the openMSX debugger on a Philips VG8020 / CBIOS MSX1 (EU), line `$0005` with value `$05` is missing.
info for character 0 ($00) Generator Data Color data $0000: 1.1.1.1. $AA $2000: $12 $0001: .1.....1 $41 $2001: $13 $0002: 1.1..... $A0 $2002: $14 $0003: ...1...1 $11 $2003: $15 $0004: 1...1... $88 $2004: $17 $0005: 1.....1. $82 $2005: $16 $0006: .1.1.1.1 $55 $2006: $18 $0007: ........ $00 $2007: $19
Result from openMSX debugger on CBIOS MSX2, as expected, full pattern and colour pattern in VRAM.
info for character 0 ($00) Generator Data Color data $0000: 1.1.1.1. $AA $2000: $12 $0001: .1.....1 $41 $2001: $13 $0002: 1.1..... $A0 $2002: $14 $0003: ...1...1 $11 $2003: $15 $0004: 1...1... $88 $2004: $17 $0005: .....1.1 $05 $2005: $16 $0006: 1.....1. $82 $2006: $18 $0007: .1.1.1.1 $55 $2007: $19
The test program (compiles with Glass):
; ROM header org $4000 db "AB" dw Main dw 0, 0, 0, 0, 0, 0 VDPData equ $98 VDPControl equ $99 CHGMOD equ $005f RomSize equ $4000 TilePos equ 0 * 8 ; Tile (x,y)=(0,0) Main: ; Change to screen 2 ld a, 2 call CHGMOD ; Pattern start address ld hl, $0000 + TilePos call SetVDPWriteAddress ; Pattern data ld hl, Pattern0 ld b, 8 ld c, VDPData otir ; Color start address ld hl, $2000 + TilePos call SetVDPWriteAddress ; Color data ld hl, Color0 ld b, 8 ld c, VDPData otir di halt SetVDPWriteAddress: ld a, l out (VDPControl), a ld a, h or %01000000 out (VDPControl), a ret Pattern0: db %10101010 db %01000001 db %10100000 db %00010001 db %10001000 db %00000101 db %10000010 db %01010101 Color0: db $12 db $13 db $14 db $15 db $17 db $16 db $18 db $19 ProgEnd: ds $4000 + RomSize - ProgEnd, 255
Login or register to post comments