It is currently Sun Jun 17, 2018 3:09 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Yay my first program.
PostPosted: Tue Feb 26, 2008 5:04 pm 
Offline
User avatar

Joined: Tue Jul 03, 2007 1:49 pm
Posts: 970
Got of my lazy ass and started programming. 15-30 min later I had a program that could display green (had some problems) special thanks to the guy that made the init code on the wiki BOOdaw and Bunnyboy.

code is here: http://rafb.net/p/J1kgB593.html

edit: slightly more noob friendly code here: http://rafb.net/p/jugLRR33.html


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 27, 2008 6:28 pm 
Offline
User avatar

Joined: Tue Jul 03, 2007 1:49 pm
Posts: 970
sorry they took it down, put it up as soon as I have acces to the computer that has it stored.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 1:14 pm 
Offline
User avatar

Joined: Tue Jul 03, 2007 1:49 pm
Posts: 970
Code:
        .inesprg    1
        .ineschr    0
        .inesmir    1
        .inesmap  0
   
   .org $8000
   .bank 0

reset:
    sei        ; ignore IRQs
    cld        ; disable decimal mode
    ldx #$40
    stx $4017  ; disable APU frame IRQ
    ldx #$ff
    txs        ; Set up stack
    inx        ; now X = 0
    stx $2000  ; disable NMI
    stx $2001  ; disable rendering
    stx $4010  ; disable DMC IRQs

    ; Optional (omitted):
    ; Set up mapper and jmp to further init code here.

    ; First of two waits for vertical blank to make sure that the
    ; PPU has stabilized
vblankwait1: 
    bit $2002
    bpl vblankwait1

    ; We now have about 30,000 cycles to burn before the PPU stabilizes.
    ; Use it to clear RAM.  X is still 0...
    txa
clrmem:
    sta $000,x
    sta $100,x
    sta $200,x
    sta $300,x
    sta $400,x
    sta $500,x
    sta $600,x
    sta $700,x  ; Remove this if you're storing reset-persistent data
    inx
    bne clrmem
   
vblankwait2:
    bit $2002
    bpl vblankwait2

chngbkr:
   lda #$3F
   sta $2006 ;first we write the upper byte of the ppu adress we want to ;write to in this case $3F00
   lda #$00
   sta $2006 ;now we write the lower byte #$00
   lda #$2a ;value green = #$2a
   sta $2007 ;ppudata
   lda #%00001000
   sta $2001 ;main screen turn on

loop:

   jmp loop

      ;!The Vector Table!
       .bank 1
   .org   $FFFA
   .dw      0 ;(NMI_Routine)
   .dw      reset  ;(Reset_Routine)
   .dw      0 ;(IRQ_Routine)





Last edited by Jeroen on Fri Sep 17, 2010 5:33 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 03, 2008 3:14 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2149
Location: Minneapolis, Minnesota, United States
Good work as your first program. Now try and do something with graphics or sound.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 2:47 pm 
Offline
User avatar

Joined: Tue Jul 03, 2007 1:49 pm
Posts: 970
I did actually. As the people on the irc channel know. I made a program with a moveable sprite. kinda confused on sound though :-/


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 04, 2008 4:00 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2149
Location: Minneapolis, Minnesota, United States
Yeah, sound really confused me at first. There are still things I don't quite understand about sound. But if you just mess around with it, you will eventually figure it out. Here, look at this code:

Code:
   lda #$01
   sta $4015
   lda #$1F
   sta $4000
   lda #$08
   sta $4001
   lda #$4D
   sta $4002
   lda #$55
   sta $4003


You can place this somewhere to make a short low tone. You can edit the value of what's going into $4002 and bits 0-2 of what's going into $4003 to make the pitch different. If you want to see the values you can store into the registers to get pitch perfect notes, refer to my document:

http://www.freewebs.com/the_bott/NotesTable.txt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group