Author |
Message |
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 10 Jun 2003 02:34:05 pm Post subject: |
|
|
What would you do to make a pause that lasts about 1 second ?
Perhaps something like this
Code: ld bc, 65535
wait: nop
djnz wait
ret
But it is too fast ; what could I write instead of No Operation ? HALT would be good because it waits the next operation (~1/200 sec) but I doesn't work... Why doesn't it work and what would you do if you had to wait about 1 sec. ?
Oh, and I don't want to do anything during this second, in fact, it is a kind of "chrono", as "3...2...1...go !"
thx |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 10 Jun 2003 02:37:42 pm Post subject: |
|
|
i would try the same loop u have, but put in multiple nops like so :
Code: ld bc,$FFFF
sec:
nop
nop
nop
nop
djnz sec
ret
don't know how good it will work, but u can try just adding many nops... i dunno what is wrong with halt... i only use it when turning off the calculator... |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 10 Jun 2003 03:04:00 pm Post subject: |
|
|
TOO FAST U know, NOP is juste equal to "00", so it is not very long, even if you do it 10*65536 times !
But I was just wondering how to do to turn off the calculator. In Jeff Chai's tutorial, he says I have to write this :
Code: di ; désactive les interruptions
ld a, 001h
out (003h), a
ei ; active les interruptions
ret
But it doesn't do anything... Perhaps is it because I've got a TI-83plus, but Jeff chai's tutorials were written for TI-83+...
Edit :
I've juste read asmguru, the code is the following :
Code: di ; désactive les interruptions
ld a, 001h
out (003h), a ; éteint la calto
ld a ,000h
out (004h),a
ex af, af'
exx
ei ; active les interruptions
ret
But it didn't work neither... on Virtual-TI ! In fact it works only on my calculator. The other method does also works. So what's the advantage of the best method ?
Last edited by Guest on 10 Jun 2003 03:13:31 pm; edited 1 time in total |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 10 Jun 2003 04:51:27 pm Post subject: |
|
|
djnz uses only register B; I think; therefore, you can load BC with anything you want, and the loop will never execute more than 255 times.
Code: ld bc,0
call delay
ret
delay:
dec bc
ld a,b
or c ;BC=0?
ret z ;If 0, return
halt
jr delay;else, continue
In this routine, loading bc with 0 will make the longest delay because bc will go all they way past 0 and to its highest value!
As you Know, OR A is similar to CP 0, so you can easily see how ld a,b/or c checks if BC is 0.
Halt was added to save battery life and make the delay 140 micro seconds loger/loop.
Please note that Mr. David from Cirrus origionally created this kind of a delay routine. |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 10 Jun 2003 07:09:49 pm Post subject: |
|
|
well, thank u Mr. David from cirrus! lol, that sounds pretty funny... try Sir David... YA! but that routine was wayy groovy! |
|
Back to top |
|
|
Justin W. Shattered Silence
Advanced Member
Joined: 24 May 2003 Posts: 429
|
Posted: 10 Jun 2003 10:12:14 pm Post subject: |
|
|
Tyraniek wrote: TOO FAST U know, NOP is juste equal to "00", so it is not very long, even if you do it 10*65536 times !
That would be incorrect. A nop does nothing to execution except for eating up 4 clock cycles, the halt instruction also uses 4 clock cycles. Now halts make a very effective delay and so do nop's.
You can get a very sufficent delay using a nop.
ld bc,$FFFF
call delay
ret
delay:
nop
dec bc
ld a,b
or c
ret z
jr delay
Now the above delay will take 2293731 clock cycles to complete. A more than sufficent delay for any program.
The nop alone executed 65535 times takes 262140 clock cycles. About 3 seconds. |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 03:04:40 am Post subject: |
|
|
Turn the scren black, then after 3 seconds, display ram cleared.
People will really believe their calculator crashed and reset |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 11 Jun 2003 03:22:48 am Post subject: |
|
|
It works, but is a little bit faster than one second
It lasts a little bit less than 1 sec with NOP (too slow with halt), so I just put others "NOP".
thx
for the "ram cleared", it shouldn't be difficult to do and it is indeed a "good" surprise. hehehe... |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 11 Jun 2003 12:29:12 pm Post subject: |
|
|
lol, and THEN u can make it so all the keys do nothing! unless they press a special combo or something |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 11 Jun 2003 01:47:22 pm Post subject: |
|
|
LOL, that's sadistic ! |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 02:35:55 pm Post subject: |
|
|
This is slightly more sadistic:
Code: #include "ti83plus.inc"
.org userMem-2
.db $BB,$6d
reset .equ $ff
group1 .equ $fe
directup .equ 247
directdown .equ 254
directleft .equ 253
directright .equ 251
keyport = 1
im 1
di
ld hl,int_start
ld de,$9a9a
ld bc,int_end-int_start
ldir
ld hl,$9900
ld (hl),$9a
ld de,$9901
ld bc,256
ldir
ld a,$99
ld i,a
im 2
ei
inf_loop:
ei
ld a,(onebyteofdata)
cp 1
jr z,exit
jr inf_loop
exit:
im 1
ret
int_start:
di
exx
ex af,af'
ld a,reset
out (keyport),a
ld a,group1
out (keyport),a
in a,(keyport)
cp directup & directdown & directleft & directright
jr nz,ignore
ld a,1
ld (onebyteofdata),a
ignore:
ex af,af'
exx
reti
int_end:
onebyteofdata:
.db $00
.end
To see a truely sadistic creation, try the app that I attached. |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 11 Jun 2003 02:58:01 pm Post subject: |
|
|
I can't try it for the moment because VTI doesn't support applications. Maybe I'll put it on my TI......... Can't you explain what it does or do we have to download it on our calculator... :-/
By the way, what's the fonction of
Code: .org userMem-2
.db $BB,$6d ? |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 11 Jun 2003 03:20:03 pm Post subject: |
|
|
that is purely evil Jbirk! it is completely ********* funny(edited by me, so as not to ruin the suprise!)! install it on your calculator.
Code: ;Standard template for ti83+ asm programs
#include "ti83plus.inc";File needed to access system routines
.org userMem-2 ;Define where to start in memory
.db $BB,$6D ;AsmPrgm instruction
ret ;Return to TI-OS
.end ;End of code
does that help any?
Last edited by Guest on 11 Jun 2003 06:50:27 pm; edited 1 time in total |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 11 Jun 2003 03:21:08 pm Post subject: |
|
|
I wrote Evil and installed it on my calculator, so I can assure you that it does no actual harm. You will have to try it to see what it does.
UserMem-2 is $9d95-2 or $9d93
Then the $BB,$6D is the AsmPrgm token, so TI OS knows it is working with an asm program.
$9d93+2 is $9d95 a.k.a. userMem.
How it works, is each instruction takes X number of bytes of ram.
The first instruction will be at userMem, and others will follown.
When you have a command such as jp label, the assembler must count how much space each command above label takes up, and add it to $959f to determine where label is in ram.
Here, try this:
#include ti83plus.inc
.org userMem-2
.db $BB,$6D
.org userMem+1 ;confuse the assember a little
bcall(_homeup)
bcall(_clrlcdfull)
ld hl,text
bcall(_puts)
ret ;I almost forgot the ret
text:
.db "text here",0
If this works like I think it will, you will see "ext here" displayed instead of "text here" because label text will not point to the beginning of the text, but one byte after the text.
Last edited by Guest on 11 Jun 2003 03:22:02 pm; edited 1 time in total |
|
Back to top |
|
|
Tyraniek
Member
Joined: 07 Jun 2003 Posts: 133
|
Posted: 11 Jun 2003 03:59:59 pm Post subject: |
|
|
Thank you, I knew that but I didn't know we could write BASIC instructions in an asm program using their hexadecimal codes. |
|
Back to top |
|
|
David The XORcist!
Advanced Member
Joined: 20 May 2003 Posts: 268
|
Posted: 13 Jun 2003 03:46:57 pm Post subject: |
|
|
Hehe, you could write BASIC programs in assembler using .db statements and tokens, but I don't see the use with that |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 13 Jun 2003 08:22:37 pm Post subject: |
|
|
it would be a long and tedious process, and u would have to look up 2 byte tokens quite a bit! |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 14 Jun 2003 03:21:19 am Post subject: |
|
|
If anyone does try the Application I attaced to the first page of this topic, all you have to do to turn it off it is hold down ON and tap the Y= key.
I would not write an application to actually mess up a calcultor. |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 14 Jun 2003 05:59:59 pm Post subject: |
|
|
thank u Jbirk, i was waiting for u to post the keyshortcut out of that! it was Evil |
|
Back to top |
|
|
NETWizz Byte by bit
Bandwidth Hog
Joined: 20 May 2003 Posts: 2369
|
Posted: 15 Jun 2003 04:14:07 am Post subject: |
|
|
What it does is install a RawKeyHook to cancel every key!
When Y= is pressed, it is treated differently because I have it jump to a routine that checks if on is pressed.
If on is pressed, I uninstall the RawKeyHook. If on is not pressed, I cancel Y= too.
Very simple. In fact, it took less than 5 minutes to make.
My favorite aspect of it is that pulling an AAA does not cause a ram reset because you are in TI-OS and the system monitor loop is okay. |
|
Back to top |
|
|
|