wudsn-ide/com.wudsn.ide.ref/ASM/C64/ACME/examples/Crsr.a
2018-12-30 16:52:33 +01:00

120 lines
1.8 KiB
Plaintext

;ACME 0.07
; ab hier liegt die Cursorsteuerung
; A = screenx, Y = screeny
!zone
crsrset
sta .m+1;buffer x
iny;adjust height
iny
iny
sty .n+1;buffer y
jsr crsroff
lda #0;clear Hi
sta vtemp+1
.n lda #MODIFIED8; y
asl;*2
asl;*4
rol vtemp+1
asl;*8
rol vtemp+1
asl;*16
rol vtemp+1
sta vtemp;stash Lo
ldy vtemp+1;copy Hi
sty vtemp+2
asl;*32
rol vtemp+2
asl;*64
rol vtemp+2
adc vtemp;+ 16er-Lo
sta vtemp;80er-Lo in vtemp
bcc .m;page
inc vtemp+1
clc
.m adc #MODIFIED8; x
sta vtemp;store Lo
lda vtemp+1;get 16er-Hi
adc vtemp+2;add 64er-Hi
adc #attrhi;add base
sta vtemp+1;store Hi
!zone
crsron
lda conreg;buffert CR
sta .m+1
+bank15
jsr vpntcrsr;set address
.l2 bit vdc;get ready
bpl .l2
lda reg;get attribute
sta tcolor;buffer it
jsr vpntcrsr;set address
lda clrcrsr;get crsr
.l bit vdc;get ready
bpl .l
sta reg;set crsr
.m lda #MODIFIED8; bank
sta conreg;restore CR
rts
!zone
crsroff
lda conreg;buffer CR
sta .m+1
+bank15
jsr vpntcrsr;set address
lda tcolor;get attribute
.l bit vdc;get ready
bpl .l
sta reg;set attribute
.m lda #MODIFIED8; bank
sta conreg;restore CR
rts
; push data
!zone
crsrnew
ldx crsrheap;get stackpointer
lda vtemp;get low
sta crsrheap,x;push
lda vtemp+1;get high
sta crsrheap+1,x;push
inx;inc stackpointer
inx
stx crsrheap;set stackpointer
jsr crsroff
!zone
crsrhide
ldx #$3f;place cursor
stx vtemp+1; outside visible
ldx #$ff; area
stx vtemp
rts
!zone
crsrold
ldx crsrheap;get stackpointer
dex;previous entry !
dex
lda crsrheap,x;get lo
sta vtemp;set lo
lda crsrheap+1,x;get hi
sta vtemp+1;set hi
stx crsrheap;set stackpointer
jmp crsron
!zone
crsrinit
ldx #1;init cursorstack
stx crsrheap
jmp crsrhide;and hide cursor
crsrheap
!fill 33, 33
vpntcrsr
+ldax vtemp
jmp ramaccess;set vdc