Page 1 of 2
Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Tue Mar 22, 2016 7:15 pm
by doragasu
AFAIK, the 68k at the hardware level, cannot read a single byte: if you want to read a byte, it reads a full 16-bit word, but keeps only the relevant 8 bits (the upper or lower byte). But when writing to the cart, it can write bytes: we have LDSW line to write the lower part (at an odd address) and UDSW line to write the upper part (at an even address). I know that you can read and write bytes the following way (because my WiFi cart works like this):
Code: Select all
TYPE | ADDRESS | DATA | [LU]DSW
=====|=========|========|=========
WR | bN...N1 | D[0-7] | LDSW
RD | bN...N1 | D[0-7] | N/A
This works using odd addresses. I'm wondering how should I do this if I want to read and write to an even address... would it be like this?
Code: Select all
TYPE | ADDRESS | DATA | [LU]DSW
=====|=========|=========|=========
WR | bN...N0 | D[0-7] | UDSW
RD | bN...N0 | D[8-15] | N/A
Or maybe like this?
Code: Select all
TYPE | ADDRESS | DATA | [LU]DSW
=====|=========|=========|=========
WR | bN...N0 | D[8-15] | UDSW
RD | bN...N0 | D[8-15] | N/A
Or maybe none of these?
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Tue Mar 22, 2016 9:19 pm
by Sik
Use either of the two signals as if it was an extra address line, then when reading use the same value on both bytes. I don't recall how the 68000 behaves when writing (did it write the same byte twice too? if so you can get away with just an 8-bit bus altogether). Note that this would force you to use only byte accesses though (much like with Z80 RAM), for allowing word accesses too you'll need something more complex.
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Fri Mar 25, 2016 12:56 am
by HardWareMan
Is it real so hard to look into M68K UM?
![Image](http://savepic.ru/9133393.png)
LDS - Lower Data Strobe: CPU use D0-D7
UDS - Upper Data Strobe: CPU use D8-D15
LWR = LDS | R/W
UWR = UDS | R/W
Any questionas?
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Fri Mar 25, 2016 3:19 pm
by doragasu
HardWareMan wrote:Is it real so hard to look into M68K UM?
Could you please point me to a manual? Searching the net, I can easily find the m68k programmer manual, but it does not deal with hardware, just programming details.
Also there is something that does not match my observations... In the diagram, #LDS is active (low) for odd addresses (A0 = 1) and #UDS is active for even addresses (A0 = 0). But
as I wrote here, I have observed (using a logic analyzer) just the opposite: #LDSW is lowered for even addresses, and #UDSW is lowered for odd addresses.
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Fri Mar 25, 2016 5:22 pm
by Sik
doragasu wrote:#LDSW is lowered for even addresses, and #UDSW is lowered for even addresses.
![Confused :?](./images/smilies/icon_confused.gif)
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Fri Mar 25, 2016 8:50 pm
by doragasu
Sik wrote:doragasu wrote:#LDSW is lowered for even addresses, and #UDSW is lowered for even addresses.
![Confused :?](./images/smilies/icon_confused.gif)
Edited and corrected
![Wink :wink:](./images/smilies/icon_wink.gif)
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 5:06 am
by HardWareMan
doragasu wrote:Could you please point me to a manual? Searching the net, I can easily find the m68k programmer manual, but it does not deal with hardware, just programming details.
Because you must search M68K User Manual, not M68K Programming Manual.
doragasu wrote:Also there is something that does not match my observations... In the diagram, #LDS is active (low) for odd addresses (A0 = 1) and #UDS is active for even addresses (A0 = 0). But
as I wrote here, I have observed (using a logic analyzer) just the opposite: #LDSW is lowered for even addresses, and #UDSW is lowered for odd addresses.
M68K is big endian. And where you find A0?
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 7:28 am
by Sik
Internal signal (the LSB of whatever address it's trying to access, as it'd appear in the registers).
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 1:47 pm
by Eke
doragasu wrote:
as I wrote here[/url], I have observed (using a logic analyzer) just the opposite: #LDSW is lowered for even addresses, and #UDSW is lowered for odd addresses.
Seems like you are confused, from what you wrote in the post you linked, you actually observed the opposite i.e
UDSW being lowered for even addresses, which is indeed correct behavior
doragasu wrote:
I was wrongly assuming that when writing to even addresses, #LDSW was active, but it is #UDSW line the one that is lowered! I
Also note that when doing a word write, both signals are asserted, although technically the address is even (A0=0 internally).
Actually, those signals are just strobes that indicate which part of the data bus (low or high) hold valid data, as documented below from the 68k User Manual.
![68k_strobe.jpg](./download/file.php?id=38&sid=b7dbdaa6d50e290672d5de975b87784d)
- 68k_strobe.jpg (47.11 KiB) Viewed 15572 times
68k being a BIG Endian CPU, high byte (D8-D15) is stored at even address (ADDR) and low byte (D0-D7) is stored at odd address (ADDR + 1) where ADDR is address on external bus (VA1-VA23).
And to be nitpicking, there aren't any signals named #LDSW or #UDSW, there are #UDS, #LDS and #RW controlled by 68k CPU then #LWR and #UWR which are generated by VDP using 68k signals.
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 2:53 pm
by doragasu
HardWareMan wrote:doragasu wrote:Could you please point me to a manual? Searching the net, I can easily find the m68k programmer manual, but it does not deal with hardware, just programming details.
Because you must search M68K User Manual, not M68K Programming Manual.
No m68k manuale here (neither on the links below).
doragasu wrote:Also there is something that does not match my observations... In the diagram, #LDS is active (low) for odd addresses (A0 = 1) and #UDS is active for even addresses (A0 = 0). But
as I wrote here, I have observed (using a logic analyzer) just the opposite: #LDSW is lowered for even addresses, and #UDSW is lowered for odd addresses.
M68K is big endian. And where you find A0?[/quote]
As Sik wrote, A0 is internal (I suppose that's the reason it has an asterisk on the diagram you posted). It's the bit 0 of the address you write on your code.
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 3:04 pm
by doragasu
Eke wrote:Seems like you are confused, from what you wrote in the post you linked, you actually observed the opposite i.e UDSW being lowered for even addresses, which is indeed correct behavior
You are right, I was confused, and what I observed matches the diagram HardwareMan posted. I'm feeling a bit stupid, as I double checked the thing before posting (looks like both times I checked it wrong). Also the table you posted sums it all.
Thanks all for the info, and sorry for being so dumb.
BTW, did another search using Google instead of DuckDuckGo, and the User Manual appeared on the second entry... DuckDuckGo has still much to improve.
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sat Mar 26, 2016 4:24 pm
by Sik
Searching the filenames is easier! =/
M68000PRM.pdf = programmer manual
MC68000UM.pdf = user manual
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sun Mar 27, 2016 5:15 am
by HardWareMan
Sik wrote:Searching the filenames is easier! =/
M68000PRM.pdf = programmer manual
MC68000UM.pdf = user manual
Sure, but you must to know them first, isn't it?
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Sun Mar 27, 2016 8:50 pm
by doragasu
The easiest way is
providing the download URL
It's curious, I repeated searching "M68K User Manual" using Bing, and the manual does neither appear. It looks like only Google hits it...
Re: Reading and writing bytes. Addresses, data, LDSW and UDSW...
Posted: Mon Mar 28, 2016 8:00 am
by HardWareMan
doragasu wrote:The easiest way is
providing the download URL
It's curious, I repeated searching "M68K User Manual" using Bing, and the manual does neither appear. It looks like only Google hits it...
There are no M68K CPU. There is only 68000 or M68000 CPUs.