6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 15, 2024 7:12 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Dec 27, 2004 7:25 am 
Offline

Joined: Mon Dec 27, 2004 6:52 am
Posts: 3
I am confused when i use "stz" to clear memory that located in zero page in w65c02s instruction sets.
first I defined
year equ e4h
then .......
stz year
the confusion appeared.after compiled,the instruction opcode is "9c e5 00" rather than "64 e5"that i think reasonable.So when the program runs to this step stop will inevitably happen and notify "Error instruction (opcode)at address ....".But even the exactly same intruction sometimes is compiled normally and other times abnormally.
certainly,if using "lda ...,sta ..."replace it ,compiling process is ok,I don't understand why this happened.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 27, 2004 9:31 am 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Which assembler and emulator are you using? We might be able to help if you give us some more information.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 27, 2004 9:53 am 
Offline

Joined: Sun Aug 24, 2003 7:17 pm
Posts: 111
STZ in zero page is $64, otherwise $9c. I.e. both

64 e5

and

9c e5 00

are fine!

The only difference is that the first version saves one byte and is slightly faster.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Dec 27, 2004 7:54 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
The original message hints at two different problems.

1. Even though the 'year' constant is in the $00-$FF range the poster indicates that his assembler is generating an absolute rather than zero-page instruction.
Quote:
the confusion appeared.after compiled,the instruction opcode is "9c e5 00" rather than "64 e5"

This suggests assembler in use is in error or some other factor not visible in the short code sample is misdirecting the assembler.

2. The code appears to be being executed in some kind of emulator that does not support 65C02 opcodes. If this is the case then the poster should stick to the 6502 opcode set and configure his assembler to reject extended instructions.
Quote:
So when the program runs to this step stop will inevitably happen and notify "Error instruction (opcode)at address ....".


More information about the assembler and emulator in use might help determine what is going on here.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 28, 2004 6:49 am 
Offline

Joined: Mon Dec 27, 2004 6:52 am
Posts: 3
firstly thank you all.
basically,I know the difference of "64.." and "9c..." that generated from "STZ", and then that is my point I don't understand. "STZ YEAR" there should be correspondant to "64.."not "9c.."and so I think it is my assembler's fault.
The assembler i am making use, i think, may be not familiar to you.The IC , manufactured in taiwan, just use 6502 core and then use their own assembler.So I am not very confident to the assembler. [/b]


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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: