*****************************************************************************
; Step for Step Text (Character after character)  [First/Last Version]
; By Maurice Wielink (Normaly only into Musix but since I mess around with
; my Devpac assembler I gave it a Try !!!) 	
 
; This Source Print some Text strings Character after Character !!!
***************************************************************************** 
NRPage		equ	4		;HIER AANTAL BLADZIJDEN INVULLEN !!!
 					;Enter Number of pages here !!!
OpenWindow	equ	$ffffff34  
CloseWindow	equ	$ffffffb8

OpenLibrary	equ	$fffffdd8	;exec.library equates
CloseLibrary	equ	$fffffe62

WBENCHSCREEN	equ	$0001

Delay		equ	-198

_SysBase		equ	4
_LVOOpenLibrary		equ	-552
_LVOCloseLibrary	equ	-414

_LVOText		equ	-60
_LVOMove		equ	-240
_LVOSetAPen		equ	-342
;-------------------------------------------------

CALLEXEC	MACRO
	move.l	(_SysBase).w,a6
	jsr	_LVO\1(a6)
	ENDM
EXECNAME	MACRO
	dc.b	'exec.library',0
	ENDM

CALLGRAF	MACRO
	move.l	_GfxBase,a6
	jsr	_LVO\1(a6)
	ENDM
GRAFNAME	MACRO
	dc.b	'graphics.library',0
	ENDM

CALLINT	MACRO
	move.l	_IntuitionBase,a6
	jsr	_LVO\1(a6)
	ENDM
INTNAME	MACRO
	dc.b	'intuition.library',0
	ENDM

;========================================================================

	move.l	#intname,a1		;get library name
	moveq	#0,d0
	CALLEXEC	OpenLibrary	;open intuition library
	move.l	d0,_IntuitionBase	;store base address
	beq	_error

	move.l	#gfxname,a1		;open graphics library
	moveq	#0,d0
	CALLEXEC	OpenLibrary
	move.l	d0,_GfxBase
	beq	_closeint

	move.l	#dosname,a1
	moveq	#0,d0
	CALLEXEC	OpenLibrary
	move.l	d0,_DosBase
	beq	_closegfx

	lea	newwindow,a0		;Get address of newwindow structure
	move.l	_IntuitionBase,a6	;Get intuition base
	JSR	OpenWindow(a6)		;Open new window
	move.l	d0,windowbase		;store window base
	beq	_closedos		;(_closescreen)

	move.l	windowbase,a1
	move.l	50(a1),a1
	move.l  a1,rastport
;----------------------------------------------------------------------------
;       TEXT IN WINDOW
;       --------------
	lea	TextData,a4	     ;Text
MoreText:
	move.l	#10,d6		     ;Y-Postion where first line starts
	move.l	#14,d7		     ;Number of Lines (0 = 1 / 5 = 6 etc)

	move.l	rastport,a1
	move.l	#1,d0		     ;Color of Characters (White)
	CALLGRAF SetAPen
 
;------------------------------------
MLoop:
	move.l	#25,d5		     ; X-Position where first line starts
	move.l	#51,d4		     ; Offset for loop= 52 characters per line 
loop 
	add.l	#10,d5		     ; A Character Further (X)  
	move.l	d5,d0	  	     ; X-Position
	move.l	d6,d1		     ; Y-Position where first line starts
	move.l	rastport,a1
	CALLGRAF Move                ; Move to X,Y

	move.l	rastport,a1
	move.b	(a4)+,(a0)	     ; Get Next Char
	move.l	#1,d0 		     ; 1 Charachter at the time 
	CALLGRAF Text                ; Show text

	bsr	DoDelay		     ; Delay a bit        
RMouse:				     ; Right Mouse To Abort and Exit 				     
 btst	#10,$dff016		     ; While printing text
 beq	quit 

 	dbra	d4,loop		     ; Characters per line (are in d4) 
 
	add.l	#10,d6		     ; new line (Y-Position)
	dbra    d7,MLoop	     ; Get next Line until all lines are done
				      
; Nu Bladzijde Wissen en Volgende Printen
; Erase Page and Print next one   
  
Mouse2:
	btst	#6,$bfe001	     ; Wait for mouse, then Next Page	
	bne	Mouse2 
	bsr	ClearPage	     ; Clear Previous Page	 
	add.l	#1,PageCounter	     ; Update Page Counter	
	cmp.l	#NRPage,PageCounter  ; Compare with Number of Pages
	beq	quit		     ; Quit if all Pages are printed	
	bra     MoreText	     ; If not,Next Page	
 
;======================================================================
;				THE END 
 
quit:

_closewindow:
 move.l windowbase,a0
 move.l _IntuitionBase,a6
 jsr 	CloseWindow(a6)

_closegfx:
 move.l _GfxBase,a1
 CALLEXEC	CloseLibrary

_closeint:
 move.l _IntuitionBase,a1
 CALLEXEC	CloseLibrary
 
_closedos:
 move.l _DosBase,a1
 CALLEXEC	CloseLibrary

_error:
 move.l #0,d0
 rts
  
;======================================================================
DoDelay 	
 move.l _DosBase,a6
 move.l #1,d1		;Set this to Zero for more speed !
 jsr Delay(a6) 
 rts
;========================================================================
ClearPage:
	move.l	#10,d6		     ;Y-Postion where first line starts
	lea	EraseString,a3	     ;Text
	move.l	#14,d7		     ;Number of Lines per Page (15)
 
	move.l	rastport,a1
	move.l	#1,d0		     ;Color of Characters (White)
	CALLGRAF SetAPen
 
ELoop:
	move.l	#25,d0		     ;X-Position where first line starts
	move.l	d6,d1		     ;Y-Position where first line starts
	move.l	rastport,a1
	CALLGRAF Move                ;Move to X,Y
	
	move.l	rastport,a1
	move.l  a3,a0		     ;Text (Line With Space's)
	move.l	#66,d0 		     ;Charachters per line 
	CALLGRAF Text                ;Show text (Erase)

	add.l	#10,d6		     ;new line (Y-Position) 
	dbra    d7,ELoop	     ;Get next Line until all lines
				     ;are done.
	rts			     ;Get back
;============================================================================
;Structures and data's
newwindow	dc.w	20		;leftedge
		dc.w	20		;topedge
		dc.w	600,160		;width,height
		dc.b	2		;detail pen
		dc.b	1		;block pen
		dc.l	0 		;IDCMP flags
		dc.l	0  		;
		dc.l	0		;pointer to first gadget structure
		dc.l	0		;pointer to custom menu tick
		dc.l	0		;pointer to title text,0
 		dc.l	0		;pointer to custom screen
		dc.l	0		;pointer to custom bitmap
		dc.w	600,160		;minimum width,height
		dc.w	600,160		;maximum width,height
		dc.w	WBENCHSCREEN	;type of screen

		even
;==========================================================================
TextData:
  dc.b  'Hi there Ron, Maurice Wielink Here, How are You ?!? '
  dc.b  '              [I`m Fine Thank you !]                '
  dc.b  'I`m back again with some Musix for NewsFlash, I hope'
  dc.b  'You like It (I Do).                                 '
  dc.b  '----------------------------------------------------'
  dc.b  'F1 for `Speed Classic Symphony`  [Sound FX]         '	  
  dc.b  '                                                    '
  dc.b  'F2 for `Digital Dictator`    [Musical Enlightenment]'
  dc.b  '                                                    ' 
  dc.b  'F3 for `Acoustica` (Old One) [Sound FX]             '          
  dc.b  '                                                    ' 
  dc.b  'F4 for `Snake Dance`         [Sound FX]             ' 
  dc.b  '----------------------------------------------------' 
  dc.b  '[Source of this little proggy is in the C Directory]'
  dc.b  'DESTROY LEFT MOUSE BUTTON TO READ SOME MORE TEXT !!!'

  dc.b  'About the musix:                                    '          
  dc.b  '----------------------------------------------------'
  dc.b  'When I made `Speed Classic Symphony`, I went Nuts...' 
  dc.b  'Almost the whole tune is build up with Thirty Second' 
  dc.b  'Note Flurries going almost faster then a metronome  ' 
  dc.b  'can go (?), the first part of the tune was Composed '  
  dc.b  'by myself, I stole the second part from A.Brimble...' 
  dc.b  '(who had stolen it from bach, so no one can`t blame ' 
  dc.b  ' me, he he)..........                               '
  dc.b  '----------------------------------------------------'  
  dc.b  'Digital Dictator was Composed by me and Created with' 
  dc.b  'Musical Enlightenment [Yes, A Very powerfull Editor]' 
  dc.b  '----------------------------------------------------' 
  dc.b  'Pom....Pom.....Pom.....Pom......                    '  
  dc.b  '                                Hit Ya Left But !!! '

  dc.b  '`Acoustica` (Bad samples) was done with Sound FX and'
  dc.b  'is based on `Das Boot` [The acoustic part that is]  '
  dc.b  '----------------------------------------------------' 
  dc.b  '`Snake Dance`  is a Mix-up between Asian like music ' 
  dc.b  'and Other styles (?).............and was composed by'                        
  dc.b  'myself in about 30 minutes.                         ' 
  dc.b  '----------------------------------------------------' 
  dc.b  'Pom....Pom.....Pom......Pom......Pom........ (Mmm)  ' 
  dc.b  '                                                    '
  dc.b  'Next Time I will send you my version of `DAS BOOT`..'  
  dc.b  '[From that Movie with that Submarine] the first part' 
  dc.b  'is already done (with Musical Enlightenment) but now' 
  dc.b  'I have to make a trip to the North Sea to sample the' 
  dc.b  'Sea (Or I sample my Toilet....much cleaner then the ' 
  dc.b  'North Sea, even when I used It... Hit Left Mouse !!!' 

  dc.b  '----------------------------------------------------'
  dc.b  'Allright this is it for now........Continue the good'
  dc.b  'work and thanx for that music disk of Robert Babicz ' 
  dc.b  '[Very good Samples indeed]                          '
  dc.b  '----------------------------------------------------' 
  dc.b  'Signed:  Maurice Wielink                            '                                                        
  dc.b  '         Hondemanstraat 51                          '
  dc.b  '         1508 GA, Zaandam                           '
  dc.b  '         The Netherlands                            '
  dc.b  '----------------------------------------------------' 
  dc.b  '  Vraag me niet waarom ik in het Engels schrijf.....'    
  dc.b  '  because I have`nt a Clue !                        '    
  dc.b  '                                                    '
  dc.b  '  Pom.....Pom.... Don`t press the button Yet !!!    '  
  dc.b  '                  Allright Press Left Button Now !!!'                    
  even     

PageCounter:	dc.l	0
 even
intname:
 dc.b 'intuition.library',0
 even
gfxname:
 dc.b 'graphics.library',0 
 even

dosname:
 dc.b 'dos.library',0
  even

_GfxBase	dc.l 0
 
_IntuitionBase  dc.l 0

_DosBase	dc.l 0
 even

scrnbase	dc.l	0
windowbase	dc.l	0
rastport	dc.l	0
userport	dc.l	0
viewport	dc.l	0
 even
EraseString:
 dc.b '                                                                  ' 
 even 

;The
 end


