[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Stack Pointer Problem on 65816
- Subject: Stack Pointer Problem on 65816
- From: "Bryan Parkoff" <spam>
- Date: Sun, 15 Jun 2003 19:33:31 -0500
- Newsgroups: comp.sys.apple2
- Xref: archiver1.google.com comp.sys.apple2:31267
I tried to push processor status register into stack before it goes into
Accumulator register. Then it is popped out of the stack. I get weird
error message on ProDOS. The error message are "type file mismatch","out of
memory".
I use processor status register to convert into base 2 binary. Here is
my sample code.
2000: A9 C1 LDA #C1 ; Load 0xC1
2002: 08 PHP ; Push Processor Status
into Stack
2003: A3 01 LDA 01,S ; Load Processor Status into
Accumulator from Stack
2005: 28 PLP ; Pop Processor Status
out of Stack
2006: A0 07 LDY #07 ; Load 0x07 into Y Register
2008: 48 PHA ; Push 0xC1 into Stack
2009: 68 PLA ; Pop ASL 0x?? out of
Stack
200A: 0A ASL ; ASL 0xC1
200B: 48 PHA ; Save ASL 0x?? into
Stack
200C: 90 02 BCC 2010 {+02} ; If Even then goto 2010
200E: B0 04 BCS 2014 {+04} ; If Odd then goto 2014
2010: A9 B0 LDA #B0 ; Load Zero into
Accumulator
2012: 80 02 BRA 2016 {+02} ; Always goto 2016
2014: A9 B1 LDA #B1 ; Load One into
Accumulator
2016: 9D 00 50 STA 5000,X ; Ignore it **It is to store
in memory instead of screen**
2019: E8 INX ; Ignore it **It
is to increase X Register into memory
201A: 20 ED FD JSR FDED ; Print 00110000 into screen
201D: 88 DEY ; Decrease Y
Register until it reaches zero
201E: 10 E9 BPL 2009 {-17} ; If it reaches zero then it
won't goto back to 2009
2020: 60 RTS ; End of program
After reviewing my code, I suspect that Stack is not in proper balance.
Please make any corrections for me. Thanks...
Bryan Parkoff