[A86] Re: vertical scrolling


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

[A86] Re: vertical scrolling




Ok!

This is taken from the intro to The Tower of Hanoi, so it's written 
specifically for my needs in that particular program.

Andreas Finne


Here it is:

#include asm86.h
#include "ti86asm.inc"

.org $9100

	set textwrite,(iy+new_grf_flgs)
	ld hl,_plotSScreen
	ld de,_plotSScreen+1
	ld bc,1023
	ld (hl),0
	ldir
	ld hl,$0000
	ld (_penCol),hl

DisplayText:
	ld hl,Text
	ld b,26
DTLoop:
	call _vputs
	push hl
	push bc
	call Scroll
	ld hl,_plotSScreen
	ld de,_plotSScreen+1
	ld (hl),0
	ld bc,1023
	ldir
	pop bc
	pop hl
	xor a
	ld (_penCol),a
	ld (_penRow),a
	djnz DTLoop
	ld b,8
ExtraLoop:
	push bc
	push hl
	call Scroll
	pop hl
	pop bc
	djnz ExtraLoop
Quit:
	res textwrite,(iy+new_grf_flgs)
	ret

PreQuit:
	pop hl	;From the scroll routine itself
	pop hl	;			"
	pop hl	;The call to Scroll
	pop hl	;
	pop hl	;
	jr Quit

Scroll:
	ld hl,_plotSScreen
	ld b,8
SLoop:
	push bc
	push hl
	ld b,25
Delay:
	halt
	djnz Delay
	call _getky
	cp K_ENTER
	jr z,PreQuit
	ld hl,$FC10
	ld de,$FC00
	ld bc,1008
	ldir
	ld bc,16
	ld de,$FFF0
	pop hl
	ldir
	pop bc
	djnz SLoop
	ret

Text:
.db "At the time of "
.db "the creation, a temple",0
.db "was built in Benares."
.db " Inside the great",0
.db "temple there were"
.db " 64 golden disks,",0
.db "all of different"
.db " sizes and mounted on",0
.db "three diamond pegs.",0
.db " ",0
.db "The god Brahma placed"
.db " all the disks",0
.db "on one peg, in order"
.db " of size with the",0
.db "largest at the bottom.",0
.db " ",0
.db "The task of the temple"
.db " priests is to",0
.db "transfer the disks"
.db " unceasingly from",0
.db "peg to peg, one at a"
.db " time, never",0
.db "placing a larger disk"
.db " on a smaller",0
.db "one.",0
.db " ",0
.db "When all the disks"
.db " have been moved,",0
.db "the universe will end...",0
.db " ",0
.db "Today, the task of"
.db " the priests is",0
.db "nearly forgotten, but"
.db " there is one",0
.db "thing that reminds us"
.db " of the legend.",0
.db " ",0
.db "That thing is the"
.db " puzzle called the",0
.db "Tower of Brahma, the"
.db " puzzle also",0
.db "known as the Tower"
.db " of Hanoi...",0

.end

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.