- Joined: 28 Feb 2016
- Posts: 502
- Location: Barcelona
|
Help Needed
Posted: Wed Apr 17, 2019 6:28 pm
|
Hello, I post here if somebody can help me
Trying to fix GG2SMS problems with Tilemap writting to $3800
I need to copy partial RAM to VRAM, for example:
( $D500-$D900 RAM ) to ( $200-$600 VRAM )
$D500 RAM =$200 VRAM
$D501 RAM =$201 VRAM
$D502 RAM =$202 VRAM
$D503 RAM =$203 VRAM
...
$D900 RAM =$600 VRAM
Thankyou
|
- Site Admin
- Joined: 19 Oct 1999
- Posts: 14738
- Location: London
|
Posted: Wed Apr 17, 2019 11:58 pm
|
You can copy data to VRAM using the otir opcode.
|
- Joined: 05 Sep 2013
- Posts: 3825
- Location: Stockholm, Sweden
|
Posted: Thu Apr 18, 2019 8:04 am Last edited by sverx on Thu May 02, 2019 8:39 pm; edited 1 time in total
|
you set VRAM (write) address by doing
ld hl,#$4200 ; (your $200 address + $4000 for writing)
ld c,#$BF ; (VDP Control Port)
di
out (c),l
out (c),h
ei
then you copy your data (4 times 256 bytes) from RAM to VRAM
ld hl,$D500
ld c,#$BE ; (VDP Data Port)
ld a,#4
ld b,0
-:
OTIR ; ( copy 256 bytes )
dec a ; (4 times)
jr nz, -
please be aware that OTIR is too fast if you're writing to VRAM *not* during vBlank.
|
- Joined: 28 Feb 2016
- Posts: 502
- Location: Barcelona
|
Posted: Fri Apr 19, 2019 5:15 pm
|
Thankyou Maxim, sverx and Calindro for help me ;)
Code ready working now
|