**************************************************************************                                                                       **       OSBYTE 154 (&9A) SET VIDEO ULA                                  **                                                                       **************************************************************************E9FF	TXA         ;osbyte entry! X transferred to A thence to*******Set Video ULA control register **entry from VDU routines **************    	            ;called from &CBA6, &DD37EA00	PHP         ;save flagsEA01	SEI         ;disable interuptsEA02	STA &0248   ;save RAM copy of new parameterEA05	STA &FE20   ;write to control registerEA08	LDA &0253   ;read  space countEA0B	STA &0251   ;set flash counter to this valueEA0E	PLP         ;get back statusEA0F	RTS         ;and return**************************************************************************                                                                       **        OSBYTE &9B (155) write to palette register                     **                                                                       **************************************************************************    	    ;entry X contains value to writeEA10	TXA         ;A=XEA11	EOR #&07    ;convert to palette formatEA13	PHP         ;EA14	SEI         ;prevent interruptsEA15	STA &0249   ;store as current palette settingEA18	STA &FE21   ;store actual colour in registerEA1B	PLP         ;get back flagsEA1C	RTS         ;and exit    	            ;**************************************************************************       GSINIT  string initialisation                                   **       F2/3 points to string offset by Y                               **                                                                       **       ON EXIT                                                         **       Z flag set indicates null string,                               **       Y points to first non blank character                           **       A contains first non blank character                            **************************************************************************EA1D	CLC         ;clear carryEA1E	ROR &E4     ;Rotate moves carry to &E4EA20	JSR &E03A   ;get character from textEA23	INY         ;increment Y to point at next characterEA24	CMP #&22    ;check to see if its '"'EA26	BEQ &EA2A   ;if so EA2A (carry set)EA28	DEY         ;decrement YEA29	CLC         ;clear carryEA2A	ROR &E4     ;move bit 7 to bit 6 and put carry in bit 7EA2C	CMP #&0D    ;check to see if its CR to set ZEA2E	RTS         ;and return**************************************************************************       GSREAD  string read routine                                     **       F2/3 points to string offset by Y                               **                                                                       **************************************************************************    	            ;EA2F	LDA #&00    ;A=0EA31	STA &E5     ;store AEA33	LDA (&F2),Y ;read first characterEA35	CMP #&0D    ;is it CREA37	BNE &EA3F   ;if not goto EA3FEA39	BIT &E4     ;if bit 7=1 no 2nd '"' foundEA3B	BMI &EA8F   ;goto EA8FEA3D	BPL &EA5A   ;if not EA5AEA3F	CMP #&20    ;is less than a space?EA41	BCC &EA8F   ;goto EA8FEA43	BNE &EA4B   ;if its not a space EA4BEA45	BIT &E4     ;is bit 7 of &E4 =1EA47	BMI &EA89   ;if so goto EA89EA49	BVC &EA5A   ;if bit 6 = 0 EA5AEA4B	CMP #&22    ;is it '"'EA4D	BNE &EA5F   ;if not EA5FEA4F	BIT &E4     ;if so and Bit 7 of &E4 =0 (no previous ")EA51	BPL &EA89   ;then EA89EA53	INY         ;else point at next characterEA54	LDA (&F2),Y ;get itEA56	CMP #&22    ;is it '"'EA58	BEQ &EA89   ;if so then EA89EA5A	JSR &E03A   ;read a byte from textEA5D	SEC         ;and return withEA5E	RTS         ;carry set    	            ;EA5F	CMP #&7C    ;is it '|'EA61	BNE &EA89   ;if not EA89EA63	INY         ;if so increase Y to point to next characterEA64	LDA (&F2),Y ;get itEA66	CMP #&7C    ;and compare it with '|' againEA68	BEQ &EA89   ;if its '|' then EA89EA6A	CMP #&22    ;else is it '"'EA6C	BEQ &EA89   ;if so then EA89EA6E	CMP #&21    ;is it !EA70	BNE &EA77   ;if not then EA77EA72	INY         ;increment Y againEA73	LDA #&80    ;set bit 7EA75	BNE &EA31   ;loop back to EA31 to set bit 7 in next CHREA77	CMP #&20    ;is it a spaceEA79	BCC &EA8F   ;if less than EA8F Bad String ErrorEA7B	CMP #&3F    ;is it '?'EA7D	BEQ &EA87   ;if so EA87EA7F	JSR &EABF   ;else modify code as if CTRL had been pressedEA82	BIT &D9B7   ;if bit 6 setEA85	BVS &EA8A   ;then EA8AEA87	LDA #&7F    ;else set bits 0 to 6 in AEA89	CLV         ;clear VEA8A	INY         ;increment YEA8B	ORA &E5     ;EA8D	CLC         ;clear carryEA8E	RTS         ;Return    	            ;EA8F	BRK         ;EA90	DB  &FD     ;error numberEA93	DB 'Bad String' ; messageEA9B	BRK         ;************ Modify code as if SHIFT pressed *****************************EA9C	CMP #&30    ;if A='0' skip routineEA9E	BEQ &EABE   ;EAA0	CMP #&40    ;if A='@' skip routineEAA2	BEQ &EABE   ;EAA4	BCC &EAB8   ;if A<'@' then EAB8EAA6	CMP #&7F    ;else is it DELETEEAA8	BEQ &EABE   ;if so skip routineEAAA	BCS &EABC   ;if greater than &7F then toggle bit 4EAAC	EOR #&30    ;reverse bits 4 and 5EAAE	CMP #&6F    ;is it &6F (previously ' _' (&5F))EAB0	BEQ &EAB6   ;goto EAB6EAB2	CMP #&50    ;is it &50 (previously '`' (&60))EAB4	BNE &EAB8   ;if not EAB8EAB6	EOR #&1F    ;else continue to convert ` _EAB8	CMP #&21    ;compare &21 '!'EABA	BCC &EABE   ;if less than returnEABC	EOR #&10    ;else finish conversion by toggling bit 4EABE	RTS         ;exit    	            ;    	            ;ASCII codes &00 &20 no change    	            ;21-3F have bit 4 reverses (31-3F)    	            ;41-5E A-Z have bit 5 reversed a-z    	            ;5F & 60 are reversed    	            ;61-7E bit 5 reversed a-z becomes A-Z    	            ;DELETE unchanged    	            ;&80+ has bit 4 changed************** Implement CTRL codes *************************************EABF	CMP #&7F    ;is it DELEAC1	BEQ &EAD1   ;if so ignore routineEAC3	BCS &EAAC   ;if greater than &7F go to EAACEAC5	CMP #&60    ;if A<>'`'EAC7	BNE &EACB   ;goto EACBEAC9	LDA #&5F    ;if A=&60, A=&5FEACB	CMP #&40    ;if A<&40EACD	BCC &EAD1   ;goto EAD1  and return unchangedEACF	AND #&1F    ;else zero bits 5 to 7EAD1	RTS         ;return    	            ;EAD2	DB  '/!BOOT',&0D