Author Topic: GDB's  (Read 9924 times)

0 Members and 1 Guest are viewing this topic.

Offline XiiDraco

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 513
  • Rating: +32/-5
  • Forget the numbers, just call me, Recreation.
    • View Profile
    • Black-Lark Games
Re: GDB's
« Reply #15 on: October 25, 2013, 12:46:08 pm »
so like gdb1-> L1

then how would I add more? (values)
(wow this is confusing) >.<

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: GDB's
« Reply #16 on: October 25, 2013, 12:47:19 pm »
just use instead of the GDB your free ram space, L1.
What i always do is using instead of the GDB a variable, that also works.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline XiiDraco

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 513
  • Rating: +32/-5
  • Forget the numbers, just call me, Recreation.
    • View Profile
    • Black-Lark Games
Re: GDB's
« Reply #17 on: October 25, 2013, 12:49:41 pm »
oh wait so use it in he same way i would use gdb?
wos thats simple.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: GDB's
« Reply #18 on: October 25, 2013, 03:07:49 pm »
   the fundamental difference between "L1" and "GDB1" is that the first is a pointer to a static position in RAM that is guaranteed to be usable to any program that wants it while that program is running (this is not strictly true of the other "Ln" pointers, but it's the same basic idea) while the second is a pointer to a position within your program. when you "store a value to GDB1", axe inserts the data directly into your program somewhere at compile time and returns a pointer to its position within your program during run time. it would technically be possible to do the same with "L1", but storing data to that location at compile time would be completely useless. it would only exist on your calculator, not the calculators of anyone else who may want to run your program, and it would be overwritten on your calculator as soon as some other process decided to store data there. thus, axe ensures that "L1" can only be written to during runtime. what this means is that, in order to accomplish what you want, your data has to first be stored somewhere else (which could be inside your program, in an external appvar or program, or anywhere else on the calculator) and then copied over to the chunk of RAM starting at L1 for manipulation there.
   it is also possible to write to "GDB1" during runtime. bear in mind, though, that these pointers are pointing to a spot within your program itself, meaning that, if you write to an area outside of the space allotted for data at compile time, you will end up overwriting other things, including possibly even rewriting your own code as it executes. also, if your program is being executed directly from RAM, or if you are using a shell with writeback enabled, any changes you make to your program during runtime will be permanent, meaning that the next time the user launches your program he will be left using the values generated the last time it was run.

EDIT: syntax for the Copy( command, which you can use to copy a chunk of data into the space at one of the Ln vars
Code: [Select]
Copy(BUF) token: conj() Copies the 768 byte buffer to the main buffer. Same as Copy(BUF,L6,768)
Copy(BUF1,BUF2) token: conj() Copies the 768 byte buffer BUF1 to BUF2. Same as Copy(BUF1,BUF2,768)
Copy(PTR1,PTR2,SIZE) token: conj() SIZE bytes starting from PTR1 are copied to PTR2 onwards. 0 is not a valid SIZE.
Copy(PTR1,PTR2,SIZE)r token: conj() SIZE bytes ending at PTR1 are copied to PTR2 moving backwards. 0 is not a valid SIZE.
« Last Edit: October 25, 2013, 03:14:59 pm by shmibs »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: GDB's
« Reply #19 on: October 25, 2013, 05:23:10 pm »
[DATA -> L1

and just use L1 to call it.
We are talking about Axe. An open bracket is an open door to potential bugs and doesn't save any space in the compiled program, on ly in the source. It is only useful for people like Matref who code on a regular 83+ with not so much memory.

Other than that XiiR3CR34T10N, seems like you didn't really understand how pointer works. "GDB1->L1" seems like you somehow think that GDB1 and L1 are variables and that you actually store the content of GDB1 in L1. But the sentence I just wrote doesn't make any sence since GDB1 doesn't have any content, it is just a number. As shmibs said, to have the data "in" GDB1 to go to L1, you can use Copy. That would work for the initialisation of your "array". Then if you want to "add objects to your array", keep a variable that knows the number of elements in your "array" (you know what is its value at the beginning since you initialized the "array" yourself) and then, increment it when you "add" an element to the "array" and decrement it when you "remove" one. That variable will in fact be useful for two reasons. First, it helps you not go further than 768 bytes. It also gives you (after an easy addition) the pointer to the last element in the "array". And if you use a For loop for your code on your elements, it is not a bad idea to know where the For must end.

(offtopic, shmibs, you have 28 post ratings)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline XiiDraco

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 513
  • Rating: +32/-5
  • Forget the numbers, just call me, Recreation.
    • View Profile
    • Black-Lark Games
Re: GDB's
« Reply #20 on: October 27, 2013, 01:07:04 am »
Yeah, I just got how this all works when Shimbs just explained it. Thanks guys!

I'm still curious as to why the AND's (?) and OR's (?) aren't working in my program... :/

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: GDB's
« Reply #21 on: October 27, 2013, 03:15:00 am »
Those are bitwise operations in Axe.

In Basic, "4 and 2" equals "non-zero and non-zero" so it equals 1.

In Axe, "4 and 2" gives "100 and 010", and if you write this down, it gives:
100
010
000


So you might have a problem with your ANDs, depending on how and where you use them. To solve it, just to "4!=0 and (2!=0)" (where != is the "not equal to" sign).

Note that OR is bitwise too, but that doesn't cause that much problems in a If.
« Last Edit: October 27, 2013, 03:15:22 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: GDB's
« Reply #22 on: October 27, 2013, 04:06:41 am »
That's why ? and ?? were created. These are the logical AND and OR respectively.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: GDB's
« Reply #23 on: October 27, 2013, 05:16:18 am »
Hm, that should work, but I never used them that way. I basically use ? and ?? to put a if/else/end in one line, not to do boolean operations.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: GDB's
« Reply #24 on: October 27, 2013, 04:11:03 pm »
I also use them as a terneary operator though I should avoid it cause it's a major pita to maintain. ;)

Offline XiiDraco

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 513
  • Rating: +32/-5
  • Forget the numbers, just call me, Recreation.
    • View Profile
    • Black-Lark Games
Re: GDB's
« Reply #25 on: October 27, 2013, 05:24:40 pm »
Man I'f I can't figure out why ? and ?? Aren't working, I might as well just drop the contest...