[Original by Robsy]Hi again!
This is a full program that demonstrates a full frame rate horizontal text scroller. Its core routine is only 83 bytes long and it is quite optimised both in size and speed. Feel free to use it in your own programs to add an oldschool feeling. And please, don't use the same font!
;----------------------------------------------
; HORIZONTAL SCROLLER
; Eduardo A. Robsy Petrus [25/04/2005]
; (c) Karoshi Corporation, 2005
;----------------------------------------------
; - Core routine size: 86 bytes.
; - Full frame rate (50/60 Hz)
; - Supports any 8x8 type set
;----------------------------------------------
; PROs: Fast and compact.
; CONs: Only 8x8 fonts supported.
;----------------------------------------------
;----------------------------------------------
; asMSX DIRECTIVES
;----------------------------------------------
.bios
.page 2
.rom
.start INIT
;----------------------------------------------
; CONSTANTS
;----------------------------------------------
FORCLR equ 0F3E9h
;----------------------------------------------
; PROGRAM CODE
;----------------------------------------------
INIT:
; Color 15,0,0
ld hl,FORCLR
ld [hl],15
inc hl
xor a
ld [hl],a
inc hl
ld [hl],a
; Screen 2
call INIGRP
call DISSCR
; Set color
ld hl,2000h+23*32*8
ld bc,32*8
ld a,0F0h
call FILVRM
call ENASCR
; Init variables
ld hl,BUFFER
xor a
ld b,a
@@CLEAR:
ld [hl],a
inc hl
djnz @@CLEAR
@@RESTART:
ld hl,TEXT
@@SCROLLER:
ld de,BUFFER+32*8
ld a,[hl]
inc hl
cp 27
jr z,@@RESTART
push hl
ld l,a
ld h,0
add hl,hl
add hl,hl
add hl,hl
ld bc,FONT-32*8
add hl,bc
ld bc,8
ldir
ld b,8
@@SCROLL:
push bc
halt
@@WAIT:
ld hl,32*23*8
call SETWRT
ld hl,BUFFER
push hl
ld c,98h
ld b,0
otir
pop de
ld hl,BUFFER-8
ld bc,256+8
@@SHIFT:
ld a,[de]
sla a
ld [de],a
ld a,0
rla
or [hl]
ld [hl],a
inc hl
inc de
dec bc
ld a,b
or c
jr nz,@@SHIFT
pop bc
djnz @@SCROLL
pop hl
jr @@SCROLLER
;----------------------------------------------
; SCROLLER TEXT
; Use ASCII code 27 (ESC) to define end
;----------------------------------------------
TEXT:
db "Coventry, Inglaterra, a 25 de Abril de 2005. "
db "Karoshi Corp. se complace en presentarles su primer scroller "
db "horizontal con desplazamiento pixel a pixel, funcionando a "
db "pleno rendimiento en cualquier ordenador MSX. Aunque parezca "
db "mentira, la rutina completa ocupa 86 bytes. Eso si, despues "
db "hay que incluir la tipografia y el texto que "
db "aparece en movimiento. No esta mal, verdad?"
db " "
db "Lo cierto es que no es facil conseguir que esto se mueva a una "
db "velocidad aceptable, pero el codigo ha sido optimizado hasta "
db "lograr el resultado deseado. Y se podrian hacer mas cosas al "
db "mismo tiempo... Habra que preparar una demo completa con scroller "
db "y algun grafico, musica, etc. Quizas seria una buena forma para "
db "hacer ",34,"Demozines",34," y presentar asi las novedades de "
db "Karoshi en un formato mas llamativo..."
db " "
db "Aun estas leyendo esto?"
db " "
db "Pues esto se ha terminado... "
db " ",27
;----------------------------------------------
; FONT
; From Taito's Choro-Q
;----------------------------------------------
FONT:
db 000h,000h,000h,000h,000h,000h,000h,000h
db 038h,038h,038h,038h,000h,038h,038h,000h
db 0EEh,0EEh,088h,000h,000h,000h,000h,000h
db 074h,074h,0FEh,074h,0FEh,074h,074h,000h
db 038h,0FCh,0E0h,0FEh,00Eh,0FEh,038h,000h
db 0C6h,0CEh,01Ch,038h,070h,0E6h,0C6h,000h
db 078h,0E4h,0F0h,07Ah,0BCh,09Ch,07Ah,000h
db 038h,038h,020h,000h,000h,000h,000h,000h
db 01Ch,038h,038h,038h,038h,038h,01Ch,000h
db 038h,01Ch,01Ch,01Ch,01Ch,01Ch,038h,000h
db 038h,0BAh,07Ch,038h,07Ch,0BAh,038h,000h
db 000h,038h,038h,0FEh,038h,038h,000h,000h
db 000h,000h,000h,000h,000h,070h,060h,040h
db 000h,000h,000h,0FEh,000h,000h,000h,000h
db 000h,000h,000h,000h,000h,070h,070h,000h
db 006h,00Eh,01Ch,038h,070h,0E0h,0C0h,000h
db 038h,064h,0E2h,0E2h,0E2h,064h,038h,000h
db 038h,078h,038h,038h,038h,038h,07Ch,000h
db 07Ch,08Eh,01Eh,07Ch,0F0h,0E0h,0FEh,000h
db 07Ch,08Eh,00Eh,03Ch,00Eh,08Eh,07Ch,000h
db 01Ch,038h,070h,0E0h,0E4h,0FEh,004h,000h
db 07Ch,040h,07Ch,00Eh,00Eh,08Eh,07Ch,000h
db 07Ch,0E0h,0FCh,0E2h,0E2h,0E2h,07Ch,000h
db 0FEh,00Eh,01Ch,038h,038h,038h,038h,000h
db 07Ch,0E2h,0E2h,07Ch,0E2h,0E2h,07Ch,000h
db 07Ch,0E2h,0E2h,0E2h,07Eh,002h,07Ch,000h
db 000h,000h,038h,038h,000h,038h,038h,000h
db 000h,000h,038h,038h,000h,038h,038h,020h
db 01Ch,038h,070h,0E0h,070h,038h,01Ch,000h
db 000h,000h,000h,0FEh,000h,0FEh,000h,000h
db 070h,038h,01Ch,00Eh,01Ch,038h,070h,000h
db 07Ch,08Eh,00Eh,01Ch,038h,000h,038h,000h
db 038h,044h,09Ah,0A2h,09Ah,044h,038h,000h
db 038h,074h,0E2h,0E2h,0FEh,0E2h,0E2h,000h
db 0FCh,0E2h,0E2h,0FCh,0E2h,0E2h,0FCh,000h
db 038h,064h,0E2h,0E0h,0E2h,064h,038h,000h
db 0F8h,0E4h,0E2h,0E2h,0E2h,0E4h,0F8h,000h
db 0FEh,0E0h,0E0h,0FCh,0E0h,0E0h,0FEh,000h
db 0FEh,0E0h,0E0h,0FCh,0E0h,0E0h,0E0h,000h
db 038h,064h,0E2h,0E0h,0E6h,062h,03Eh,000h
db 0E2h,0E2h,0E2h,0FEh,0E2h,0E2h,0E2h,000h
db 07Ch,038h,038h,038h,038h,038h,07Ch,000h
db 07Eh,00Eh,00Eh,00Eh,08Eh,04Ch,038h,000h
db 0E2h,0E4h,0E8h,0F0h,0E8h,0E4h,0E2h,000h
db 0E0h,0E0h,0E0h,0E0h,0E0h,0E0h,0FEh,000h
db 0E2h,0F6h,0EAh,0EAh,0E2h,0E2h,0E2h,000h
db 0C2h,0E2h,0F2h,0EAh,0E6h,0E2h,0E2h,000h
db 038h,064h,0E2h,0E2h,0E2h,064h,038h,000h
db 0F8h,0E4h,0E2h,0E4h,0F8h,0E0h,0E0h,000h
db 038h,064h,0E2h,0E2h,0EAh,064h,03Ah,000h
db 0F8h,0E4h,0E2h,0E4h,0F8h,0E4h,0E2h,000h
db 078h,0E4h,0F0h,07Ch,01Eh,08Eh,07Ch,000h
db 0FEh,038h,038h,038h,038h,038h,038h,000h
db 0E2h,0E2h,0E2h,0E2h,0E2h,0E2h,07Ch,000h
db 0E2h,0E2h,0E2h,0E2h,074h,038h,010h,000h
db 0E2h,0E2h,0E2h,0EAh,0EAh,0F6h,0E2h,000h
db 0E2h,0E2h,074h,038h,074h,0E2h,0E2h,000h
db 0E2h,0E2h,074h,038h,038h,038h,038h,000h
db 0FEh,01Ch,038h,070h,0E0h,0E0h,0FEh,000h
db 07Ch,070h,070h,070h,070h,070h,07Ch,000h
db 0C0h,0E0h,070h,038h,01Ch,00Eh,006h,000h
db 07Ch,01Ch,01Ch,01Ch,01Ch,01Ch,07Ch,000h
db 038h,074h,0E2h,000h,000h,000h,000h,000h
db 000h,044h,028h,010h,028h,044h,000h,000h
db 000h,000h,000h,000h,000h,000h,000h,000h
db 000h,000h,03Ch,00Eh,07Eh,08Eh,07Eh,000h
db 0E0h,0E0h,0FCh,0E2h,0E2h,0E2h,0FCh,000h
db 000h,000h,07Ch,0E2h,0E0h,0E2h,07Ch,000h
db 00Eh,00Eh,07Eh,08Eh,08Eh,08Eh,07Eh,000h
db 000h,000h,07Ch,0E2h,0FEh,0E0h,07Ch,000h
db 000h,000h,03Ch,072h,070h,0FCh,070h,070h
db 000h,000h,07Eh,08Eh,08Eh,07Eh,00Eh,07Ch
db 0E0h,0E0h,0FCh,0E2h,0E2h,0E2h,0E2h,000h
db 038h,000h,0F8h,038h,038h,038h,0FEh,000h
db 00Eh,000h,01Eh,00Eh,00Eh,00Eh,08Eh,07Ch
db 0E0h,0E0h,0E2h,0E4h,0E8h,0F4h,0E2h,000h
db 0F8h,038h,038h,038h,038h,038h,0FEh,000h
db 000h,000h,0F4h,0EAh,0EAh,0EAh,0EAh,000h
db 000h,000h,0FCh,0E2h,0E2h,0E2h,0E2h,000h
db 000h,000h,07Ch,0E2h,0E2h,0E2h,07Ch,000h
db 000h,000h,0FCh,0E2h,0E2h,0FCh,0E0h,0E0h
db 000h,000h,07Eh,08Eh,08Eh,07Eh,00Eh,00Eh
db 000h,000h,0FCh,0E2h,0E0h,0E0h,0E0h,000h
db 000h,000h,07Ch,0E0h,07Ch,00Eh,0FCh,000h
db 070h,070h,0FCh,070h,070h,072h,03Ch,000h
db 000h,000h,0E2h,0E2h,0E2h,0E2h,07Ch,000h
db 000h,000h,0E2h,0E2h,074h,038h,010h,000h
db 000h,000h,0E2h,0E2h,0EAh,0F6h,0E2h,000h
db 000h,000h,0E2h,074h,038h,074h,0E2h,000h
db 000h,000h,08Eh,08Eh,08Eh,07Eh,00Eh,07Ch
db 000h,000h,0FEh,01Ch,038h,070h,0FEh,000h
;----------------------------------------------
; VARIABLES
;----------------------------------------------
.page 3
BUFFER: ds 33*8
;----------------------------------------------