Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TI Assembly #215

Open
WillLillis opened this issue Jan 8, 2025 Discussed in #214 · 0 comments
Open

Add TI Assembly #215

WillLillis opened this issue Jan 8, 2025 Discussed in #214 · 0 comments
Labels
0.10.1 To be completed before the 0.10.1 release enhancement New feature or request

Comments

@WillLillis
Copy link
Collaborator

Discussed in #214

Originally posted by Freed-Wu January 8, 2025
For example, TI asm have different assembly directive and CPU instruction.

        .global _main 
 .global _puts, _rand, _ltoa 
 .sect ".const" 
string1: .string "The random value returned is ", 0 
string2: .string " ", 10, 0 ; '10' == newline 
 .bss charbuf, 20 
 .text 
_main: .cproc 
 .reg random_value, bufptr, ran_val_hi:ran_val_lo 
 .call random_value = _rand() ; get a random value 

 MVKL string1, bufptr ; load address of string1 
 MVKH string1, bufptr 
 .call _puts(bufptr) ; print out string1 
 MV random_value, ran_val_lo 
 SHR ran_val_lo, 31, ran_val_hi ; sign extend random value 
 .call _ltoa(ran_val_hi:ran_val_lo, bufptr) ; convert it to a string 
 .call _puts(bufptr) ; print out the random value 
 MVKL string2, bufptr ; load address of string2 
 MVKH string2, bufptr 
 .call _puts(bufptr) ; print out a newline 
 .endproc 
@WillLillis WillLillis added enhancement New feature or request 0.10.1 To be completed before the 0.10.1 release labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.10.1 To be completed before the 0.10.1 release enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant