Author Topic: Routines  (Read 313201 times)

0 Members and 2 Guests are viewing this topic.

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: Routines
« Reply #600 on: December 13, 2011, 03:17:28 am »
I made this fun little program and I wanted to share it because its awesome.  See if you can guess what shape it draws. ;D  
(Requires 1.1.0)

:.COOL
:.Allocate a 96x64 bitmap
:[6040]→Str1
:Buff(768)
:
:.Draw a single pixel on the screen
:ClrDraw
:Pxl-On(0,0)
:
:.Loop a few times
:1→C
:For(6)
:  .Turn the buffer into a bitmap
:  Copy(L6,Str1+2,768)
:
:  .Draw some bitmaps
:  Bitmap(C,0,Str1)
:  Bitmap(0,C,Str1)
:  
:  .Display and iterate
:  DispGraph
:  C*2→C
:End
:Pause 5000
« Last Edit: December 13, 2011, 03:25:55 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Routines
« Reply #601 on: December 13, 2011, 03:46:34 am »
Spoiler For guess:
Sierpinski-ish?
################################################################
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ##  ## 
#   #   #   #   #   #   #   #   #   #   #   #   #   #   #   #   
####    ####    ####    ####    ####    ####    ####    ####   
# #     # #     # #     # #     # #     # #     # #     # #     
##      ##      ##      ##      ##      ##      ##      ##     
#       #       #       #       #       #       #       #       
########        ########        ########        ########       
# # # #         # # # #         # # # #         # # # #         
##  ##          ##  ##          ##  ##          ##  ##         
#   #           #   #           #   #           #   #           
####            ####            ####            ####           
# #             # #             # #             # #             
##              ##              ##              ##             
#               #               #               #               
################                ################               
# # # # # # # #                 # # # # # # # #                 
##  ##  ##  ##                  ##  ##  ##  ##                 
#   #   #   #                   #   #   #   #                   
####    ####                    ####    ####                   
# #     # #                     # #     # #                     
##      ##                      ##      ##                     
#       #                       #       #                       
########                        ########                       
# # # #                         # # # #                         
##  ##                          ##  ##                         
#   #                           #   #                           
####                            ####                           
# #                             # #                             
##                              ##                             
#                               #                               
################################
# # # # # # # # # # # # # # # #
##  ##  ##  ##  ##  ##  ##  ## 
#   #   #   #   #   #   #   #   
####    ####    ####    ####   
# #     # #     # #     # #     
##      ##      ##      ##     
#       #       #       #       
########        ########       
# # # #         # # # #         
##  ##          ##  ##         
#   #           #   #           
####            ####           
# #             # #             
##              ##             
#               #               
################
# # # # # # # #
##  ##  ##  ## 
#   #   #   #   
####    ####   
# #     # #     
##      ##     
#       #       
########       
# # # #         
##  ##         
#   #           
####           
# #             
##             
#               
I feel like a computer now... :P

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Routines
« Reply #602 on: December 23, 2011, 03:12:23 pm »
I've seen some people wanting to use Text input routines, so here's the one I use in Axe Snake, SpiderAx, and Jump.  Press Second when done typing, del to backspace, and Clear to quit.
At the end of the routine, the string is null terminated and begins at L1.  It also Displays it again because I wanted to show how to display it and waits for you to press second again. :)

If you use this routine, you may credit me, but it is not necessary. ;D
so... I have been trying to use this, but would it be possible to store it in a string rather than a list?
I've tried L1->Str0, but it doesn't work when trying to do stuff like this: GatCalc("appvStr0",Y0)

...but, is that even possible?

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Routines
« Reply #603 on: December 23, 2011, 03:16:10 pm »
Maybe use Copy(?

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Routines
« Reply #604 on: December 23, 2011, 03:26:16 pm »
Maybe use Copy(?
hmmm, doesn't seem to work D:

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Routines
« Reply #605 on: December 23, 2011, 09:44:02 pm »
L₁→Str0 and GetCalc("Str0",Y₀) refer to two completely different Str0's. Assuming you want to get L₁ into Str0, as in if you were to type Str0 on the home screen, it would display the string at L₁, then:
Copy(L₁,GetCalc("Str0",length(L₁)→L),L)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Routines
« Reply #606 on: December 23, 2011, 10:26:14 pm »
Yeah it all depends on what you mean.  You say you want it to store into a string rather than a list, but it doesn't store the text to a list in the first place, it stores it directly to memory, at the location L1.  When you say string, we are not sure if you mean an Axe data string (Str0 GDB0 Pic0) or an OS string

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 #607 on: December 23, 2011, 10:35:45 pm »
Do you mean into an OS string?  If so, you will want to combine a couple of routines here.  If you just want to store it to the Axe variable, Str0, that's different.  For it, do Buff(17)->Str0 at the beginning of the program and then replace L1 in my routine with Str0.

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Routines
« Reply #608 on: December 23, 2011, 11:41:24 pm »
Do you mean into an OS string?  If so, you will want to combine a couple of routines here.  If you just want to store it to the Axe variable, Str0, that's different.  For it, do Buff(17)->Str0 at the beginning of the program and then replace L1 in my routine with Str0.
ah, ok. I'm trying to get it as an axe variable, and I need it to create an appvar with the selected name in the program.
However, I'm not understanding exactly what I need to do in order to do that. D:

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Routines
« Reply #609 on: December 23, 2011, 11:45:18 pm »
Is this what you want?
Code: [Select]
"appv"Buff(8)→Str0
Copy(L₁,Str0+1,8)
GetCalc(Str0,Y₀)

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Routines
« Reply #610 on: December 23, 2011, 11:49:53 pm »
Is this what you want?
Code: [Select]
"appv"Buff(8)→Str0
Copy(L₁,Str0+1,8)
GetCalc(Str0,Y₀)
Ahh, yes!!! it works! thanks! :D

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Routines
« Reply #611 on: January 31, 2012, 07:16:13 am »
http://ourl.ca/15074
A routine which draws a sprite scaled.
If you like my work: why not give me an internet?








Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Routines
« Reply #612 on: January 31, 2012, 08:56:42 am »
To make Serpinski's triangle, I am not sure if this is proper Axe code, but it is essentially how I do it in other languages where I have such fun screen access (and it does not use another buffer):
Code: [Select]
0→A
ClrDraw
Repeat getKey(15
If A≤95
A++
Pxl-On(A,0            ;Axe use (X,Y), right?
End
DispGraph
L6+767→C-12→D
For(756)
{C--} xor {D--}→{C}
End
End
That isn't nearly as fast as it could be, but I'm not too good with Axe XD

EDIT: THe screenie isn't the above Axe program (it is in another language)
EDIT2: calc84maniac gave some optimisation tricks (using For(756) and {C--} for example)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Routines
« Reply #613 on: January 31, 2012, 09:37:52 am »
http://ourl.ca/15074
A routine which draws a sprite scaled.
I think this got lost in the threads of time, but meishe91, DJ_O, and Quigibo came up with some really neat scalers (for partial sizes, even) on this page: http://ourl.ca/60160




Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Routines
« Reply #614 on: January 31, 2012, 02:34:18 pm »
http://ourl.ca/15074
A routine which draws a sprite scaled.
I think this got lost in the threads of time, but meishe91, DJ_O, and Quigibo came up with some really neat scalers (for partial sizes, even) on this page: http://ourl.ca/60160
Cool! I haven't seen that one before. I wrote my routine at school today, because I was bored :)
If you like my work: why not give me an internet?