Re: [stella] Fishing for comments

Subject: Re: [stella] Fishing for comments
From: "Andrew Davie" <adavie@xxxxxxxxxxx>
Date: Tue, 2 Jul 2002 18:11:42 +1000
"the Accumulator
(usually called A) that can hold sixteen bits of information, and is
involved
in all the math the chip does, and X and Y each of which can also hold
16 bits/2 bytes of information."

Nope.  All registers on 6502 are 8-bits.
It is possible to access 16-bit memory through pairs of 8-bits in the form
low byte, high byte - giving a 16-bit address.  Various instructions use
this -

Absolute addressing
eg: lda $2000        ; load a byte from location hexadecimal 2000 (8192
decimal)

Zero-page addressing
eg: lda $80            ; load a byte from location $80 (128 decimal).  This
is the first byte of RAM

Absolute indexed addressing
eg: lda $2000,x        ; load a byte from location hexadecimal 2000 + x,
where x is the 8-bit value in the X register

Indirect indexed, y
eg: lda (0),y            ; load a byte from location formed by the two bytes
at 0,1 (in low, high format) added to the 8-bit value in the Y register

There are various other ways, but the above give the general idea.

Registers are 8-bit only.  Loading and storing from anywhere is also 8-bit
only.  Addresses are 8 or 16 bits.  8-bit addresses are also known as 'zero
page' because the high-byte of the (imaginary) 16-bit address for these is
always 0.  Accesssing 16-bit locations in other areas of memory (ie: not
zero page) is done through pairs of bytes in low, high format.  Indexing is
the process of adding the contents of an index register (x or y) to an
8-or-16 bit address, and grabbing a byte from that location - which may also
turn out to be either 8 or 16 bits.  :)


Cheers
A



----- Original Message -----
From: <KirkIsrael@xxxxxxxxxxxxx>
To: <stella@xxxxxxxxxxx>
Sent: Tuesday, July 02, 2002 12:29 PM
Subject: [stella] Fishing for comments


>
> So I revamped thin red line, and got myself a missile
> that (gasp) isn't the height of the screen! And you can
> move it where ever you want with the joystick! I'm so
> happpy.  It actually came together pretty well, and my
> kernal is somewhat reminiscent of a real kernel, in keeping
> track of the height of the missile and all.
>
> So any suggestions re: blatant inefficiencies are welcome.
> Also, how do you do a logical NOT?
> I'm a little worried I'm playing a little fast and loose
> with what I'm putting in VBLANK, but the controller still
> seems to work...
>
>
> --snip--
> ; yet another moving dot by Kirk Israel
>
> processor 6502
> include vcs.h
> org $F000
>
> YPosFromBot = $80;
> VisibleMissileLine = $81;
>
> ;generic start up stuff...
> Start
> SEI
> CLD
> TXS
> LDX #$FF
> LDA #0
> ClearMem
> STA 0,X
> DEX
> BNE ClearMem
> LDA #$00
> STA COLUBK
> LDA #33
> STA COLUP0
>
> LDA #80
> STA YPosFromBot ;Initial Y Position
>
> LDA #$20
> STA NUSIZ0 ;Quad Width
>
>
> ;VSYNC time
> MainLoop
> LDA  #2
> STA  VSYNC
> STA  WSYNC
> STA  WSYNC
> STA  WSYNC
> LDA  #43
> STA  TIM64T
> LDA #0
> STA  VSYNC
>
>
> ;Main Computations; check down, up, left, right
> ;general idea is to do a BIT compare to see if
> ;a certain direction is pressed, and skip the value
> ;change if so
>
> LDA #$10 ;Down?
> BIT SWCHA
> BNE SkipMoveDown
> INC YPosFromBot
> SkipMoveDown
>
> LDA #$20 ;Up?
> BIT SWCHA
> BNE SkipMoveUp
> DEC YPosFromBot
> SkipMoveUp
>
>
> ;assum horiz position will be zero
> LDX #$00
>
> LDA #$40 ;Left?
> BIT SWCHA
> BNE SkipMoveLeft
> LDX #$10
> SkipMoveLeft
>
> LDA #$80 ;Right?
> BIT SWCHA
> BNE SkipMoveRight
> LDX #$F0
> SkipMoveRight
>
> STX HMM0 ;set the move for missile 0
>
> WaitForVblankEnd
> LDA INTIM
> BNE WaitForVblankEnd
> LDY #191
>
> STA VBLANK
>
> STA WSYNC
> STA HMOVE
>
> ;main scanline loop...
> ScanLoop
> STA WSYNC
>
> ; here the idea is that VisibleMissileLine
> ; is zero if the line isn't being drawn now,
> ; otherwise it's however many lines we have to go
>
> CheckActivateMissile
> CPY YPosFromBot
> BNE SkipActivateMissile
> LDA #8
> STA VisibleMissileLine
> SkipActivateMissile
>
> ;turn missile off then see if it's turned on
> LDA #0
> STA ENAM0
> ;
> ;if the VisibleMissileLine is non zero,
> ;we're drawing it
> ;
> LDA VisibleMissileLine
> BEQ FinishMissile
> IsMissileOn
> LDA #2
> STA ENAM0
> DEC VisibleMissileLine
> FinishMissile
>
>
> DEY
> BNE ScanLoop
>
> LDA #2
> STA WSYNC
> STA VBLANK
> LDX #30
> OverScanWait
> STA WSYNC
> DEX
> BNE OverScanWait
> JMP  MainLoop
>
> org $FFFC
> .word Start
> .word Start
>
> --snip--
>
> --
> KirkIsrael@xxxxxxxxxxxxx    http://kisrael.com
> "If anyone disagrees with anything I say, I am quite prepared not only to
> retract it, but also to deny under oath that I ever said it." --T. Lehrer
>
>
> --------------------------------------------------------------------------
--------------------
> Archives (includes files) at http://www.biglist.com/lists/stella/archives/
> Unsub & more at http://www.biglist.com/lists/stella/
>
>

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


Current Thread