Re: [stella] need some quick software help...

Subject: Re: [stella] need some quick software help...
From: emooney@xxxxxxxxxxxxxxxx (Erik Mooney)
Date: Thu, 08 Jul 1999 04:03:10 GMT
>I'm playing with a couple of projects (yes Glenn, I *know* I should be
>working on the Superchip board! :) and I need some Quick&Dirty Code(tm)
>to send a square wave out the joystick port.  Does anyone have a code
>snippet that does this?  Or that simply sends out *anything*?  Maybe
>for the keypad controller?
>
>I know this is pretty easy to do, but I don't have time to re-invent the
>wheel.  :)  Actually, this fits in nicely with the recently discussed
>networking project...

Okay, took me about 4 minutes :)  Here's the code.. I'll email a binary to
Chris separately.  If someone sees a problem here, lemme know.  It should
generate a square wave on all four directional lines of both joysticks, at
about 1 KHz.  (there's 8 WSYNCs for each half-cycle, and the Atari scans
at something like 15.8 KHz IIRC.)  It's untested, of course, but it seems
too simple to fail.  (Yes, Nick, those are still your comments way back
from How to Draw a Playfield, which I still use as a skeleton for my code)

    include vcs2600.h
    org $F000
;RAM locations
Start
    SEI  ; Disable interrupts, if there are any.
    CLD  ; Clear BCD math bit.
    LDX  #$FF
    TXS  ; Set stack to top of RAM.
    LDA #0  ;Zero everything except VSYNC.
B1  STA 0,X
    DEX
    BNE B1
    DEX
    STX SWACNT  ;set data direction registers to output
    STX SWBCNT

bigloop
     LDA #$FF
     STA SWCHA
     STA SWCHB
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     LDA #$00
     STA SWCHA
     STA SWCHB
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     STA WSYNC
     jmp bigloop

;Starting positions for PC
    org $FFFC
    .word Start
    .word Start

--
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Current Thread