Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Help Needed

Reply to topic
Author Message
  • Joined: 28 Feb 2016
  • Posts: 368
  • Location: Barcelona
Reply with quote
Help Needed
Post 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
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12966
  • Location: London
Reply with quote
Post Posted: Wed Apr 17, 2019 11:58 pm
You can copy data to VRAM using the otir opcode.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2527
Reply with quote
Post 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.
  View user's profile Send private message Visit poster's website
  • Joined: 28 Feb 2016
  • Posts: 368
  • Location: Barcelona
Reply with quote
Post Posted: Fri Apr 19, 2019 5:15 pm
Thankyou Maxim, sverx and Calindro for help me ;)

Code ready working now
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!