> KeySave/s 9 Source for *KeySave - save function key definitions  Based on *Show/*KeyList (: 27OSARGS=&FFDA:OSFIND=&FFCE:OSFILE=&FFDD:OSBPUT=&FFD4 <4OS_CLI=&FFF7:OSBYTE=&FFF4:OSWRCH=&FFEE:BRKV=&202 F!load%=&FFFF0900: mcode% &200 P5zp=&A8:kptr=&A8:kend=&AA:num=&AC:host=&AD:tmp=&AE Z: d P=0 1 nP%=load%:O%=mcode% x[OPT P*3+4 .errCantSave .BRK:EQUB 192:EQUS "Can't save file":EQUB 0 : .go% LDA zp:STA ctrl:LDA zp+1:STA ctrl+1 :\ Point to filename >LDA #0:JSR CallOsfile :\ Save initial file >LDX ctrl:LDY ctrl+1:LDA #&80 :\ Point to filename =JSR OSFIND:TAY:BEQ errCantSave :\ Try to open file ?STY handle+1:JSR brkSwap:LDX #0 :\ Set up BRK handler .ShowFX ALDA FXString,X:JSR OSBPUT:INX :\ Output "FX18" string CMP #13:BNE ShowFX:LDX #0  .ShowAll AJSR ShowKey:INX:CPX #16:BNE ShowAll :\ Loop through 0 to 15 "GJSR TidyUp:LDA #5:JSR CallOsfile :\ Close file, read file info ,>LDA #&EB:STA ctrl+3:LDX #&FF :\ Set filetype=Obey 6(STX ctrl+5:STX ctrl+4:INX:STX ctrl+2 @HLDA #2:JMP CallOsfile :\ Write load address and exit J: T .TidyUp ^CJSR brkSwap:JSR RomRestore :\ Restore BRK, ROM state h7.handle:LDY #0:LDA #0:JMP OSFIND :\ Close file r: | .brkSwap 5LDA BRKV+0:LDX newBRKV+0:STA newBRKV+0:STX BRKV+0 9LDA BRKV+1:LDX newBRKV+1:STA newBRKV+1:STX BRKV+1:RTS  .brkTrap GJSR TidyUp:JMP (BRKV) :\ Close, etc., pass error on  .newBRKV EQUW brkTrap : 7.ShowKey :\ Show key X ;LDA &F4:STA rom+1 :\ Save ROM state =A #128:JSR RomSelect :\ Page workspace in 3LDA host:CMP #3:BCS ShowMaster :\ Master APHP:SEI:LDA &B10:SEC:SBC &B00,X :\ Copied from MOS 1.20 BSTA tmp:TYA:PHA:LDY #16 :\ Find length of string  .LE3B7 LDA &B00,Y:SEC:SBC &B00,X BCC LE3C8:BEQ LE3C8 &CMP tmp:BCS LE3C8:STA tmp 0 .LE3C8 :DEY:BPL LE3B7:PLA:TAY:PLP D LDA #1:ADC &B00,X:STA kptr+0 NADC tmp:STA kend+0 XFLDA #&B:STA kptr+1:STA kend+1 :\ kptr/kend=>BBC definition b@BNE KeyDisplay :\ Show key definition l.ShowMaster v1LDA &8000,X:STA kptr+0:LDA &8011,X:STA kptr+1 1LDA &8001,X:STA kend+0:LDA &8012,X:STA kend+1 .KeyDisplay )LDA kptr+0:CMP kend+0:BNE KeyNotEmpty &LDA kptr+1:CMP kend+1:BEQ KeyEmpty .KeyNotEmpty TXA:PHA:LDY handle+1:LDX #0  .PrKey 9LDA KeyString,X:JSR OSBPUT:INX :\ Print "Key " CMP #" ":BNE PrKey 3PLA:TAX:CMP #10:BCC KeyDigit :\ num<10 BLDA #"1":JSR OSBPUT:TXA:CLC:SBC #9 :\ Print "1", A=next digit  .KeyDigit ;A #"0":JSR OSBPUT :\ Print units digit >LDA #32:JSR OSBPUT:JSR PrQuote :\ Print  : .KeyPrintLp  DLDA kptr+0:CMP kend+0:BNE KeyChar :\ Not at end of defintion *>LDA kptr+1:CMP kend+1:BEQ KeyEnd :\ End of definition 4 .KeyChar >5LDY #0:LDA (kptr),Y:BPL KeyLowChar :\ Char<128 HBPHA:JSR PrBar:LDA #"!":JSR OSBPUT :\ Print "|!" for char>127 R |" z2CMP #"|" 64:BEQ KeyCtrlChar :\ | -> |" 4 #64:CMP #127:BEQ KeyCtrlChar :\ Del -> |? 6CMP #32:BCS KeyPrintChar :\ <32 -> |X .KeyCtrlChar PHA:JSR PrBar:PLA: #64 .KeyPrintChar @JSR OSBPUT:INC kptr+0:BNE KeyPrintLp :\ Print and loop back INC kptr+1:BNE KeyPrintLp  .KeyEnd "JSR PrQuote:LDA #13:JSR OSBPUT  .KeyEmpty .RomRestore .rom:LDA #0 .RomSelect STA &F4:STA &FE30:RTS .CallOsfile .LDX #ctrl 255:LDY #ctrl 256:JMP OSFILE $: ...PrBar :LDA #"|":LDY handle+1:JMP OSBPUT 8.PrQuote:LDA #34:JMP OSBPUT B.KeyString:EQUS "*Key " L$.FXString :EQUS "*FX 18":EQUB 13 VEQUS "v1.01":BRK ` .ctrl jFEQUW 0:EQUD &FFFFEB00:EQUD &FFFF0000:EQUD &FFFF0900:EQUD &FFFF0D00 t] ~ C"*SAVE KeySave ";~mcode%;" ";~O%;" ";~go%&FFFF0000;" ";~load%