feat: #2 보수 연산을 적용한 Dualsonic 시리얼 파싱 로직 구현 #6

Merged
Ghost merged 1 commits from feature/serial-complement-parser into main 2025-05-08 16:37:35 +09:00
First-time contributor

듀얼소닉 카트리지 펌웨어는 시리얼 넘버를 다음 형식으로 입력받아 4바이트(32비트) 저장소에 저장하고 처리함

[sbcartsn  생산년도(2자리) + 생산월(2자리) + 카트리지 시리얼번호(6자리)]
ex) 2505123456 → 25년 5월 생산 / 시리얼번호 123456

시리얼 넘버 전체는 10자리 숫자

펌웨어는 10자리 시리얼 넘버를 16진수 방식으로 저장하고, 32비트 signed int로 출력하기 때문에
→ 22년도 시리얼인 2200000000 부터 상위 비트가 1로 해석되어 음수 처리가 발생 (21년도까지 괜찮음)

ex) 2200000000
내부 저장 시 : 0x83126E40
이진수 : 1000 0011 0001 0010 0110 1110 0100 0000
signed 32비트 출력 시 -2094967296으로 표시됨

따라서 100000000 에 해당하는 숫자 2^32 = 4294967296을 더해 관련 보수 처리를 하여 정상적인 값 복원 가능하게 해결함

듀얼소닉 카트리지 펌웨어는 시리얼 넘버를 다음 형식으로 입력받아 4바이트(32비트) 저장소에 저장하고 처리함 ``` [sbcartsn 생산년도(2자리) + 생산월(2자리) + 카트리지 시리얼번호(6자리)] ex) 2505123456 → 25년 5월 생산 / 시리얼번호 123456 ``` 시리얼 넘버 전체는 10자리 숫자 펌웨어는 10자리 시리얼 넘버를 16진수 방식으로 저장하고, 32비트 signed int로 출력하기 때문에 → 22년도 시리얼인 2200000000 부터 상위 비트가 1로 해석되어 음수 처리가 발생 (21년도까지 괜찮음) ``` ex) 2200000000 내부 저장 시 : 0x83126E40 이진수 : 1000 0011 0001 0010 0110 1110 0100 0000 signed 32비트 출력 시 -2094967296으로 표시됨 ``` 따라서 100000000 에 해당하는 숫자 2^32 = 4294967296을 더해 관련 보수 처리를 하여 정상적인 값 복원 가능하게 해결함
Ghost added 1 commit 2025-05-08 16:34:35 +09:00
Ghost reviewed 2025-05-08 16:35:20 +09:00
@ -19,3 +19,1 @@
Private Const PROSerialParsing As ULong = 111669149696
Private Const LUXSerialParsing As ULong = 0
Private Const ALPHASerialParsing As ULong = 412316860416
Private Const TwosComplement32Mask As Long = 4294967296
Author
First-time contributor

2^32 보수 처리를 위한 const 변수

2^32 보수 처리를 위한 const 변수
Ghost reviewed 2025-05-08 16:36:02 +09:00
@ -1054,1 +1052,3 @@
DataResult = SerialParsingFunc(ModelCode, DataResult)
If serial < 0 Then
serial += TwosComplement32Mask
End If
Author
First-time contributor

22년도 시리얼 부터 음수 처리가 되어
음수가 들어올 시 보수 처리

22년도 시리얼 부터 음수 처리가 되어 음수가 들어올 시 보수 처리
Ghost merged commit a413b16831 into main 2025-05-08 16:37:35 +09:00
Ghost deleted branch feature/serial-complement-parser 2025-05-08 16:37:35 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jionmt-sw/etc-prod-utility#6
No description provided.