Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 122 users online: 5 members, 82 guests and 35 bots. Members: CalebHansberry, charlessprinkle, JamesV, Piguy-3.14. Bots: VoilaBot (2), Spinn3r (1), Magpie Crawler (3), VoilaBot (10), Googlebot (19).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
benryves

Cemetech Expert

Joined: 12 Aug 2008 Posts: 1361 Location: London, United Kingdom
|
Posted: 15 Jun 2012 09:51:59 am Post subject: |
|
|
Note that it's only random because the calculator does not contain any hardware to put a byte on the data bus when it generates an interrupt request. As such, the value will typically be approximately what was on the data bus immediately before the interrupt request, though this varies from calculator to calculator (hence the contradictory information in the 28 days guide - that will work on some calculators, but for safety assume the value is entirely random). Z80 systems that are designed with IM 2 in mind will have each interrupting device place an appropriate interrupt vector address on the data bus when interrupting.
Edit: Kerm beat me to it, evidently. It couldn't be used as an effective random number generator as there are still patterns to its randomness (and on some devices it may not be random at all). If you'd like to test the randomness of your calculator's hardware, please see IM 2 randomness on MaxCoderz.
Last edited by benryves on 15 Jun 2012 09:57:32 am; edited 1 time in total |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 15 Jun 2012 09:57:04 am Post subject: |
|
|
If the calculator know where its jumping to, then it must have a way of returning this value, correct? If you can trigger IM 2, then can't you get the address it has selected, forward from your choice of 'i', then subtract the true address from .dw 'i' , 00. Use the difference as your random seed. _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 15 Jun 2012 06:11:56 pm Post subject: |
|
|
Sorry about the double post, but this is newsworthy in this topic. I have just posted Unit 1 of the tutorial "the z80 Files" on Google Docs. The link is below. Anyone with the link can edit it, so please edit away. I actually would like it to be lengthened a bit. Comments can be left there as well, so as not to draw this topic (excuse the upcoming grammar-fail) off-topic.
https://docs.google.com/document/d/16kb_uChpEkaDiLcn2bz_FHQMGJtsLLa2MgvrZ9YX5Kk/edit _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
Posted: 16 Jun 2012 07:56:16 am Post subject: |
|
|
Why do you say that it should have a way of knowing where it came from? With a call, yes, but it does a jump to what it thinks is the IM2 handler address. I will try to get a chance to check out your draft later. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 18 Jun 2012 11:07:50 am Post subject: |
|
|
Kk. Sounds good. Please don't refrain from editing the hell out of it wherever it needs it.
What I was saying is...you know how the 'pc' register indicates the current executing address? Well, if the calculator is reading the IM2 handler address out of a randomized section of memory, it must somewhere catalog the address it's reading from, just like you need to return a pointer to something before you can read from it. Can't you fish out that address, subtract it from the two byte word consisting of high byte 'i' and low byte $00, and then have a random seed? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
Posted: 18 Jun 2012 11:23:34 am Post subject: |
|
|
It pushes 'pc' onto the stack, loads the address from ('i' (concatenate) 'bus') directly into 'pc'. If it didn't do that, then one or more registers would get trashed every time an interrupt triggered. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 21 Jun 2012 09:06:29 pm Post subject: |
|
|
What code would be used to activate "inverted text" for bcall vPutS? And I'm assuming that, since you are using iy + textFlags, iy must already point to the system flags. What do you load into it? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 22 Jun 2012 05:30:12 pm Post subject: |
|
|
Ok, that makes sense. But, what do I load into IY ? Or is it already preset? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
Posted: 22 Jun 2012 05:50:00 pm Post subject: |
|
|
| ACagliano wrote: | | Ok, that makes sense. But, what do I load into IY ? Or is it already preset? | iy is set by the OS, and if you don't know what you're doing, you shouldn't touch it. If you have code that cannot enter the OS, since it doesn't use any bcalls and doesn't allow the TI-OS's interrupts to run, then it's safe to use iy, as long as you restore it before anything that could let the OS get control happens. A good rule of thumb for beginners is to just leave it be. _________________
 |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 22 Jun 2012 06:57:59 pm Post subject: |
|
|
Ok. I had a feeling that IY was preset, but just wanted to be sure. _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
chickendude
Member

Joined: 09 Dec 2011 Posts: 142
|
Posted: 22 Jun 2012 11:43:28 pm Post subject: |
|
|
| It's not really that complicated, just be sure to restore its value before quitting your program/using routines (bcalls) that make use of the flags. Really though it's pretty slow and you can generally just use ix if you want to use an index register for something (like for masked sprites, for example). |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
Posted: 23 Jun 2012 06:25:50 am Post subject: |
|
|
Chickendude, I have known the TI-OS interrupt to need iy on occasion, and if it has been switched, terrible things befall the calculator (well, a crash, but you know). Perhaps I just happened to do things that made the interrupt need to overreach, such as triggering silent linking or turning off. _________________
 |
|
| Back to top |
|
|
chickendude
Member

Joined: 09 Dec 2011 Posts: 142
|
Posted: 23 Jun 2012 10:31:19 am Post subject: |
|
|
Really? That's interesting to know. I've never had a problem using iy just like ix, though admittedly i've also never touched linking. I guess i very rarely use iy for anything other than storing my own flags and even when i do interrupts are generally either turned off or in mode 2 because i like to play with the shadow registers a lot.
EDIT: Also, speaking of interrupts, i was just thinking that if you aren't using interrupts (im 2) you could maybe use "i" to hold data, though i guess it wouldn't be much faster than a push/pop. I think ld a,i sets/resets the z flag accordingly, too, so maybe you could take advantage of that. |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 31 Aug 2012 11:26:21 am Post subject: |
|
|
This is a program that install a small routine that runs prior to the system routine part of the time to screw with someone... Is it correct?
Code: ;; TI Calc Prank.wcodeproj
;; main.z80
;;
;; Created by Anthony Cagliano on 8/31/12
#include "ti83plus.inc"
#include "dcs7.inc"
CycleNum .equ saferam1
Start:
di
ld a,0
ld (CycleNum),a
ld a,$99
ld i,a
ld hl,$9900
ld de,$9901
ld bc,256
ld (hl),$7A
ldir
ld hl,InterruptCode
ld de,$7A7A
ld bc,InterruptCodeEnd-InterruptCode
ldir
ld de,saferam1
ld hl,texttodisp
ld bc,texttodispend-texttodisp
ldir
im 2
ei
InterruptCode:
ld a,(CycleNum)
cp 0
jr DelAll
cp 128
jr DispText
jp $0039
DelAll:
bcall(_ClrLCDFull)
jp $0039
DispText:
ld hl,saferam1+1
ld a,0
ld (curCol),a
ld (curRow),a
bcall(_PutS)
jp $0039
InterruptCodeEnd:
texttodisp:
.db "Moron",0
texttodispend:
.end
.END
_________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
jammasterz
New Member

Joined: 20 Apr 2012 Posts: 75 Location: Sweden
|
Posted: 31 Aug 2012 11:31:59 am Post subject: |
|
|
I recommend you to test programs like this in TI flash debugger.
It looks fine to me |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55881 Location: Earth, Sol, Milky Way
|
Posted: 31 Aug 2012 11:34:58 am Post subject: |
|
|
| jammasterz wrote: | I recommend you to test programs like this in TI flash debugger.
It looks fine to me | You can also use PindurTI or jsTIfied, as both have very accurate interrupt emulation. Sadly, WabbitEmu's interrupt emulation is inaccurate. _________________
 |
|
| Back to top |
|
|
jammasterz
New Member

Joined: 20 Apr 2012 Posts: 75 Location: Sweden
|
Posted: 31 Aug 2012 11:39:57 am Post subject: |
|
|
Maybe they're good too, never tried them.
Also i hope you give your guy the opcode of setting the interrupt mode back to 1 so that he can revert the prank. |
|
| Back to top |
|
|
ACagliano
Super-Expert

Joined: 08 Feb 2010 Posts: 930
|
Posted: 31 Aug 2012 01:34:34 pm Post subject: |
|
|
ACMBP:asm acagliano$ ./compile.sh prank
----------------------------------
Doors CS Assembler/Compiler
Version 2.0L
Written by Kerm Martian
http://www.Cemetech.net
----------------------------------
----- Assembling prank for the TI-83/84 Plus...
./compile.sh: line 9: tasm/zztemp.asm: No such file or directory
./compile.sh: line 15: tasm/zztemp.asm: No such file or directory
Cannot open assembly 'tasm/Brass.exe': No such file or directory.
----- There were errors.
What does this mean? _________________ -ACagliano
Current Projects
Legend of Zelda. "Ganon's Rage"
51% |
|
| Back to top |
|
|
|
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
|
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
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.042148 seconds.
|