CPU-Z80-Disassembler

 view release on metacpan or  search on metacpan

t/data/zx48_base.asm  view on Meta::CPAN

; -------------------
; CO-TEMP-3
; -------------------
; -> this routine evaluates and outputs a colour control and parameter.
; It is called from above and also from PR-ITEM-3 to handle a single embedded
; print item e.g. PRINT PAPER 6; "Hi". In the latter case, the looping for
; multiple items is within the PR-ITEM routine.
; It is quite permissible to send these to any stream.

;; CO-TEMP-3
CO_TEMP_3:
        cp 0xD9                 ; is it 'INK' ?
        ret c                   ; return if less.

        cp 0xDF                 ; compare with 'OUT'
        ccf                     ; Complement Carry Flag
        ret c                   ; return if greater than 'OVER', $DE.

        push af                 ; save the colour token.

        rst 0x20                ; address NEXT-CHAR
        pop af                  ; restore token and continue.

; -> this entry point used by CLASS-07. e.g. the command PAPER 6.

;; CO-TEMP-4
CO_TEMP_4:
        sub 0xC9                ; reduce to control character $10 (INK)
                                ; thru $15 (OVER).
        push af                 ; save control.
        call EXPT_1NUM          ; routine EXPT-1NUM stacks addressed
                                ; parameter on calculator stack.
        pop af                  ; restore control.
        and a                   ; clear carry

        call UNSTACK_Z          ; routine UNSTACK-Z returns if checking syntax.

        push af                 ; save again
        call FIND_INT1          ; routine FIND-INT1 fetches parameter to A.
        ld d,a                  ; transfer now to D
        pop af                  ; restore control.

        rst 0x10                ; PRINT-A outputs the control to current
                                ; channel.
        ld a,d                  ; transfer parameter to A.

        rst 0x10                ; PRINT-A outputs parameter.
        ret                     ; return. ->

; -------------------------------------------------------------------------
;
;         {fl}{br}{   paper   }{  ink    }    The temporary colour attributes
;          ___ ___ ___ ___ ___ ___ ___ ___    system variable.
; ATTR_T  |   |   |   |   |   |   |   |   |
;         |   |   |   |   |   |   |   |   |
; 23695   |___|___|___|___|___|___|___|___|
;           7   6   5   4   3   2   1   0
;
;
;         {fl}{br}{   paper   }{  ink    }    The temporary mask used for
;          ___ ___ ___ ___ ___ ___ ___ ___    transparent colours. Any bit
; MASK_T  |   |   |   |   |   |   |   |   |   that is 1 shows that the
;         |   |   |   |   |   |   |   |   |   corresponding attribute is
; 23696   |___|___|___|___|___|___|___|___|   taken not from ATTR-T but from
;           7   6   5   4   3   2   1   0     what is already on the screen.
;
;
;         {paper9 }{ ink9 }{ inv1 }{ over1}   The print flags. Even bits are
;          ___ ___ ___ ___ ___ ___ ___ ___    temporary flags. The odd bits
; P_FLAG  |   |   |   |   |   |   |   |   |   are the permanent flags.
;         | p | t | p | t | p | t | p | t |
; 23697   |___|___|___|___|___|___|___|___|
;           7   6   5   4   3   2   1   0
;
; -----------------------------------------------------------------------

; ------------------------------------
;  The colour system variable handler.
; ------------------------------------
; This is an exit branch from PO-1-OPER, PO-2-OPER
; A holds control $10 (INK) to $15 (OVER)
; D holds parameter 0-9 for ink/paper 0,1 or 8 for bright/flash,
; 0 or 1 for over/inverse.

;; CO-TEMP-5
CO_TEMP_5:
        sub 0x11                ; reduce range $FF-$04
        adc a,0x00              ; add in carry if INK
        jr z,CO_TEMP_7          ; forward to CO-TEMP-7 with INK and PAPER.

        sub 0x02                ; reduce range $FF-$02
        adc a,0x00              ; add carry if FLASH
        jr z,CO_TEMP_C          ; forward to CO-TEMP-C with FLASH and BRIGHT.

        cp 0x01                 ; is it 'INVERSE' ?
        ld a,d                  ; fetch parameter for INVERSE/OVER
        ld b,0x01               ; prepare OVER mask setting bit 0.
        jr nz,CO_TEMP_6         ; forward to CO-TEMP-6 if OVER

        rlca                    ; shift bit 0
        rlca                    ; to bit 2
        ld b,0x04               ; set bit 2 of mask for inverse.

;; CO-TEMP-6
CO_TEMP_6:
        ld c,a                  ; save the A
        ld a,d                  ; re-fetch parameter
        cp 0x02                 ; is it less than 2
        jr nc,REPORT_K          ; to REPORT-K if not 0 or 1.
                                ; 'Invalid colour'.

        ld a,c                  ; restore A
        ld hl,0x5C91            ; address system variable P_FLAG
        jr CO_CHANGE            ; forward to exit via routine CO-CHANGE

; ---

; the branch was here with INK/PAPER and carry set for INK.

;; CO-TEMP-7
CO_TEMP_7:



( run in 0.615 second using v1.01-cache-2.11-cpan-39bf76dae61 )