Calculator Community > ASM

How do I load a symbol into a string?

<< < (3/3)

joshuarpl:
I don't know what you mean on where to put the extra or replaced instructions, I tried this

--- Code: --- bcall(_RclAns)
 bcall(_ConvOP1)
 push af
; Load the name into OP1
 ld hl,$09AA    ; internally, Str0 is represented as 0xAA09
 ld (OP1+1),hl

; Check if it exists and delete if necessary
 rst rFindSym
 jr c,make_str0
 bcall(_DelvarArc)
make_str0:

; Now create Str0 with size 1. Put the name in OP1 first
 ld hl,$09AA
 ld (OP1+1),hl

; Size is 1 byte
 ld hl,1
 bcall(_CreateStrng)

;Pointer to size bytes is in DE. Switch to HL
 ex de,hl

; Don't need the size, so skip those two bytes and get to the start of the data
 inc hl
 Inc hl

; Now write the token
 pop af    ; if using ti83plus.inc. same as $41 or in this specific case, 'A'
 ld (hl),a

;Done!
 ret
--- End code ---
But it didn't store anything into Str0, infact it did nothing, I feel ripped off, could you send me the code itself instead of telling to "put instructions in certain locations"?
Also, I don't mean to be rude.

E37:

--- Quote from: joshuarpl on April 16, 2019, 08:57:15 pm ---I don't know what you mean on where to put the extra or replaced instructions, I tried this

--- Code: --- bcall(_RclAns)
 bcall(_ConvOP1)
 push af
; Load the name into OP1
 ld hl,$09AA    ; internally, Str0 is represented as 0xAA09
 ld (OP1+1),hl

; Check if it exists and delete if necessary
 rst rFindSym
 jr c,make_str0
 bcall(_DelvarArc)
make_str0:

; Now create Str0 with size 1. Put the name in OP1 first
 ld hl,$09AA
 ld (OP1+1),hl

; Size is 1 byte
 ld hl,1
 bcall(_CreateStrng)

;Pointer to size bytes is in DE. Switch to HL
 ex de,hl

; Don't need the size, so skip those two bytes and get to the start of the data
 inc hl
 Inc hl

; Now write the token
 pop af    ; if using ti83plus.inc. same as $41 or in this specific case, 'A'
 ld (hl),a

;Done!
 ret
--- End code ---
But it didn't store anything into Str0, infact it did nothing, I feel ripped off, could you send me the code itself instead of telling to "put instructions in certain locations"?
Also, I don't mean to be rude.

--- End quote ---

Since you seem to be trying to do something for a basic program, here is a solution in basic.

First you got to go through ti83plus.txt and go to the tokens section. Pull up an ascii chart and start hunting. It will take a lot of work to go through every ascii character and find the token equivalent to it.Then you take all of them in order and include them as data in an asm program. Many of the tokens will be 2 bytes long, but remember that the ones that aren't take up only one byte and don't need to be headed by a 0. Then have your program copy all of that into a new basic program. There you go. You have all 255 ascii characters in a basic program. It is a simple task to put some quotes around that do 'sub(' directly on that with Ans being your index. It might be easier to just put all the tokens in one program and then sort and order them from there. Alternately if you can't be bothered to do a bit of work, there is some basic program out there on ticalc that has all the ascii characters in order. If you can find it you can skip right to the 'sub(' part. I, for one, can't be bothered to hunt for it but I know it is out there.

Maybe if you told why you want to do this it would be easier to help you.  :P

Navigation

[0] Message Index

[*] Previous page

Go to full version