Kyle22 Posted February 26, 2014 Share Posted February 26, 2014 (edited) I have looked all over and can't find anyone who has done this. I was hoping it would be as simple as changing one byte in the OS keyboard table, but it's not. $D209 reads $11 for HELP, $A6 for CTRL-?, and $E6 CTRL-SHIFT-? *** This is an Incognito 800 with XL/XE OS *** So I need an XL/XE OS hack. I was trying to make CTRL-SHIFT-? work as the XL/XE HELP key. For example, Happy Master Quad sector editor uses the HELP key. Any and all info on the subject would be helpful. -K Edited February 26, 2014 by Kyle22 Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 27, 2014 Share Posted February 27, 2014 The normal key table in Rom only covers keys with Shift or Ctrl, not both. To get Help going without the actual key, you'd need to modify the keyboard interrupt handler somewhat. Probably also the key repeat code in the VBlank routine. The XL key IRQ code has parts that handle the F-keys on any XL/XE model which means there's sufficient space to remove that and add other code. Alternate to all that, an actual extra key could be wired into the keyboard, although potentially a tricky job. Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 27, 2014 Author Share Posted February 27, 2014 This looks like the area in question, I hoped to just do a small patch without having to shift everything around. fc4a lda $D209 ; KBCODE tax cmp #$9F bne fc5c lda $02ff ; SSFLAG eor #$ff sta $02ff ; SSFLAG bcs fc6dfc5c and #$3f cmp #$11 ; value for HELP key bne fc90 stx $02dc ; HELPFG beq fc6dfc67 stx $02fc ; CH stx $02f2 ; CH1fc6d lda #$03 sta $02f1 ; KEYDEL lda #$00 sta $4d ; ATRACT lda $02d9 ; spare byte sta $022b ; SRTIMR lda $022f ; SDMCTL bne fc87 lda $02dd ; Spare sta $022f ; SDMCTLfc87 sty $d301 pla tay pla tax pla rtifc90 cpx #$84 beq fcb5 cpx #$94 bne fc67 lda $02f4 ; CHBAS ldx $026b ; LINBUF sta $026b stx $02f4 ; CHBAS cpx #$cc beq fcae tya ora #$08 tay bne fc6dfcae tya and #$f7 tay jmp fc6dfcb5 lda $022f ; SDMCTL beq fc87 sta $02dd ; Spare byte lda #$00 sta $022f ; SDMCTL beq fc87 pha lda $02c6 ; COLOR2 eor #004f and $004e sta $d40a ; WSYNC sta $d017 ; COLPF1 pla rti Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 27, 2014 Share Posted February 27, 2014 (edited) Yes, you might be able to get away with a small patch. You should be able to rework the handler code. Since the 1200XL stuff for F-keys and LEDs is still in there, it can be removed without affecting anything. Also note how it masks out the Shift+Ctrl combinations when checking for Help. Obviously that can't work on an 800 since you'd have to dedicate a key to Help and you'd lose it's functionality. You could probably keep the Shift/Ctrl combinations of Help, maybe use ? for Help, then the , and . for the Shift and Ctrl versions of Help. Also, keep the code path the same as if Help was otherwise detected on an XL - remembering that the Help key doesn't generate a keycode in CH or a keyclick. I think the auto-repeat stuff in the VBlank can be left as-is... at worst you'd get those unassigned codes being sent to CH and a keyclick generated but I feel that most likely it should behave same as an XL regarding (lack of) repeat. Finally, once you've finalised the mod, you might want to alter the system checksum of the relevant OS ROM area. Edited February 27, 2014 by Rybags Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 27, 2014 Author Share Posted February 27, 2014 I assembled a small program to copy OS into RAM so I can POKE it. I am using DDT in the M65 cart, and it's tricky. If I'm not careful, I crash the keyboard handler and lock up, as I'm poking in real time If I could only squeeze out one or two extra bytes.... I would be happy just to get HELP, I don't think the CTRL or CTRL-SHIFT is used by much. Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 27, 2014 Share Posted February 27, 2014 For debugging purposes you might be better off just doing a custom keyboard IRQ in lower RAM. If you remove all the stuff that alters PORTB, does F-key checks etc then there should be plenty of room to handle the Help substitution. Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 27, 2014 Author Share Posted February 27, 2014 I just got it fc5c cmp #e6 ; scan code of ctrl-shift-? bne fc90 ; is isn't ldx #$11 ; XL help key code stx $02dc ; put it in HELPFG The problem I was having was that my RAM OS kept getting kicked out every time I tried to load a program to test it. Now, I need to figure out the checksum thing. I just patched the check routine to clc and rts, instead of calculating a proper cksum. But it works, and is exactly the same size, only 6 bytes changed Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 27, 2014 Share Posted February 27, 2014 (edited) It's probably inevitable though that something will come along that wants Shift or Ctrl + Help. There should be room - just get rid of that F-key and PortB stuff. Actually - the F-key stuff isn't totally useless. One nice feature is that they added extra features like: - Home (move cursor to 0,0 without doing CLS) - cursor to start of line - cursor to end of line The Home feature is real nice. Personally I'd just have it replace Shift + Clear, you can still use Ctrl + Clear for clear-screen. Been a while since I looked, not sure if it's done by a key mapping or by the IRQ flagging a special function required. Edited February 27, 2014 by Rybags Quote Link to comment Share on other sites More sharing options...
fibrewire Posted February 27, 2014 Share Posted February 27, 2014 (edited) For Incognito equipped machines, why not add the left column of keys from the CX85? Several are on EBAY right now. Edited February 27, 2014 by fibrewire Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 27, 2014 Author Share Posted February 27, 2014 Interesting idea, but the code would need modified to store $11 in $02dc. It would not be compatible with some programs because of the extra interrupt handler. You can't just set it to produce the scan code for the HELP key $11 because it never gets passed to the OS help key routine. I tried. Quote Link to comment Share on other sites More sharing options...
Rybags Posted February 28, 2014 Share Posted February 28, 2014 With the keyboard IRQ I only meant do it in lower RAM while testing. Then replace the OS one when you have everything working and cut to suitable size. Quote Link to comment Share on other sites More sharing options...
Kyle22 Posted February 28, 2014 Author Share Posted February 28, 2014 With the keyboard IRQ I only meant do it in lower RAM while testing. Then replace the OS one when you have everything working and cut to suitable size. Sorry, I was referring to the idea of using a modified CX85 handler. I think I'll leave it as-is, for compatibility reasons. I have yet to see a program that uses shift or ctrl help. If I do, I'll attack the issue again. With only 6 bytes to change (plus the checksum), it should be easy to patch into most other OS's without too much trouble. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.