Laurens,

  Here is the sprite routine... Some people had already read it
and did not found the error... Thanks in advance by helping.
The code is made for M80/L80.


--- start ----

SETPAG  EQU     0013Dh
CHGMDP  EQU     001B5h
INIPLT  EQU     00141h
SETPLT  EQU     0014Dh
CHGCLR  EQU     00111h
CALPAT  EQU     000F9h
CALATR  EQU     000FDh
CLRSPR  EQU     000F5h

;BIOS
CALSLT  EQU     0001Ch
TOTEXT  EQU     000D2h
CHGET   EQU     0009Fh
LDIRVM  EQU     0005Ch
LDIRMV  EQU     00059h
WRTVDP  EQU     00047h

START:
        CALL    INIT            ; Runs initialization
        LD      IX,CHGET        ; Wait a key
        CALL    CALLBIOS        
        CALL    DEINIT          ; Exit program
        


;-----
; Initialize the Graphics
;-----
INIT:
        LD      IX,CHGMDP       ; Carrega funcao de mudanca de screen
        LD      A,6             ; Indica Screen 6
        CALL    CALLSUB ; Executa
        XOR     A               ; Zera A
        LD      (CLIKSW),A      ; Desliga o click do teclado
        LD      (DPPAGE),A      ; Seta pagina de Display para 0
        LD      (ACPAGE),A      ; Seta pagina de escrita para 0
        LD      IX,SETPAG       ; Carrega funcao de mudar paginas
        CALL    CALLSUB ; Executa
        LD      IX,INIPLT       ; Carrega funcao de inicializar o pallete
        CALL    CALLSUB ; Executa
        LD      IX,SETPLT       ; Carrega funcao de mudar o palete
        ; Preto
        LD      D,0             ; Indica cor 0
        LD      A,0             ; Indica R e B = 0
        LD      E,0             ; Indica G =0
        CALL    CALLSUB ; Executa
        ; Azul
        LD      D,1             ; Indica cor 1
        LD      A,36h           ; Indica R=3 e B = 6
        LD      E,3             ; Indica G =3
        CALL    CALLSUB ; Executa
        ; Cinza
        LD      D,2             ; Indica cor 2
        LD      A,56h           ; Indica R=5 e B = 6
        LD      E,5h            ; Indica G =5
        CALL    CALLSUB ; Executa
        ; Branco
        LD      D,3             ; Indica cor 3
        LD      A,77h           ; Indica R=7 e B = 7
        LD      E,7h            ; Indica G =7
        CALL    CALLSUB         ; Executa
        LD      A,32h           ; Indica valor para repeticao do teclado
        LD      (REPCNT),A      ; Altera valor de repeticao do teclado
        CALL    INITSPRITES             ; Inicializa Sprites
        RET                     ; Retorna...

;-----
;  Back to text and exit
;-----
DEINIT:
        XOR     A
        LD      (DPPAGE),A      ; Seta pagina de Display para 0
        LD      (ACPAGE),A      ; Seta pagina de escrita para 0
        LD      IX,SETPAG       ; Carrega funcao de mudar paginas
        CALL    CALLSUB         ; Executa
        LD      A,80            ; Indica 80 colunas
        LD      (LINL40),A      ; Coloca no local adequado
        LD      IX,CHGMDP       ; Carrega funcao que muda modo de video
        LD      A,0             ; Indica Screen 0
        CALL    CALLSUB         ; Executa mudanca de tela
              LD      IX,CHGCLR ; Indica funcao de mudanca de cor
              XOR     A         ; Indica cor 0
              LD      (BAKCLR),A        ; Indica fundo.
              LD        A,15            ; Indica cor 15         
              LD      (FORCLR),A        ; Indica frente
              LD      A,0
              CALL    CALLSUB
        JP      0               ; Sai do programa


;-----
; Initialize sprites
;-----
INITSPRITES:
        ; Clean sprites table
        LD      IX,CLRSPR       ; Indica funcao de limpar sprites
        CALL    CALLSUB         ; Executa funcao
        ; Set 8x8 mode and normal size
        LD      A,(RG1SAV)      ; Carrega R#1 em A
        AND     11111100b       ; Zera bit 0 (tam normal) e 1 (8x8)
        LD      (RG1SAV),A      ; Salva alteracao no Byte
        LD      B,A             ; Carrega B com valor de escrita
        LD      C,1             ; Indica R#1
        LD      IX,WRTVDP       ; Indica funcao de escrita no VDP
        CALL    CALLBIOS        ; Executa funcao
        ; Turn on sprites
        LD      A,(RG8SAV)      ; Carrega R#8 em A
        AND     11111101b       ; Zera 2o. bit (Liga Sprites)
        LD      (RG8SAV),A      ; Salva alteracao no Byte
        LD      B,A             ; Carrega B com valor
        LD      C,8             ; Indica R#8
        LD      IX,WRTVDP       ; Chama funcao de escrita no VDP
        CALL    CALLBIOS        ; Executa
        ; Pattern Address
        LD      IX,CALPAT       ; Aponta funcao que acha tabela de patt
        XOR     A               ; Indica sprite 0
        CALL    CALLSUB         ; Chama subrom
        LD      (SPRPTR),HL     ; Grava em local adequado
        ; Attibutes Address
        LD      IX,CALATR       ; Indica funao que acha end de attr.
        XOR     A               ; Indica sprite 0
        CALL    CALLSUB         ; Chama SubRom
        LD      (SPRATT),HL     ; Grava no local adequado
        ; Colors Address
        XOR     A               ; Zera Cf
        LD      DE,512          ; Carrega 512 em DE
        SBC     HL,DE           ; Subtrai 512 de HL (HL agora = tab.de cores)
        LD      (SPRCOL),HL     ; Salva na RAM
        ; Initialize pattern
        LD      DE,0A000h       ; Aponta para endereco temporario
        LD      HL,SPRITES_PAT  ; Aponta para tabela
        LD      BC,8*2          ; Indica 16 bytes
        LDIR                    ; Copia
        LD      DE,(SPRPTR)     ; Aponta DE para tabela de padroes na VRAM
        LD      HL,0A000h       ; Aponta HL para inicio da tabela de padroes
        LD      BC,8*2          ; Indica 8 bytes*2sprites
        LD      IX,LDIRVM       ; Indica funcao de copia RAM->VRAM
        CALL    CALLBIOS        ; Executa funcao
        ; Initialize colors
        LD      DE,0A000h       ; Aponta para endereco temporario
        LD      HL,SPRITES_COL  ; Aponta para tabela
        LD      BC,16*2         ; Indica 16*2 bytes
        LDIR                    ; Copia
        LD      DE,(SPRCOL)     ; Aponta DE para tabela de cores na VRAM
        LD      HL,0A000h       ; Aponta HL para inicio da tabela de cores
        LD      BC,16*2         ; Indica 16bytes*2sprites
        LD      IX,LDIRVM       ; Indica funcao de copia da RAM->VRAM
        CALL    CALLBIOS        ; Executa
        ; Initialize Attributes
        LD      DE,0A000h       ; Aponta para endereco temporario
        LD      HL,SPRITES_ATT  ; Aponta para tabela
        LD      BC,4*2          ; Indica 8 bytes
        LDIR                    ; Copia
        LD      DE,(SPRATT)     ; Aponta DE para tabela de atributos na VRAM
        LD      HL,0A000h       ; Aponta HL para inicio da tabela de atributos
        LD      BC,4*2          ; Indica 4bytes*2sprites
        LD      IX,LDIRVM       ; Indica funcao de copia RAM->VRAM
        CALL    CALLBIOS        ; Executa
        RET                     ; Retorna...


;-----
; call BIOS function
; Entrada: IX - ponteiro para funcao da BIOS
;-----
CALLBIOS:
        LD      IY,(EXPTBL-1)   ; Slot da MainRom
        CALL    CALSLT          ; Chama rotina
        RET                     ; Volta...

;-----
; Call SUBROM function
; Entrada: IX - ponteiro para funcao da SubRom
;-----
CALLSUB:
        LD      IY,(EXBRSA-1)   ; Slot da SubRom
        CALL    CALSLT          ; Chama rotina
        RET                     ; Volta...


; Variaveis

SPRPTR:         DB      000h,000h
SPRATT:         DB      000h,000h
SPRCOL:         DB      000h,000h

;Sprites
SPRITES_PAT:
        DB      0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh ; contorno seta
        DB      0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh ; contorno seta
SPRITES_ATT:
        DB      06Ah,07Fh,000h,001h
        DB      06Ah,07Fh,001h,001h
SPRITES_COL:
        DB      001h,001h,001h,001h,001h,001h,001h,001h ; contorno da seta
        DB      001h,001h,001h,001h,001h,001h,001h,001h ;
        DB      001h,001h,001h,001h,001h,001h,001h,001h ; miolo da seta
        DB      001h,001h,001h,001h,001h,001h,001h,001h ;

        END     START

--- end code ----

     []'s Daniel Caetano ([EMAIL PROTECTED])

...IBM: Insolent Bickering Mal-der-mer
OS/2 Sites:     http://www.os2brasil.com.br/novidades/
                http://www.os2brasil.com.br/novidades/drivers.shtml
                http://www.geocities.com/SiliconValley/8752/os2hp/index.html
MSX Sites:      http://www.fudeba.cjb.net/ e http://www.msxnews.cjb.net/
MSX Phoenix:    http://www.msxphoenix.cjb.net/


****
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