Autor
| My Z80 is a bit rusty, help me refresh it...
| frax msx friend Mensajes: 7 | Publicado: Octubre 25 2007, 20:04   | Im tracing through some code trying to figure out whats going on.
8983 218d8a ld hl,#8a8d <- See data below
8986 4e ld c,(hl)
8987 23 inc hl
8988 7e ld a,(hl)
8989 23 inc hl
898a a7 and a <--? why and a with a? if a=0?
898b 280a jr z,#8997
898d 47 ld b,a
898e 0a ld a,(bc) <-- bc? hmm, ok, so the data @8a8d contains addresses?
898f 57 ld d,a
8990 3a0700 ld a,(#0007) <-- 7? ok, now im lost...
8993 82 add a,d
8994 02 ld (bc),a
8995 18ef jr #8986
8997 3ae0f3 ld a,(#f3e0)
899a e680 and #80
899c f602 or #02
899e 3264f2 ld (#f264),a
89a1 326bf2 ld (#f26b),a
89a4 cd73f2 call #f273
89a7 0680 ld b,#80
89a9 2163f2 ld hl,#f263
89ac 3a0700 ld a,(#0007)
89af 3c inc a
89b0 4f ld c,a
89b1 7e ld a,(hl)
89b2 23 inc hl
89b3 ed79 out (c),a
89b5 ed41 out (c),b
89b7 04 inc b
89b8 cb58 bit 3,b
89ba 28f5 jr z,#89b1
$8a8d looks like this
8a8d b4 f2 77 f2 7b f2 7e f2 86 f2 8c f2 94 f2 97 f2
8a9d a1 f2 a6 f2 ad f2 b1 f2 00 00
/frax | | Metalion msx freak Mensajes: 235 | Publicado: Octubre 25 2007, 20:21   | Hi,
1) the and a opcode is a quick way used to set the flags according to the content of a. In this case, it is used to set the Z flag, so that the next opcode jr z,#8997 can jump accordingly.
2) the ld a,(#0007) is used to load the VDP #0 port address (stored at $0007 in the ROM).
Apparently, what the first part of this routine does is :
- read a set of data through a library of addresses stored in #8A8D
- add to them the base address of the VDP #0 port
- store them back in their original location
Maybe in order to prepare quick VDP commands ?
| | frax msx friend Mensajes: 7 | Publicado: Octubre 25 2007, 20:27   | Quote:
| Maybe in order to prepare quick VDP commands ?
|
Hmm, kinky... | | frax msx friend Mensajes: 7 | Publicado: Octubre 26 2007, 08:19   | Nops, still don't quite geddit.
| | Prodatron msx master Mensajes: 1109 | Publicado: Octubre 26 2007, 10:44   | So let's summarize it:
- the first part (#8983-#8995) writes the correct VDP port number to an amount of addresses around #f2xx, which are specified in the zero-treminated table
- the second part (#8997-#89a4) I don't understand (don't know the addresses and calls)
- the third and last part (#89a7-#89ba) seems to write init values (stored at #f263) to the VDP registers 0-7 (which are the basic MSX1 video registers)
| |
| |
| |