Advertisement
Guest User

hello.z80

a guest
Apr 28th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. outCharHinted:
  3.                     ; OUT-CHAR-HINTED
  4.  
  5.             .ORG    40000 ; address 30000 ($7530). todo normal one.
  6.  
  7. colStart:          
  8.             PUSH    BC ; B - backup current color                    ;
  9.             LD      BC,($5C8D) ; backup the current color value
  10.  
  11.  
  12.             CALL    $2D1B ; routine NUMERIC tests if it is a digit ?
  13.             JP      NC,outCh3 ; to OUT-CH-3 to print digit without
  14.                     ; changing mode. Will be 'K' mode if digits
  15.                     ; are at beginning of edit line.
  16.  
  17.  
  18.                     ; save the registers for later restore
  19.                     ; what those will be used for:
  20.  
  21.             PUSH    DE ;
  22.             PUSH    HL ; list pointer
  23.  
  24.  
  25.             CP      $A5 ; if a < A5? (i.e. not commands or functions)
  26.             JR      C,colCaps ; go to caps letters
  27.                     ;
  28.             CP      $C5 ; if a < C5? (i.e. not operators)
  29.             JR      C,colMarkFunc ; go to function colorizer
  30.                     ;
  31.             JP      colMarkOp ; else go to operator colorizer
  32.                     ;
  33. colCaps:            
  34.  
  35.             CP      $41 ; if a < 41 (i.e. it's not the caps letter A)
  36.             JP      C,colMisc ; go to misc
  37.                     ;
  38.             CP      $5B ; if a < 5B (i.e. it's in the A-Z range)
  39.             JP      C,colMarkLet ; go to letter colorizer
  40.  
  41. colSmall:          
  42.             CP      $61 ; if a < 61 (i.e. it's not in the a-z range)
  43.             JP      C,colMisc
  44.                     ;
  45.             CP      $7B ; if a < 7B (i.e. it's in the a-z range)
  46.             JP      C,colMarkLet
  47.                     ;
  48.                     ;
  49. colMisc:            
  50.             LD      HL,colMiscList ; address of the list of symbols to colorize
  51.                     ;       CALL    HI-SEARCH           ; scan the list
  52. colSearchLoop:          
  53.             CP      (HL) ; is the value in (HL)
  54.             JP      Z,colMarkOp ; then go to operator colorizer
  55.                     ;
  56.             CP      $20 ; is the symbol is space?
  57.             JP      colEnd ; exit then
  58.                     ;
  59.             INC     HL
  60.             JR      colSearchLoop
  61.                     ;
  62. colMiscList:      
  63.             .db      "+-*/<>= " ; list of scattered operator symbols
  64.                     ; the space symbol is used as end marker
  65.                     ;
  66.  
  67. colMarkOp:          
  68.             PUSH    AF
  69.             LD      A,$39
  70.             LD      ($5C8D),A ; operators: blue on white
  71.             POP     AF
  72.             JP      colEnd
  73.                     ;
  74. colMarkFunc:        
  75.             PUSH    AF
  76.             LD      A,$3C
  77.             LD      ($5C8D),A ; functions: green on white
  78.             POP     AF
  79.             JP      colEnd
  80.                     ;
  81. colMarkLet:        
  82.             PUSH    AF
  83.             LD      A,$3B
  84.             LD      ($5C8D),A ; letters: magenta on white
  85.             POP     AF
  86.             JP      colEnd
  87.  
  88.                     ;
  89. colMarkRem:        
  90.             PUSH    AF
  91.             LD      A,$30
  92.             LD      ($5C8D),A ; remarks: black on yellow
  93.             POP     AF
  94.             JP      colEnd
  95.                     ;
  96.                     ;
  97. colEnd:            
  98.             pop     HL
  99.             pop     DE
  100.            
  101.                     ;
  102.             CP      $21 ; less than quote character ?
  103.             JP      C,outCh3 ; to OUT-CH-3 to output controls and space.
  104.  
  105.             RES     2,(IY+$01) ; initialize FLAGS to 'K' mode and leave
  106.                     ; unchanged if this character would precede
  107.                     ; a keyword.
  108.  
  109.             CP      $CB ; is character 'THEN' token ?
  110.             JP      Z,outCh3 ; to OUT-CH-3 to output if so.
  111.  
  112.             CP      $3A ; is it ':' ?
  113.             JP      NZ,$195A ; to OUT-CH-1 if not statement separator
  114.                     ; to change mode back to 'L'.
  115.  
  116.             BIT     5,(IY+$37) ; FLAGX  - Input Mode ??
  117.             JP      NZ,outCh2 ; to OUT-CH-2 if in input as no statements.
  118.                     ; Note. this check should seemingly be at
  119.                     ; the start. Commands seem inappropriate in
  120.                     ; INPUT mode and are rejected by the syntax
  121.                     ; checker anyway.
  122.                     ; unless INPUT LINE is being used.
  123.  
  124.             BIT     2,(IY+$30) ; test FLAGS2 - is the ':' within quotes ?
  125.             JP      Z,outCh3 ; to OUT-CH-3 if ':' is outside quoted text.
  126.  
  127.             JP      outCh2 ; to OUT-CH-2 as ':' is within quotes
  128.                     ;
  129.  
  130.  
  131. outCh1:
  132. ;; OUT-CH-1
  133. ;L195A:  
  134.         CP      $22             ; is it quote character '"'  ?
  135.         JR      NZ,outCh2        ; to OUT-CH-2 with others to set 'L' mode.
  136.  
  137.         PUSH    AF              ; save character.
  138.         LD      A,($5C6A)       ; fetch FLAGS2.
  139.         XOR     $04             ; toggle the quotes flag.
  140.         LD      ($5C6A),A       ; update FLAGS2
  141.         POP     AF              ; and restore character.
  142.  
  143. outCh2:
  144. ;; OUT-CH-2
  145. ;L1968:  
  146.         SET     2,(IY+$01)      ; update FLAGS - signal L mode if the cursor
  147.                                 ; is next.
  148. outCh3:
  149. ;; OUT-CH-3
  150. ;L196C:  
  151.         RST     10H             ; PRINT-A vectors the character to
  152.                                 ; channel 'S', 'K', 'R' or 'P'.
  153.                                
  154.         POP     BC              ; restore colors
  155.         LD     ($5C8D), BC
  156.                                
  157.         RET                     ; return.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement