*
* Mr. Z released this and I noticed shortly thereafter that by changing
* $34 to $22, it would work to scroll text in the text/background
*
*================================================
*
* Border Scroll by: Mr. Z
*
* Modifications by Chris Shepherd:
* -> Complementary Border Bars
* -> Scroll on text, not graphics
* -> Change color per line
*
*===============================================
lst off
cas in
ORG $2000
MX %11
STOP = $00
BLANK MAC
LUP 21
STZ $22
--^
NOP
EOM
CONV MAC
LDY #$64
CMP #$11
BNE STOY
LDY #$86
STOY TYA
EOM
STARTTT SEC
XCE
CLC
XCE
SEP #$30
STZ $C034
LDA #$F6
STA $C022
STZ POS
STZ STOP
LDA #$03
STA TIMING
REP #$30 ; Build a table with the adress of all chars
LDX #$00
LDA #$0000
]lp STA CHARAD2,X
CLC
ADC #$15
INX
INX
CPX #$68
BNE ]lp
LDA #$0002 ; Timing for accurate (+/- 6 pixels)
STA SHIFT ; Left/Right Position
LDA #$0001 ; Width of a single char
STA LLEN2
STZ CHARNB
SEP #$30
START LDA #$80 ; Must be at 1 mhz !!!!
TRB $C036
MAIN JSR startii
JSR VBL3 ; Waits for
JSR SCROLLER
jsr starti
LDA $C000
BPL MAIN
KICK JMP KICK
VBL3 REP #$30
LDA #$C000 ; Direct page at $C000 so that we can adress
TCD ; The softswitches with short ZP instructions
SEP #$30
LDX #$0F ; Color of the chars ($0F=white)
LIN LDA #$C0
VERTLIN CMP $C02E ; Vertical synchro
BNE VERTLIN
NOP
LDA $C02F ; Then, different temporisations depending
CMP #$46 ; on the value of $C02F, this ensures that
BEQ FIRST ; the 65816 is really synchronized with the VGC
CMP #$48
BEQ SECOND
CMP #$4A
BEQ THIRD
CMP #$4C
BEQ FOURTH
BIT $00
CMP #$47
BEQ FIFTH
CMP #$49
BEQ SIXTH
CMP #$4B
BEQ SEVENTH
CMP #$4D
BEQ EIGHTH
JMP VBL3
FIRST NOP
NOP
NOP
SECOND NOP
NOP
NOP
THIRD NOP
NOP
NOP
FOURTH NOP
FIFTH NOP
NOP
NOP
SIXTH NOP
NOP
NOP
SEVENTH NOP
NOP
NOP
EIGHTH NOP
NOP
NOP
NOP
BIT $00
GOWAIT JSR TEMPO4 ; Crucial, Depending on the time this routine
LN1 STZ $22 ; takes, we'll have the text moved left/right
STZ $22 ; of approx +/- 6 pixels (1/64th of the width
STZ $22 ; of a complete line, incl. left/right border)
STZ $22
STZ $22
STZ $22 ; STZ = a black element
STZ $22 ; STX = a colored element (white in this case)
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST1 STZ $22
DEX ; Not NOP, DEX (Both are 2 Cycles!!!) colorful...
LN11 BLANK ; One line out of two is black (choice !)
LN2 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST2 STZ $22
DEX
LN22 BLANK
LN3 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST3 STZ $22
DEX
LN33 BLANK
LN4 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST4 STZ $22
DEX
LN44 BLANK
LN5 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST5 STZ $22
DEX
LN55 BLANK
LN6 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST6 STZ $22
DEX
LN66 BLANK
LN7 STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
STZ $22
ST7 STZ $22
STZ $22 ; Make sure the border will end up black
REP #$30 ; Restore direct page adress
LDA #$0000
TCD
SEP #$30
RTS
SCROLLER LDA STOP ; Stop = 1 means no scrolling
BEQ SCROLLIT
RTS
SCROLLIT REP #$30 ; SHIFT = left/right fine position of the text
LDA SHIFT
BMI MV ; Minus --> time to scroll the text itself
ASL
TAX
LDA TEMPOS,X ; else, get the correspoding timing routine adress
STA GOWAIT+1 ; and poke it into the synchro routine
DEC SHIFT
BRL ENDSCRO
MV LDA #$0001 ; Restore SHIFT
STA SHIFT
LDA #TEMPO4 ; And first tempo adress
STA GOWAIT+1
SEP #$30
LDX #$00 ; Move every STZ or STX of the synchro routine
SCRLEFT LDA LN1+2,X ; one step left...
STA LN1,X
STA LN11,X
LDA LN2+2,X
STA LN2,X
STA LN22,X
LDA LN3+2,X
STA LN3,X
STA LN33,X
LDA LN4+2,X
STA LN4,X
STA LN44,X
LDA LN5+2,X
STA LN5,X
STA LN55,X
LDA LN6+2,X
STA LN6,X
STA LN66,X
LDA LN7+2,X
STA LN7,X
INX
INX
CPX #$28
BNE SCRLEFT
REP #$30
SEP #$20
LDX CHARNB ; Adress of current char
LDA BORCHAR,X ; Get Char 'Bitmap'
CONV ; Convert it into STZs and STXs
STA ST1 ; Store it
LDA BORCHAR+3,X
CONV
STA ST2
LDA BORCHAR+6,X
CONV
STA ST3
LDA BORCHAR+9,X
CONV
STA ST4
LDA BORCHAR+$C,X
CONV
STA ST5
LDA BORCHAR+$F,X
CONV
STA ST6
LDA BORCHAR+$12,X
CONV
STA ST7
REP #$30
INC CHARNB
DEC LLEN2 ; finished with this char ?
BPL ENDSCRO ; no
LDA #$0003
STA LLEN2 ; yes, then restart Charlength
SEP #$30
LDX #$64 ; Poke a 6 pixel 'SPACE'
STX ST1
STX ST2
STX ST3
STX ST4
STX ST5
STX ST6
STX ST7
BRA GETCHAR2 ; And get the next char (Adress and so on...)
MX %00
RESTART2 REP #$30
LDA #TEXT2 ; Back to the beginning
STA GETCHAR2+1
NEWONE2 SEP #$30
GETCHAR2 LDA TEXT2 ; 00 means Restart
BEQ RESTART2
INCIT2 INC GETCHAR2+1
BNE NOINC2
INC GETCHAR2+2
NOINC2 CMP #$A0
BCS INRANGE3
LDA #$A0
INRANGE3 CMP #$E0
BCC INRANGE4
LDA #$A0
INRANGE4 SEC
SBC #$A0
TAX
LDA CHARTB,X ; Convert ASCII value-$A0
REP #$30 ; into char position in the set
AND #$00FF
ASL
TAX
LDA CHARAD2,X ; Adress table...
STA CHARNB
ENDSCRO SEP #$30
RTS
TEMPO2 NOP ; Two cycles tempo
RTS
TEMPO3 BIT $00 ; Three cycles tempo
RTS
TEMPO4 NOP ; Four cycles tempo
NOP
RTS
TEMPOS DA TEMPO2 ; Adress table of the tempo routines
DA TEMPO3
DA TEMPO4
CHARTB HEX 00,24,24,31,32,33,34,2A,2E,2F,37,00,2B,2C,28,27
HEX 26,1B,1C,1D,1E,1F,20,21,22,23,29,28,00,00,2B,25
HEX 2F,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,0E,0F
HEX 10,11,12,13,14,15,16,17,18,19,1A,2C,00,2D,00,00
TEXT2 ASC " WHAT DID YOU SAY? THE APPLE CAN'T HAVE 2 BORDER COLORS? "
ASC "WHAT DID YOU SAY? TEXT CAN'T BE MULTIPLE COLORS? LET ME "
ASC "TELL YOU A LITTLE SECRET, I'M NOT IN GRAPHICS MODE, AM I? "
ASC "LOOKS LIKE THE BACKGROUND IS MULTIPLE COLORS! - CHRIS "
HEX 00
POS DS 2
TIMING DS 2
CHARNB DS 2
LLEN2 DS 2
SHIFT DS 2
DS \
BORCHAR HEX 000000 ; Characters Bitmap
HEX 000000 ; 00=black element, 11=colored element
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 111100
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 111100
HEX 111111
HEX 110000
HEX 110000
HEX 110000
HEX 110000
HEX 110000
HEX 111111
HEX 111100
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111100
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 110000
HEX 110000
HEX 110000
HEX 111111
HEX 110000
HEX 110000
HEX 110000
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 111111
HEX 000011
HEX 000011
HEX 000011
HEX 000011
HEX 000011
HEX 000011
HEX 111100
HEX 110000
HEX 110011
HEX 110011
HEX 111100
HEX 111100
HEX 110011
HEX 110011
HEX 110000
HEX 110000
HEX 110000
HEX 110000
HEX 110000
HEX 110000
HEX 111111
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111100
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 110000
HEX 110000
HEX 110000
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111100
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 111100
HEX 110011
HEX 110011
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 111111
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 001100
HEX 001100
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 001100
HEX 111111
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 001100
HEX 001100
HEX 001100
HEX 111111
HEX 111111
HEX 000011
HEX 001100
HEX 110000
HEX 111111
HEX 111111
HEX 001100
HEX 111100
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 111111
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 001100
HEX 110000
HEX 110000
HEX 110011
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 110000
HEX 110000
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 001100
HEX 110000
HEX 110000
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 111111
HEX 000011
HEX 000011
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 111111
HEX 110011
HEX 110011
HEX 111111
HEX 000011
HEX 000011
HEX 111111
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 001100
HEX 000000
HEX 001100
HEX 111111
HEX 110011
HEX 000011
HEX 001100
HEX 001100
HEX 000000
HEX 001100
HEX 111100
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 110011
HEX 111111
HEX 000000 ; /
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 001100
HEX 001100
HEX 000000
HEX 001100
HEX 001100
HEX 000000
HEX 001100
HEX 001100
HEX 000000
HEX 001100
HEX 001100
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 001100
HEX 001100
HEX 110000
HEX 000000
HEX 000000
HEX 000000
HEX 111111
HEX 000000
HEX 000000
HEX 000000
HEX 000000
HEX 001100
HEX 001100
HEX 111111
HEX 001100
HEX 001100
HEX 000000
HEX 000011
HEX 001100
HEX 110000
HEX 110000
HEX 110000
HEX 001100
HEX 000011
HEX 110000
HEX 001100
HEX 000011
HEX 000011
HEX 000011
HEX 001100
HEX 110000
CHARAD2 DS $70
vmin = $7D
vmax = $b8
vmini = $da
vmaxi = $e5
startii lda #vmin
find cmp $c02e
bne find
draw lda #$0f
sta $c022
sta $c034
timer lda #$10
jsr $fca8
back stz $c034
stz $c022
lda flag
beq inc
dec dec startii+1
lda startii+1
cmp #vmin
beq dec2
rts
dec2 stz flag
inc inc startii+1
lda startii+1
cmp #vmax
beq inc2
rts
inc2 lda #$01
sta flag
jmp dec
flag hex 00
starti lda #vmini
findi cmp $c02e
bne findi
drawi lda #$0f
sta $c022
sta $c034
timeri lda #$10
jsr $fca8
backi stz $c034
stz $c022
lda flagi
beq inci
deci dec starti+1
lda starti+1
cmp #vmini
beq dec2i
rts ;<-------------------
dec2i stz flagi
inci inc starti+1
lda starti+1
cmp #vmaxi
beq inc2i
rts ;<--------------------
inc2i lda #$01
sta flagi
jmp deci
flagi hex 00
SatanMessage asc "Happy 1991 woo woo woo"

