Author Topic: Learn Hex/NikProgrammer  (Read 23146 times)

0 Members and 2 Guests are viewing this topic.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #30 on: June 08, 2014, 12:29:03 am »
ExecAns shouldn't create a program, it runs a program. It takes the code in Ans, puts it into prgmU, and runs prgmU. The problem might be that the current running program (the one that calls prgmEXECANS) gets overwritten when prgmU gets run. I'm not sure, i'll look at it later.

But this isn't really about writing assembly in hex anymore, you might want to open a new thread asking for help on this specific program. But it would really help if you provided the mnemonics instead of the hex so people other than Xeda and perhaps calc84maniac actually knew what the code did. Hex is such a pain.
Code: [Select]
;(saferam1 = saveSScreen)
name_str = saferam1
size = saferam1+2
code_start = saferam1+4

start:
    bcall(_RclAns)            ;set pointer into OP1
    cp 4
     ret nz
    ld hl,$55                ;ASCII for 'U'
    ld (name_str),hl        ;save zero terminated string name
    ld (OP1+1),hl
    ld hl,code_start
    ex de,hl                ;de = code_start, hl = ans ptr?
    ld c,(hl)                ;i assume bc = size of Ans
    inc hl
    ld b,(hl)
    inc hl
    ld (size),bc
    ldir                    ;copy code in Ans into saferam
    bcall(_ChkFindSym)
     jr c,not_found
        bcall(_DelVarArc)    ;del prgmU if it existed
not_found:
    ld a,5                    ;5 = non-protected program
    ld hl,saferam1
    bcall(_ExecuteNewPrgm)    ;a = var type, hl = pointer to structure (zero terminated string, size (word), program data)
    ret
A couple things: i'm not sure if RclAns actually gives readable results in a/de/hl. They seem to assume that _RclAns puts out the same outputs as _ChkFindSym (see WikiTI). WikiTI and the 83 Plus System Routines manual both say all registers are destroyed (ie. return junk/non-useful info). I don't know what happens with _ExecNewPrgm, it may kick the currently running BASIC program out.

EDIT: If all you want to do is create a program, you should look at the _CreateProg bcall.
« Last Edit: June 08, 2014, 12:32:41 am by chickendude »

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #31 on: June 16, 2014, 06:04:45 pm »
Was that to me? I don't understand ASM... But by the way I want to learn it though.
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #32 on: June 16, 2014, 06:15:48 pm »
That's the same code as from TI-BasicDev just in assembly mnemonics. I'm not really sure what you want, when you run that program does it return to the TI-OS? Like i said there, there's another routine to call if all you want to do is create a program (_CreateProg).

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #33 on: June 17, 2014, 04:15:35 am »
Was that to me? I don't understand ASM... But by the way I want to learn it though.
Wait. Did you even follow what we said ? Hex programming = assembly. You can't learn one separately, it's just two ways to write it.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #34 on: June 17, 2014, 11:18:40 am »
Sorry, I am bad at explaining... I know HEX and ASM are the same things, the first one is just ASM translated to the calculator's language.
Or am I wrong?!
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

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: Learn Hex/NikProgrammer
« Reply #35 on: June 17, 2014, 11:24:34 am »
That is correct. Streetwalrus was referring to this:
Was that to me? I don't understand ASM... But by the way I want to learn it though.
We are giving you the ASM to help you learn it. You can't really understand the hexadecimal machine code without understanding the ASM instructions with which they are associated.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #36 on: June 29, 2014, 03:33:55 pm »
So I am trying again to learn ASM in 28 days (it's a lot easier the second time) but TASM does not work on my new 64 bit notebook. I downloaded SPASM but now even the copy-pasted hello world program makes it throw errors on each b_call and I really don't know what went wrong... I suppose the TASM syntax is a bit different from the SPASM syntax?
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #37 on: June 29, 2014, 05:27:36 pm »
You'll need to add:
#define b_call(xxxx) rst 28h \ .dw xxxx
..to the top. Also, i would recommend using this ti83plus.inc instead. Most people use bcall(_XXXX), you might find that that is already defined in your ti83plus.inc.

EDIT: Just to clarify, that is bcall without the underscore. I believe TI added an instruction for B_CALL, so you might be able to use B_CALL _NewLine (no parentheses) just like any other instruction, too.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #38 on: June 30, 2014, 10:31:08 am »
Ok, thank you, I'll try this when I'll have more time... (If I ever will have more time... :P :/)
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #39 on: July 03, 2014, 10:36:09 am »
It does not work...
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #40 on: July 03, 2014, 03:01:54 pm »
What doesn't work? Assembling it? Are you using the ti83plus.inc that i linked to? What exactly are you trying to assemble (can you post the code)? Does it not assemble or does the .8xp not work?

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #41 on: July 04, 2014, 10:50:00 am »
What does not work is the assembling.
I use the include file you showed me.
Code:

.nolist
#include "ti83plus.inc"
#define    ProgStart    $9D95
.list
.org    ProgStart - 2
    .db    t2ByteTok, tAsmCmp
    b_call(ClrLCDFull)
    ld    hl, 0
    ld    (PenCol), hl
    ld    hl, msg
    b_call(PutS)
    b_call(NewLine)
    ret

msg:
    .db "Hello world!", 0
.end
.end

I removed the underscores before the b-call names, like you said me
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #42 on: July 04, 2014, 11:04:48 am »
The underscores need to be in there afaik.

Offline NikProgrammer

  • LV3 Member (Next: 100)
  • ***
  • Posts: 50
  • Rating: +0/-0
  • Calc's are the most handy thing ever invented :D
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #43 on: July 05, 2014, 04:08:26 am »
It once didn't work with underscores :blah:
Well, I'm not english or american so if anything posted by me is not correct just say or ignore...
And please don't set me back because I live in germay... Though I speak german I am still from UA!
––––––––––––––––––––––––––––––––––––––––––––––––––––
It may sound weird but:
'The teapot cools down long.'
and
'The teapot does not cool down long.'
means the same.

What for do we live? - To think of why we do live.
––––––––––––––––––––––––––––––––––––––––––––––––––––
Loving chess- If you know any good chess programs for TI-83+ please PM me- thanks!
Working on Remakes for all of my programs to optimize them and add more user friendliness... And most important: Graphics. I'm not good at graphics, every help is welcome... -Please PM too.

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: Learn Hex/NikProgrammer
« Reply #44 on: July 05, 2014, 09:05:48 am »
I was talking about the underscore in the B_CALL macro ;)