Author Topic: Routines  (Read 317485 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #510 on: December 20, 2010, 12:31:14 am »
Very cool looking!
A pseudo-random question (out of curiosity only): Is it possible to modify the code so that when you call the subroutine(s), you can define how long you want your data to be?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Routines
« Reply #511 on: December 20, 2010, 12:53:09 am »
That would definitely be possible for the addition and subtraction routines, but I don't know how that would work with the decimal display routine. It works by having all the multiples of 10 that can fit in the data size you're using hardcoded into the routine. I could hardcode the multiples of 10 up to a very high amount and just hope the user doesn't exceed it, although that would probably be a bit wasteful, as I doubt most people would require most of the excess data.

But it's possible. Want me to try it?


Note: That question was pretty much rhetorical, because now I want to try this anyway. ;)
« Last Edit: December 20, 2010, 12:54:31 am by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #512 on: December 20, 2010, 12:56:45 am »
Cool Runer112, thanks for explaining. :)

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #513 on: December 20, 2010, 12:59:22 am »
A rhetorical response to a rhetorial question... I would like to announce 'FTW', but I can't come up with a way to word it...
Hmm...

It would be even cooler if you could mix and match the sizes, especially for addition and subtraction, allowing me to do things like add a 3 byte number to a 5 byte number...  And for completeness, something that could take an X byte number and truncate/pad it to a Y byte size number...

I'm not really sure how decimals would work with all that, though.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Routines
« Reply #514 on: December 20, 2010, 12:23:42 pm »
Wow.  This is great.  Thanks Runer! ;D

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Routines
« Reply #515 on: February 02, 2011, 04:15:55 pm »
Woo, necro. I thought I'd share my own custom input routine, coming in at ~360 bytes.(For some reason I've never liked input...). Anyway, it's very flexible and allows the use of ALPHA to toggle between caps, lowercase, and number input. Writes ASCII to the desired location in memory. Press Enter to "finish"
Code: [Select]
.A0

0->A->K->P->{pointer}^^r

Fill(pointer,max amount of characters+1)
DeltaList(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,0)->GDB0A
GDB0A->G
64->L
DeltaList(33,34,26,18,35,27,19,36,28,20,0)->GDB0N
[]->Str00
"ABC"[00]
"abc"[00]
"123"[00]

While K-9
getKey->K
!If -48
A+1->A
!If -3
->A
End
!If A
GDB0A->G
64->L
End
!If -1
GDB0A->G
96->L
End
!If -1
GDB0N->G
47->L
End
End

Text(0,58,A*4+Str00
If K
If inString(,G)
+L->{P+pointer}
If P-(max amount of characters-1)
P+1->P
0->{P+pointer+1}
End
End
End
Text(x position,y position,pointer

End
edit: here's a basic screenie
« Last Edit: February 02, 2011, 04:19:15 pm by squidgetx »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Routines
« Reply #516 on: February 02, 2011, 04:56:16 pm »
Nice.  Looks great. :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #517 on: February 02, 2011, 06:50:53 pm »
I don't understand what's the text at the bottom for ???

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Routines
« Reply #518 on: February 02, 2011, 07:30:42 pm »
It shows whether the current input mode is in caps (ABC), lowercase (abc), or numerical (123) :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #519 on: February 03, 2011, 12:56:51 am »
Oh ok, you should probably add text saying Mode: or something, so it is a bit more clear. :P

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Routines
« Reply #520 on: February 07, 2011, 07:24:24 am »
While messing around with my memory mapper I came across a way to basically use file objects in archive as pointers. This means that you can draw sprites from archive :o Unfortunately, it only works with nostub executables :(
Code: [Select]
Asm(DB0665)^256->theta //run this line at the beginning of the program and make sure that you don't touch theta ever)
...stuff
GetCalc("prgmBLA",Y1)
{degreeY1+2}Asm(7DD306)
.Now whenever you want to reference Y1...
Pt-On(X,Y,{degreeY1}r
.If you have more than one file object make sure that the last 7DD306 matches the one you are using.
...at the end of the program
thetaAsm(7DD306)
« Last Edit: February 07, 2011, 07:24:58 am by squidgetx »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Routines
« Reply #521 on: February 07, 2011, 11:46:44 am »
I think you might run into problems if the sprite data spans two pages.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Routines
« Reply #522 on: February 07, 2011, 06:01:23 pm »
Hm. Yeah, that's true. I guess it's not really very useful then lol XD

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Routines
« Reply #523 on: February 12, 2011, 02:09:28 am »
Should this be stickied now that there's more room?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Routines
« Reply #524 on: February 12, 2011, 07:40:10 pm »
You should probably sticky all the important threads I guess, now that it won't clutter the progress threads list anymore. Someone already did with this one, though.