Autor
| 17 bit Bios calls
|
norakomi msx professional Mensajes: 861 | Publicado: Noviembre 09 2005, 19:11   |
LDIR: copying from HL to DE with BC as its lenght.
Most of the time bios calls regarding memory swapping and copying are 16 bit calls.
There are also Bios calls that copy from RAM to VRAM
Like
LD HL,sprite1 ;your sprite table
LD DE,$7800 ;sprite character pattern (screen 5)
LD BC,32 ;lenght
CALL $5C
this CALL sets the vdp to write at address $7800, and then copies 32 bytes from RAM (pointed to by HL) to VRAM (starting at $7800).
Now I have found these Bios calls pretty usefull, and a lot of time they are very fast as well !!
I have however changed my sprite pattern table start address (it normally starts at $7400).
Now it starts at page 2 at $17400
and those 16 bit Bios calls become useless when writing to the color, attribute or character tables.
So,
Are there 17 bit Bios calls?
***************************
Lots of programming fun to you !!
***************************
 |
|
BiFi msx guru Mensajes: 3142 | Publicado: Noviembre 09 2005, 20:05   |
nope, you need to use either the SETPAG BIOS call in the SubROM to extend the range to 17 bits... or make it yourself... (/me would choose the latter). |
|
ARTRAG msx master Mensajes: 1578 | Publicado: Noviembre 09 2005, 20:35   |
@norakomi
it is very easy to do by yourself
Look at tni site, there is a full list of examples to start with.
In order to set the VRAM address at 17 bit you can use:
;
;
;=================================================================
;= VDP-Routines ==================================================
;=================================================================
;
;
;Set VDP port #98 to start writing from address AHL (17-bit)
;
SetVdp_Write:
rlc h
rla
rlc h
rla
srl h
srl h
di
out (#99),a ;set bits 15-17
ld a,14+128
out (#99),a
ld a,l ;set bits 0-7
nop
out (#99),a
ld a,h ;set bits 8-14
or 64 ; + write access
ei
out (#99),a
ret
and in oder to copy your tables you can
ld a,vram /2^16
ld hl, vram & #FFFF
call SetVdp_Write
ld hl,ram
ld de,nbyte
ld c,#98
loop:
outi
dec de
ld a,e
or d
jr nz,loop
ret
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Noviembre 09 2005, 20:51   |
now do it according to the MSX standard?  |
|
ARTRAG msx master Mensajes: 1578 | Publicado: Noviembre 09 2005, 21:03   |
Do at init time:
init:
ld a,(6)
ld (here5+1),a
inc a
ld (here1+1),a
ld (here2+1),a
ld (here3+1),a
ld (here4+1),a
ret
and label the code in this way:
;
;Set VDP port #98 to start writing from address AHL (17-bit)
;
SetVdp_Write:
rlc h
rla
rlc h
rla
srl h
srl h
di
here1:
out (#99),a ;set bits 15-17
ld a,14+128
here2:
out (#99),a
ld a,l ;set bits 0-7
nop
here3:
out (#99),a
ld a,h ;set bits 8-14
or 64 ; + write access
ei
here4:
out (#99),a
ret
copyblock:
ld a,vram /2^16
ld hl, vram & #FFFF
call SetVdp_Write
ld hl,ram
ld de,nbyte
here5:
ld c,#98
loop:
outi
dec de
ld a,e
or d
jr nz,loop
ret
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Noviembre 10 2005, 07:37   |
and for ROM?  |
|
ARTRAG msx master Mensajes: 1578 | Publicado: Noviembre 10 2005, 09:55   |
move your I/O routines in ram, they shouldn't wast more than few bytes.
|
|
ARTRAG msx master Mensajes: 1578 | Publicado: Noviembre 10 2005, 09:56   |
just kidding. Who the hell cares of the standard if your code works in 99.9999% of the cases?
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Noviembre 10 2005, 10:20   |
... without moving to RAM (I expected you to react with that)  |
|
AuroraMSX
 msx master Mensajes: 1224 | Publicado: Noviembre 10 2005, 10:23   |
Quote:
| just kidding. Who the hell cares of the standard if your code works in 99.9999% of the cases?
|
Hm, that's exactly the kind of reasoning that leads to websites that look like sh** on a stick on non-IE browsers. But that's a bit off-topic  |
|
BiFi msx guru Mensajes: 3142 | Publicado: Noviembre 10 2005, 11:11   |
always make for non-IE browsers...  |
|
AuroraMSX
 msx master Mensajes: 1224 | Publicado: Noviembre 10 2005, 11:22   |
Quote:
| always make for non-IE browsers... 
|
Which, in 99.9999% of all cases will look like sh** on a stick when using IE. Unless you specifically hack/code your html and css for both IE and non-IE. |
|
AuroraMSX
 msx master Mensajes: 1224 | Publicado: Noviembre 10 2005, 11:27   |
anyhoo:
get VDP addresses from ROM (#0006 and #0007)
IF addresses are NOT #98 and #99
THEN
EXIT_WITH_MESSAGE "Get yourself a decent MSX :P"
FI
// rest of program follows here using direct addressing for IO
 |
|
GhostwriterP msx addict Mensajes: 305 | Publicado: Noviembre 10 2005, 13:38   |
Or use something like the following routine.
SetWrite ;in a-16k block hl-adress in 16 k block
di
out (99h),a
ld a,14+128
out (99h),a
ld a,l
out (99h),a
ld a,64
or h
out (99h),a
ei
ret
If you are using a fixed number you could always use "otir" like:
ld a,5
ld hl,3400h
call SetWrite
ld hl,sprite1
ld bc,32*256+98h
otir
Calculating the adress goes like a*4000h+hl.
Further more I if you keep writing in the same 16kb block (14000h-18000h) you
could use the following routine for the second sprite:
SetWrite16 ;in hl-adress in 16 k block
di
ld a,l
out (99h),a
ld a,64
or h
out (99h),a
ei
ret
ld hl,3400h+20h
call SetWrite16
...
|
|
GhostwriterP msx addict Mensajes: 305 | Publicado: Noviembre 10 2005, 13:41   |
And yes you could read out the right vdp ports in the BIOS ROM and modify the code a bit to
follow msx standard  |
|
|
|
|