Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- outCharHinted:
- ; OUT-CHAR-HINTED
- .ORG 40000 ; address 30000 ($7530). todo normal one.
- colStart:
- PUSH BC ; B - backup current color ;
- LD BC,($5C8D) ; backup the current color value
- CALL $2D1B ; routine NUMERIC tests if it is a digit ?
- JP NC,outCh3 ; to OUT-CH-3 to print digit without
- ; changing mode. Will be 'K' mode if digits
- ; are at beginning of edit line.
- ; save the registers for later restore
- ; what those will be used for:
- PUSH DE ;
- PUSH HL ; list pointer
- CP $A5 ; if a < A5? (i.e. not commands or functions)
- JR C,colCaps ; go to caps letters
- ;
- CP $C5 ; if a < C5? (i.e. not operators)
- JR C,colMarkFunc ; go to function colorizer
- ;
- JP colMarkOp ; else go to operator colorizer
- ;
- colCaps:
- CP $41 ; if a < 41 (i.e. it's not the caps letter A)
- JP C,colMisc ; go to misc
- ;
- CP $5B ; if a < 5B (i.e. it's in the A-Z range)
- JP C,colMarkLet ; go to letter colorizer
- colSmall:
- CP $61 ; if a < 61 (i.e. it's not in the a-z range)
- JP C,colMisc
- ;
- CP $7B ; if a < 7B (i.e. it's in the a-z range)
- JP C,colMarkLet
- ;
- ;
- colMisc:
- LD HL,colMiscList ; address of the list of symbols to colorize
- ; CALL HI-SEARCH ; scan the list
- colSearchLoop:
- CP (HL) ; is the value in (HL)
- JP Z,colMarkOp ; then go to operator colorizer
- ;
- CP $20 ; is the symbol is space?
- JP colEnd ; exit then
- ;
- INC HL
- JR colSearchLoop
- ;
- colMiscList:
- .db "+-*/<>= " ; list of scattered operator symbols
- ; the space symbol is used as end marker
- ;
- colMarkOp:
- PUSH AF
- LD A,$39
- LD ($5C8D),A ; operators: blue on white
- POP AF
- JP colEnd
- ;
- colMarkFunc:
- PUSH AF
- LD A,$3C
- LD ($5C8D),A ; functions: green on white
- POP AF
- JP colEnd
- ;
- colMarkLet:
- PUSH AF
- LD A,$3B
- LD ($5C8D),A ; letters: magenta on white
- POP AF
- JP colEnd
- ;
- colMarkRem:
- PUSH AF
- LD A,$30
- LD ($5C8D),A ; remarks: black on yellow
- POP AF
- JP colEnd
- ;
- ;
- colEnd:
- pop HL
- pop DE
- ;
- CP $21 ; less than quote character ?
- JP C,outCh3 ; to OUT-CH-3 to output controls and space.
- RES 2,(IY+$01) ; initialize FLAGS to 'K' mode and leave
- ; unchanged if this character would precede
- ; a keyword.
- CP $CB ; is character 'THEN' token ?
- JP Z,outCh3 ; to OUT-CH-3 to output if so.
- CP $3A ; is it ':' ?
- JP NZ,$195A ; to OUT-CH-1 if not statement separator
- ; to change mode back to 'L'.
- BIT 5,(IY+$37) ; FLAGX - Input Mode ??
- JP NZ,outCh2 ; to OUT-CH-2 if in input as no statements.
- ; Note. this check should seemingly be at
- ; the start. Commands seem inappropriate in
- ; INPUT mode and are rejected by the syntax
- ; checker anyway.
- ; unless INPUT LINE is being used.
- BIT 2,(IY+$30) ; test FLAGS2 - is the ':' within quotes ?
- JP Z,outCh3 ; to OUT-CH-3 if ':' is outside quoted text.
- JP outCh2 ; to OUT-CH-2 as ':' is within quotes
- ;
- outCh1:
- ;; OUT-CH-1
- ;L195A:
- CP $22 ; is it quote character '"' ?
- JR NZ,outCh2 ; to OUT-CH-2 with others to set 'L' mode.
- PUSH AF ; save character.
- LD A,($5C6A) ; fetch FLAGS2.
- XOR $04 ; toggle the quotes flag.
- LD ($5C6A),A ; update FLAGS2
- POP AF ; and restore character.
- outCh2:
- ;; OUT-CH-2
- ;L1968:
- SET 2,(IY+$01) ; update FLAGS - signal L mode if the cursor
- ; is next.
- outCh3:
- ;; OUT-CH-3
- ;L196C:
- RST 10H ; PRINT-A vectors the character to
- ; channel 'S', 'K', 'R' or 'P'.
- POP BC ; restore colors
- LD ($5C8D), BC
- RET ; return.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement