6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 10:11 pm

All times are UTC




Post new topic Reply to topic  [ 78 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
PostPosted: Mon Dec 12, 2022 7:37 pm 
Offline

Joined: Sun Aug 28, 2022 7:30 pm
Posts: 26
Thanks for your response Daryl, sorry for not responding sooner. It was for health reasons.

Honestly, before trying your AVR-based 6502 Emulator, I had tried to go ahead with the klaus's sytem , but I couldn't get into the command mode. When booting the system the monitor runs continuously and does not respond to enter command mode. I have asked for some help in http://forum.6502.org/viewtopic.php?f=8&t=2407&start=30. I didn't get too much.

The only thing I have achieved is that the debugger/monitor attends to a Break launched from TeraTerm, as can be seen below:
..........................
0.1FF 0.FFF9 00 x00 y00 NV-BDIZC H>
0.1FF 0.FFF8 00 x00 y00 NV-BDIZC H>
0.1FF 0.FFF7 00 x00 y00 NV-BDIZC H>
0.1FF
Terminal break signal detected

0.1FF 0.FFF1 00 x00 y00 NV-BDIZC H>
0.1FF 0.FFF0 00 x00 y00 NV-BDIZC H>
..................

On the other hand, continuing with your AVR-based 6502 Emulator, in a first phase, I would like to try your suggestion to read/write external memory in slow mode. Could you, please, give me some idea how to approach that in some code form?

Diego,


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 13, 2022 5:29 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1748
Location: Sacramento, CA
This example treats external memory as a data IO device. You cannot execute code from this memory.

First for the hardware, you could use PA and PB to create a 16 bit address bus. Use PC for the data bus. You can use pins on PD for the /OE and /WE. Set them as outputs and set them high initially.

To read an address in ext memory,
set PA and PB to outputs and PC to inputs.
write address values to PA and PB
bring the /OE pin low
Read PC
raise /OE

To write,
set PA, PB, and PC to outputs
write address values to PA and PB
write your data value to PC
bring the /WE pin low
raise /WE

For actual code, you'll need to Access the IO page and the specific IO port registers.
Port_A_DDR - $3F21
Port_A_Output - $3F22
Port_B_DDR - $3F24
Port_B_Output - $3F25
Port_C_DDR - $3F27
Port_C_Output - $3F28
Port_C_Input - $3F26
Port_D_DDR - $3F2A
Port_D_Output - $3F2B

OE - Pin D7
WE - Pin D6

To Read address $2345 in ext memory,:

LDA #$C0
STA Port_D_DDR
STA Port_D_Output ; OE and WE high

LDA #$FF
STA Port_A_DDR
STA Port_B_DDR
LDA #$00
STA Port_C_DDR
LDA #$23
STA Port_A_Output
LDA #$45
STA Port_B_Output
LDA #$40
STA Port_D_Output ; /OE low
LDA Port_C_Input
STA input_data ; read data from memory
LDA #$C0
STA Port_D_Output ; /OE High
RTS

That should gets you started.

If you want the emulator to see external RAM as its system RAM, then you need to do similar code in the AVR emulator engine to replace the internal SRAM access code. Be sure to decode the AVR IO page correctly. If you want to eliminate the Flash "ROM", then you'll need to preload the external RAM before you release the emulator from RESET.

best wishes!

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 20, 2022 8:07 pm 
Offline

Joined: Sun Aug 28, 2022 7:30 pm
Posts: 26
Thank you very much, Daryl. I'll work on it.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 78 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC


Who is online

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