DataMuseum.dk

Presents historical artifacts from the history of:

Commodore CBM-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Commodore CBM-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦e0f310c9a⟧ TextFile

    Length: 2515 (0x9d3)
    Types: TextFile
    Notes: UNIX file
    Names: »scroll.s«

Derivation

└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
    └─⟦926b8033d⟧ UNIX V7 Filesystem
        └─ ⟦this⟧ »u/demo/slide/scroll.s« 

TextFile



	.globl	scroll_, scantab_, aldir_, linerase_, nulls_


SEG0	= 0x3a000000		/ first screen segment
SEG1	= 0x3b000000		/ second screen segment
YMAX	= 800			/ scan lines per screen
YSPLIT	= 512			/ scan line that crossed into SEG1
YSCROLL	= 25			/ scrolling increment
MAXLINE = 32			/ YMAX / YSCROLL
WPERSL	= 64			/ words per scan line
BPERSL	= WPERSL * 2		/ bytes per scan line
SS = 0x3F3F			/ system stack 
OS = 0x3e3e
/ rr2	pointer to scan line data
/ rr4	reference pointer to screen
/ r6	a word offset into the screen
/ r7	word count
/ rr8	source pointer
/ rr10	destination pointer


scroll_:
	pushl	(rr14), rr10
	pushl	(rr14), rr8
	push	(rr14), r7
	push	(rr14), r6
	pushl	(rr14), rr4
	pushl	(rr14), rr2

	ldl	rr2, $scantab_+YSCROLL*2
	ldl	rr4, $SEG0 + YSCROLL*BPERSL
	ld	r8, r4
	ld	r10, r4
	jr	1f

0:	add	r5, $BPERSL
	jr	c, 2f

1:	ld	r6, (rr2)
	ld	OS|[-YSCROLL*2](r3), r6
	inc	r3, $2
	xor	r7, r7
	orb	rl7, rl6
	jr	z, 0b
	ldb	rl6, rh6
	xorb	rh6, rh6
	add	r6, r6
	ld	r9, r5
	add	r9, r6
	ld	r11, r9
	sub	r11, $YSCROLL*BPERSL
	ldir	(rr10), (rr8), r7
	jr	0b

2:	ldl	rr4, $SEG0+0x10000-YSCROLL*BPERSL
	ldl	rr8, $SEG1
	jr	1f

0:	add	r5, $BPERSL
	jr	c, 2f

1:	ld	r6, (rr2)
	ld	OS|[-YSCROLL*2](r3), r6
	inc	r3, $2
	xor	r7, r7
	orb	rl7, rl6
	jr	z, 0b
	ldb	rl6, rh6
	xorb	rh6, rh6
	add	r6, r6
	ld	r11, r5
	add	r11, r6
	ld	r9, r11
	add	r9, $YSCROLL*BPERSL
	ldir	(rr10), (rr8), r7
	jr	0b

2:	ldl	rr4, $SEG1+YSCROLL*BPERSL
	ld	r10, r4
	jr	1f

0:	add	r5, $BPERSL
	cp	r3, $scantab_+YMAX*2
	jr	z, 2f

1:	ld	r6, (rr2)
	ld	OS|[-YSCROLL*2](r3), r6
	inc	r3, $2
	xor	r7, r7
	orb	rl7, rl6
	jr	z, 0b
	ldb	rl6, rh6
	xorb	rh6, rh6
	add	r6, r6
	ld	r9, r5
	add	r9, r6
	ld	r11, r9
	sub	r11, $YSCROLL*BPERSL
	ldir	(rr10), (rr8), r7
	jr	0b

2:	ldl	rr8, $nulls_
	ld	r11, $[[MAXLINE-1]*YSCROLL-YSPLIT]*BPERSL
	ld	r7, $YSCROLL*WPERSL
	ldir	(rr10), (rr8), r7

	popl	rr2, (rr14)
	popl	rr4, (rr14)
	pop	r6, (rr14)
	pop	r7, (rr14)
	popl	rr8, (rr14)
	popl	rr10, (rr14)
	ret

aldir_:
	dec	r15, $12
	ldm	(rr14), r8, $6
	ld	r13, r15
	ldl	rr10, SS|16(r13)
	ldl	rr8, SS|20(r13)
	ld	r12, SS|24(r13)
	ldir	(rr10), (rr8), r12
	ldm	r8, (rr14), $6
	inc	r15, $12
	ret	


////////
/
/ erase text line
/	linerase( line)
/ YSCROLL scan lines are filled with nulls, starting at text line `line'.
/
linerase_:
	ld	r1, SS|4(r15)
	mult	rr0, $YSCROLL
	ldl	rr4, $SEG0
	cp	r1, $YSPLIT
	jr	c, 1f
	ldl	rr4, $SEG1
	sub	r1, $YSPLIT

1:	mult	rr0, $BPERSL
	ld	r5, r1
	ldl	rr2, $nulls_
	ld	r0, $YSCROLL*WPERSL
	ldir	(rr4), (rr2), r0

	ret


	.bssd
nulls_:	.blkw	YSCROLL * WPERSL