Commodore 64 > Programmazione, Grafica e Musica

Hey Mamma, Guarda: Un Intro!

(1/4) > >>

iAN CooG:
 Lungi da me l'idea di essere considerato un demo-coder, ma basta poco davvero per mettere insieme un qualcosa che assomigli a un piccolo intro... il tutto fatto seguendo un tutorial e il solito PRG in formato testo a portata di mano.


--- Codice: ---;Little HF intro -=[iAN CooG/HokutoForce]=-
timer = $0700
*=$0801
        .byte $0b
        .byte $08
        .byte $be
        .byte $1b
        .byte $9e
        .byte $32
        .byte $30
        .byte $35
        .byte $39
        .byte $0
        lda #0    ; clear screen using black
        jsr $e536
        sei

; build timer table @ $0700
; 23 byte of code instead of 40 byte fixed table
        ldx #$00
        ldy #$00
tlp1    lda #$08    ; 08 08 08 08 08 08 01
        inx         ; x 5 times
        cpx #$08
        bne tok1
        lda #01
        sta $02
        ldx #0
tok1    sta timer,y
        iny
        cpy #$28
        bne tlp1

        ldx #$04       ; reset to 04xx to allow re-run of
        jsr patchstars ; the intro; can be omitted

        jsr starpattern
       ;now automodify the routine
       ;so next time only colours at $d800 are modified
        ldx #$d8
        jsr patchstars

       ;new irq
        lda #<irq
        sta $0314
        lda #>irq
        sta $0315

       ;ldx #$3b ; default values
       ;stx $d012
       ;stx irq+3

        lda $d011
        and #$7f
        sta $d011

        ldy #$27
prt     lda title,y
        sta $05e0,y
        dey
        bpl prt
        cli
spc     lda $dc01
        and #$10; space?
        bne spc
       ;rts
        sei
        jsr $fd15; reset vectors
        jsr $e536; cls in white (FD15 ret w/A=$31)
        dex
        stx $c6  ; leave no key in buffer
        cli
        rts      ; return to basic
;.................................
irq
        ldx #$00
        lda #$83
start
        cmp $d012
        bne start
        nop     ; wait some cycles
        nop     ; to make rasters more stable
        nop
        nop
        nop
        nop
loop
        ldy timer,x
        lda color,x
        sta $d020
        sta $d021

delay
        dey
        bne delay
        inx
        cpx #(endcolor-color)
        bne loop


;rotating raster : up-down
        lda endcolor-2
        sta $fe
        ldx #(endcolor-color-2)
rotr    lda color-1,x
        sta color  ,x
        dex
        bne rotr
        lda $fe
        sta color
;rotating raster : down-up
;        lda color
;        sta $02
;        ldx #00
; rotr   lda color+1,x
;        sta color  ,x
;        inx
;        cpx #(endcolor-color-1)
;        bne rotr
;        lda $02
;        sta endcolor-2

       ;---w8 some time
        lda $dc05
        cmp #$30
        bmi xirq
        ldx $02
        cpx #(endstar-starcolor)
        bne conts
        ldx #0
conts   lda starcolor,x
        jsr stars
        inx
        stx $02

xirq    jmp $ea31
;................................
starpattern
;connection lines
        ldx #$0f; grey
        lda #$21
        sta $0502
        stx $d902
        lda #$27
        sta $04B4
        stx $d8B4
        lda #$2C
        sta $0466
        stx $d866
        lda #$2D
        sta $0412
        sta $0413
        sta $0414
        sta $0415
        stx $d812
        stx $d813
        stx $d814
        stx $d815
        lda #$2E
        sta $04B3
        sta $043E
        stx $d8B3
        stx $d83E

       ; the 7 stars
        lda #$2A
stars
        sta $0411
        sta $0416
        sta $048D
        sta $04DA
stars2
        sta $052A
        sta $0553
        sta $057C

        rts

patchstars
        stx stars+2
        stx stars+2+3
        stx stars+2+6
        stx stars+2+9
        inx
        stx stars2+2
        stx stars2+2+3
        stx stars2+2+6
        rts
color  ; italian style r00lz;)
       .byte $02,$02,$02,$0a,$00,$02,$0a,$0f,$00
       .byte $02,$0a,$0f,$01,$00,$02,$0a,$0f,$01
       .byte $01,$01,$0f,$0d,$05,$00,$01,$0f,$0d
       .byte $05,$00,$0f,$0d,$05,$00,$0d,$05,$05,$05,$0
endcolor
starcolor
       .byte $06,$0e,$03,$01,$01,$07,$08,$09,$0b
endstar
           ;1234567890123456789012345678901234567890
title .scru "* HOKUTOFORCE: ITALY'S BRIGHTEST STARS *"
title_n

--- Termina codice ---
Usare sempre C64asm, soprattutto per la direttiva .SCRU che non trovo in nessun altro xasm

ice00:
 cosa fa la direttiva .SCRU ?

Alberto:
 se non sbaglio,la .SCRU prende i caratteri di una stringa e ne poka in memoria i codici schermo.

iAN CooG:

--- Citazione da: "Alberto" --- se non sbaglio,la .SCRU prende i caratteri di una stringa e ne poka in memoria i codici schermo.
--- Termina citazione ---
Esatto, fa la conversione in screencodes facendo prima l'uppercase della stringa ascii, usando .SCRL invece rispetta il lower/uppercase immesso.

MarC=ello:
 
--- Citazione ---Esatto, fa la conversione in screencodes facendo prima l'uppercase della stringa ascii, usando .SCRL invece rispetta il lower/uppercase immesso.
--- Termina citazione ---

Aiuto! Non ho capito (forse sarĂ  l'ora)...  :overkiller:

Buonanotte a tutti! :sonno:  

Navigazione

[0] Indice dei post

[#] Pagina successiva

Vai alla versione completa