Author Topic: Routines  (Read 313280 times)

0 Members and 1 Guest are viewing this topic.

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 #195 on: March 28, 2010, 01:23:02 am »
Mhmm I really have absolutely no clue what the code is doing x.x, I would like to specify which part I don't understand, but I just understand nothing, not even how the data looks like in the appvar x.x

Offline mapar007

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 550
  • Rating: +28/-5
  • The Great Mata Mata
    • View Profile
Re: Routines
« Reply #196 on: March 28, 2010, 07:07:42 am »
I think it does this:

(assuming you mean the ASM part)

Basically, it creates an appvar (removes it first if it existed) with the size specified in the first two bytes of savesscreen, and the name by the 9 bytes at HL. Then it returns a pointer (in HL) to the data start of the appvar. There you can start writing data.

The load routine works analogously.
I assume HL always points to ans in Axe, and (savesscreen); (savesscreen+1) contains the value of A? (sorry if I'm wrong, I didn't bother checking)




SirCmpwn's example does just that: it supplies the name of an appvar in ans, then length in A, next, it creates an appvar, storing the pointer to A. Then he writes to the location A is pointing to.
(I assume {A} is a pointer dereference operator)


EDIT: SirCmpwn, would you be so kind to remove the commented-out lines in your listing (code+hex) files next time? No offense intended, but it's a bit harder to read IMO.
« Last Edit: March 28, 2010, 07:13:55 am by mapar007 »

SirCmpwn

  • Guest
Re: Routines
« Reply #197 on: March 28, 2010, 12:08:34 pm »
Sorry about the comments.
Let me walk you guys through the code.  For future reference, you should know that A is at savesscreen and that Ans is in HL.
Code: [Select]
rst rmov9toop1 ; Moves the string at HL to OP1
bcall ChkFindSym ; Looks to see if it already exists
jr c, Continue ; If it doesn't exist, jump to Continue
bcall delvararc ; If it does, delete it
Continue:
ld hl, (savesscreen) ; Load A into HL for the size
bcall CreateAppVar ; Create the variable
ex de, hl ; Swap HL with DE (DE is a pointer to the data location)
inc hl ; The first two bytes of any variable are the length, so move past it
inc hl ; And return a pointer to the first data byte.
Here is the load routine:
Code: [Select]
Start:
rst rmov9toop1 ; Move the string in Ans (HL) to OP1
bcall ChkFindSym ; And look to see if it exists
jr nc, Continue ; If it exists, skip to Continue
ld hl, 0 ; If it doesn't exist, load 0 into Ans (HL)
jr End ; And skip to the end of the routine
Continue:
ex de, hl ; If it does, swap HL with DE (DE is pointer to data)
inc hl ; Move past the size bytes
inc hl ; And return a pointer in Ans
End:

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 #198 on: March 28, 2010, 12:33:52 pm »
@Sir I meant the entire code actually, including Axe. I now understand what {A} does, though, after a talk with Quigibo. {A} == LA(1), {A+1} == LA(2), etc, or something similar. I don't get the lenght thing, though.
« Last Edit: March 28, 2010, 12:35:42 pm by DJ Omnimaga »

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 #199 on: March 28, 2010, 03:07:36 pm »
@Sir I meant the entire code actually, including Axe. I now understand what {A} does, though, after a talk with Quigibo. {A} == LA(1), {A+1} == LA(2), etc, or something similar. I don't get the lenght thing, though.
Length just means how big the appvar is. Make sure not to use data outside the appvar, or you might corrupt other things.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Routines
« Reply #200 on: March 28, 2010, 03:26:58 pm »
This is also what makes the AppVar so sick. :D
You specify how many BYTES there are.
Each byte is a number up to 255 so...

WIN!

(This is in comparison to normal TI-BASIC lists.)
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







SirCmpwn

  • Guest
Re: Routines
« Reply #201 on: March 28, 2010, 03:28:32 pm »
At least one person is grateful for the routine...

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Routines
« Reply #202 on: March 28, 2010, 03:35:46 pm »
Easy there, SirCmpwn.

You're cool.
And, you're very good at programming.
But, you're starting to sound like you have a condescending tone towards us.

Not cool.
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







SirCmpwn

  • Guest
Re: Routines
« Reply #203 on: March 28, 2010, 09:17:19 pm »
Woah, I'm totally not trying to be condecending.  I apologize if I am, and I will definately try to be better about it.
I think Omnimaga is one of the best calculator based forums out there, and by no means do I look down on it.

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 #204 on: March 28, 2010, 11:23:40 pm »
@calc84 thanks for the clarification

@sircmpwn I was not being ungrateful toward the routine. I think it's even very good. I was just confused at how it worked.

Offline LordConiupiter

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 339
  • Rating: +3/-0
  • Just one of the thousands of Axe-fans...
    • View Profile
Re: Routines
« Reply #205 on: March 29, 2010, 02:07:59 am »
I have written an Input routine in Axe for inputting strings. It is attached to this post, and here is the code in plain text:

Code: [Select]
:.INPUT
:DiagnosticOff
:"'WRMHC ?θVQLGV .ZUPKFC∟ YTOJEBX→Str88
:"XSNIDAA[i]e[/i]
:"?→Str89
:0→Q→L→F+1→T
:Repeat Q
:Lbl GK
:0→K+9→T
:Repeat K
:Pause 100
:getKey→K
:T+1→T
:!If T^10-1
:Output(L,0,224+F►Frac
:End
:!If T^20-1
:Output(L,0," 
:1→T
:End
:End
:If K=15
:ClrHome
:0→L
:Goto GK
:End
:If K=54
:F+1→F
:F≠4*F→F
:Goto GK
:End
:ReturnIf K=9
:{Str88+K-10}→{Str89+L
:For(P,0,L
:Output(P,0,{Str89+P}►Frac
:End
:L+1→L
:End
Generated by SourceCoder, © 2005 Cemetech
« Last Edit: March 29, 2010, 01:30:33 pm by LordConiupiter »
everytime that I was down, you would always come around, and get my feedback on the ground. (modified part from 'Seasons in the sun')

No matter how many errors are bothering you, always try to stay rel-Axe!

The HoMM project will be resumed as soon Axe 1.0.0 will be released!
Projects:
Code: [Select]
HoMM:   [==--------]    Project 'resumed': I'm suffering overwhelming new ideas being popped up in my dreams :P
tiDE:   [----------]    Explored and understood the main part of the code: just started writing a Tokenizer.



password of the week: uvanapererubupa (Any pronunciation is the right one ;) )   :D click me, and you'll be raided :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 #206 on: March 29, 2010, 02:23:46 pm »
Ooh nice, might be useful for highscore saving :D

Offline LordConiupiter

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 339
  • Rating: +3/-0
  • Just one of the thousands of Axe-fans...
    • View Profile
Re: Routines
« Reply #207 on: April 05, 2010, 02:35:34 pm »
yes, and for saving games with a non-standard name :P
I created a sprite editor in basic, with 8x8 and 16x16 size support, and a routine in Axe to draw 16x16 sprites.

A small explanation:
The draw routine draws a sprite from the data stored in Pic1 and the 24 bytes after its standard 8 bytes.
It just copies the sprite in couples of 2 bytes (r) to the plotSScreen (L6) in a For loop
after that it Draws the buffer to the screen with a simple DispGraph.
« Last Edit: April 05, 2010, 04:33:00 pm by LordConiupiter »
everytime that I was down, you would always come around, and get my feedback on the ground. (modified part from 'Seasons in the sun')

No matter how many errors are bothering you, always try to stay rel-Axe!

The HoMM project will be resumed as soon Axe 1.0.0 will be released!
Projects:
Code: [Select]
HoMM:   [==--------]    Project 'resumed': I'm suffering overwhelming new ideas being popped up in my dreams :P
tiDE:   [----------]    Explored and understood the main part of the code: just started writing a Tokenizer.



password of the week: uvanapererubupa (Any pronunciation is the right one ;) )   :D click me, and you'll be raided :D

_player1537

  • Guest
Re: Routines
« Reply #208 on: April 05, 2010, 02:38:12 pm »
ooh, nice.  Looks a lot better than my sprite editor.  Does it use xlib+basic or pure basic?  I'm gonna have to check this out later :)

Edit:  Just noticed, where's the actual code?
« Last Edit: April 05, 2010, 02:39:10 pm by _player1537 »

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 #209 on: April 05, 2010, 02:41:06 pm »
wow looks nice :D

I will really need to update the site download section at one point with most program tools posted in this section. That stuff may be useful and might be hard to find since these topics grow larger and larger.