Author Topic: Ok, I'm a noob  (Read 6474 times)

0 Members and 1 Guest are viewing this topic.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Ok, I'm a noob
« on: March 23, 2012, 09:57:50 am »
Ok, here is what I tried:

Code: [Select]
.NOLIST
#define   EQU   .equ
#define   equ   .equ
#define   END   .end
#define   end   .end
#include "ti83plus.inc"
.LIST

     .org 9D93h
     .db $BB,$6D
StartProg:
Conditional:
      ld a,3
      cp 7
      jp z,IsSeven
      cp 3
      jp z,IsThree
      jp nz,IsNoneOfThese
IsSeven
ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHell
      B_CALL(_PutS)
      ret
txtHell:
.db "7",0
IsThree
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHel
      B_CALL(_PutS)
      ret
txtHel:
.db "3",0
IsNoneOfThese
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHello
      B_CALL(_PutS)
      ret
txtHello:
      .db "Hello World",0
.end

and it didn't work, so i also tried this:

Code: [Select]
.NOLIST
#define   EQU   .equ
#define   equ   .equ
#define   END   .end
#define   end   .end
#include "ti83plus.inc"
.LIST

     .org 9D93h
     .db $BB,$6D
StartProg:
Conditional:
      ld a,3
      cp 7
      jp z,IsSeven
      cp 3
      jp z,IsThree
      jp nz,IsNoneOfThese
IsSeven
ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHell
      B_CALL(_PutS)
      ret
IsThree
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHel
      B_CALL(_PutS)
      ret
IsNoneOfThese
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHello
      B_CALL(_PutS)
      ret
txtHello:
      .db "Hello World",0
txtHel:
.db "3",0
txtHell:
.db "7",0
.end

TASM (i haven't tried with the doors CS DSK) always gives an error: unknow command: B_CALL(_PutS)
« Last Edit: March 23, 2012, 11:00:14 am by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

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: Ok, I'm a noob
« Reply #1 on: March 23, 2012, 10:16:40 am »
Try adding this:
Code: [Select]
#define   B_CALL(xxxx)    .db $EF \ .dw xxxx

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #2 on: March 23, 2012, 10:21:18 am »
Ok, I'll try, and does it has to be in the TI83 inc file or in the sourcefile?

Ok, i've put it in the included file, my conclusion: it was there, but in b_call en not B_CALL :P
« Last Edit: March 23, 2012, 10:25:27 am by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

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: Ok, I'm a noob
« Reply #3 on: March 23, 2012, 10:24:59 am »
It can be in either :)

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #4 on: March 23, 2012, 10:51:32 am »
Ok, and what if I wanted an user-input that asks for a number? What B_CALL should it be? Or is it something else?

Ok, in asmin28days, they're talking about this

Code: [Select]
.module    ConvDec8
ConvDec8:
    LD    C, 0

_Loop:
    CALL  GetChar
    CCF             ; End if no more characters
    RET   NC

    SUB   '0'       ; Throw out all characters below '0'
    JR    C, _Check

    CP    10        ; Throw out all characters above '9'
    CCF
    RET   C

    LD    D, A       ; Save value in D
    LD    A, C       ; Load running total
    CP    26        ; Halt if there would be an overflow (260+)
    JP    NC, Ungetc ; Return gotten character

    LD    E, C       ; Save current number in case of overflow
    ADD   A, A       ; Multiply by 10
    ADD   A, A
    ADD   A, C
    ADD   A, A
    ADD   A, D       ; Add gotten character

    LD    C, A       ; Halt if overflow (256 to 259)
    JR    NC, _Loop

    LD    C, E
    JP    Ungetc

_Check:
    CP    ' ' - '0' ; If a space is encountered exit without error
    RET   Z
    SCF
    RET


but in what register is it saved?

Ans I get an error: with : GetChar  and  Ungetc
« Last Edit: March 23, 2012, 11:00:28 am by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

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: Ok, I'm a noob
« Reply #5 on: March 23, 2012, 10:58:47 am »
XD It isn't usually that easy to do in assembly XD

As for the routine, that converts a string of tokens to a number and stores it to register a (it isn't an input routine). If I have time later, I will write some code for an input routine, but it is not too simple.

Also, avoid double-posting unless it has been about a day and your question wasn't answered (you can just use the edit button).
:D

EDIT: Those calls aren't there in your code, that is why you get an error

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #6 on: March 23, 2012, 11:02:16 am »
Ok, thanks, but as I allready mentioned, I'm a N00B :P

But I'll try to do the whole 28days.

But usually I like it to get a bunch of examples and then some explanation with it.

Like in this one http://www.arasian.com/support/education/tutorial&t=2&s=9

Euhm, guys, what's the best vti to use to test my progs?


Euhm, other question: why does this gives a RAM clear?
Code: [Select]
.NOLIST
#define   EQU   .equ
#define   equ   .equ
#define   END   .end
#define   end   .end
#include "ti83plus.inc"
.LIST

     .org 9D93h
     .db $BB,$6D
StartProg:
B_CALL(_ClrLCDFull)

GetKeyLoop:
     B_CALL(_GetKey)
     cp k1
     jp z,Numb1
     cp k3
     jp z,Numb3
     cp k7
     jp z,Numb7
     jp GetKeyLoop

Conditional:
      cp 7
      jp z,IsSeven
      cp 3
      jp z,IsThree
      jp nz,IsNoneOfThese

IsSeven
ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHell
      B_CALL(_PutS)
      ret

IsThree
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHel
      B_CALL(_PutS)
      ret

IsNoneOfThese
 ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHello
      B_CALL(_PutS)
      ret

txtHell:
.db "7",0

txtHel:
.db "3",0

txtHello:
      .db "Hello World",0

Numb1:
ld a,1

Numb3:
ld a,3

Numb7:
ld a,7

.end
« Last Edit: March 23, 2012, 11:44:54 am by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Ok, I'm a noob
« Reply #7 on: March 23, 2012, 12:49:23 pm »
When the processor jumps to Numb1, Numb3, or Numb7, it will load A with the appropriate number, but it will continue, not only to the next LD (if there is one), but also past the end of the program. At that point, it's no longer your code that's executing, and the processor's going to encounter something that leads it to crash.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #8 on: March 23, 2012, 02:02:07 pm »
Do you have any tips to fix it?

and what if I place a jump to conditions after the 3 ld's?

It worked :P
« Last Edit: March 23, 2012, 02:42:18 pm by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: Ok, I'm a noob
« Reply #9 on: March 23, 2012, 02:42:45 pm »
You could have a jump back to the conditions (I don't remember much from HotDog's tutorials, but I think you could also just place a ret after each so it automatically returns to where it was before)

Unless I'm thinking of something different...
« Last Edit: March 23, 2012, 02:42:53 pm by HOMER-16 »

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline C0deH4cker

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 258
  • Rating: +11/-1
    • View Profile
    • iNinjas Forum/Repo
Re: Ok, I'm a noob
« Reply #10 on: March 23, 2012, 06:14:45 pm »
You could have a jump back to the conditions (I don't remember much from HotDog's tutorials, but I think you could also just place a ret after each so it automatically returns to where it was before)

Unless I'm thinking of something different...
yeah, basically just add a ret after each of the ld cmds, but make sure to use call instead of jp.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #11 on: March 25, 2012, 10:36:14 am »
Yeah, with the script I posted it only worked with another jp to the conditionals
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

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: Ok, I'm a noob
« Reply #12 on: March 25, 2012, 11:24:30 am »
***This does not have anything to do with your code above!***
Here is some example code you can play with:
Code: [Select]
;Get the value in Ans
     B_CALL(_RclAns)  ;Ans→OP1
     B_CALL(_ConvOP1) ;OP1 converted to DE, E→A

;At ths point, A contains the value of Ans

     ld hl,37         ;37→HL
     cp 13            ;If A=13
     call z,SetHLto4  ;Then call the routine
     cp 7             ;If A=7
     call z,SetHLto11 ;Then call the routine
     B_CALL(_DispHL)
     ret
;======
SetHLto4:
     ld hl,4         ;4→HL
     ret             ;Return
SetHLto11:
     ld hl,11        ;11→HL
     ret             ;Return     
Does this help at all?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Ok, I'm a noob
« Reply #13 on: March 25, 2012, 11:57:09 am »
yeah, basically just add a ret after each of the ld cmds, but make sure to use call instead of jp.
In this case that wouldn't work because he doesn't want to return back to where he was, but rather jump to Conditional.
stevon8ter: your code, as it stands, converts keypresses to values, and uses those values to determine what code to execute. In this case, it would make much more sense just to use the keypresses directly to determine where to jump to execute the other code. (That is, Numb1 etc. and Conditional are unnecessary. IsSeven etc. should be jumped to directly from GetKeyLoop.)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: Ok, I'm a noob
« Reply #14 on: March 27, 2012, 08:56:12 am »
To all of you: thank you, and I'll be a long time offline :( going on vacation and have there no intenet.

And xeda: I thank you very much, I like the way you do it, givin an example and I can learn out of it, all people may do that :P
And sometimes i'll ask for an expelnation
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER