User Tools

Site Tools


programmering:demo1-code

Demo1 kode

Kompileres med pasmo

pasmo -d --tapbas demo1.asm demo1.tap
   	org     32768

start:
        di		  ; no need to spend time reading keyboard etc.
        call clearscreen
        call clearattr
effects:
        call effect1
        call effect2
        call effect3
        call effect4
        call effect5
        call effect6
        call effect7
        call effect8
	call shift_patterns
	jr effects
 
effect1: 
;	pattern 11111122
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,six_lines
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret
	
effect2: ; 21111112
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern2)
	ld bc,one_line
	ld (hl),a
	ldir
	ld a,(pattern1)
	ld bc,six_lines
	ld (hl),a
	ldir
    	ld a,(pattern2)
	ld bc,one_line
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect3: ; 22111111
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
	ld a,(pattern1)
	ld bc,six_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect4: ; 12211111
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,one_line
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
    	ld a,(pattern1)
	ld bc,five_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect5: ; 11221111
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,two_lines
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
    	ld a,(pattern1)
	ld bc,four_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect6: ; 11122111
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,three_lines
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
    	ld a,(pattern1)
	ld bc,three_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect7: ; 11112211
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,four_lines
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
    	ld a,(pattern1)
	ld bc,two_lines
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

effect8: ; 11111221
	ld hl,screenstart
	ld de,screenstart+1
    	ld a,(pattern1)
	ld bc,five_lines
	ld (hl),a
	ldir
	ld a,(pattern2)
	ld bc,two_lines
	ld (hl),a
	ldir
    	ld a,(pattern1)
	ld bc,one_line
	ld (hl),a
	ldir
	call copy_top_of_screen
	ret

clearscreen: 
;	could be optimized using the push sp trick
	xor a
	ld hl,screenstart
	ld de,screenstart+1
	ld bc,screensize-1
	ld (hl),a
	ldir
	xor a
	out (254),a ; black border
	ret

clearattr:
;	could be optimized using the push sp trick
	ld a,56			; black ink, white paper
	ld hl,attrstart
	ld bc,attrsize-1
	ld de,attrstart+1
	ld (hl),a
	ldir
	ret

copy_top_of_screen:
;	could be optimized using the push sp trick
	ld bc,16*one_line	
	ld hl,screenstart
	ld de,screenstart+8*one_line
	ldir 
	ret 

shift_patterns:
	ld hl,pattern1
	rlc (hl)
	ld hl,pattern2
	rlc (hl)
	rlc (hl)
	ret

pattern1:		defb	%11111100
pattern2:		defb	%00000011

screenstart:		equ	16384     
screensize:		equ	6144
set_border:		equ     #229B
attrstart:		equ	screenstart+screensize
attrsize:		equ	24*32

one_line:		equ     32*8
two_lines:		equ 	2*one_line
three_lines:		equ 	3*one_line
four_lines:		equ 	4*one_line
five_lines:		equ 	5*one_line
six_lines:		equ 	6*one_line


END	start
programmering/demo1-code.txt · Last modified: 2023/10/21 19:19 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki