Incredibly simple VDP programs (set mode 2, load palette) (Development 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 49 gasten en 2 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - Incredibly simple VDP programs (set mode 2, load palette)

Schrijver

Incredibly simple VDP programs (set mode 2, load palette)

wur
msx friend
Berichten: 8
Geplaatst: 17 Juni 2005, 13:39   
Hello MSX community,

I am currently trying to code some very simple programs that use the VDP. I'm using tniasm and loading under MSX-Basic. (Yes, I know that's bad, but I'm just starting here!)

without further adieu....


here's one that's supposed to change to text 2 mode:

db $fe
dw start
dw eof
dw exec

org $8800

test2a: equ $04
test2b: equ $10

start:

hello: db "testing"

exec:

; set up registers 0 and 1 via port 1
ld a, test2a
out (1), a
ld a, $80
out (1), a
ld a, test2b
out (1), a
ld a, $81
out (1), a

ld bc, hello
call puts

.end: ret


puts:

ld a, (bc)
cp 0
ret z
call $a2
inc bc
jp puts
.end: ret

eof:


The text mode just stays the same!

Here's one that's supposed to load the palette with red, green, red, green ... until it's full, and then set the text to palette #0 and palette #1 (so, of course, it will be red and green). However, the screen remains blue and white!:

; set up VDP so only green and red are used

db $fe
dw start
dw eof
dw exec

org $8800


start:

loopvar: db 17
starttext: db "Starting... ", $0
redtext: db "Loading red... ", $0
greentext: db "Loading green... ", $0
testing: db "testing... ", $0


noblue: equ $00
red: equ $70
green: equ $07
nogreen: equ $00

exec:
; select palette # 0

ld a, $00
out (1), a ; palette # 0 in
ld a, $90
out (1), a ; register # 16

; for looping

call &theloop

; set up palette's register so palette can be automatically loaded from port 2
ld a, $01
out (1), a
ld a, $87
out (1), a

ld bc, testing
call puts

.end: ret

theloop:

ld bc, starttext
call puts
ld a, (loopvar)

.redloop:

sub a, 1
jp z, .end
ld (loopvar), a
ld bc, redtext
call puts
ld a, red
; load red-blue info ($07, just red) and then green info ($00, no green) into port 2
out (2), a
ld a, nogreen
out (2), a
ld a, (loopvar)
jp .greenloop

.greenloop:

sub a, 1
jp z, .end
ld (loopvar),a
ld bc, greentext
call puts
ld a, noblue
; load red-blue info ($00, no color) and then green info ($07, green) into port 2
out (2), a
ld a, green
out (2), a
ld a, (loopvar)
jp .redloop

.end: ret


puts:

ld a, (bc)
cp 0
ret z
call $a2
inc bc
jp puts
.end: ret

eof:


If someone can please help me with either of these, I'll love them forever.


Thanks,
wur
flyguille
msx master
Berichten: 1202
Geplaatst: 17 Juni 2005, 13:56   
ell, all the OUT (n) has value 1 or 2

VDP is at $98 and $99 (the more commons)
and $9A $9B for msx2 extensions
flyguille
msx master
Berichten: 1202
Geplaatst: 17 Juni 2005, 13:57   
So

OUT ($98), a
IN a, ($98)
OUT ($99), a

are the more common IN/OUT for VDP
wur
msx friend
Berichten: 8
Geplaatst: 17 Juni 2005, 14:27   
ah, okay. The VDP's 0th port is $98 in the MSX's memory, and its 1 port is $99 in the memory? That was what confused me.
flyguille
msx master
Berichten: 1202
Geplaatst: 17 Juni 2005, 14:29   
Yes
wur
msx friend
Berichten: 8
Geplaatst: 17 Juni 2005, 14:49   
thank you! Green text on red background never looked so beautiful. ^_^
flyguille
msx master
Berichten: 1202
Geplaatst: 17 Juni 2005, 15:01   
I am glad that you are using tniASM... ... because this is the compiler used in all MNBIOS's docs. So go and get experience using that.


SKiLLa
msx user
Berichten: 61
Geplaatst: 26 Juni 2005, 02:04   
You might consider disabling the interrupts before messing with the VDP
and enabling them later. Otherwise you're bound to have problems later on ...

Disabling Interrupts: "DI"... and "EI" enables them again (don't forget ;-)
MysteryMan
msx friend
Berichten: 13
Geplaatst: 27 Juni 2005, 11:17   
tnAsm == simple in usage with not to much diffecult pre-processor commands etc. so lets you concentrate on youre code!

And there's nothing wrong with that!

--jups even an c#.net and vb.net programmer likes tniAsm !!!---
 
 







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