Re: A82: Port 1, the keyboard port.


[Prev][Next][Index][Thread]

Re: A82: Port 1, the keyboard port.



Forgot to include the showscreen header. =)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;       Show Screen: FASTEST copy function to the TI-82 LCD
;       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;               By Sam Davies
;                       sdavies@mail.trilogy.net
;Args:
;       HL -> picture location, should be COLUMNS*ROWS BYTES long
;               (i.e. HL=$88B8, COLUMNS=12 and ROWS=63 for GRAPH_MEM)
;Returns:
;       Picture displayed in graph mem
;       AF, BC, DE, HL destroyed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
COL_START = 0
COLUMNS = 12

ROW_START = 0
ROWS = 63

#if (COL_START>12)
!!! Error: COL_START must be from 0 to 12
#endif
#if (COL_START<0)
!!! Error: COL_START must be from 0 to 12
#endif
#if (ROW_START>63)
!!! Error: ROW_START must be from 0 to 63
#endif
#if (ROW_START<0)
!!! Error: ROW_START must be from 0 to 63
#endif
#if (COL_START+COLUMNS>12)
!!! Error: Columns run off the screen!
#endif
#if (ROW_START+ROWS>63)
!!! Error: Rows run off the screen!
#endif

;CALL $07F3 does the following:
;       CALL $07F3      17
;07F3:  PUSH AF         11
;       INC HL           6
;       DEC HL           6
;       POP AF          10
;       RET             10
;                      =60 T States
;
;You only need exactly 29 T States between OUT (C),r's to port 10.
;*NOTE: This is NOT true for ROM version 18.0! This does work for 16.0
however.

SHOW_SCREEN:
        di

        ld      A, $05          ;  7
        out     ($10), A        ; 11
	CALL $07F3			;Comment these if using ROM
16.0
        ld      C, $11          ;  7
        exx                     ;  4
        ld      DE, ($80+ROW_START)<<8 + $20 + COL_START ; 10
        ld      BC, $0010       ; 10
        out     (C), E          ; 12
	CALL $07F3			;Comment these if using ROM
16.0
        exx                     ;  4
        ld      DE, COLUMNS-1   ; 10
        exx                     ;  4
        ld      A, $21+COLUMNS+COL_START ;  7
        inc     E               ;  4
LineLoop:

        out     (C), D          ; 12
	CALL $07F3			;Comment these if using ROM
16.0
        exx                     ;  4
        push    HL              ; 11
        ld      B, ROWS-ROW_START ;  7
WriteLoop:
        nop                     ;  4
        outi                    ; 16
	CALL $07F3			;Comment these if using ROM
16.0
        add     HL, DE          ; 11
        jr      nz, WriteLoop   ; 12 or 7

        pop     HL              ; 10
        inc     HL              ;  4
        exx                     ;  4

        out     (C), E          ; 12
	CALL $07F3			;Comment these if using ROM
16.0
        inc     E               ;  4

        ld      R, A            ;  9 <-This is just to waste time

        cp      E               ;  4
        jr      nz, LineLoop    ; 12

        ei
        ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


References: