Autor
| Bios is called at linesplit?
|
norakomi msx professional Mensajes: 861 | Publicado: Diciembre 15 2005, 08:55   |
Hey !!
I know that at VBLANK a call is made to rom, ... to a Bios routine, which Pushes all registers, and Pops all registers at the end of VBLANK.
What about a linesplit?
In my game between lines y=16 and y=20 its completely black.
When my linesplit is called (at y=18), I disable screen, set r#18, set r#23, poll for HBLANK start, poll for HBLANK end, and enable screen again.
However after executing the split routine there is allways some jitter around y=18.
Is it something because of the Bios. How can I find out what the Bios does while interfering my linesplit?
|
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 09:07   |
Every interrupt will execute RST#38
Disassemble it and you will know. Here's a brief detail:
- push all regs (incl. shadow regs)
- check what (vdp) interrupt and call either #fd9a or #fd9f int hook
- call keyboard routine
- call diskhook (to stop drivespin etc)
- call "play" hook
- increase timer byte
- and some more stuff
- pop all regs
As you can see, much overhead. As well on vblank as on other (vdp) interrupts (e.g. lineint)
You might wanna set RAM on page 0 and make own routines (a RAM bios, just like DOS)
We done this (ofcourse) with our F-kernel, which might be a good example for you. We've put a new RST#38 up and made it do "nothing" (only pushing/popping AF register and check VBL status and (if enabled) check the source of the int) unless you set interrupt routines (aka. add a keyboard matrix reader) This will cut down interrupt spill time.
**
another trick to speed things up.
at the #fd9f/a hook POP all the regs that were pushed at rst#38 including 1 extra for the stack (remember that the hook is "called" from bios which will increase SP)
this way you'll skip on all the overhead. The hooks are called at the beginning of rst#38 so it's fast enough for ya I guess.
good luck
-
|
|
norakomi msx professional Mensajes: 861 | Publicado: Diciembre 15 2005, 09:24   |
Quote:
| another trick to speed things up.
at the #fd9f/a hook POP all the regs that were pushed at rst#38 including 1 extra for the stack (remember that the hook is "called" from bios which will increase SP)
this way you'll skip on all the overhead. The hooks are called at the beginning of rst#38 so it's fast enough for ya I guess.
good luck-
|
cool trick !! Ill experiment on that one (shouldnt be 2 difficult).
Hey another thing:
Ive been cutting on the Bios use:
How exactly do I set RAM to page 0?, and is it a possiblilty to do this only IN THE GAME, and outside of the game (like intro screen, loading and saving files) I set page 0 to ROM again.?
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Diciembre 15 2005, 09:44   |
first you need to know in which slot the RAM is located... luckilly the diskrom did that job for you already and stored the slot (BIOS RDSLT, WRSLT and ENASLT) format in $F341 for page 0.
|
|
AuroraMSX
 msx master Mensajes: 1278 | Publicado: Diciembre 15 2005, 09:59   |
Quote:
| Every interrupt will execute RST#38
Disassemble it and you will know. Here's a brief detail:
- push all regs (incl. shadow regs)
- check what (vdp) interrupt and call either #fd9a or #fd9f int hook
- call keyboard routine
- call diskhook (to stop drivespin etc)
- call "play" hook
- increase timer byte
- and some more stuff
- pop all regs
|
If memory serves me well:
- #FD9A is always called, upon VDP VBLANK #FD9F is called after return from #FD9A (not sure about this one, tho)
- kbd routine, disk, play etc are only called upon VBLANK (after return from #FD9F)
|
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 10:07   |
something like that yeah. it's all from memory (and since I haven't been using BIOS since euh... early nineties I was surprised I got this close haha)
anyway, the BIOS ints are a pain in the ass concering speed issues.
swapping RAM/ROM on page 0 ain't that hard. also, don't forget to correct subslot setting (the famous poke -1,xx). I can pass you the asm source for that (have to look that one up tho, it's somewhere in the boot routine of the kernel... it's been years remember) I can also look up the RAM/ROM switch thing, got that in implemented in kernel too so you don't have to invent the wheel again. good luck so far
|
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 10:08   |
but I think the Beefmaster-B will outrun me on the sources  (he's the fastest dude ever man!) |
|
BiFi msx guru Mensajes: 3142 | Publicado: Diciembre 15 2005, 10:55   |
rst $38: - pushall
- call $fd9a
- check vblank (register A contains S#0 contents)
- no? jump to end of handler
- call $fd9f (diskstop is called from here)
- increase jiffy
- scan and handle keyboard stuff (find char to key, put in keyboard buffer)
- play music (handle play queues, filled by PLAY statement)
- event trapping (ON STOP, SPRITE, STRIG, KEY, etc.)
end of handler: |
|
norakomi msx professional Mensajes: 861 | Publicado: Diciembre 15 2005, 12:43   |
Quote:
| first you need to know in which slot the RAM is located... luckilly the diskrom did that job for you already and stored the slot (BIOS RDSLT, WRSLT and ENASLT) format in $F341 for page 0.
|
When I type "page" in Wbass2 I get this:
Page Slot Mem
0.......0.... 3.....
1.......3-2..5.....
2.......3.2..4.....
3.......3.2..0.....
should I type page 0,3,2,6 to enable RAM in page 0?
and if so, can I do this freely inside a routine?
like this:
ld a,6
out ($FC),a ;page 0,3,2,6
do routine
ld a,0
out ($FC),a ;page 0,3,2,0 restore page 0 to ROM
??
|
|
norakomi msx professional Mensajes: 861 | Publicado: Diciembre 15 2005, 12:48   |
Quote:
| another trick to speed things up.
at the #fd9f/a hook POP all the regs that were pushed at rst#38 including 1 extra for the stack (remember that the hook is "called" from bios which will increase SP)
this way you'll skip on all the overhead. The hooks are called at the beginning of rst#38 so it's fast enough for ya I guess.
|
I would like to know exactly which registers to POP and in which order.
What about this ?
Lineint:
bla
bla
bla
POP IY
POP IX
POP HL
POP DE
POP BC
POP AF
EXX
EX AF,AF
POP HL
POP DE
POP BC
POP AF
POP AF ; 1 extra for the stack?????????????????????????????????
EI
RET |
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 13:21   |
about the marry poppins:
Disasm $rst#38 and REVERSE POP the registers. (but you prolly did that, I don't have proper resources here to check)
the extra POP has to be done FIRST (you did it last), remember you'll pop the last SP entry which came from the CALL #FD9F/A. Don't matter which reg to pop, AF is fine (you'll be popping the original AF reg anyway)
|
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 13:31   |
about the RAM/ROM in page0
- the Wbass data is from YOUR machine.
MSX have different slot settings. for turbo R its'page 0,0,0,x (iirc) and your data is from a phillips computer? (subslot 2)
It's a bit confusing maybe but you'll have to get the slot regs from the system vars #f341... and #FFFF etc. (don't remember correctly. beef help me out here)
in #F341 the primairy slot for page 0 is stored (in your case: 3), in #FFFF the secondair slot is stored (negative value!). in your case (slot 2 peek (#FFFF) will prolly get 0x05 which is negative value for 0x0A.
Now the interesting thing is that this value SHOULD be 0x55 / 0xAA since that will point ALL pages to subslot 2.
here's how it works: (#FFFF)
every 2 bits represent the subslot value for a slot
b0/1 for slot 0, b2/3 for slot 1, b4/5 for slot 2 and b6/7 for slot 3.
Now most machines have WRONG value (only slotdata for slot 0&1) (hence the 0x05 instead of 0x55). Remember the famous poke -1,x ?? well, thaz exaclty what you need to set.
so read #ffff, make negative and copy LSB to MSB (lsb=least segn.bits = low nible = bits 0-3.. just in case you forgot  )
something like (this is out of my head and very quick, might be buggy)
ld a,(-1)
cpl ;not NEG but xor 0xff (which is the same as cpl)
and 0x0f ; keep LSB
ld b,a
rlca ; shift to MSB
rlca
rlca
rlca
and 0xf0 ;keep MSB (just in case Cy was "1')
or B
ld (-1),a or out (#a8),a ; <--- not sure here... somebody???
something like that.
|
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 13:32   |
Quote:
| Quote:
| first you need to know in which slot the RAM is located... luckilly the diskrom did that job for you already and stored the slot (BIOS RDSLT, WRSLT and ENASLT) format in $F341 for page 0.
|
When I type "page" in Wbass2 I get this:
Page Slot Mem
0.......0.... 3.....
1.......3-2..5.....
2.......3.2..4.....
3.......3.2..0.....
should I type page 0,3,2,6 to enable RAM in page 0?
and if so, can I do this freely inside a routine?
like this:
ld a,6
out ($FC),a ;page 0,3,2,6
do routine
ld a,0
out ($FC),a ;page 0,3,2,0 restore page 0 to ROM
??
|
uhm, sure you can. but that will only change memmap 
(confusing eh)
out (#FC),A will set PAGE 0,x,x,A
where X is not set.. only A is set.
Memmap is only useable when slot is set to RAM |
|
ro msx guru Mensajes: 2353 | Publicado: Diciembre 15 2005, 13:37   |
setting RAM in page 0 might be something like this:
ld a,(#F341) ; get RAM primslot for page 0
ld h,0 (indicates page 0 to be set)
call #24 ; change slot
back to ROM might be simple:
ld a,0
ld h,0
call #24
(I'm not sure, but isn't ROM bios always in prim. slot 0??)
The poke -1 (for subslots) has to be done FIRST THING in your proggy (only once  ) |
|
norakomi msx professional Mensajes: 861 | Publicado: Diciembre 15 2005, 13:54   |
 pfffffffffff *-* |
|
|
|
|