Help i need to create a program and i dont know how

Let's talk about anything related to the 6502 microprocessor.
Amenofhis
Posts: 31
Joined: 21 Nov 2008

yeah

Post by Amenofhis »

Shift the bit, left to right right to left but still i dont find anything, the thing is today but i have nothing ill ask for few more days but still i dont have anything that xplain or gave a example to do for the LSR ASL
Amenofhis
Posts: 31
Joined: 21 Nov 2008

I made this

Post by Amenofhis »

I made this prog but still is not the same of what i want. this is a decrease thing. i got to work im taking example from this but still not getting it.

.ORG $0200

DELAY:

LDX #$64
STX $0005
Img DEC $0005
PHP
JSR Dito1
PLP
BNE Img
RTS

Dito1:

LDX #$01
log2: LDY #$01
log1: DEY
BNE log1
DEX
PHP
JSR log3
PLP
BNE log2


log3:
LDX #$FF
STX $0010
micro2 DEC $0010
PHP
JSR mic2
PLP
BNE micro2
RTS

mic2:

LDX #$FF
log4: LDY #$FF
log5: DEY
BNE log5
DEX
BNE log4
RTS
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Re: yeah

Post by kc5tja »

Amenofhis wrote:
Shift the bit, left to right right to left but still i dont find anything, the thing is today but i have nothing ill ask for few more days but still i dont have anything that xplain or gave a example to do for the LSR ASL
A link to the W65C02 programmer's manual was provided in an earlier response which fully explains the operation of these instructions, with examples, and even pictures, provided. The manual assumes the reader has positively zero knowledge of assembly language programming at all, let alone of the 6502 in particular.

However, remember that visualization of a program's output is hardware specific; so, to actually display something, even once you figure out your solution, you'll want to refer to the programming documentation suitable for your environment. For example, writing to the display on a Commodore 64 is very different from an Atari 800, because the screens use different character sets and base addresses, and it's different still from Kowalski's 6502 simulator.

So, to repeat a question from before, it would be helpful to know which 6502 environment you are using. :)
Amenofhis
Posts: 31
Joined: 21 Nov 2008

Hum

Post by Amenofhis »

Hum thanks but i download the document u gave me has 469 pages but i didnt find what i want a example like i got here because the program i use to emulate is call macroassambler & Emulartor from Michal Kalwaski

from this webpage http://home.pacbell.net/michal_k/

im looking for a example same as i post before to start with.
Nightmaretony
In Memoriam
Posts: 618
Joined: 27 Jun 2003
Location: Meadowbrook
Contact:

Post by Nightmaretony »

phillhs wrote:
Nightmaretony wrote:
shit the bit across multiple screen locations in a smooth scroll.
I'm sure you mean SHIFT the bit :) :) :)

Phill.
thanks, no brain that morning...

lda #"N"
sta $0200
lda #"O"
sta $0201
lda #"B"
sta $0202
lda #"R"
sta $0203
lda #"A"
sta $0204
lda #"I"
sta $0205
lda #"N"
sta $0206
lda #"F"
sta $0207
lda #"O"
sta $0208
lda #"R"
sta $0209
lda #"T"
sta $020A
lda #"O"
sta $020B
lda #"N"
sta $020C
lda #"Y"
sta $020D
"My biggest dream in life? Building black plywood Habitrails"
Nightmaretony
In Memoriam
Posts: 618
Joined: 27 Jun 2003
Location: Meadowbrook
Contact:

Re: I made this

Post by Nightmaretony »

Amenofhis wrote:
I made this prog but still is not the same of what i want. this is a decrease thing. i got to work im taking example from this but still not getting it.

.ORG $0200

DELAY:

LDX #$64
STX $0005
Img DEC $0005
PHP
JSR Dito1
PLP
BNE Img
RTS

Dito1:

LDX #$01
log2: LDY #$01
log1: DEY
BNE log1
DEX
PHP
JSR log3
PLP
BNE log2


log3:
LDX #$FF
STX $0010
micro2 DEC $0010
PHP
JSR mic2
PLP
BNE micro2
RTS

mic2:

LDX #$FF
log4: LDY #$FF
log5: DEY
BNE log5
DEX
BNE log4
RTS

ok, so what is the reasoning for using mic and log and micro for your routine labels?
"My biggest dream in life? Building black plywood Habitrails"
bgaarsoe
Posts: 7
Joined: 08 Mar 2004
Location: Park City, UT

Another Example

Post by bgaarsoe »

It may already be too late for you, but here is another short example with comments (Too bad about the formatting. Everything gets squished. :cry: ):

.ORG $200

XDELAY .EQU 155 ;THESE DETERMINE DELAY DURATION
YDELAY .EQU 155 ;FIDDLE WITH THESE TO GET THE RIGHT DELAY
ADELAY .EQU 5

SCREENMEM .EQU $7000 ;YOUR SCREEN MEM LOCATION


MAIN LDA #%10000000 ;STARTING BIT IMAGE
SHIFTRIGHT LDX #7 ;SHIFT COUNTER
SHIFTRIGHTLP STA SCREENMEM ;DISPLAY THE BIT PATTERN
JSR DELAY ;CALL DELAY ROUTINE
DEX
BEQ SHIFTLEFT
LSR A ;SHIFT THE BIT RIGHT
JMP SHIFTRIGHTLP
SHIFTLEFT LDX #7 ;SHIFT COUNTER
SHIFTLEFTLP STA SCREENMEM ;DISPLAY BIT PATTERN
JSR DELAY ;CALL DELAY ROUTINE
DEX
BEQ SHIFTRIGHT
ASL A ;SHIFT THE BIT LEFT
JMP SHIFTLEFTLP


DELAY PHA ;SAVE CURRENT REGISTER VALUES
TAY
PHA
TXA
PHA
LDA #ADELAY
YRESET LDY #YDELAY
XRESET LDX #XDELAY
XLOOP DEX
BNE XLOOP
DEY
BNE XRESET
SEC ;DECREMENT THE A REGISTER
SBC #1 ;NOTE: 65C02 HAS A "DEC A" COMMAND FOR THIS
BNE YRESET
PLA ;RESTORE ORIGINAL REGISTER VALUES
TXA
PLA
TYA
PLA
RTS
Last edited by bgaarsoe on Fri Dec 19, 2008 5:58 am, edited 1 time in total.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
(Too bad about the formatting. Everything gets squished. :cry:
Put [co de] and [/co de] around the section, removing the space I put in the middle to keep them from doing their thing. To make sure you got your spacing and vertical alignment the way you intended before posting, click "Preview".
bgaarsoe
Posts: 7
Joined: 08 Mar 2004
Location: Park City, UT

Post by bgaarsoe »

Thanks, Garth. It was too late to edit it, so here it is again:

Code: Select all

               .ORG     $8000

XDELAY         .EQU     155           ;CONSTANTS: USED IN THE DELAY LOOP TO DETERMINE DELAY DURATION
YDELAY         .EQU     155           ;FIDDLE WITH THESE TO GET THE RIGHT DELAY.
ADELAY         .EQU     5

SCREENMEM      .EQU     $7000         ;THIS NEEDS TO BE YOUR SCREEN MEM LOCATION.


MAIN           LDA      #%10000000    ;STARTING BIT IMAGE
SHIFTRIGHT     LDX      #7            ;SHIFT COUNTER
SHIFTRIGHTLP   STA      SCREENMEM
               JSR      DELAY         ;CALL DELAY ROUTINE
               DEX
               BEQ      SHIFTLEFT
               LSR      A             ;SHIFT THE BIT RIGHT
               JMP      SHIFTRIGHTLP
SHIFTLEFT      LDX      #7            ;SHIFT COUNTER
SHIFTLEFTLP    STA      SCREENMEM
               JSR      DELAY         ;CALL DELAY ROUTINE
               DEX
               BEQ      SHIFTRIGHT
               ASL      A             ;SHIFT THE BIT LEFT
               JMP      SHIFTLEFTLP



;***** THREE-LEVEL DELAY LOOP--A=OUTER LOOP COUNTER, Y=MIDDLE LOOP COUNTER, X=INNER LOOP COUNTER ******

DELAY          PHA                    ;SAVE THE CURRENT REGISTER VALUES ON THE STACK
               TAY
               PHA
               TXA
               PHA
               LDA      #ADELAY
YRESET         LDY   	#YDELAY
XRESET         LDX   	#XDELAY
XLOOP          DEX
               BNE   	XLOOP
               DEY
               BNE   	XRESET
               SEC
               SBC   	#1            ;NOTE: 65C02 HAS A "DEC A" COMMAND FOR THIS. 
               BNE   	YRESET
               PLA                    ;RESTORE REGISTER VALUES FROM THE STACK
               TXA
               PLA
               TYA
               PLA
               RTS
Last edited by bgaarsoe on Fri Dec 19, 2008 6:01 am, edited 4 times in total.
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
It was too late to edit it, so here it is again:
You should always be able to go back and edit your own posts, but you'll have to be logged in or the "Edit" button won't show.
bgaarsoe
Posts: 7
Joined: 08 Mar 2004
Location: Park City, UT

Post by bgaarsoe »

GARTHWILSON wrote:
Quote:
It was too late to edit it, so here it is again:
You should always be able to go back and edit your own posts, but you'll have to be logged in or the "Edit" button won't show.
Thanks again, Garth.
Post Reply