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
|