[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ok, anyone started Contiki 4 AII yet?
- Subject: Re: Ok, anyone started Contiki 4 AII yet?
- From: "Axel Muhr" <axelAtgeekdotDotcom>
- Date: Wed, 19 Mar 2003 13:54:13 +0100
- Newsgroups: comp.sys.apple2
- Organization: Virginia Department of Education
- References: <b52h93$f5d2@pen6.pen.k12.va.us> <3io45b.qaf.ln@news.musoftware.de>
- Xref: archiver1.google.com comp.sys.apple2:28881
Hey Gang,
"Ullrich von Bassewitz" <uz@remove-to-reply.musoftware.de> schrieb im
Newsbeitrag 3io45b.qaf.ln@news.musoftware.de">news:3io45b.qaf.ln@news.musoftware.de...
> Axel Muhr <axelAtgeekdotDotcom> wrote:
> > Chris (Morse)? Adam? Any ideas, hints? Thanks in advance...
>
> The apple libraries don't have an implementation for the clock() function,
and
> therefore no CLK_TCK constant.
What a thread! This grew huge since I had my last look ;-)
Ok, in the meantime I've discussed a bit with Ulrich about several
solutions... My first idea was VBL (like others suggested here, too), but my
suggestion
@ticka: bit $c019 ; Loop VBL low
bpl ticka
@tickb: bit $c019 ; Loop VBL high
bmi tickb ; ein Tickcycle ist durch
<inc counter here>
was rightfully "killed" by Ullrich, as it just counts while running (i.e. no
background-counting). So my next idea was a interupt handler (coping with
II,IIe,IIc and IIgs)... for googles sake, I found this old code from David
Empson, which could be a basis to work from. What do you think?
Cheers, Axel
* VBL interrupt handler for the IIe, IIc and IIgs, for use from
* Applesoft BASIC. (untested at the time of posting)
*
* by David Empson (dempson@actrix.gen.nz)
*
* This program is hereby donated to the public domain. If you distribute
* it, please include the full text of the relevant portion of the original
* article.
jmp install ; Entry point to install the handler
jmp remove ; Entry point to remove the handler
mouseCN dfb $00 ; Modified to hold mouse slot in $Cn format
mouseN0 dfb $00 ; Modified to hold mouse slot in $n0 format
vblcount dfb $00 ; Incremented for each VBL
* Routine to do the installation steps
install
* Locate the mouse.
lda #$C7 ; Start the search at slot 7
sta $3D
lda #$00
sta $3C ; Set up a pointer for the slot search
sta mouseCN ; Ensure our important variables are cleared
sta vblcount
slotlp ldx #4 ; Set up count for lookup table
bytelp lda offsets,X ; Get offset into card
tay
lda ($3C),Y ; Get a byte from the card
cmp values,X ; Does it match?
bne notmouse ; If not, this slot isn't a mouse
dex
bpl bytelp ; Loop back around for next byte
lda $3D
sta mouseCN ; Store the slot number in $Cn format
tax ; and save it in X
asl
asl
asl
asl
sta mouseN0 ; Store the slot number in $n0 format
bne gotmouse ; Branch is always taken
notmouse
ldx $3D
dex
stx $3D
cpx #$C1 ; Done all slots yet?
bcs slotlp ; Loop for the next slot
nomouse rts ; Return to BASIC
* We have found the mouse. Set up our interrupt handler.
gotmouse
ldy #$13
lda ($3C),Y ; Get the location of the SERVEMOUSE routine
sta doservm+1 ; Patch the call into the interrupt handler
stx doservm+2
iny
lda ($3C),Y ; Get the location of the READMOUSE routine
sta doreadm+1 ; Patch the call into the interrupt handler
stx doreadm+2
* Set up the mouse firmware.
ldy #$19
lda ($3C),Y ; Get the location of the INITMOUSE routine
sta doinitm+1
stx doinitm+2 ; Patch our call
ldy #$12
lda ($3C),Y ; Get the location of the SETMOUSE routine
sta dosetm+1
stx dosetm+2 ; Patch our call
ldy mouseN0
doinitm jsr $0000 ; Patched with location of INITMOUSE
* Install the interrupt handler.
jsr $BF00 ; Call ProDOS
dfb $40 ; ALLOC_INTERRUPT call
da allocpb ; Address of parameter block
bcs nomouse ; If error, forget about it
* Set up the appropriate mouse mode.
lda #$09 ; Mode: enable mouse, VBL interrupt only
* Fall through to our setmouse subroutine. It will return to BASIC.
setmouse
* Subroutine to set the mouse mode to the value in A.
ldx mouseCN
ldy mouseC0
dosetm jsr $0000 ; Patched with location of SETMOUSE
rts ; Return to BASIC or caller
* Routine to disable and remove the interrupt handler.
remove
* Check that the install routine has been called successfully.
ldx mouseCN
beq noremove
* Disable the mouse