; THIS SMALL ROUTINE OF SCROLL
; WAS RIPPED FROM AN HTT. DEMO
;       BY IACT In 1993
;
;--------------------------

 Disk 'FONT\FONT2.HTT'

CHBASE=$8000
CHBASE2=$8400

        Org $6000

Start:

 Load CHBASE,'D1:FONT2.HTT'

        LDA <DLIST
        STA 560
        LDA >DLIST
        STA 561
        LDA <DLI
        STA 512
        LDA >DLI
        STA 513

        LDA #$C0
        STA $D40E ;NMIEN

        LDA #6
        LDY <VBI
        LDX >VBI
        JSR $E45C

        LDA #$02
        STA SCRL  ;TEMP LOCATION
        LDA <TEXT
        STA 203
        LDA >TEXT
        STA 204
  WaitKey
;--------------------------
DLI:    PHA
        TXA
        PHA
        LDA >CHBASE
        STA $D409  ;CHBASE
        LDX #$00
L0015:  LDA COLPF0,X
        STA $D40A  ;WSYNC
        STA $D016
        LDA COLPF1,X
        STA $D017
        LDA COLPF2,X
        STA $D018
        INX
        CPX #$07
        BNE L0015
        LDA >CHBASE2
        STA $D40A  ;WSYNC
        STA $D409  ;CHBASE
L0016:  LDA COLPF0,X
        STA $D016
        LDA COLPF1,X
        STA $D40A  ;WSYNC
        STA $D017
        LDA COLPF2,X
        STA $D018
        INX
        CPX #$0F
        BNE L0016
        DEC SCRL
        LDA SCRL
        CMP #$FF
        BNE L0017
        LDA #$0F
        STA SCRL
        INC 203
        BNE Check_End_Text
        INC 203
Check_End_Text: LDA 203
 CMP <ENDTEXT
 BNE L0017
 LDA 204
 CMP >ENDTEXT
 BNE L0017
 LDA >TEXT
 STA 204
 LDA <TEXT
 STA 203
L0017: LDA SCRL
 STA $D404  ;HSCROL
 PLA
 TAX
 PLA
 RTI
;--------------------------
VBI: LDA #$2F
 STA $022F  ;SDMCTL
 STA $D400  ;SMACTL
 LDA SCRL
 STA $D404  ;HSCROL
 LDA #$00
 STA $D20E  ;IRQEN
 JSR L0019
 JMP $E45F  ;EXITVBI
L0019: LDX #$00
 LDY #$00
L0022: LDA (203),Y
 AND #$1F
 STA $BC00,X
 CLC
 ADC #$20
 INX
 STA $BC00,X
 CLC
 ADC #$20
 INX
 STA $BC00,X
 CLC
 ADC #$20
 INX
 STA $BC00,X
 INX
 INY
 CPY #$0C
 BNE L0022
 RTS
;----------------------------
SCRL: DB 0
COLPF0: DB $34,$36,$38,$3A,$3C,$3F,$3F,$3C,$3A,$38,$36,$34,$32,$30
COLPF1: DB $16,$18,$1A,$1C,$1F,$1F,$1C,$1A,$18,$16,$14,$14,$14,$14
COLPF2: DB $68,$6A,$6C,$6E,$6E,$6C,$6A,$68,$66,$64,$64,$64,$64,$64
;-----------------------------
DLIST:  DB 112
        DB 112
        DB 112
        DB 240
        DB $54
        DB 0
        DB 188
        DB $54
        DB 0
        DB 188
        DB 112
        DB 112
        DB 112
        DB 65
        DB A(DLIST)
;------------------------------
TEXT: DB '            A NICE COLORFULL SCROLL RIPPED FROM AN HTT DEMO'
ENDTEXT:
 DB '                  '
End start