I'm trying to improve the ROM framework in Bruce Smith's book. The things it didn't address were lower/mixed case command and abbreviations. I've got these working, but have one thing left to fix.
Namely, if my * command is *MYCOMMAND, *MYCOMMAND works (in any case), *MY., *MYC. etc all work. But, *MYCOMMAND. (ie with a period after the full command name) also works...but shouldn't.
Is anyone able to suggest what I could add to make it work please? I think I've been staring at it for too long. I tried a few things, but none had the desired effect!
Here's my current code:
Code: Select all
.unrecognised TYA PHA TXA PHA LDX #&FF DEY STY stack .ctloop INX INY LDA table, X BMI found \ end of string? LDA (comline), Y CMP #&2E \ ASC"." - check for abbreviations BNE not_dot .skip_if_dot \ Skip the rest of the current rom command INX LDA table, X BMI found \ Jump to found when the jump address is encountered BPL skip_if_dot \ Loop around until the table command is exhausted .not_dot AND #&DF CMP table, X \ keep testing for matches BEQ ctloop .again \ fetch next command in table INX LDA table, X BPL again CMP #&FF \ no more? BEQ out \ none matched; exit INX LDY stack JMP ctloop .out .not_this_rom PLA TAX PLA TAY PLA RTS .found CMP #&FF BEQ not_this_rom STA jump+1 INX LDA table, X STA jump JMP (jump) .table EQUS "MYCOMMAND",&0D \ &0D *MYCOMMANDxxxx doesn't match EQUB jumpaddress DIV 256 EQUB jumpaddress MOD 256 EQUB &FF