Author Topic: CheckSums in Axe?  (Read 12670 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #15 on: September 17, 2010, 06:26:55 pm »
So what would you recommend?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #16 on: September 17, 2010, 07:24:19 pm »
Here's the source code and hex for the checksumming routine
Code: [Select]
  di
  in a,($06)
  push af
  ld hl,$0000
  ld bc,$0700
  jr go
ComeBack:
  in a,($02)
  bit 5,a
  jr nz,TI84P
  bit 7,a
  jr nz,TI83PSE
  ld bc,$1F18
  jr go
TI83PSE:
  ld b,$7F78
  jr go
TI84P:
  in a,($21)
  bit 0,a
  jr nz,TI84PSE
  ld bc,$3F34
  jr go
TI84PSE:
  ld bc,$7F74
go:
  ld a,b
  out ($06),a
  ld de,$4000
loopi:
  ld a,(de)
  add a,l
  ld l,a
  adc a,h
  sub l
  ld h,a
  inc de
  ld a,d
  cp $80
  jr c,loopi
  dec b
  ld a,c
  cp b
  jr c,go
  ld a,c
  or a
  jr z,ComeBack
  pop af
  out ($06),a
  ret
Code: [Select]
F3DB06F52100000100071821DB02CB6F200DCB7F200501181F18120678180EDB21CB47200501343F180301747F78D3061100401A856F8C9567137AFE8038F40579B838E979B728C4F1D306C9I've tested it and it doesn't crash. Note that it should be its own subroutine because it returns when it's done.
On my calc, it took a couple seconds to run (I enclosed it in an Axe program).
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: CheckSums in Axe?
« Reply #17 on: September 17, 2010, 08:36:45 pm »
There are built in MD5 bcalls by the way to validate apps, but that would probably be overkill anyway.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #18 on: September 18, 2010, 09:50:02 am »
Here's the source code and hex for the checksumming routine
Code: [Select]
 di
  in a,($06)
  push af
  ld hl,$0000
  ld bc,$0700
  jr go
ComeBack:
  in a,($02)
  bit 5,a
  jr nz,TI84P
  bit 7,a
  jr nz,TI83PSE
  ld bc,$1F18
  jr go
TI83PSE:
  ld b,$7F78
  jr go
TI84P:
  in a,($21)
  bit 0,a
  jr nz,TI84PSE
  ld bc,$3F34
  jr go
TI84PSE:
  ld bc,$7F74
go:
  ld a,b
  out ($06),a
  ld de,$4000
loopi:
  ld a,(de)
  add a,l
  ld l,a
  adc a,h
  sub l
  ld h,a
  inc de
  ld a,d
  cp $80
  jr c,loopi
  dec b
  ld a,c
  cp b
  jr c,go
  ld a,c
  or a
  jr z,ComeBack
  pop af
  out ($06),a
  ret
Code: [Select]
F3DB06F52100000100071821DB02CB6F200DCB7F200501181F18120678180EDB21CB47200501343F180301747F78D3061100401A856F8C9567137AFE8038F40579B838E979B728C4F1D306C9I've tested it and it doesn't crash. Note that it should be its own subroutine because it returns when it's done.
On my calc, it took a couple seconds to run (I enclosed it in an Axe program).

Ran it. It returns 0. Is that right, or is it not working?  And what var does it return into? How do I access it from Axe?
« Last Edit: September 18, 2010, 09:50:39 am by ACagliano »

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #19 on: September 19, 2010, 11:53:35 am »
Use it like this:
Code: [Select]
Disp sub(C)>Dec
Return
Lbl C
.ASM code from above
Use it as you would any other expression. (My example displays the checksum)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #20 on: September 19, 2010, 02:30:31 pm »
Excellent. And how would I save the result into an arbitrary appvar?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #21 on: September 19, 2010, 02:35:50 pm »
Supposing the appvar is called "appvCHECKSUM"
Code: [Select]
Return!If GetCalc("appvCHECKSUM",2)->X
sub(C)->{X}r
Note that this example doesn't check if the appvar already exists, and assumes subroutine C as above.
And again, the process takes a couple seconds.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #22 on: September 19, 2010, 02:44:32 pm »
thanks