gnacu / i2c6502

Implementation of the i2c serial bus protocol in 6502, for the Commodore 64
MIT License
9 stars 2 forks source link

Code compilation problem #1

Closed radius75 closed 2 weeks ago

radius75 commented 2 weeks ago

Hello,

I'm trying to run your code with my ds3231 on a C64C Pal. My ds3231 is functional, I use it under Geos and with programs written by Timo.V https://sites.google.com/site/dividedbit/home/c64-projects/ds1307-rtc

When compiling in 64tass.exe I have errors: obraz https://github.com/gnacu/i2c6502/blob/59015d7c4d7b744d47cf3c91cf2d494260c09d91/i2c6502.asm#L75 https://github.com/gnacu/i2c6502/blob/59015d7c4d7b744d47cf3c91cf2d494260c09d91/i2c6502.asm#L88 https://github.com/gnacu/i2c6502/blob/59015d7c4d7b744d47cf3c91cf2d494260c09d91/i2c6502.asm#L139 https://github.com/gnacu/i2c6502/blob/59015d7c4d7b744d47cf3c91cf2d494260c09d91/i2c6502.asm#L156

After removing the:$ff entries, the compilation completes without any other errors.

The operation of the program compiled in this way ends with the message FAILED TO GET RTC TIME

I connected SDA->pin E (PB2), SCL->pin F (PB3). https://github.com/gnacu/i2c6502/blob/59015d7c4d7b744d47cf3c91cf2d494260c09d91/i2c6502.asm#L14-L15

Can I get some advice? Regards Krzysztof

gnacu commented 2 weeks ago

The :$ff means XOR with $ff. Therefore it inverts the bits of the constant. So, the code won’t work correctly if you remove those. I would read the documentation of your assembler to learn what notation it uses for XOR (EOR) and change those :$ff instances to the right notation. Let me know how it goes!!

radius75 commented 2 weeks ago

Hi, Thanks for the tip. It compiled successfully, instead of :$ff it is ^$ff The assembler and its manual can be downloaded here: https://sourceforge.net/projects/tass64/ Regards Krzysztof

radius75 commented 1 week ago

Hi, I needed your code to build an RTC synchronization circuit. I have built a set that allows me to quickly synchronize the clock via USB/rs232 in Win7, for ds3231 and CMD fd-2000, using a .bat script. Bez tytułu2

mode com88:2400,n,8,1,p
@echo off  
set daysofweek=2,3,4,5,6,7,1 #1-Sunday,2-Monday etc...
for /F "skip=2 tokens=2-4 delims=," %%A in ('WMIC Path Win32_LocalTime Get DayOfWeek /Format:csv') do set daynumber=%%A  
for /F "tokens=%daynumber% delims=," %%B in ("%daysofweek%") do set day=%%B
echo .>\\.\com88
echo %time% :%day%.>\\.\com88

To be completely happy, I need a modified ds3231 Driver (for connection via pb2 and pb3) ds3231 for Geos. Do you also happen to have the source of this Driver from Timo V.? Otherwise I will have to reverse engineer this Drivers. :)

Regards

gnacu commented 1 week ago

I don’t have the source code to the GEOS driver. I asked Timo V. if I could have the source code to his READY prompt tools for reading and setting the datetime of the DS3231. He sent me the C-source code to those, and I ported them to 6502 assembly, which is what you find in this repository. You could just ask Timo directly, before you try to reverse engineer his GEOS driver.

radius75 commented 1 week ago

As you suggested, I tried to contact Timo on Lemon64. If I ever have a ready driver for Geos, I will link it here. After reading the description on https://c64os.com/post/i2c6502, I expanded the set to the 3in1 version. The case I have is spacious :) Regards. Bez tytułu2