sadly, I'm no longer sure if this will be feasible as an SE. the code doesn't crash on calc, however without a mouse plugged in it drastically slows down the mouse movement. with a mouse plugged in you can't move the mouse at all, either by using the mouse, or by using the keys. my guess is that its because it has to reload and initialize the driver every mouse cycle.

anywho, its fairly small, so if kerm has almost any freespace (the module takes 326 bytes and it would take less if I hadn't had to be hackish to try and get it to work as an SE.

here's the code. if you want to compile it, plz to ask me for the include files.


Code:
;USB Browse
.nolist
#include "dcs6.inc"
USBDriverCall = 326 + $86ec
USBDriverBuf  = USBDriverCall + 32
DBuf        = USBDriverBuf+128
savesscreen   = $86ec   ;aka SERam
#include "usb8xspasm.inc"
_strcpy      =$44E3
_MultAbyE   =$8042   
_memclear    =$4c30   
_findapp   =$4c4e
;SEOffset   equ   $86ec
.list
   .org 0
   .db $BB,$6D      ;ASM program header
   .db $AB,$C9      ;ignore program; ret
SEStart:
   .db $31,$87,$50      ;SE for DCS 5 and higher
   .dw SEBoot-SEStart   ;or .dw 0 if there is no boot section in this SE
   .dw SEMouse-SEStart   ;or .dw 0 if there is no mouse section in this SE
   .dw 0   ;or .dw 0 if there is no unload section in this SE
SEBoot:         ;if there is a boot section...
   ;...code...
   in a,(6)
   ld (ix),a
   ret
SEOffset = SERam - $
SEMouse:   

   ;ld d,0
   ;ret
   ;if there is a mouse section...
   ;...code...
   in a,(2)
   ld b,a
   and 80h
   jp z,TI83p+SEOffset
   in a,(21h)
   and 3
   jp z,TI84p+SEOffset
   bit 5,b
   jp z,TI83p+SEOffset
TI84p:
.echo "SEoffset"
.echo (TI84p + SEOffset)
   push ix
   ld   hl,uuAppName+SEOffset
   rst    20h  ;move 9 to op1
   ;bcall(_mov9toop1)
   bcall(_findapp)
   jp     c,uuDone+SEOffset
   ld     de,USBDriverCall
   ld     hl,uuDriverCode+SEOffset
   ld     bc,uuDriverSize
   ldir
   ld     (USBDriverCall+uuMod1 + 1),a
   in     a,(6)
   ld     (USBDriverCall+uuMod3 +1),a
   or     a
   jp     uuDone+SEOffset
uuAppName:
   .db     $14,"USBDRV8X",0
uuDriverCode:
   push   af
   in     a,(6)
   ld     (USBDriverCall+uuMod2 +1),a
   call   USBDriverCall+uuCall1
   pop    af
   call   USBDriverEntryPoint
   push   af
uuMod2 = $ - uuDriverCode
   ld     a,0
   out    (6),a
   pop    af
   ret
uuCallBack:
uuMod3 = $-uuDriverCode
   ld     a,0
   out    (6),a
   call   Stub+SEOffset
uuCall1 EQU $-uuDriverCode
uuMod1 EQU $-uuDriverCode
   ld   a,0
   out    (6),a
   ret
uuDriverSize = $ - uuDriverCode
uuDone:
offCallBack = uuCallBack-uuDriverCode

   ;in a,(6)
   jp   c,NOUSB+SEOffset
   ld   hl,USBDriverBuf   
   U_CALL(DriverInit)
   jp   c,USBERR+SEOffset
   ld   hl,DBuf
   ld   bc,256
   bcall(_MemClear)
   ld   de,DBuf
   ld   b,0
   U_CALL(MouseInit)
   jp   c,USBERR+SEOffset
   U_CALL(MouseGetKey)
   bit 0,b
   jr nz,LeftClick
   bit 1,b
   jr nz,RightClick
   bit mouseBitRight,c
   jr nz,MoveRight
   bit mouseBitLeft,c
   jr nz,MoveLeft
   bit mouseBitUp,c
   jr nz,MoveUp
   bit mouseBitDown,c
   jr nz,MoveDown
   U_CALL(HostKill)
   U_CALL(DriverKill)
NOUSB:
   pop ix
   ld a,(ix)
   out (6),a
   ld d,0
   ret   

LeftClick:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,1
   ret
RightClick:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,2
   ret
MoveLeft:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,5
   ret
MoveRight:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,6
   ret
MoveUp:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,3
   ret
MoveDown:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
   ld d,4
   ret
USBERR:
   U_CALL(HostKill)
   U_CALL(DriverKill)
   pop ix
   ld a,(ix)
   out (6),a
TI83P:
   ld d,0
Stub:
   ret
   
MyRam = $ - SEMouse
   .echo "Mouse Module Size:"
   .echo $ - SEMouse
.end
END
In the most cramped version, the Spanish version, I have about 650 bytes, so there's a strong chance I'll include it. Smile
So this means Spanish is the most efficient out of French, English, and French?
Xphoenix wrote:
So this means Spanish is the most efficient out of French, English, and French?


No, it means you can't read.
Firstly it means the oppisite. Secondly you listed French twice.

EDIT: Kllrnohj beat me to the post.
KermMartian wrote:
In the most cramped version, the Spanish version, I have about 650 bytes, so there's a strong chance I'll include it. Smile


pwntastic.
Super Speler wrote:
EDIT: Kllrnohj beat me to the post.


By 5 seconds Wink. I'd blame that on you pointing out his inclusion of French twice.
Whoa, you definitely don't want to be re-initializing the device and killing it on every call to this.

Is there some way for you to run certain SEs with a certain code at startup and shutdown so that this will know when to init, die, and then move the mouse? If not, I highly recommend it, like what Ion does with its modules.
you can, but there is no way to ensure the driver will remain uncorrupted in memory.

[edit]

I get 2 bytes of ram that can remain uncorrupted, 1 of them I use for storing which page DCS is on.
elfprince13 wrote:
you can, but there is no way to ensure the driver will remain uncorrupted in memory.


Perhaps the SE system should be re-written then to allow for such things. Perhaps a sort of malloc call for SEs. Not sure how feasible it would be, but SEs could have a header that says how much space they want/need and DCS could create an AppVar with that size, then upon SE execution a variable (register or predefined saferam word, for example) would point to the section of the AppVar's data that the SE can use. When a program is run, the AppVar could just be archived to free up that chunk of RAM while allowing the SEs to keep their data. Of course, this wouldn't guarantee the RAM isn't corrupted by a different SE, but still...
hmmm, perhaps I can redo it a bit to optimize it, I just had an idea.
You can figure out what page DCS is on with a simple in a,(6) when your 'running' section starts.
KermMartian wrote:
You can figure out what page DCS is on with a simple in a,(6) when your 'running' section starts.


we'll come back to that, lemme do what I just thought of doing Smile (this optimization *won't* work if its in an app, but the way I'm setup now, it should be fine.
Well, you did mention that you'd rather be corrected than reprimanded, so there you go.

As far as the code goes, Elfprince was kind enough to include entire header including the equates, so you wouldn't need to do much more than run it through an assembler to see how done it is.
I knew that that code didn't work I was wondering if any changes to that code had fixed the issues since he posted the original code.
when I have anything resembling improved code it will be posted. until then, please only post if you have feedback/code suggestions
http://jim.revsoft.org/SEmouse.8xp

It will overwrite a portion of user ram. I suggest to used this only as a test after a ram clear. The problem is there isn't alot of safe ram.

It needs 416 bytes of ram, and 250 of code(more for better acceleration).

My first thought was that it might be possible to use the extra ram pages, unfortunately this caused nothing but complications.

If you have 32, 128, and 256 bytes ram buffers lying around this might be doable without crash or corruption.
Jim e wrote:
http://jim.revsoft.org/SEmouse.8xp

It will overwrite a portion of user ram. I suggest to used this only as a test after a ram clear. The problem is there isn't alot of safe ram.

It needs 416 bytes of ram, and 250 of code(more for better acceleration).

My first thought was that it might be possible to use the extra ram pages, unfortunately this caused nothing but complications.

If you have 32, 128, and 256 bytes ram buffers lying around this might be doable without crash or corruption.


I was using the space starting from the end of the SE to the end of appbackupscreen for the buffers, but that only works if they can be overwritten between runs.
elfprince13 wrote:
I was using the space starting from the end of the SE to the end of appbackupscreen for the buffers, but that only works if they can be overwritten between runs.
Definitely won't work.

I didn't see any reason why remapping portions of the ram wouldn't work. I turned on the pump so the USB hook "shouldn't" try writing to memory unless I say so. My original idea was to use a portion of another ram page to store the U_call, the driver buffer, and the descriptor buffer. When I needed them I would Block remap using port 28h. Problem is it didn't work.

Normally the hook occurs when the USB triggers an interrupt. Pump however disables USB interrupts, not the hook. When I worked with the MSD driver I had my own interrupts, everything worked as expected cause I controlled everything. This time though ti-os interrupts are running. I think for some reason ti-os set the hardware to trigger interrupts again, because thats what the behavior appears to be. I'm not sure. It might still be possible to implement this in the app, it would certainly justify Kerm's mouse interface some.

I don't know, the benefit of keeping the usb data on another page is that you could keep the mouse going even with other programs without any changes to their program's code to support it. Maybe warping around USB8x's hook so you could remap the ram layout prior to it's call would be possible. Either way this would be far more practical in the app rather than a module.

Quote:
Take a look at Jim, he had several mistakes as well, but you don't see me pointing them out, and we all know he's far from dumb.
Yes thanks for not singling me out and bringing light to my poor spelling.
  
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