Super Simple/ Stupid question- how does the Put_S command work?

A bit of background, I want to make a basic incrementing loop using asm opcode on-calc assembly. I have done this before, but now there is a problem- I put-


Code:

AsmPrgm
210000; loads 0 into Hl
EF0A45; Put_S
C9; ret


But when I do that, I get a lowercase e instead of a zero! I assume it's the TI ASCII code, but how do I display numbers instead of symbols?

Thank you in advance,
Blackhawk
You're displaying the string in memory at address 0, not the character with code 0. Most appropriate here would probably be _DispHL:

Code:
    ld hl,0
    ; 256 iterations
    ld b,0

loop:
    push bc
    push hl
    ; Pretty sure these romcalls clobber a bunch of regs, hence stashing some things on the stack
    ; Assuming _ClrLCDFull does an implicit _HomeUp; working from memory
    bcall _ClrLCDFull
    pop hl
    push hl
    bcall _DispHL
    pop hl
    pop bc
    inc hl
    djnz loop
    ret


The actual implementation of _PutS is basically this:

Code:
PutS:
    ld a,(hl)
    or a
    ret z
    bcall _PutC
    inc hl
    jr PutS
According to http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:450A, it takes as an input a zero terminated string pointed to by HL. The memory location at 0000 contains 0xDB, which in the TI character set is a lowercase e. To do what you are looking to do, you could load HL with a pointer to the character 0x30, which is 0. it would look like:

Code:

AsmPrgm
219C9D; load HL with the location of the string which we want to display, which is right now 7 bytes after the start of the program. The start of the program is always at 9D95
EF0A45 ; bcall PutS
C9; ret, end of code
30; the character for 0, is at address 9D9C
00; the 0 which tells the calc that the string is over
If what you want to do is display the calc's ASCII map, you'd rather do that :
Code:
AsmPrgm
0600
60
67
224B84 ; write at currow
AF
D5
F5
EF0445 ; _putC
F1
3C
D1
10F8
C9
I didn't quite communicate that clearly enough- is there an opcode to display the number in its memory?

Suedo-code;

Load 0 into Hl
Display Hl (0)
Inc. Hl (0-> 1)
Display Hl (1)

I can use the ASCII code, but I would have to store all the codes in ram and that would be a mess

Thanks in advance,
Blackhawk
There's no specific BCALL for that, but if you put the address in HL you can do that :
Code:
5E2356EBEF0745
I'm still not sure what you're talking about. Tari mentioned the bcall "_DispHL". _DispHL will draw the value of HL to the screen. If you do "ld hl,0000 \ bcall(_DispHL)" it'll output "0". It'll work up to $FFFF (65535).

Another option to display single digits is _PutC. To quickly convert a single digit (0-9) to it's ASCII value, just add $30 to it (that's in hex). I think _PutC displays the character stored in a.
Thaaaaaaaaaaaaank you chickendude! got it to work!


Blackhawk
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement