Incredibly simple VDP programs (set mode 2, load palette) (Development Foros MSX)MSX Resource Center PassionMSX MSX2 contest           
                       
English Nederlands Español Português Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 51 invitados y 1 miembro en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

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

Autor

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

wur
msx friend
Mensajes: 8
Publicado: Junio 17 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
Mensajes: 1202
Publicado: Junio 17 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
Mensajes: 1202
Publicado: Junio 17 2005, 13:57   
So

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

are the more common IN/OUT for VDP
wur
msx friend
Mensajes: 8
Publicado: Junio 17 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
Mensajes: 1202
Publicado: Junio 17 2005, 14:29   
Yes
wur
msx friend
Mensajes: 8
Publicado: Junio 17 2005, 14:49   
thank you! Green text on red background never looked so beautiful. ^_^
flyguille
msx master
Mensajes: 1202
Publicado: Junio 17 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
Mensajes: 61
Publicado: Junio 26 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
Mensajes: 13
Publicado: Junio 27 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 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation