]> git.sur5r.net Git - cc65/commitdiff
Prepared infrastructure for a shared loadable generic mouse driver based the GEOS...
authorol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 8 Feb 2012 14:30:07 +0000 (14:30 +0000)
committerol.sc <ol.sc@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 8 Feb 2012 14:30:07 +0000 (14:30 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5496 b7a2c559-68d2-44c3-8de9-860c34a00d81

13 files changed:
libsrc/geos-cbm/Makefile
libsrc/geos-cbm/drivers/Makefile
libsrc/geos-cbm/drivers/fio_module.s [deleted file]
libsrc/geos-cbm/drivers/mcbdefault.s [deleted file]
libsrc/geos-cbm/drivers/mouse_stddrv.s [deleted file]
libsrc/geos-common/Makefile
libsrc/geos-common/drivers/Makefile [new file with mode: 0644]
libsrc/geos-common/drivers/fio_module.s [new file with mode: 0644]
libsrc/geos-common/drivers/geos-stdmou.s [new file with mode: 0644]
libsrc/geos-common/drivers/mcbdefault.s [new file with mode: 0644]
libsrc/geos-common/drivers/mouse_stddrv.s [new file with mode: 0644]
libsrc/geos-common/mousesprite/Makefile
libsrc/geos-common/mousesprite/mouse.s [deleted file]

index d5a649d8c9118dc2e24ee05cc70f467945a0248f..c2a2720b525e6ba60074c55b6471684dd0fd5276 100644 (file)
@@ -57,7 +57,7 @@ EMDS = geos-vdc.emd
 
 JOYS = geos-stdjoy.joy
 
-MOUS = #geos-stdmou.mou
+MOUS =
 
 SERS =
 
index 1e3d5d446e5c8673a868425e0b91edb864d68e99..96af4145bcec9a4d4f618b0668848220ddb11e95 100644 (file)
@@ -5,9 +5,6 @@
 #--------------------------------------------------------------------------
 # Object files
 
-S_OBJS +=      fio_module.o    \
-               joy_stddrv.o    \
-               mcbdefault.o    \
-               mouse_stddrv.o  \
+S_OBJS +=      joy_stddrv.o    \
                tgi_colors.o    \
                tgi_stddrv.o
diff --git a/libsrc/geos-cbm/drivers/fio_module.s b/libsrc/geos-cbm/drivers/fio_module.s
deleted file mode 100644 (file)
index 4d11511..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-;
-; Low level file I/O routines, ONLY for module loading OR sth similar
-;
-; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
-; 25.12.2002
-;
-; only ONE opened file at a time, only O_RDONLY flag
-
-; int open (const char* name, int flags, ...); /* May take a mode argument */
-; int __fastcall__ close (int fd);
-; int __fastcall__ read (int fd, void* buf, unsigned count);
-
-FILEDES                = 3             ; first free to use file descriptor
-
-            .importzp ptr1, ptr2, ptr3, tmp1
-            .import addysp, popax
-            .import __oserror
-           .import _FindFile, _ReadByte
-           .export _open, _close, _read
-
-           .include "geossym.inc"
-           .include "const.inc"
-                   .include "errno.inc"
-           .include "fcntl.inc"
-
-_open:
-       cpy #4                  ; correct # of arguments (bytes)?
-       beq @parmok             ; parameter count ok
-       tya                     ; parm count < 4 shouldn't be needed to be...
-               sec                     ; ...checked (it generates a c compiler warning)
-       sbc #4
-       tay
-       jsr addysp              ; fix stack, throw away unused parameters
-
-; Parameters ok. Pop the flags and save them into tmp3
-
-@parmok:
-       jsr popax               ; Get flags
-       sta tmp1
-        jsr popax              ; Get name
-       sta ptr1
-       stx ptr1+1
-           
-       lda filedesc            ; is there a file already open?
-       bne @alreadyopen
-           
-       lda tmp1                ; check open mode
-       and #(O_RDWR | O_CREAT)
-       cmp #O_RDONLY           ; only O_RDONLY is valid
-       bne @badmode
-           
-       lda ptr1
-       ldx ptr1+1
-       jsr _FindFile           ; try to find the file
-       tax
-       bne @oserror
-           
-       lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1)
-       sta f_track
-       lda dirEntryBuf + OFF_DE_TR_SC + 1
-       sta f_sector
-       lda #<diskBlkBuf        ; buffer for ReadByte (r4)
-       sta f_buffer
-       lda #>diskBlkBuf
-       sta f_buffer+1
-       ldx #0                  ; offset for ReadByte (r5)
-       stx f_offset
-       stx f_offset+1
-       lda #0                  ; clear errors
-       sta __oserror
-       jsr __seterrno
-       lda #FILEDES            ; return fd
-       sta filedesc
-       rts
-@badmode:
-       lda #EINVAL             ; invalid parameters - invalid open mode
-       .byte $2c               ; skip
-@alreadyopen:
-       lda #EMFILE             ; too many opened files (there can be only one)
-       jmp __directerrno       ; set errno, clear oserror, return -1
-@oserror:
-       jmp __mappederrno       ; set platform error code, return -1
-
-_close:
-       lda #0
-       sta __oserror
-       jsr __seterrno          ; clear errors
-       lda #0                  ; clear fd
-       sta filedesc
-       tax
-       rts
-
-_read:
-    ; a/x - number of bytes
-    ; popax - buffer ptr
-    ; popax - fd, must be == to the above one
-    ; return -1+__oserror or number of bytes read
-
-       eor #$ff
-       sta ptr1
-       txa
-       eor #$ff
-       sta ptr1+1              ; -(# of bytes to read)-1
-       jsr popax
-       sta ptr2
-       stx ptr2+1              ; buffer ptr
-       jsr popax
-       cmp #FILEDES            ; lo-byte == FILEDES
-       bne @filenotopen
-       txa                     ; hi-byte == 0
-       beq @fileok             ; fd must be == FILEDES
-
-@filenotopen:
-       lda #EBADF
-       jmp __directerrno       ; Sets _errno, clears _oserror, returns -1
-
-@fileok:
-       lda #0
-       sta ptr3
-       sta ptr3+1              ; put 0 into ptr3 (number of bytes read)
-       sta __oserror           ; clear error flags
-       jsr __seterrno
-
-       lda f_track             ; restore stuff for ReadByte
-       ldx f_sector
-       sta r1L
-       stx r1H
-       lda f_buffer
-       ldx f_buffer+1
-       sta r4L
-       stx r4H
-       lda f_offset
-       ldx f_offset+1
-       sta r5L
-       stx r5H
-
-       clc
-       bcc @L3                 ; branch always
-
-@L0:   jsr _ReadByte
-       ldy #0                  ; store the byte
-       sta (ptr2),y
-       inc ptr2                ; increment target address
-       bne @L1
-       inc ptr2+1
-
-@L1:   inc ptr3                ; increment byte count
-       bne @L2
-       inc ptr3+1
-
-@L2:   lda __oserror           ; was there error ?
-       beq @L3
-       cmp #BFR_OVERFLOW       ; EOF?
-       beq @done               ; yes, we're done
-       jmp __mappederrno       ; no, we're screwed
-
-@L3:   inc ptr1                ; decrement the count
-       bne @L0
-       inc ptr1+1
-       bne @L0
-
-@done:
-       lda r1L                 ; preserve data for ReadByte
-       ldx r1H
-       sta f_track
-       stx f_sector
-       lda r4L
-       ldx r4H
-       sta f_buffer
-       stx f_buffer+1
-       lda r5L
-       ldx r5H
-       sta f_offset
-       stx f_offset+1
-
-       lda ptr3                ; return byte count
-       ldx ptr3+1
-       rts
-
-.bss
-
-filedesc:
-       .res 1                  ; file open flag - 0 (no file opened) or 1
-f_track:
-       .res 1                  ; values preserved for ReadByte
-f_sector:
-       .res 1
-f_offset:
-       .res 2
-f_buffer:
-       .res 2
diff --git a/libsrc/geos-cbm/drivers/mcbdefault.s b/libsrc/geos-cbm/drivers/mcbdefault.s
deleted file mode 100644 (file)
index 6fca43a..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-;
-; Mouse callbacks for GEOS.
-;
-; GEOS has a built-in mouse architecture.  Half of this file does nothing
-; -- it exists merely to allow portable programs to link and run.
-;
-; 2.7.2001, Maciej 'YTM/Elysium' Witkowiak
-; 2004-03-20, Ullrich von Bassewitz
-; 2004-09-24, Greg King
-;
-
-;      .constructor    init_pointer
-        .export         _mouse_def_callbacks
-
-;       .include        "mouse-kernel.inc"
-;      .include        "const.inc"
-;      .include        "geossym.inc"
-       .include        "jumptab.inc"
-
-;       .macpack        generic
-
-; The functions below must be interrupt-safe,
-; because they might be called from an interrupt-handler.
-
-.code
-
-; --------------------------------------------------------------------------
-; Hide the mouse pointer. Always called with interrupts disabled.
-
-hide := MouseOff
-
-; --------------------------------------------------------------------------
-; Show the mouse pointer. Always called with interrupts disabled.
-
-show := MouseUp
-
-; --------------------------------------------------------------------------
-; Move the mouse pointer X position to the value in .XA. Always called with
-; interrupts disabled.
-
-.proc   movex
-
-        rts
-
-.endproc
-
-; --------------------------------------------------------------------------
-; Move the mouse pointer Y position to the value in .XA. Always called with
-; interrupts disabled.
-
-.proc   movey
-
-        rts
-
-.endproc
-
-; --------------------------------------------------------------------------
-; Callback structure
-
-.rodata
-
-_mouse_def_callbacks:
-        .addr   hide
-        .addr   show
-        .addr   movex
-        .addr   movey
-
-
diff --git a/libsrc/geos-cbm/drivers/mouse_stddrv.s b/libsrc/geos-cbm/drivers/mouse_stddrv.s
deleted file mode 100644 (file)
index fec7b50..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-;
-; Name of the standard mouse driver
-;
-; 2010-01-25, Greg King
-;
-; const char mouse_stddrv[];
-;
-
-           .export _mouse_stddrv
-
-.rodata
-
-_mouse_stddrv:
-       .asciiz "geos-stdmou.mou"
index 99e8fa94caa26d760fc62aee758dff631ce0c586..70dd09a2313ba45d23f0e2c53922d08845ea091d 100644 (file)
@@ -26,6 +26,21 @@ CFLAGS       = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include
 %.o:   %.s
        @$(AS) -g -o $@ $(AFLAGS) $<
 
+%.emd: %.o ../runtime/zeropage.o
+       @$(LD) -o $@ -t module $^
+
+%.joy: %.o ../runtime/zeropage.o
+       @$(LD) -o $@ -t module $^
+
+%.mou: %.o ../runtime/zeropage.o
+       @$(LD) -o $@ -t module $^
+
+%.ser: %.o ../runtime/zeropage.o
+       @$(LD) -o $@ -t module $^
+
+%.tgi: %.o ../runtime/zeropage.o
+       @$(LD) -o $@ -t module $^
+
 #--------------------------------------------------------------------------
 # Directories
 
@@ -42,6 +57,19 @@ DIRS =       common          \
        runtime         \
        system
 
+#--------------------------------------------------------------------------
+# Drivers
+
+EMDS =
+
+JOYS =
+
+MOUS = #geos-stdmou.mou
+
+SERS =
+
+TGIS =
+
 #--------------------------------------------------------------------------
 # Directives
 
@@ -54,9 +82,13 @@ vpath %.s $(DIRS)
 
 .PHONY:        all clean zap
 
-all:   $(C_OBJS) $(S_OBJS)
+all:   $(C_OBJS) $(S_OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)
 
+../runtime/zeropage.o:
+       $(MAKE) -C $(dir $@) $(notdir $@)
+       
 clean:
-       @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS)
+       @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o)
 
 zap:   clean
+       @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS)
diff --git a/libsrc/geos-common/drivers/Makefile b/libsrc/geos-common/drivers/Makefile
new file mode 100644 (file)
index 0000000..a706e22
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# makefile for CC65 runtime library
+#
+
+#--------------------------------------------------------------------------
+# Object files
+
+S_OBJS +=      fio_module.o    \
+               mcbdefault.o    \
+               mouse_stddrv.o
diff --git a/libsrc/geos-common/drivers/fio_module.s b/libsrc/geos-common/drivers/fio_module.s
new file mode 100644 (file)
index 0000000..4d11511
--- /dev/null
@@ -0,0 +1,191 @@
+;
+; Low level file I/O routines, ONLY for module loading OR sth similar
+;
+; Maciej 'YTM/Elysium' Witkowiak <ytm@elysium.pl>
+; 25.12.2002
+;
+; only ONE opened file at a time, only O_RDONLY flag
+
+; int open (const char* name, int flags, ...); /* May take a mode argument */
+; int __fastcall__ close (int fd);
+; int __fastcall__ read (int fd, void* buf, unsigned count);
+
+FILEDES                = 3             ; first free to use file descriptor
+
+            .importzp ptr1, ptr2, ptr3, tmp1
+            .import addysp, popax
+            .import __oserror
+           .import _FindFile, _ReadByte
+           .export _open, _close, _read
+
+           .include "geossym.inc"
+           .include "const.inc"
+                   .include "errno.inc"
+           .include "fcntl.inc"
+
+_open:
+       cpy #4                  ; correct # of arguments (bytes)?
+       beq @parmok             ; parameter count ok
+       tya                     ; parm count < 4 shouldn't be needed to be...
+               sec                     ; ...checked (it generates a c compiler warning)
+       sbc #4
+       tay
+       jsr addysp              ; fix stack, throw away unused parameters
+
+; Parameters ok. Pop the flags and save them into tmp3
+
+@parmok:
+       jsr popax               ; Get flags
+       sta tmp1
+        jsr popax              ; Get name
+       sta ptr1
+       stx ptr1+1
+           
+       lda filedesc            ; is there a file already open?
+       bne @alreadyopen
+           
+       lda tmp1                ; check open mode
+       and #(O_RDWR | O_CREAT)
+       cmp #O_RDONLY           ; only O_RDONLY is valid
+       bne @badmode
+           
+       lda ptr1
+       ldx ptr1+1
+       jsr _FindFile           ; try to find the file
+       tax
+       bne @oserror
+           
+       lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1)
+       sta f_track
+       lda dirEntryBuf + OFF_DE_TR_SC + 1
+       sta f_sector
+       lda #<diskBlkBuf        ; buffer for ReadByte (r4)
+       sta f_buffer
+       lda #>diskBlkBuf
+       sta f_buffer+1
+       ldx #0                  ; offset for ReadByte (r5)
+       stx f_offset
+       stx f_offset+1
+       lda #0                  ; clear errors
+       sta __oserror
+       jsr __seterrno
+       lda #FILEDES            ; return fd
+       sta filedesc
+       rts
+@badmode:
+       lda #EINVAL             ; invalid parameters - invalid open mode
+       .byte $2c               ; skip
+@alreadyopen:
+       lda #EMFILE             ; too many opened files (there can be only one)
+       jmp __directerrno       ; set errno, clear oserror, return -1
+@oserror:
+       jmp __mappederrno       ; set platform error code, return -1
+
+_close:
+       lda #0
+       sta __oserror
+       jsr __seterrno          ; clear errors
+       lda #0                  ; clear fd
+       sta filedesc
+       tax
+       rts
+
+_read:
+    ; a/x - number of bytes
+    ; popax - buffer ptr
+    ; popax - fd, must be == to the above one
+    ; return -1+__oserror or number of bytes read
+
+       eor #$ff
+       sta ptr1
+       txa
+       eor #$ff
+       sta ptr1+1              ; -(# of bytes to read)-1
+       jsr popax
+       sta ptr2
+       stx ptr2+1              ; buffer ptr
+       jsr popax
+       cmp #FILEDES            ; lo-byte == FILEDES
+       bne @filenotopen
+       txa                     ; hi-byte == 0
+       beq @fileok             ; fd must be == FILEDES
+
+@filenotopen:
+       lda #EBADF
+       jmp __directerrno       ; Sets _errno, clears _oserror, returns -1
+
+@fileok:
+       lda #0
+       sta ptr3
+       sta ptr3+1              ; put 0 into ptr3 (number of bytes read)
+       sta __oserror           ; clear error flags
+       jsr __seterrno
+
+       lda f_track             ; restore stuff for ReadByte
+       ldx f_sector
+       sta r1L
+       stx r1H
+       lda f_buffer
+       ldx f_buffer+1
+       sta r4L
+       stx r4H
+       lda f_offset
+       ldx f_offset+1
+       sta r5L
+       stx r5H
+
+       clc
+       bcc @L3                 ; branch always
+
+@L0:   jsr _ReadByte
+       ldy #0                  ; store the byte
+       sta (ptr2),y
+       inc ptr2                ; increment target address
+       bne @L1
+       inc ptr2+1
+
+@L1:   inc ptr3                ; increment byte count
+       bne @L2
+       inc ptr3+1
+
+@L2:   lda __oserror           ; was there error ?
+       beq @L3
+       cmp #BFR_OVERFLOW       ; EOF?
+       beq @done               ; yes, we're done
+       jmp __mappederrno       ; no, we're screwed
+
+@L3:   inc ptr1                ; decrement the count
+       bne @L0
+       inc ptr1+1
+       bne @L0
+
+@done:
+       lda r1L                 ; preserve data for ReadByte
+       ldx r1H
+       sta f_track
+       stx f_sector
+       lda r4L
+       ldx r4H
+       sta f_buffer
+       stx f_buffer+1
+       lda r5L
+       ldx r5H
+       sta f_offset
+       stx f_offset+1
+
+       lda ptr3                ; return byte count
+       ldx ptr3+1
+       rts
+
+.bss
+
+filedesc:
+       .res 1                  ; file open flag - 0 (no file opened) or 1
+f_track:
+       .res 1                  ; values preserved for ReadByte
+f_sector:
+       .res 1
+f_offset:
+       .res 2
+f_buffer:
+       .res 2
diff --git a/libsrc/geos-common/drivers/geos-stdmou.s b/libsrc/geos-common/drivers/geos-stdmou.s
new file mode 100644 (file)
index 0000000..1889c4f
--- /dev/null
@@ -0,0 +1,194 @@
+;
+; Maciej 'YTM/Elysium' Witkowiak
+;
+; 2.7.2001
+;
+; Wrapper for GEOS standard input device interface
+;
+                                        
+       .export         _mouse_init, _mouse_done
+       .export         _mouse_hide, _mouse_show
+       .export         _mouse_box
+       .export         _mouse_pos, _mouse_info
+       .export         _mouse_move, _mouse_buttons
+
+               .import         popsreg, addysp1
+       .importzp       sp, sreg, ptr1
+
+       .include "const.inc"
+       .include "jumptab.inc"
+       .include "geossym.inc"
+
+
+.code
+
+; --------------------------------------------------------------------------
+;
+; unsigned char __fastcall__ mouse_init (unsigned char type);
+;
+
+_mouse_init:
+       jsr     StartMouseMode
+       jsr     MouseOff
+
+       lda     #0
+       sta     mouseTop
+       sta     mouseLeft
+       sta     mouseLeft+1
+.ifdef  __GEOS_CBM__
+       lda     #199
+       sta     mouseBottom
+       lda     graphMode
+       bpl     _mse_screen320
+
+       lda     #<639                   ; 80 columns on C128
+       ldx     #>639
+       bne     _mse_storex
+_mse_screen320:
+       lda     #<319                   ; 40 columns on C64/C128
+       ldx     #>319
+_mse_storex:
+.else
+       lda     #191
+       sta     mouseBottom
+       lda     #<559
+       ldx     #>559
+.endif
+       sta     mouseRight
+       stx     mouseRight+1
+_mse_initend:
+       lda     #0
+       tax
+; --------------------------------------------------------------------------
+;
+; void mouse_done (void);
+;
+_mouse_done:
+       rts
+
+; --------------------------------------------------------------------------
+;
+; void mouse_hide (void);
+;
+
+_mouse_hide = MouseOff
+
+; --------------------------------------------------------------------------
+;
+; void mouse_show (void);
+;
+
+_mouse_show = MouseUp
+
+; --------------------------------------------------------------------------
+;
+; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
+;
+
+_mouse_box:
+       ldy     #0                      ; Stack offset
+
+       sta     mouseBottom
+
+       lda     (sp),y
+       sta     mouseRight
+       iny
+       lda     (sp),y
+       sta     mouseRight+1            ; maxx
+
+       iny
+       lda     (sp),y
+       sta     mouseTop
+       iny                             ; Skip high byte
+
+       iny
+       lda     (sp),y
+       sta     mouseLeft
+       iny
+       lda     (sp),y
+       sta     mouseLeft+1             ; minx
+
+       jmp     addysp1                 ; Drop params, return
+
+; --------------------------------------------------------------------------
+;
+; void __fastcall__ mouse_pos (struct mouse_pos* pos);
+; /* Return the current mouse position */
+;
+
+_mouse_pos:
+               sta     ptr1
+       stx     ptr1+1                  ; Remember the argument pointer
+
+       ldy     #0                      ; Structure offset
+
+        php
+        sei                            ; Disable interrupts
+
+               lda     mouseXPos               ; Transfer the position
+       sta     (ptr1),y
+       lda     mouseXPos+1
+       iny
+       sta     (ptr1),y
+       lda     mouseYPos
+       iny
+       sta     (ptr1),y
+       lda     #$00
+       iny
+       sta     (ptr1),y
+
+       plp                             ; Reenable interrupts
+       rts                             ; Done
+
+; --------------------------------------------------------------------------
+;
+; void __fastcall__ mouse_info (struct mouse_info* info);
+; /* Return the state of the mouse buttons and the position of the mouse */
+;
+
+_mouse_info:
+
+; We're cheating here to keep the code smaller: The first fields of the
+; mouse_info struct are identical to the mouse_pos struct, so we will just
+; call _mouse_pos to initialize the struct pointer and fill the position
+; fields.
+
+        jsr    _mouse_pos
+
+; Fill in the button state
+
+       jsr     _mouse_buttons          ; Will not touch ptr1
+       iny
+       sta     (ptr1),y
+
+       rts
+
+; --------------------------------------------------------------------------
+;
+; void __fastcall__ mouse_move (int x, int y);
+;
+
+_mouse_move:
+       jsr     popsreg                 ; Get X
+        php
+        sei                            ; Disable interrupts
+       sta     mouseYPos
+       lda     sreg
+       ldx     sreg+1
+       sta     mouseXPos
+       stx     mouseXPos+1
+       plp                             ; Enable interrupts
+       rts
+
+; --------------------------------------------------------------------------
+;
+; unsigned char mouse_buttons (void);
+;
+
+_mouse_buttons:
+       ldx     #0
+       lda     pressFlag
+       and     #SET_MOUSE
+       lsr
+       rts
+
diff --git a/libsrc/geos-common/drivers/mcbdefault.s b/libsrc/geos-common/drivers/mcbdefault.s
new file mode 100644 (file)
index 0000000..6fca43a
--- /dev/null
@@ -0,0 +1,68 @@
+;
+; Mouse callbacks for GEOS.
+;
+; GEOS has a built-in mouse architecture.  Half of this file does nothing
+; -- it exists merely to allow portable programs to link and run.
+;
+; 2.7.2001, Maciej 'YTM/Elysium' Witkowiak
+; 2004-03-20, Ullrich von Bassewitz
+; 2004-09-24, Greg King
+;
+
+;      .constructor    init_pointer
+        .export         _mouse_def_callbacks
+
+;       .include        "mouse-kernel.inc"
+;      .include        "const.inc"
+;      .include        "geossym.inc"
+       .include        "jumptab.inc"
+
+;       .macpack        generic
+
+; The functions below must be interrupt-safe,
+; because they might be called from an interrupt-handler.
+
+.code
+
+; --------------------------------------------------------------------------
+; Hide the mouse pointer. Always called with interrupts disabled.
+
+hide := MouseOff
+
+; --------------------------------------------------------------------------
+; Show the mouse pointer. Always called with interrupts disabled.
+
+show := MouseUp
+
+; --------------------------------------------------------------------------
+; Move the mouse pointer X position to the value in .XA. Always called with
+; interrupts disabled.
+
+.proc   movex
+
+        rts
+
+.endproc
+
+; --------------------------------------------------------------------------
+; Move the mouse pointer Y position to the value in .XA. Always called with
+; interrupts disabled.
+
+.proc   movey
+
+        rts
+
+.endproc
+
+; --------------------------------------------------------------------------
+; Callback structure
+
+.rodata
+
+_mouse_def_callbacks:
+        .addr   hide
+        .addr   show
+        .addr   movex
+        .addr   movey
+
+
diff --git a/libsrc/geos-common/drivers/mouse_stddrv.s b/libsrc/geos-common/drivers/mouse_stddrv.s
new file mode 100644 (file)
index 0000000..fec7b50
--- /dev/null
@@ -0,0 +1,14 @@
+;
+; Name of the standard mouse driver
+;
+; 2010-01-25, Greg King
+;
+; const char mouse_stddrv[];
+;
+
+           .export _mouse_stddrv
+
+.rodata
+
+_mouse_stddrv:
+       .asciiz "geos-stdmou.mou"
index f76ea33be9ea43ec128c627d82097c9fa58bd899..054546e6493b3a04ebdb42e27d3fdfde12e0570c 100644 (file)
@@ -17,5 +17,4 @@ S_OBJS +=     startmousemode.o        \
                inittextprompt.o        \
                promptoff.o             \
                prompton.o              \
-               getnextchar.o           \
-               mouse.o
+               getnextchar.o
diff --git a/libsrc/geos-common/mousesprite/mouse.s b/libsrc/geos-common/mousesprite/mouse.s
deleted file mode 100644 (file)
index 1889c4f..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-;
-; Maciej 'YTM/Elysium' Witkowiak
-;
-; 2.7.2001
-;
-; Wrapper for GEOS standard input device interface
-;
-                                        
-       .export         _mouse_init, _mouse_done
-       .export         _mouse_hide, _mouse_show
-       .export         _mouse_box
-       .export         _mouse_pos, _mouse_info
-       .export         _mouse_move, _mouse_buttons
-
-               .import         popsreg, addysp1
-       .importzp       sp, sreg, ptr1
-
-       .include "const.inc"
-       .include "jumptab.inc"
-       .include "geossym.inc"
-
-
-.code
-
-; --------------------------------------------------------------------------
-;
-; unsigned char __fastcall__ mouse_init (unsigned char type);
-;
-
-_mouse_init:
-       jsr     StartMouseMode
-       jsr     MouseOff
-
-       lda     #0
-       sta     mouseTop
-       sta     mouseLeft
-       sta     mouseLeft+1
-.ifdef  __GEOS_CBM__
-       lda     #199
-       sta     mouseBottom
-       lda     graphMode
-       bpl     _mse_screen320
-
-       lda     #<639                   ; 80 columns on C128
-       ldx     #>639
-       bne     _mse_storex
-_mse_screen320:
-       lda     #<319                   ; 40 columns on C64/C128
-       ldx     #>319
-_mse_storex:
-.else
-       lda     #191
-       sta     mouseBottom
-       lda     #<559
-       ldx     #>559
-.endif
-       sta     mouseRight
-       stx     mouseRight+1
-_mse_initend:
-       lda     #0
-       tax
-; --------------------------------------------------------------------------
-;
-; void mouse_done (void);
-;
-_mouse_done:
-       rts
-
-; --------------------------------------------------------------------------
-;
-; void mouse_hide (void);
-;
-
-_mouse_hide = MouseOff
-
-; --------------------------------------------------------------------------
-;
-; void mouse_show (void);
-;
-
-_mouse_show = MouseUp
-
-; --------------------------------------------------------------------------
-;
-; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy);
-;
-
-_mouse_box:
-       ldy     #0                      ; Stack offset
-
-       sta     mouseBottom
-
-       lda     (sp),y
-       sta     mouseRight
-       iny
-       lda     (sp),y
-       sta     mouseRight+1            ; maxx
-
-       iny
-       lda     (sp),y
-       sta     mouseTop
-       iny                             ; Skip high byte
-
-       iny
-       lda     (sp),y
-       sta     mouseLeft
-       iny
-       lda     (sp),y
-       sta     mouseLeft+1             ; minx
-
-       jmp     addysp1                 ; Drop params, return
-
-; --------------------------------------------------------------------------
-;
-; void __fastcall__ mouse_pos (struct mouse_pos* pos);
-; /* Return the current mouse position */
-;
-
-_mouse_pos:
-               sta     ptr1
-       stx     ptr1+1                  ; Remember the argument pointer
-
-       ldy     #0                      ; Structure offset
-
-        php
-        sei                            ; Disable interrupts
-
-               lda     mouseXPos               ; Transfer the position
-       sta     (ptr1),y
-       lda     mouseXPos+1
-       iny
-       sta     (ptr1),y
-       lda     mouseYPos
-       iny
-       sta     (ptr1),y
-       lda     #$00
-       iny
-       sta     (ptr1),y
-
-       plp                             ; Reenable interrupts
-       rts                             ; Done
-
-; --------------------------------------------------------------------------
-;
-; void __fastcall__ mouse_info (struct mouse_info* info);
-; /* Return the state of the mouse buttons and the position of the mouse */
-;
-
-_mouse_info:
-
-; We're cheating here to keep the code smaller: The first fields of the
-; mouse_info struct are identical to the mouse_pos struct, so we will just
-; call _mouse_pos to initialize the struct pointer and fill the position
-; fields.
-
-        jsr    _mouse_pos
-
-; Fill in the button state
-
-       jsr     _mouse_buttons          ; Will not touch ptr1
-       iny
-       sta     (ptr1),y
-
-       rts
-
-; --------------------------------------------------------------------------
-;
-; void __fastcall__ mouse_move (int x, int y);
-;
-
-_mouse_move:
-       jsr     popsreg                 ; Get X
-        php
-        sei                            ; Disable interrupts
-       sta     mouseYPos
-       lda     sreg
-       ldx     sreg+1
-       sta     mouseXPos
-       stx     mouseXPos+1
-       plp                             ; Enable interrupts
-       rts
-
-; --------------------------------------------------------------------------
-;
-; unsigned char mouse_buttons (void);
-;
-
-_mouse_buttons:
-       ldx     #0
-       lda     pressFlag
-       and     #SET_MOUSE
-       lsr
-       rts
-