Re: Assembly Programming / Keyboard Relay
On Thu, Aug 04, 2005 at 02:21:24PM +0200, Frode Tenneboe wrote: > On Thu, 4 Aug 2005 11:51:17 +0100 Stuart Brady <[EMAIL PROTECTED]> wrote: > > I tried setting BREAKDI... didn't seem to help, unfortunately. > > Hmmm...do you have an old ROM? how about poke svar 321,1 then? > Haven't tested with the serial driver though... Still doesn't work. :( > > I don't think there would be a way to determine when a key is released, > > or to allow keys to be pressed together. > > Not sure what bearing this has one your function. As I understand it > you want to use the SAM teletype-ish; one key at a time, serial. I want it to be keyboard-ish, equivalent to sending press/release events. When a scan line changes, it prints the entire scan line to the stream. The other end receives lines like: 1,254 1,255 2,253 2,255 5,127 5,255 The left-most number is the scan line number. The right-most number is the current scan -- each bit corresponding to the key. 0 indicates that the key is pressed (and 1 means it's released). So 255 means that no keys are pressed on that scan line. This is the same as the BASIC program that I'd written earlier. Cheers, -- Stuart Brady
Re: Assembly Programming / Keyboard Relay
On Thu, 4 Aug 2005 11:51:17 +0100 Stuart Brady <[EMAIL PROTECTED]> wrote: > On Thu, Aug 04, 2005 at 09:59:48AM +0200, Frode Tenneboe wrote: > > I don't know whether DI could interfere with serial drivers. Ah. You are probably right. :) > I tried setting BREAKDI... didn't seem to help, unfortunately. Hmmm...do you have an old ROM? how about poke svar 321,1 then? Haven't tested with the serial driver though... > > Just a few questions: > > 1) Why did you use JSTKSTORE and JSTRS? Couldn't you just > > RST#10 the character? Or..in other words, I don't think I > > understand the "test" routine. > > For each scan line, it determines whether that scan line has changed. > If it has, then it prints the scan line number, followed by its new > value. The print routine prints out the (unsigned) integer held by A in > decimal. It stores the integer (JSTKSTORE), converts it to a string > (JSTRS), and then prints that string (#0013). I''m still not sure I understand the whole exercise. You are only interested in printing the key input, right? > > 2) Since you are alredy using ROM routines, why not use the > > JREADKEY/JWAITKEY instead. This gives the key in A and > > you are ready to send it to the stream. > > I don't think there would be a way to determine when a key is released, > or to allow keys to be pressed together. Not sure what bearing this has one your function. As I understand it you want to use the SAM teletype-ish; one key at a time, serial. It would probably help if I actually ran the code. :) Buf if your routine works - don't change it! Here's the assembly from the keyscan routine in ROM: D5B8 ;KEYSCAN. D5B8 ;ACTION: LOOK FOR CHANGED BITS IN KEYBOARD STATE SINCE LAST SCAN, SO THAT D5B8 ;SEVERAL KEYS CAN BE PRESSED DOWN AND A NEW KEY WILL STILL BE NOTICED. IGNORE D5B8 ;KEY RELEASES. IF THERE HAVE BEEN NO NEW PRESSES, RETURN THE SAME KEYSCAN D5B8 ;CODES AS LAST TIME, UNLESS ALL KEYS ARE RELEASED - THEN RETURN NULL CODE. D5B8 D5B8 ;ENTRY: NO CONDITIONS D5B8 ;EXIT: IF NZ, NO KEY PRESSED AND DE= D5B8 ; IF Z, E=KEY VALUE D5B8 ; IF D=0, NO SHIFT, ELSE D=1 (CAPS SH.) 2 (SYM. SH.) OR 3 (CONTROL) D5B8 D5B8 ;ENTER AT KEYSCAN+3 WITH HL=DIFFERENT 18-BYTE KBUFF IF DESIRED D5B8 D5B8 ;USED BY INKEY$ - 2 SCANS IN CASE OF INTERRUPT -Frode -- ^ Frode Tennebø | email: [EMAIL PROTECTED] ^ | Ericsson AS | Isebakkeveien 49 | | N-1788 Halden | Phone: +47 45 24 99 39| | with Standard.Disclaimer; use Standard.Disclaimer;|
Re: Assembly Programming / Keyboard Relay
On Thu, Aug 04, 2005 at 09:59:48AM +0200, Frode Tenneboe wrote: > On Wed, 3 Aug 2005 23:37:14 +0100 Stuart Brady <[EMAIL PROTECTED]> wrote: > > I've ported the keyboard relaying program that I wrote to assembly > > language, and I've found a problem: pressing ESCAPE breaks into SAM > > BASIC. Could someone tell me how to stop it from doing that, please? > > You could either DI first in your program, or (AFAICR) > POKE 23361,1 (BERAKDI). I don't know whether DI could interfere with serial drivers. I tried setting BREAKDI... didn't seem to help, unfortunately. > Just a few questions: > 1) Why did you use JSTKSTORE and JSTRS? Couldn't you just > RST#10 the character? Or..in other words, I don't think I > understand the "test" routine. For each scan line, it determines whether that scan line has changed. If it has, then it prints the scan line number, followed by its new value. The print routine prints out the (unsigned) integer held by A in decimal. It stores the integer (JSTKSTORE), converts it to a string (JSTRS), and then prints that string (#0013). > 2) Since you are alredy using ROM routines, why not use the > JREADKEY/JWAITKEY instead. This gives the key in A and > you are ready to send it to the stream. I don't think there would be a way to determine when a key is released, or to allow keys to be pressed together. Thanks, -- Stuart Brady
Re: Assembly Programming / Keyboard Relay
On Wed, 3 Aug 2005 23:37:14 +0100 Stuart Brady <[EMAIL PROTECTED]> wrote: > Hi, > > I've ported the keyboard relaying program that I wrote to assembly > language, and I've found a problem: pressing ESCAPE breaks into SAM > BASIC. Could someone tell me how to stop it from doing that, please? You could either DI first in your program, or (AFAICR) POKE 23361,1 (BERAKDI). > Also, this is my first real assembly language program, so if anyone can > give feedback, or spot any bugs, I'd be grateful! Just a few questions: 1) Why did you use JSTKSTORE and JSTRS? Couldn't you just RST#10 the character? Or..in other words, I don't think I understand the "test" routine. 2) Since you are alredy using ROM routines, why not use the JREADKEY/JWAITKEY instead. This gives the key in A and you are ready to send it to the stream. -Frode -- ^ Frode Tennebø | email: [EMAIL PROTECTED] ^ | Ericsson AS | Isebakkeveien 49 | | N-1788 Halden | Phone: +47 45 24 99 39| | with Standard.Disclaimer; use Standard.Disclaimer;|
RE: Who`s missing?
Back in ye olde days, Colin MacD, Ian Slavin, Steve Taylor and Stefan all posted here. I think most of them still lurk - at least, Colin MacD certainly does. ;) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Calvin Allett > Sent: 08/02/2005 5:56 PM > To: sam-users@nvg.ntnu.no > Subject: Who`s missing? > > From memory alone who`s missing from posting here? > > To not still be typing in five minutes, I`ll only mention a > few but just a couple I`m amazed haven`t found their way here > being Colin MacDonald, though I get the impression he`s doing > well... and Ian Slavin (Axe), would be cool too if Steve > Taylor or M.o.Magic etc could be here :) > > Ohh, and Stefan Drissen, I know most/half members here were > regulars at the UK meetings or had connections with SAMCo, > but who amongst the scene do you wish was > contributing or talking about SAM Still? > > > > > > ___ > How much free photo storage do you get? Store your holiday > snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
RE: Quick question...
For the 3rd time :P (cheers frode ;)) Erm thewhitehouse.co.uk always works , must get the web server up n running again soon C -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Cooke Sent: 06 July 2005 09:50 To: sam-users@nvg.ntnu.no Subject: Quick question... Does anyone have a working email address for Chris White any more? Just wondering :) Si (busy busy busy trying to ship http://sufferingtiesthatbind.com/)
Assembly Programming / Keyboard Relay
Hi, I've ported the keyboard relaying program that I wrote to assembly language, and I've found a problem: pressing ESCAPE breaks into SAM BASIC. Could someone tell me how to stop it from doing that, please? Also, this is my first real assembly language program, so if anyone can give feedback, or spot any bugs, I'd be grateful! Other than that, it seems to work much, much faster than the BASIC version -- it's actually quite usable. Here's the code: LD A,#06; switch to stream 6 CALL jsetstrm LD BC,8 ; clear the lastscan buffer LD HL,lastscan LD D,H LD E,L INC DE LDIR keybloop: CALL scan ; contiuously check the keyboard CALL test JR keybloop scan: LD HL,scanbuf ; output buffer LD B,%1110 ; first scan line scanloop: LD C,hikey ; high-order 3 bits of scan line IN A,(C) AND %1110 LD (HL),A LD C,lokey ; low-order 5 bits of scan line IN A,(C) AND %0001 OR (HL) LD (HL),A ; save the scan line INC HL ; next scan line SCF RL B JR C,scanloop IN A,(C); last scan line (RDMSEL) AND %0001; low-order 5 bits only LD (HL),A RET test: LD HL,scanbuf ; test each scan line LD DE,lastscan LD B,9 ; 9 scan lines testloop: LD A,(DE) LD C,(HL) ; B is always 0 - no need to save it CP C JP Z,testnext ; skip this if the scan line has not changed LD A,C LD (DE),A ; update this scan line in the lastscan buffer LD A,9 ; print the scan line number that has changed SUB B CALL print LD A,#2C; print a comma RST #10 LD A,(DE) ; print the value of the scan line CALL print LD A,#0d; print a \r RST #10 testnext: INC HL ; test the next scan line INC DE DJNZ testloop RET print: PUSH AF ; print the value held in A PUSH BC PUSH DE PUSH HL LD D,A LD C,0 LD E,0 LD A,0 CALL jstkstore CALL jstrs CALL #0013 POP HL POP DE POP BC POP AF RET jsetstrm: EQU #0112 ; ROM routines jstkstore: EQU #0127 jstrs: EQU #017e hikey: EQU 249; I/O ports lokey: EQU 254 scanbuf: DEFS 9 ; buffers lastscan: DEFS 9 And here's the BASIC loader: 10 LOAD "keyb.cde" CODE 20 PRINT "SAM Coupe Keyboard Relay" 30 CLOSE #6 40 OPEN #6;"b" 50 CALL 32768 -- Stuart Brady