Offline
Tokyo, Japan

I just had a bit of a brainwave which might be useful for logones users. 2 questions

Basically logones is a set of ten "screens" is this extendable or is it a hard limit? could logones use 20 or 30 or 40 screens if I created extra .nam files?

Second, at the moment A and B cycle through the screens. Is there a little code modification to make logones automatically cycle through the screens, either as a loop or ping pong?

Reason for asking is this would effectively make logones into a simple NES animation tool. You could make one .nam. load it into, YYCHR or whatever, alter it slightly, save the new one, load it, alter it etc, to create "frames" of animation rather than static screens.

Offline
rochester, ny

yeah this would be really easy to do actually. one second.

Offline
rochester, ny

i'm sure it could have been done better but hey, it works.

with logones, pressing select stops the screen from scrolling, if it is. it still does that but now, if you HOLD SELECT and then TAP START, the screens will start animating. it goes through each screen and then starts back over at the beginning. to turn the animation off, hold select and tap start again. pretty easy.

scroll down through the code until you see "NMI:". a few lines down from that you should see a little note i made that says "change this number to change the speed of the animation". the number right now is "#$20". that's hexadecimal so change that to whatever number you want between 00 and FF to change the speed at which it animates. smaller numbers are faster. change it to #$01 for hyperspeed.

just copy this quote into a text file and save it in the logones folder as logones.asm, replacing the one that's already there.

;       ----------------------------------------------------

;    logoNES - version 0.1
;    Copyright 2010 Don Miller
;    For more information, visit: http://www.no-carrier.com

;    This program is free software: you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation, either version 3 of the License, or
;    (at your option) any later version.

;    This program is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.

;    You should have received a copy of the GNU General Public License
;    along with this program.  If not, see <http://www.gnu.org/licenses/>.

;       ----------------------------------------------------

NewButtons = $41
OldButtons = $42
JustPressed = $43
ScreenNumber = $44
OldScreen = $45
PaletteNumber = $46

scroll_h = $c0
scroll_v = $c4

scroll_dir = $d0

cc_toggle = $d1
PalNumber = $d2
PalCounter =$d3
Color0 = $d4
Color1 = $d5
Color2 = $d6
Color3 = $d7

animation_timer = $d8
animation_on_off = $d9

;       ----------------------------------------------------

        .ORG $7ff0
Header:                         ; 16 byte .NES header (iNES format)
    .DB "NES", $1a
    .DB $02                 ; size of PRG ROM in 16kb units
    .DB $01            ; size of CHR ROM in 8kb units
    .DB #%00000000        ; mapper 0
    .DB #%00000000        ; mapper 0
        .DB $00
        .DB $00
        .DB $00
        .DB $00
        .DB $00
        .DB $00
        .DB $00
        .DB $00

        .ORG $8000

;       ----------------------------------------------------

Reset:                          ; reset routine
        SEI
        CLD
    LDX #$00
    STX $2000
    STX $2001
    DEX
    TXS
      LDX #0
      TXA
ClearMemory:
    STA 0, X
    STA $100, X
    STA $200, X
    STA $300, X
    STA $400, X
    STA $500, X
    STA $600, X
    STA $700, X
        STA $800, X
        STA $900, X
        INX
    BNE ClearMemory

;       ----------------------------------------------------

        LDA #$00                ; setting up variables
        STA ScreenNumber
        STA PaletteNumber
        sta scroll_h
        sta scroll_v
        sta scroll_dir
        sta cc_toggle

    LDA #$FF
    sta animation_timer

    LDA #$00
    sta animation_on_off

        lda #6                  ; lower this number to increase
        sta PalNumber           ; the speed of the color cycle
        sta PalCounter

        lda #$01                ; these are the 4 colors
        sta Color0              ; that will cycle when you
        lda #$11                ; hit the "start" button
        sta Color1
        lda #$21
        sta Color2
        lda #$31
        sta Color3

;       ----------------------------------------------------

    LDX #$02                ; warm up
WarmUp:
    BIT $2002
    BPL WarmUp
    DEX
    BNE WarmUp

           LDA #$3F
    STA $2006
    LDA #$00
    STA $2006
        TAX
LoadPal:                        ; load palette
        LDA palette, x
        STA $2007
        INX
        CPX #$10
        BNE LoadPal

    LDA #$20
    STA $2006
    LDA #$00
    STA $2006

    LDY #$04                ; clear nametables
ClearName:
    LDX #$00
    LDA #$00
PPULoop:
    STA $2007
    DEX
    BNE PPULoop

    DEY
    BNE ClearName

;       ----------------------------------------------------

        LDA #<pic0              ; load low byte of first picture
        STA $10

        LDA #>pic0              ; load high byte of first picture
        STA $11

;       ----------------------------------------------------

        JSR DrawScreen          ; draw initial nametable
        JSR LoadScreen
        JSR DrawScreen2          ; draw initial nametable
        JSR Vblank              ; turn on screen

;       ----------------------------------------------------

InfLoop:                        ; loop forever, program now controlled by NMI routine

        JMP InfLoop

;       ----------------------------------------------------

LoadNewPalette:
           LDX PaletteNumber       ; load palette lookup value
        LDY #$00
        LDA #$3F
    STA $2006
    LDA #$00
    STA $2006
LoadNewPal:                     ; load palette
        LDA palette, x
        STA $2007
        INX
        INY
        CPY #$10
        BNE LoadNewPal
        RTS

;       ----------------------------------------------------

DrawScreen:

       LDA #$20                ; set to beginning of first nametable
        STA $2006
        LDA #$00
        STA $2006

        LDY #$00
        LDX #$04

NameLoop:                       ; loop to draw entire nametable
        LDA ($10),y
        STA $2007
        INY
        BNE NameLoop
        INC $11
        DEX
        BNE NameLoop

        RTS

;       ----------------------------------------------------

DrawScreen2:

       LDA #$28                ; set to beginning of first nametable
        STA $2006
        LDA #$00
        STA $2006

        LDY #$00
        LDX #$04

NameLoop2:                       ; loop to draw entire nametable
        LDA ($10),y
        STA $2007
        INY
        BNE NameLoop2
        INC $11
        DEX
        BNE NameLoop2

        RTS

;       ----------------------------------------------------

Vblank:                         ; turn on the screen and start the party
    BIT $2002
    BPL Vblank

        LDX scroll_h
        STX $2005
        LDX scroll_v
        STX $2005

    LDA #%10001000
    STA $2000
        LDA #%00001110
    STA $2001

        RTS

;       ----------------------------------------------------

LoadScreen:

        LDA #%00000000          ; disable NMI's and screen display
    STA $2000
       LDA #%00000000
       STA $2001

        LDA ScreenNumber

Test0:
        CMP #0                  ; compare ScreenNumber to find out which picture / palette to load
        BNE Test1
        LDA #<pic0              ; load low byte of picture
        STA $10
        LDA #>pic0              ; load high byte of picture
        STA $11
        LDA #$00
        STA PaletteNumber       ; set palette lookup location
        RTS

Test1:
        CMP #1
        BNE Test2
        LDA #<pic1
        STA $10
        LDA #>pic1
        STA $11
        LDA #$10
        STA PaletteNumber
        RTS

Test2:
        CMP #2
        BNE Test3
        LDA #<pic2
        STA $10
        LDA #>pic2
        STA $11
        LDA #$20
        STA PaletteNumber
        RTS

Test3:
        CMP #3
        BNE Test4
        LDA #<pic3
        STA $10
        LDA #>pic3
        STA $11
        LDA #$30
        STA PaletteNumber
        RTS

Test4:
        CMP #4
        BNE Test5
        LDA #<pic4
        STA $10
        LDA #>pic4
        STA $11
        LDA #$40
        STA PaletteNumber
        RTS

Test5:
        CMP #5
        BNE Test6
        LDA #<pic5
        STA $10
        LDA #>pic5
        STA $11
        LDA #$50
        STA PaletteNumber
        RTS

Test6:
        CMP #6
        BNE Test7
        LDA #<pic6
        STA $10
        LDA #>pic6
        STA $11
        LDA #$60
        STA PaletteNumber
        RTS

Test7:
        CMP #7
        BNE Test8
        LDA #<pic7
        STA $10
        LDA #>pic7
        STA $11
        LDA #$70
        STA PaletteNumber
        RTS

Test8:
        CMP #8
        BNE Test9
        LDA #<pic8
        STA $10
        LDA #>pic8
        STA $11
        LDA #$80
        STA PaletteNumber
        RTS

Test9:
        LDA #<pic9
        STA $10
        LDA #>pic9
        STA $11
        LDA #$90
        STA PaletteNumber
        RTS

;       ----------------------------------------------------

ControllerTest:

        LDA NewButtons
    STA OldButtons

        LDX #$00
    LDA #$01        ; strobe joypad
    STA $4016
    LDA #$00
    STA $4016
ConLoop:
    LDA $4016        ; check the state of each button
    LSR
    ROR NewButtons
        INX
        CPX #$08
        bne ConLoop

    LDA OldButtons          ; invert bits
    EOR #$FF
    AND NewButtons
    STA JustPressed



        ;button ( 0 0 0 0 0  0  0 0 )
        ;layout ( R L D U St Sl B A )

CheckSelect:
    LDA #%00000100
    AND OldButtons
    BEQ CheckStart

        lda #$00
        sta scroll_dir          ; stops scrolling

    LDA #%00001000
    AND JustPressed
    BEQ CheckLeft

        lda animation_on_off
        eor #$01
        sta animation_on_off           ; toggles animation
    jmp CheckLeft

CheckStart:
    LDA #%00001000
    AND JustPressed
    BEQ CheckLeft

        lda cc_toggle
        eor #$01
        sta cc_toggle           ; toggles color cycling

CheckLeft:
    LDA #%01000000
    AND JustPressed
    BEQ CheckRight

        lda #3
        sta scroll_dir          ; scrolls left

CheckRight:
    LDA #%10000000
    AND JustPressed
    BEQ CheckDown

        lda #4
        sta scroll_dir          ; scrolls right

CheckDown:
    LDA #%00100000
    AND JustPressed
    BEQ CheckUp

        lda #2
        sta scroll_dir          ; scrolls down

CheckUp:
    LDA #%00010000
    AND JustPressed
    BEQ CheckB

        lda #1
        sta scroll_dir          ; scrolls up

CheckB:
    LDA #%00000010
    AND JustPressed
    BEQ CheckA

    DEC ScreenNumber        ; decrement screen number here
        BPL CheckA
    LDA #9                    ; equal to total # of screens, starting from 0
    STA ScreenNumber

CheckA:
    LDA #%00000001
    AND JustPressed
    BEQ EndDrawChk

    INC ScreenNumber        ; increment screen number here
        LDA ScreenNumber
    CMP #10                    ; equal to total # of screens +1, starting from 0
    BNE EndDrawChk
    LDA #0
    STA ScreenNumber

EndDrawChk:
    LDA ScreenNumber        ; has screen number changed? if not, skip redraw
    CMP OldScreen
    BEQ CheckOver

        JSR LoadScreen          ; turn off and load new screen data
        JSR LoadNewPalette      ; load new palette
        JSR DrawScreen          ; draw new screen
        JSR LoadScreen          ; turn off and load new screen data
        JSR DrawScreen2         ; draw new screen
        JSR Vblank              ; turn the screen back on

CheckOver:

        RTS

;       ----------------------------------------------------

ScrollCheck:
        LDA scroll_dir
ScrollUp:
        CMP #1
        BNE ScrollDown
        INC scroll_v
        lda scroll_v
        cmp #240
        bne ScrollOver
        lda #0
        sta scroll_v
        JMP ScrollOver
ScrollDown:
        CMP #2
        BNE ScrollLeft
        DEC scroll_v
        LDA scroll_v
        cmp #255
        bne ScrollOver
        lda #239
        sta scroll_v
        JMP ScrollOver
ScrollLeft:
        CMP #3
        BNE ScrollRight
        INC scroll_h
        JMP ScrollOver
ScrollRight:
        DEC scroll_h
ScrollOver:
        JMP Scroll_Done

;       ----------------------------------------------------

color_cycle:

    DEC PalCounter            ; decrement counter, skip if not 0
        BNE NoCycling

    LDA Color3                 ; rotate the color values
    LDX Color0
    STA Color0
        LDA Color1
        STX Color1
        LDX Color2
        STA Color2
    STX Color3

    LDA #$3F                ; point to palette, the last three values of
    STA $2006               ; the fourth background palette - does not
    LDA #$0d                ; overwrite color zero (see readme.txt)
    STA $2006

    LDA Color1              ; write the rotated palette to the PPU
    STA $2007
    LDA Color2
    STA $2007
    LDA Color3
    STA $2007

    LDA PalNumber
    STA PalCounter

NoCycling:
        jmp cc_over

;       ----------------------------------------------------

NMI:

    LDA ScreenNumber        ; save old screen number for later compare
    STA OldScreen

    lda animation_on_off
    cmp #$00
    beq more_nmi_stuff

    inc animation_timer
    lda animation_timer
    cmp #$20            ; change this number to change the speed of the animation
    bne more_nmi_stuff
    lda #0
    sta animation_timer
    inc ScreenNumber
    lda ScreenNumber
    cmp #10
    bne more_nmi_stuff
    lda #0
    sta ScreenNumber

more_nmi_stuff:

        JSR ControllerTest      ; check for user input
        lda cc_toggle
        beq no_cc
        jmp color_cycle
no_cc:
        JSR LoadNewPalette
cc_over:
        LDA scroll_dir
    cmp #$00
        BEQ Scroll_Done

    jmp ScrollCheck



Scroll_Done:
        lda scroll_h
        sta $2005
        lda scroll_v
        sta $2005

        RTI
IRQ:
        RTI

;       ----------------------------------------------------

palette:                        ; palette data
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$01,$11,$21 ; palette 0 - aligns with pic0.nam below
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 1 - alings with pic1.nam below
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 2 - aligns with you know what below...
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 3
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 4
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 5
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 6
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 7
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 8
        .byte $0F,$00,$10,$30,$0F,$05,$26,$30,$0F,$13,$23,$33,$0F,$1C,$2B,$39 ; palette 9

;       ----------------------------------------------------

                                ; include picture data

pic0:
        .INCBIN "pic0.nam"      ; logoNES 0.1 splash screen by enso, 2009 - http://enso.tumblr.com
pic1:
        .INCBIN "pic1.nam"     
pic2:
        .INCBIN "pic2.nam"
pic3:
        .INCBIN "pic3.nam"
pic4:
        .INCBIN "pic4.nam"
pic5:
        .INCBIN "pic5.nam"
pic6:
        .INCBIN "pic6.nam"
pic7:
        .INCBIN "pic7.nam"
pic8:
        .INCBIN "pic8.nam"
pic9:
        .INCBIN "pic9.nam"

;       ----------------------------------------------------

    .ORG $fffa              ; vectors
    .DW NMI
    .DW Reset
    .DW IRQ

Last edited by nickmaynard (Nov 19, 2012 6:44 am)

Offline
Tokyo, Japan

Le wow! That was fast. I'm away from my pc for a bit but when I get back on in a few days I will open yychr and have a play!

Is it possible to use more than ten .nam "frames"?

Offline
IL, US

well, since you want to animate, why not use NESflix?

Offline
Tokyo, Japan

Im already pretty comfortable with YYCHR and Shirus nes tool thing and you dont need to convert the frames. Also if you do something with an animated gif I assume you will get little imperfections and distortions if the gif isnt PERFECT nes graphic spec. Animations with logones should be really crisp.

Mosre optjons are always good!

Offline
Lexington, KY

Upload some videos if you end up making anything!

Offline
rochester, ny
Lazerbeat wrote:

Le wow! That was fast. I'm away from my pc for a bit but when I get back on in a few days I will open yychr and have a play!

Is it possible to use more than ten .nam "frames"?

yeah, you're only limited by the mapper you use, i think. with a basic nrom mapper, you get either 16k or 32k to work with and each nametable is 960 bytes.

Offline
rochester, ny

but there are different mappers that would allow for more frames, yeah.

Offline
Tokyo, Japan

I FINALLY had a bit of time to sit down and fiddle with this for a bit. It is super fun. I am basically thinking of making little abstract animation to make glitchy transitions between litewall / glitchnes. or to make borders to overlay on scrollnes.

Thanks huge amounts nick!