added simple message validation

This commit is contained in:
Charles Mangin 2021-06-16 00:14:21 -04:00 committed by GitHub
parent e724c60e55
commit cb5f9b8943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 7 deletions

24
QR.6502
View File

@ -71,8 +71,10 @@ ROMSETVID EQU $FE93
ORG $2000 ; PROGRAM DATA STARTS AT $2000
JMP CHECKMESSAGE ; CHECKS CONTENT OF ALPHANUMERIC MESSAGE
JSR ROMINIT ; GR/HGR off, Text page 1
SETUP JSR ROMINIT ; GR/HGR off, Text page 1
LDA #$00
STA LORES ; low res graphics mode
STA MIXCLR
@ -606,6 +608,21 @@ NEXTMULT DEX
*** MULT45
CHECKMESSAGE LDA MODE
CMP #$20 ; ALPHANUMERIC MODE, LIMITED CHARACTERS IN ALPHANUM
BEQ CHECKBYTES
CHECKDONE JMP SETUP ; BYTE MODE, SKIP TO THE SETUP
CHECKBYTES LDY #$FF
CHECKCHAR ; FOR EACH CHARACTER OF THE MESSAGE, CHECK FOR FF
INY
LDX MESSAGE,Y
BEQ CHECKDONE
LDA ALPHANUM,X
BPL CHECKCHAR
RTS ; OOPS. INVALID CHARACTER.
DS \
QRLINE0 HEX 00,F0,F0,F0,F0,F0,00,FF,00,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,FF,00,F0,F0,F0,F0,F0,00
@ -635,11 +652,10 @@ GENERATOR HEX 00,11,3C,4F,32,3D,A3,1A,BB,CA,B4,DD,E1,53,EF,9C,A4,D4,D4,BC,BE
* 0 17 60 79 50 61 163 26 187 202 180 221 225 83 239 156 164 212 212 188 190
DS \
ALPHANUM DS 32
ALPHANUM DS 32,$FF
HEX 24,FF,FF,FF,25,26,FF,FF,FF,FF,27,28,FF,29,2A,2B,00,01,02,03,04,05,06,07,08,09,2C,FF,FF,FF,FF,FF,FF,0A,0B,0C,0D,0E,0F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20,21,22,23
* ASCII VAL
DS \,$FF
DS \
INTTOEXP HEX 00,00,01,19,02,32,1A,C6,03,DF,33,EE,1B,68,C7,4B,04,64,E0,0E,34,8D,EF,81,1C,C1,69,F8,C8,08,4C,71,05,8A,65,2F,E1,24,0F,21,35,93,8E,DA,F0,12,82,45,1D,B5,C2,7D,6A,27,F9,B9,C9,9A,09,78,4D,E4,72,A6,06,BF,8B,62,66,DD,30,FD,E2,98,25,B3,10,91,22,88,36,D0,94,CE,8F,96,DB,BD,F1,D2,13,5C,83,38,46,40,1E,42,B6,A3,C3,48,7E,6E,6B,3A,28,54,FA,85,BA,3D,CA,5E,9B,9F,0A,15,79,2B,4E,D4,E5,AC,73,F3,A7,57,07,70,C0,F7,8C,80,63,0D,67,4A,DE,ED,31,C5,FE,18,E3,A5,99,77,26,B8,B4,7C,11,44,92,D9,23,20,89,2E,37,3F,D1,5B,95,BC,CF,CD,90,87,97,B2,DC,FC,BE,61,F2,56,D3,AB,14,2A,5D,9E,84,3C,39,53,47,6D,41,A2,1F,2D,43,D8,B7,7B,A4,76,C4,17,49,EC,7F,0C,6F,F6,6C,A1,3B,52,29,9D,55,AA,FB,60,86,B1,BB,CC,3E,5A,CB,59,5F,B0,9C,A9,A0,51,0B,F5,16,EB,7A,75,2C,D7,4F,AE,D5,E9,E6,E7,AD,E8,74,D6,F4,EA,A8,50,58,AF
EXPTOINT HEX 01,02,04,08,10,20,40,80,1D,3A,74,E8,CD,87,13,26,4C,98,2D,5A,B4,75,EA,C9,8F,03,06,0C,18,30,60,C0,9D,27,4E,9C,25,4A,94,35,6A,D4,B5,77,EE,C1,9F,23,46,8C,05,0A,14,28,50,A0,5D,BA,69,D2,B9,6F,DE,A1,5F,BE,61,C2,99,2F,5E,BC,65,CA,89,0F,1E,3C,78,F0,FD,E7,D3,BB,6B,D6,B1,7F,FE,E1,DF,A3,5B,B6,71,E2,D9,AF,43,86,11,22,44,88,0D,1A,34,68,D0,BD,67,CE,81,1F,3E,7C,F8,ED,C7,93,3B,76,EC,C5,97,33,66,CC,85,17,2E,5C,B8,6D,DA,A9,4F,9E,21,42,84,15,2A,54,A8,4D,9A,29,52,A4,55,AA,49,92,39,72,E4,D5,B7,73,E6,D1,BF,63,C6,91,3F,7E,FC,E5,D7,B3,7B,F6,F1,FF,E3,DB,AB,4B,96,31,62,C4,95,37,6E,DC,A5,57,AE,41,82,19,32,64,C8,8D,07,0E,1C,38,70,E0,DD,A7,53,A6,51,A2,59,B2,79,F2,F9,EF,C3,9B,2B,56,AC,45,8A,09,12,24,48,90,3D,7A,F4,F5,F7,F3,FB,EB,CB,8B,0B,16,2C,58,B0,7D,FA,E9,CF,83,1B,36,6C,D8,AD,47,8E,01

View File

@ -14,5 +14,5 @@
820 VTAB 16: INVERSE: PRINT "Valid characters:" : PRINT "A-Z 0-9 $ % * + - . / : (space)": NORMAL
1000 VTAB 12: INPUT ">";S$
1010 if ((M$ = "A" and len(S$)>114) or (M$ = "B" and len(S$)>78)) then ? "Message too long.": goto 1000
1020 CALL 8192
1020 CALL 8192 : REM IF THIS FAILS, THE MESSAGE CONTAINS SOMETHING OUTSIDE THE ALLOWED RANGE
1030 HOME : VTAB 5: INVERSE : ? "INVALID CHARACTERS ENTERED. TRY AGAIN.": NORMAL :VTAB 8:GOTO 810

Binary file not shown.