some questions about fmsxs60 (Emulation MSX Fora)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 113 gasten en 1 MSX vriend online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Emulation - some questions about fmsxs60

Ga naar pagina ( Vorige pagina 1 | 2 | 3 | 4 )
Schrijver

some questions about fmsx\s60

jr
msx addict
Berichten: 310
Geplaatst: 13 April 2006, 20:36   
Uhh... ;-) Well, looking at the C code now, it's probably pretty easy to convert the smaller routine ("smart" rendering) to some BASIC-lookalike:

10 for y=1 to 208:for x=1 to 88
20 poke d,peek(s):d=d+1:s=s+1
30 c1=peek(s):s=s+1
40 c2=peek(s):s=s+1
50 c3=peek(s)
60 if c1=c3 and c1<>c2 then poke d,c2 else poke d,c1
70 d=d+1:next x:s=s+8:next y


Now d represents the memory address of the display frame buffer and s points to the MSX offscreen bitmap as described before. Does it make more sense now? ;-)
jr
msx addict
Berichten: 310
Geplaatst: 13 April 2006, 20:46   
If you still prefer assembler, here's the same bit in assembly with a little bit of unrolling already done (now r1 points to MSX frame and r2 to the display frame buffer)... oh, just noticed that this code and the BASIC one I wrote earlier expect that the MSX frame pointer has the "excess border" adjustment done already when entering the routine.
    mov r3, #208
y_loop:
    mov r4, #176
    ldrh r7, [ r1 ], #2
x_loop:
    strh r7, [ r2 ], #2
    ldrh r5, [ r1 ], #2
    ldrh r6, [ r1 ], #2
    ldrh r7, [ r1 ], #2
    cmp r5, r7
    movne r6, r5
    cmp r5, r6
    strneh r6, [ r2 ], #2
    streqh r5, [ r2 ], #2
    strh r7, [ r2 ], #2
    ldrh r5, [ r1 ], #2
    ldrh r6, [ r1 ], #2
    ldrh r7, [ r1 ], #2
    cmp r5, r7
    movne r6, r5
    cmp r5, r6
    strneh r6, [ r2 ], #2
    streqh r5, [ r2 ], #2
    subs r4, r4, #4
    bne x_loop
    add r1, r1, #14
    subs r3, r3, #1
    bne y_loop

NYYRIKKI
msx master
Berichten: 1499
Geplaatst: 13 April 2006, 20:49   
Yes, makes very much more sense

I have to make some tests, if this new method looks ultimate cool, I tell you that you have to implement it.
jr
msx addict
Berichten: 310
Geplaatst: 13 April 2006, 21:06   
Shit... can't stop writing this BASIC code... I'm infected! ;-) The "resample" routine in BASIC could be something like this (same s and d variables as before):
10 defint a-z:for y=1 to 208:for x=1 to 88
11 c1=peek(s):s=s+1:c2=peek(s):s=s+1:c3=peek(s):s=s+1
12 r1=c1/2048:g1=(c1/32) and 63:b1=c1 and 31
13 r2=c2/2048:g2=(c2/32) and 63:b2=c2 and 31
14 r3=c3/2048:g3=(c3/32) and 63:b3=c3 and 31
15 r2=r2+r3:g2=g2+g3:b2=b2+b3
16 r1=(r1+r2)/3:g1=(g1+g2)/3:b1=(b1+b2)/3
17 poke d,(r1*2048) or (g1*32) or b1:d=d+1
18 c3=peek(s):s=s+1
19 r3=c3/2048:g3=(c3/32) and 63:b3=c3 and 31
20 r2=(r2+r3)/3:g2=(g2+g3)/3:b2=(b2+b3)/3
21 poke d,(r2*2048) or (g2*32) or b2:d=d+1
22 next x:s=s+8:next y

One important thing to note though: in this code, as well as the BASIC code I wrote here earlier, poke and peek are supposed to return 16bit values, not 8bit values. Also the s and d addresses when increased by 1 move to the next 16bit value in memory... so in 8bit addressing you would need to change all s and d increases from 1 to 2 plus make the peek and poke read 2 bytes and construct a 16bit value. Sorry :-)
 
Ga naar pagina ( Vorige pagina 1 | 2 | 3 | 4 )
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.