Author Topic: Input Replacement Function Help  (Read 3840 times)

0 Members and 1 Guest are viewing this topic.

Offline neuronix

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 108
  • Rating: +0/-0
    • View Profile
Input Replacement Function Help
« on: July 05, 2016, 08:02:57 am »
I would like create an axe librairie to input replace input function, but my code doesn't work :(
This is my code:
Code: [Select]
..
.Adresse Var
8265→→°Num+2→→°Shift+2→→°ALock+2→→°Alpha

.Change Type Disp
1→Num
0→Shift
0→ALock
0→Alpha

.Data
Liste(33,34,26,18,35,27,19,36,28,20,0)→N
Liste(47,39,31,46,38,30,22,14,45,37,29,21,13,44,36,28,20,12,43,35,27,19,11,42,34,26,18,10,33,25,17,0)→A

Liste('0','1','2','3','4','5','6','7','8','9',0)→D
Liste('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','θ','"',' ',':','?',0)→E

Lbl BInput

.Parametres
°Alpha+2→→°XBox+2→→°YBox+2→→°MaxInput+2→→°OutPtr
r₁→XBox
r₂→YBox
r₃→MaxInput
L₁→OutPtr

For(A,0,MaxInput-1)
0→{OutPtr+A}
End

Repeat getKey(9) ou getKey(15)
 Output(XBox,YBox,"_"
 getKey(54)?Shift=0→Shift
 If getKey(48)
  If Shift
   1→ALock
   0→Num
  Else
   1→Alpha
   0→Num
  End
  If Alpha ou ALock
   0→Alpha
   0→ALock
   1→Num
  End
  0→Shift
 End
If YBox*16+XBox<MaxInput
 If ALock ou Alpha
  dansChaîne(A,getKey)→θ
  If θ
   Output(XBox,YBox,{E+θ-1}Frac
   →{YBox*16+XBox+OutPtr}
   XBox++
  End
 End
 If Num
  dansChaîne(N,getKey)→θ
  If θ
   Output(XBox,YBox,{D+θ-1}Frac
   →{YBox*16+XBox+OutPtr}
   XBox++
  End
 End
 If XBox=16
  YBox++
  0→XBox
 End
End
 Pause 500
 Output(XBox,YBox," "
 Pause 500
End
Return

And the code of the example program:
Code: [Select]
.INPUT
Goto A
prgmINPUTLIB
Lbl A
BInput(0,0,11)
Thank you in advance :)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Input Replacement Function Help
« Reply #1 on: July 05, 2016, 01:14:41 pm »
Wouldn't it be that your code is never run because you skip over it via 'Goto A'?
/e

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Input Replacement Function Help
« Reply #2 on: July 05, 2016, 03:05:08 pm »
Could you be more descriptive about how it doesn't work? Does it crash? Does it freeze? Does it produce unexpected output?

Wouldn't it be that your code is never run because you skip over it via 'Goto A'?

Axe doesn't have real library support, so you traditionally just import the "library" program at compile time like that and jump over all of it. It looks silly, but it's actually legit.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6266
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Input Replacement Function Help
« Reply #3 on: July 05, 2016, 03:06:51 pm »
Wouldn't it be that your code is never run because you skip over it via 'Goto A'?

Axe doesn't have real library support, so you traditionally just import the "library" program at compile time like that and jump over all of it. It looks silly, but it's actually legit.
Oh right, forgot to put my ASM hat back on and think about it that way. I'm so use to procedural style programming right now due to work.
/e