Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I was wondering if I could get a few "simple" routines (as in simple in C and ASM) that will work in ICE (eZ80 hex code subroutines included).
    ▪ ITEM - Priority
    Battery Level - SOLVED
    Real-time Date - High
    Real-time Clock - SOLVED
    Setting Time - Medium
    Setting Date - Medium
    Alphabetizing VAT Pointers - SOLVED
    Detecting whether a program is ASM or BASIC -SOLVED
    Running a BASIC or ASM program given it's name in a string - SOLVED


To help other people, I am including the solutions in this first post:
Real-time Clock:

Code:
*{|EF30008}→HOUR
*{|EF30004}→MINUTE
*{|EF30000}→SECOND

Suggested by PT_

Battery Status:

Code:
*{|ED02A86}→STATUS

Suggested by Ti64CLi

Detecting whether a program is ASM or BASIC:

Code:
0→POS
iFor ASM
DetectVar(°POS, 0, 6)→PROG
OpenVar(PROG, 0, 6)→SLOT
i                        --OR--
iFor BASIC
DetectVar(°POS, 0, 5)→PROG
OpenVar(PROG, 0, 5)→SLOT

Suggested by me

Running a BASIC or ASM program given it's name in a string:

Code:
"NAME"→PROGRAM
1 (ASM) or 2 (BASIC)→TYPE
End()
CloseAll()
OpenVar("θθθθTEMP", "w", 5)→SLOT
If TYPE=1
Write('Asm(prgm', 3, 1, SLOT)
Seek(3, 0, SLOT)
Else
Write('prgm', 1, 1, SLOT)
Seek(1, 0, SLOT)
End
Write(PROGRAM, length(PROGRAM), 1, SLOT)
CloseAll()
Asm(CD9C0E02)
prgmθθθθTEMP
Asm(CD9C0E02)
Asm(CD3C1A02)
Asm(CD100802)
ClrHome
End()
ClrHome
DeleteVar("θθθθTEMP", 5)
Begin()
CloseAll()

Suggested by LAX18, optimized and enhancd by me

Alphabetizing VAT Pointers:

Code:
"FDCB21862A9D25D0CDDD31D1D0FDCB2146CA5831D1E5CD7931D1D1E52A0832D11815CD7931D1ED4B0B32D1B7E5ED42E1281401FAFFFF09E5D5CD8331D1D1E130E10106000009EB7EC60701060000094FED430E32D1ED531132D1D5E5B7ED52E1D12846E5112332D1EDB82A1132D1C1C5B7ED42E5C1E123E5ED5B0E32D1B7ED52EBE1EDB0212332D1ED4B0E32D1ED5B1132D1EDB82A0B32D1ED4B0E32D1B7ED42220B32D1E1C3AE30D1E1220B32D1C3AE30D1FDCB21C6220832D1CD7931D1220B32D1C3AE30D101FAFFFF09CD7931D1C3DD31D1010000004E0CB7ED42C9FDCB218EFDCB21962B1B06407EB830068077FDCB21CE1AB830068012FDCB21D6E5D52313461A0E00B8280430020C472B1B1ABE200C10F8D1E1CDC631D10DC03FC9D1E1F5FDCB214E28047ED64077FDCB215628041AD64012F1C9EB2A9A25D0B7ED52C8EB7EE61FE5210532D101030000EDB1E1C26C31D12B2B2B5E2B562B7E2B37C9050615"→SORTVAT
Copy(|ED130A6,SORTVAT,354)
Asm(CDA630D1)

Suggested (A.K.A taken out of one of his programs) by LAX18, who, in turn, was helped with this by Mateo

If anyone can help, that would be great.
I will give you credit in my shell.
Thanks,
You could use this code :
*{|ED02A86}->BATTERYSTATUS
Then if BATTERYSTATUS = 4, it's 100% full, 3=>75%, 2=>50% and 1=>25%.
(I may be mistaking, but I think it's that)
Ti64CLi wrote:
You could use this code :
*{|ED02A86}->BATTERYSTATUS
Then if BATTERYSTATUS = 4, it's 100% full, 3=>75%, 2=>50% and 1=>25%.
(I may be mistaking, but I think it's that)


...And to add to that, simply multiply BATTERYSTATUS by 25.
calclover2514 wrote:
I was wondering if I could get a few simple routines that will work in ICE.
Running a BASIC program given it's name in a string
Running an ASM program given it's name in a string

ICE is not the correct language to be using here. If you want to bang your head against a wall for hours though; be my guest.
MateoConLechuga wrote:
calclover2514 wrote:
I was wondering if I could get a few simple routines that will work in ICE.
Running a BASIC program given it's name in a string
Running an ASM program given it's name in a string

ICE is not the correct language to be using here. If you want to bang your head against a wall for hours though; be my guest.


Meh, I used to know how to do this, and it did work with little code, but it wasn't very efficient.
MateoConLechuga wrote:
calclover2514 wrote:
I was wondering if I could get a few simple routines that will work in ICE.
Running a BASIC program given it's name in a string
Running an ASM program given it's name in a string

ICE is not the correct language to be using here. If you want to bang your head against a wall for hours though; be my guest.

I sort of realized that, however, I already have about 6000 lines of code in ICE that I would rather not re-write in C

Also, I'm almost certain that beckadamtheinventor knows how to do everything I just mentioned Razz

P.S. The whole point of this post is to make this stuff easy for ICE programmers.
I don't necessarily need solutions, but some pointers would help (haha. no pun intended)
MateoConLechuga wrote:
calclover2514 wrote:
I was wondering if I could get a few simple routines that will work in ICE.
Running a BASIC program given it's name in a string
Running an ASM program given it's name in a string

ICE is not the correct language to be using here. If you want to bang your head against a wall for hours though; be my guest.

Being one who has done an ICE shell, please take Mateo's advice. Often times, there is more head banging than enjoyment. Use C or ez80.

If you really need routines though, you can look at NOS's source. Specifically, there is a label in the NOSSUB program that has program execution code for both BASIC and ASM programs.
LAX18 wrote:
MateoConLechuga wrote:
calclover2514 wrote:
I was wondering if I could get a few simple routines that will work in ICE.
Running a BASIC program given it's name in a string
Running an ASM program given it's name in a string

ICE is not the correct language to be using here. If you want to bang your head against a wall for hours though; be my guest.

Being one who has done an ICE shell, please take Mateo's advice. Often times, there is more head banging than enjoyment. Use C or ez80.

If you really need routines though, you can look at NOS's source. Specifically, there is a label in the NOSSUB program that has program execution code for both BASIC and ASM programs.


How did you get the variable TYPE (distinguish between ASM and BASIC)?
I believe I got it by reading the first few bytes of the program and looking at whether it is a protected or unprotected program.
LAX18 wrote:
I believe I got it by reading the first few bytes of the program and looking at whether it is a protected or unprotected program.

How?
EDIT: Never mind, I figured it out.
  
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 GMT - 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