[cc65] OT: Atari ML help

Date view Thread view Subject view

From: Shawn Jefferson (sjefferson_at_sd62.bc.ca)
Date: 2003-05-09 20:30:18


Hi,

I'm trying to write a VBI routine for the atari and for some reason it doesn't seem to be working.  Here it is:


            .export     _init_vbi, _alienptr
            .import     _aliens
            .include    "atari.inc"



_init_vbi:  lda #7                  ; deferred vblank
            ldx #>vbi               ; hi address of vbi routine
            ldy #<vbi               ; lo address of vbi routine
            jsr SETVBV              ; jump to os set vblank routine
            rts


vbi:        lda _charset            ; charset flag
            beq cs0 
            lda #$E0                ; charset1
            sta CHBAS
            lda #0                  ; change flag
            sta _charset
            jmp cont

cs0:        lda #$CC                ; charset0
            sta CHBAS
            lda #1                  ; change flag
            sta _charset


cont:       lda <_aliens            ; lo byte of aliens array
            sta _alienptr 
            lda >_aliens            ; hi byte of aliens array
            sta _alienptr+1

            ldx #10                ; 10 aliens 
loop:       ldy #1
            lda (_alienptr),y

            sec
            sbc #1                  ; nextmove--
            sta (_alienptr),y

nexta:      dex                     ; next alien
            beq exitvbi 

            clc 
            lda _alienptr           ; increment alienptr to next record
            adc #12
            bcc inclo
            inc _alienptr+1
inclo:      sta _alienptr
            jmp loop

exitvbi:    jmp XITVBV



    .zeropage

_charset:   .byte      0
_alienptr:  .word      0


The rountine is being set as the VBI vector, since I can see the charsets rotating on screen.  In the second half I am trying to loop through an array of 10 structures, decrementing one of the fields each time.  For some reason it isn't doing this... see anything wrong here?  The structures are 12 bytes long and _aliens the array of structs.

I did have a check to see if (_alienptr),1 was zero and if so decrement it, but I removed it just to eliminate that as a problem.

Thanks,
Shawn Jefferson


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-05-09 20:33:44 CEST