At 12:42 AM 06/21/98 +0200, you wrote:

>I want to write data to the Pattern Table of Screen 2. Doing it from BASIC
>with VPOKE and VPEEK works good, but in assembler not. I've write this
>little program:
>
>START:      EQU &HA000 ; Start address
>SCREEN2:    EQU &H72 ; SCREEN 2 BIOS routine
>VPOKE:      EQU &H4D ; VPOKE BIOS routine
>PAT2:       EQU &H0000 ; SCREEN 2 Pattern Table Address
>COL2:       EQU &H2000 ; SCREEN 2 Color Table Address
>NOM2:       EQU &H1800 ; SCREEN 2 Name Table Address
>NUMCHAR:    EQU 4      ; Number of chars to redefine
>
>            ORG START
>            CALL SCREEN2
>            LD HL, PAT2
>            LD B, NUMCHAR*8-1
>            LD DE, DEFCHAR
>LOOP:       LD A, (DE)
>            CALL VPOKE
>            INC HL
>            INC DE
>            DJNZ LOOP
>            LD A,(DE)
>            CALL VPOKE
>            RET
>
>
>DEFCHAR:    DB *** Data of the new chars ***

Why don't you simply go through the loop NUMCHAR*8 times? You gain very
little speed by doing the last VPOKE outside the loop. Besides, when your
assembly programs become larger, the size of your code is as important as
the speed, believe me.

>Its function is to redefine NUMCHAR characters, that is, to write NUMCHAR*8
>bytes in the Pattern Table of SCREEN 2.
>But... this doesn't work.
>What is wrong?

I can't spot anything wrong. Maybe I am overlooking something, but...
There is always a possibility you should be aware of: maybe the code is
fine, but you are expecting to see the wrong thing. For example: did you
set the values in the color table to such values that would enable you to
see the changed characters? You might have seen them black on black...

>P.S.: Now, I see a possible problem... the VPOKE BIOS routine modifies the
>HL register?

You can easily test that by adding a PUSH/POP pair. But my documentation
(BIOS.TXT from Compass) tells me only AF is modified by VPOKE call.

Bye,
                Maarten

****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to