how can 8 bit PC access 512byte of ROM
In SX28, the program memory is divided into 4 pages, each page is 512bytes. PA2, PA1, PA0 is for page selection. In the data sheet,
PA2:PA0 = 000 page 0
·············· 001 page 1
·············· 010 page 2
·············· 011 page 3
The MSB is essentially not used, so how can 8 bit PC can access 512 ROM? Thanks for help.
PA2:PA0 = 000 page 0
·············· 001 page 1
·············· 010 page 2
·············· 011 page 3
The MSB is essentially not used, so how can 8 bit PC can access 512 ROM? Thanks for help.
Comments
When a JMP instruction is executed address·bits 0 to 8 (9 bits) come from the instruction itself, bits 9-10 come from PA0 and PA1.
When a CALL or MOV PC,x is executed address bits 0 to 7 (8 bits) come from the instruction, bit 8 is always 0, bits 9-10 come from PA0 and PA1
This is why a subroutine must be in the first half of any code page (because bit 8 is always set to 0).
And why a MOV PC,x location must be in the first half of any code page (same reason).
I hope this make sense, it's kinda hard to explain...
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Teacher: What is the difference between ignorance and apathy ?
Student: I don't know and I don't care
Teacher: Correct !
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
As Bean explained, for a jump or call instruction, the target address is composed by the lower 9 bits in the instruction (or 8 bits for calls with the 9th bit always 0), and by the upper two bits PA1 and PA0 in the status register (for the SX48/52, three bits PA2...0 are used).
As long as program code is "linear", it is no problem when such code crosses page boundaries. Let's assume there is an instruction at program memory address $2FF. After this has been executed, the instruction at address $300 will be executed next because the "internal" program counter simply increments into the next page.
Be aware that it can cause much PIA when you perform a jmp instruction after such a "silent" page boundary crossing. You might assume it would not be a problem jumping to a target in page $300, following the example above. As the target address for a jmp is composed as mentioned before, you must make sure that the PA bits in the status register are set to page $300 prior to the jump. Otherwise, the jump will land in page $200.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
"one byte at a time"
Just teasing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College