From: cuz Date: Mon, 29 Mar 2004 17:27:48 +0000 (+0000) Subject: Loadable mouse driver for the C128 X-Git-Tag: V2.12.0~859 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e4de88958e5ba4b306814bbab1d88a9fd3a9616e;p=cc65 Loadable mouse driver for the C128 git-svn-id: svn://svn.cc65.org/cc65/trunk@2966 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/Makefile b/libsrc/Makefile index bd694ec89..cd86484f7 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -163,7 +163,7 @@ c64lib: # C128 c128lib: - for i in c128 cbm common runtime conio dbg em joystick serial tgi zlib; do \ + for i in c128 cbm common runtime conio dbg em joystick mouse serial tgi zlib; do \ AS=$(AS) \ CC=$(CC) \ LD=$(LD) \ @@ -175,10 +175,11 @@ c128lib: mv c128/crt0.o c128.o cp c128/*.emd . cp c128/*.joy . + cp c128/*.mou . cp c128/*.ser . cp c128/c128-640-200-2.tgi c128-vdc.tgi cp c128/c128-640-480-2.tgi c128-vdc2.tgi - + #----------------------------------------------------------------------------- # Commdore P500 / CBM 5x0 diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index 46dd381b4..0cbb8ad8c 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -20,6 +20,9 @@ %.joy: %.o ../runtime/zeropage.o @$(LD) -t module -o $@ $^ +%.mou: %.o ../runtime/zeropage.o + @$(LD) -t module -o $@ $^ + %.ser: %.o ../runtime/zeropage.o @$(LD) -t module -o $@ $^ @@ -44,7 +47,7 @@ OBJS = _scrsize.o \ kbhit.o \ kernal.o \ mainargs.o \ - mouse.o \ + mcbdefault.o \ randomize.o \ revers.o \ slow.o \ @@ -59,6 +62,8 @@ EMDS = c128-georam.emd c128-ram.emd c128-ramcart.emd c128-reu.emd c128-vdc.emd JOYS = c128-ptvjoy.joy c128-stdjoy.joy +MOUS = c128-1351.mou + SERS = c128-swlink.ser TGIS = c128-640-200-2.tgi c128-640-480-2.tgi @@ -68,16 +73,16 @@ TGIS = c128-640-200-2.tgi c128-640-480-2.tgi .PHONY: all clean zap -all: $(OBJS) $(EMDS) $(JOYS) $(SERS) $(TGIS) +all: $(OBJS) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS) ../runtime/zeropage.o: $(MAKE) -C $(dir $@) $(notdir $@) clean: - @$(RM) $(OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o) + @$(RM) $(OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(MOUS:.mou=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o) zap: clean - @$(RM) $(EMDS) $(JOYS) $(SERS) $(TGIS) + @$(RM) $(EMDS) $(JOYS) $(MOUS) $(SERS) $(TGIS) diff --git a/libsrc/c128/c128-1351.s b/libsrc/c128/c128-1351.s new file mode 100644 index 000000000..afb451eb8 --- /dev/null +++ b/libsrc/c128/c128-1351.s @@ -0,0 +1,402 @@ +; +; Driver for the 1351 proportional mouse. Parts of the code are from +; the Commodore 1351 mouse users guide. +; +; Ullrich von Bassewitz, 2003-12-29 +; + + .include "zeropage.inc" + .include "mouse-kernel.inc" + .include "c128.inc" + + .macpack generic + +; ------------------------------------------------------------------------ +; Header. Includes jump table + +.segment "JUMPTABLE" + +HEADER: + +; Driver signature + + .byte $6d, $6f, $75 ; "mou" + .byte MOUSE_API_VERSION ; Mouse driver API version number + +; Jump table. + + .addr INSTALL + .addr UNINSTALL + .addr HIDE + .addr SHOW + .addr BOX + .addr MOVE + .addr BUTTONS + .addr POS + .addr INFO + .addr IOCTL + .addr IRQ + +; Callback table, set by the kernel before INSTALL is called + +CHIDE: jmp $0000 ; Hide the cursor +CSHOW: jmp $0000 ; Show the cursor +CMOVEX: jmp $0000 ; Move the cursor to X coord +CMOVEY: jmp $0000 ; Move the cursor to Y coord + + +;---------------------------------------------------------------------------- +; Constants + +SCREEN_HEIGHT = 200 +SCREEN_WIDTH = 320 + +;---------------------------------------------------------------------------- +; Global variables. The bounding box values are sorted so that they can be +; written with the least effort in the BOX routine, so don't reorder them. + +.bss + +Vars: +OldPotX: .res 1 ; Old hw counter values +OldPotY: .res 1 + +YPos: .res 2 ; Current mouse position, Y +XPos: .res 2 ; Current mouse position, X +YMax: .res 2 ; Y2 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMin: .res 2 ; X1 value of bounding box + +OldValue: .res 1 ; Temp for MoveCheck routine +NewValue: .res 1 ; Temp for MoveCheck routine + +; Default values for above variables + +.rodata + +.proc DefVars + .byte 0, 0 ; OldPotX/OldPotY + .word SCREEN_HEIGHT/2 ; YPos + .word SCREEN_WIDTH/2 ; XPos + .word SCREEN_HEIGHT ; YMax + .word SCREEN_WIDTH ; XMax + .word 0 ; YMin + .word 0 ; XMin +.endproc + +.code + +;---------------------------------------------------------------------------- +; INSTALL routine. Is called after the driver is loaded into memory. If +; possible, check if the hardware is present. +; Must return an MOUSE_ERR_xx code in a/x. + +INSTALL: + +; Initialize variables. Just copy the default stuff over + + ldx #.sizeof(DefVars)-1 +@L1: lda DefVars,x + sta Vars,x + dex + bpl @L1 + +; Be sure the mouse cursor is invisible and at the default location. We +; need to do that here, because our mouse interrupt handler doesn't set the +; mouse position if it hasn't changed. + + sei + jsr CHIDE + lda XPos + ldx XPos+1 + jsr CMOVEX + lda YPos + ldx YPos+1 + jsr CMOVEY + cli + +; Done, return zero (= MOUSE_ERR_OK) + + ldx #$00 + txa + rts ; Run into UNINSTALL instead + +;---------------------------------------------------------------------------- +; UNINSTALL routine. Is called before the driver is removed from memory. +; No return code required (the driver is removed from memory on return). + +UNINSTALL = HIDE ; Hide cursor on exit + +;---------------------------------------------------------------------------- +; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages +; a counter for calls to show/hide, and the driver entry point is only called +; if the mouse is currently visible and should get hidden. For most drivers, +; no special action is required besides hiding the mouse cursor. +; No return code required. + +HIDE: sei + jsr CHIDE + cli + rts + +;---------------------------------------------------------------------------- +; SHOW routine. Is called to show the mouse pointer. The mouse kernel manages +; a counter for calls to show/hide, and the driver entry point is only called +; if the mouse is currently hidden and should become visible. For most drivers, +; no special action is required besides enabling the mouse cursor. +; No return code required. + +SHOW: sei + jsr CSHOW + cli + rts + +;---------------------------------------------------------------------------- +; BOX: Set the mouse bounding box. The parameters are passed as they come from +; the C program, that is, maxy in a/x and the other parameters on the stack. +; The C wrapper will remove the parameters from the stack when the driver +; routine returns. +; No checks are done if the mouse is currently inside the box, this is the job +; of the caller. It is not necessary to validate the parameters, trust the +; caller and save some code here. No return code required. + +BOX: ldy #5 + sei + sta YMax + stx YMax+1 + +@L1: lda (sp),y + sta XMax,y + dey + bpl @L1 + + cli + rts + +;---------------------------------------------------------------------------- +; MOVE: Move the mouse to a new position. The position is passed as it comes +; from the C program, that is: X on the stack and Y in a/x. The C wrapper will +; remove the parameter from the stack on return. +; No checks are done if the new position is valid (within the bounding box or +; the screen). No return code required. +; + +MOVE: sei ; No interrupts + + sta YPos + stx YPos+1 ; New Y position + jsr CMOVEY ; Set it + + ldy #$01 + lda (sp),y + sta XPos+1 + tax + dey + lda (sp),y + sta XPos ; New X position + + jsr CMOVEX ; Move the cursor + + cli ; Allow interrupts + rts + +;---------------------------------------------------------------------------- +; BUTTONS: Return the button mask in a/x. + +BUTTONS: + lda #$7F + sei + sta CIA1_PRA + lda CIA1_PRB ; Read joystick #0 + cli + ldx #0 + and #$1F + eor #$1F + rts + +;---------------------------------------------------------------------------- +; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. +; No return code required. + +POS: ldy #MOUSE_POS::XCOORD ; Structure offset + + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 + iny + sta (ptr1),y + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts + + iny + sta (ptr1),y ; Store last byte + + rts ; Done + +;---------------------------------------------------------------------------- +; INFO: Returns mouse position and current button mask in the MOUSE_INFO +; struct pointed to by ptr1. No return code required. +; +; 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. + +INFO: jsr POS + +; Fill in the button state + + jsr BUTTONS ; Will not touch ptr1 + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y + + rts + +;---------------------------------------------------------------------------- +; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl +; specific data in ptr1, and the ioctl code in A. +; Must return an error code in a/x. +; + +IOCTL: lda #MOUSE_ERR_INV_IOCTL + rts + +;---------------------------------------------------------------------------- +; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context +; (so be careful). +; + +IRQ: lda SID_ADConv1 ; Get mouse X movement + ldy OldPotX + jsr MoveCheck ; Calculate movement vector + sty OldPotX + +; Skip processing if nothing has changed + + bcc @SkipX + +; Calculate the new X coordinate (--> a/y) + + add XPos + tay ; Remember low byte + txa + adc XPos+1 + tax + +; Limit the X coordinate to the bounding box + + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa + + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 + +; Move the mouse pointer to the new X pos + + tya + jsr CMOVEX + +; Calculate the Y movement vector + +@SkipX: lda SID_ADConv2 ; Get mouse Y movement + ldy OldPotY + jsr MoveCheck ; Calculate movement + sty OldPotY + +; Skip processing if nothing has changed + + bcc @SkipY + +; Calculate the new Y coordinate (--> a/y) + + sta OldValue + lda YPos + sub OldValue + tay + stx OldValue + lda YPos+1 + sbc OldValue + tax + +; Limit the Y coordinate to the bounding box + + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa + + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 + +; Move the mouse pointer to the new X pos + + tya + jmp CMOVEY + +; Done + +@SkipY: rts + +; -------------------------------------------------------------------------- +; +; Move check routine, called for both coordinates. +; +; Entry: y = old value of pot register +; a = current value of pot register +; Exit: y = value to use for old value +; x/a = delta value for position +; + +MoveCheck: + sty OldValue + sta NewValue + ldx #$00 + + sub OldValue ; a = mod64 (new - old) + and #%01111111 + cmp #%01000000 ; if (a > 0) + bcs @L1 ; + lsr a ; a /= 2; + beq @L2 ; if (a != 0) + ldy NewValue ; y = NewValue + sec + rts ; return + +@L1: ora #%11000000 ; else or in high order bits + cmp #$FF ; if (a != -1) + beq @L2 + sec + ror a ; a /= 2 + dex ; high byte = -1 (X = $FF) + ldy NewValue + sec + rts + +@L2: txa ; A = $00 + clc + rts + diff --git a/libsrc/c128/mcbdefault.s b/libsrc/c128/mcbdefault.s new file mode 100644 index 000000000..d5a91f923 --- /dev/null +++ b/libsrc/c128/mcbdefault.s @@ -0,0 +1,109 @@ +; +; Default mouse callbacks for the C64 +; +; Ullrich von Bassewitz, 2004-03-20 +; +; All functions in this module should be interrupt safe, because they may +; be called from an interrupt handler +; + + .export _mouse_def_callbacks + + .include "mouse-kernel.inc" + .include "c128.inc" + + .macpack generic + +; Sprite definitions. The first value can be changed to adjust the number +; of the sprite used for the mouse. +MOUSE_SPR = 0 ; Sprite used for the mouse +MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask +MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask +VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register +VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register + +.code + +; -------------------------------------------------------------------------- +; Hide the mouse pointer. Always called with interrupts disabled. + +.proc hide + + lda #MOUSE_SPR_NMASK + and VIC_SPR_ENA + sta VIC_SPR_ENA + rts + +.endproc + +; -------------------------------------------------------------------------- +; Show the mouse pointer. Always called with interrupts disabled. + +.proc show + + lda #MOUSE_SPR_MASK + ora VIC_SPR_ENA + sta VIC_SPR_ENA + rts + +.endproc + +; -------------------------------------------------------------------------- +; Move the mouse pointer X position to the value in a/x. Always called with +; interrupts disabled. + +.proc movex + +; Add the X correction and set the low byte. This frees A. + + add #24 ; X correction + sta VIC_SPR_X + +; Set the high byte + + txa + adc #0 + bne @L1 ; Branch if high byte not zero + lda VIC_SPR_HI_X ; Get high X bits of all sprites + and #MOUSE_SPR_NMASK ; Clear high bit for sprite + sta VIC_SPR_HI_X + rts + +@L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites + ora #MOUSE_SPR_MASK ; Set high bit for sprite + sta VIC_SPR_HI_X + rts + +.endproc + +; -------------------------------------------------------------------------- +; Move the mouse pointer Y position to the value in a/x. Always called with +; interrupts disabled. + +.proc movey + + clc + ldx PALFLAG + bne @L1 + adc #50 ; FIXME: Should be NTSC, is PAL value + sta VIC_SPR_Y ; Set Y position + rts + +@L1: adc #50 ; Add PAL correction + sta VIC_SPR_Y ; Set Y position + rts + +.endproc + +; -------------------------------------------------------------------------- +; Callback structure + +.rodata + +_mouse_def_callbacks: + .addr hide + .addr show + .addr movex + .addr movey + + diff --git a/libsrc/c128/mouse.s b/libsrc/c128/mouse.s deleted file mode 100644 index a1871e462..000000000 --- a/libsrc/c128/mouse.s +++ /dev/null @@ -1,495 +0,0 @@ -; -; Ullrich von Bassewitz, 24.04.1999 -; -; Routines for the 1351 proportional mouse. Parts of the code are from -; the Commodore 1351 mouse users guide. -; - - .export _mouse_init, _mouse_done - .export _mouse_hide, _mouse_show - .export _mouse_box, _mouse_info - .export _mouse_move, _mouse_pos - .export _mouse_buttons, _mouse_info - .condes MouseIRQ, 2 - - .import popax, addysp1 - .importzp ptr1, sp - - .include "c128.inc" - - .macpack generic - - -.code - -; -------------------------------------------------------------------------- -; -; Constants -; - -SPRITE_HEIGHT = 21 -SPRITE_WIDTH = 24 -SCREEN_HEIGHT = 200 -SCREEN_WIDTH = 320 -XCORR = SPRITE_WIDTH - -; -------------------------------------------------------------------------- -; -; unsigned char __fastcall__ mouse_init (unsigned char type); -; - -.proc _mouse_init - lda Initialized ; Already initialized? - bne AlreadyInitialized ; Jump if yes - -; Initialize variables - - ldx #0 - lda #XCORR - sta XPos - stx XPos+1 - stx YPos - stx YPos+1 - stx OldPotX - stx OldPotY - stx XMin - stx XMin+1 ; XMin = 0 - lda #50 ; ## FIXME: This is the PAL value - sta YCorr - sta YPos - stx YPos+1 - sec - sbc #SPRITE_HEIGHT ; Sprite height in pixels - sta YMin - stx YMin+1 ; YMin = 29 - lda #SCREEN_HEIGHT ; Vertical screen res - add YCorr ; Add correction factor - sta YMax - stx YMax+1 - inx ; X = 1 - stx Invisible ; Mouse *not* visible - lda #<(SCREEN_WIDTH + SPRITE_WIDTH) - sta XMax - stx XMax+1 ; XMax = 320 + sprite width - -; Save the old init status and reset bit 0. This will disable the BASIC -; IRQ handler which will otherwise try to manage the mouse sprite on its -; own - - lda INIT_STATUS - sta OldInitStatus - and #$FE - sta INIT_STATUS - -; Mouse successfully initialized - - lda #1 - sta Initialized - rts - -AlreadyInitialized: - lda #0 ; Error - rts - -.endproc - -; -------------------------------------------------------------------------- -; -; void mouse_done (void); -; - -_mouse_done: - lda Initialized ; Initialized? - beq mddone ; Jump if no - lda #0 - sta Initialized ; Reset the initialized flag - lda OldInitStatus ; Load the old BASIC int bit - and #$01 ; Mask it - ora INIT_STATUS ; Restore the old state - sta INIT_STATUS - -; Disable the mouse sprite - -DisableSprite: - lda #$FE ; Clear bit for sprite #0 - sei ; Disable interrupts - and VIC_SPR_ENA - sta VIC_SPR_ENA ; Disable sprite - cli ; Enable interrupts -mddone: rts - - -; -------------------------------------------------------------------------- -; -; void mouse_hide (void); -; - -.proc _mouse_hide - - lda Invisible ; Get the flag - bne @L1 ; Jump if already invisible - jsr DisableSprite ; Disable the mouse sprite -@L1: inc Invisible ; Set the flag to invisible - rts - -.endproc - -; -------------------------------------------------------------------------- -; -; void mouse_show (void); -; - -.proc _mouse_show - - lda Invisible ; Mouse invisible? - beq @L1 ; Jump if no - dec Invisible ; Set the flag - bne @L1 ; Jump if still invisible - - sei ; Disable interrupts - jsr MoveSprite1 ; Move the sprite to it's position - lda VIC_SPR_ENA ; Get sprite enable register - ora #$01 ; Enable sprite #0 - sta VIC_SPR_ENA ; Write back - cli ; Enable interrupts - -@L1: rts - -.endproc - -; -------------------------------------------------------------------------- -; -; void __fastcall__ mouse_box (int minx, int miny, int maxx, int maxy); -; - -.proc _mouse_box - - ldy #0 ; Stack offset - - add YCorr ; Adjust the Y value - bcc @L1 - inx - clc -@L1: sei ; Disable interrupts - - sta YMax - stx YMax+1 ; maxy - - lda (sp),y - adc #XCORR - sta XMax - iny - lda (sp),y - adc #$00 - sta XMax+1 ; maxx - - iny - lda (sp),y - add YCorr - sta YMin - iny - lda (sp),y - adc #$00 - sta YMin+1 ; miny - - iny - lda (sp),y - add #XCORR - sta XMin - iny - lda (sp),y - adc #$00 - sta XMin+1 ; minx - - cli ; Enable interrupts - - jmp addysp1 ; Drop params, return - -.endproc - -; -------------------------------------------------------------------------- -; -; void __fastcall__ mouse_pos (struct mouse_pos* pos); -; /* Return the current mouse position */ -; - -.proc _mouse_pos - - sta ptr1 - stx ptr1+1 ; Remember the argument pointer - - ldy #0 ; Structure offset - sec ; Needed for the SBC later - - sei ; Disable interrupts - lda XPos ; Transfer the position - sbc #XCORR - sta (ptr1),y - lda XPos+1 - sbc #$00 - iny - sta (ptr1),y - lda YPos - ldx YPos+1 - cli ; Restore initial interrupt state - - sub YCorr ; Apply the Y correction value - bcs @L1 - dex -@L1: iny - sta (ptr1),y ; Store YPos - txa - iny - sta (ptr1),y - - rts ; Done - -.endproc - -; -------------------------------------------------------------------------- -; -; void __fastcall__ mouse_info (struct mouse_info* info); -; /* Return the state of the mouse buttons and the position of the mouse */ -; - -.proc _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 - ldy #4 - sta (ptr1),y - - rts - -.endproc - -; -------------------------------------------------------------------------- -; -; void __fastcall__ mouse_move (int x, int y); -; - -.proc _mouse_move - - add YCorr ; Add Y coordinate correction - bcc @L1 - inx - clc -@L1: sei - sta YPos - stx YPos+1 - cli - - jsr popax ; Get X - adc #XCORR ; Adjust X coordinate - bcc @L2 - inx -@L2: sei - sta XPos - stx XPos+1 ; Set new position - jsr MoveSprite ; Move the sprite to the mouse pos - cli ; Enable interrupts - - rts - -.endproc - -; -------------------------------------------------------------------------- -; -; unsigned char mouse_buttons (void); -; - -.proc _mouse_buttons - - lda #$7F - sei - sta CIA1_PRA - lda CIA1_PRB ; Read joystick #0 - cli - ldx #0 - and #$1F - eor #$1F - rts - -.endproc - -; -------------------------------------------------------------------------- -; -; Mouse interrupt handler -; - -IRQDone:rts - -MouseIRQ: - - lda Initialized ; Mouse initialized? - beq IRQDone ; Jump if no - lda SID_ADConv1 ; Get mouse X movement - ldy OldPotX - jsr MoveCheck ; Calculate movement vector - sty OldPotX - -; Calculate the new X coordinate (--> a/y) - - add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax - -; Limit the X coordinate to the bounding box - - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa - - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 - -; Calculate the Y movement vector - - lda SID_ADConv2 ; Get mouse Y movement - ldy OldPotY - jsr MoveCheck ; Calculate movement - sty OldPotY - -; Calculate the new Y coordinate (--> a/y) - - sta OldValue - lda YPos - sub OldValue - tay - stx OldValue - lda YPos+1 - sbc OldValue - tax - - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa - - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 - -; Move the mouse sprite to the current mouse position. Must be called -; with interrupts off. MoveSprite1 is an entry without checking. - -MoveSprite: - - lda Invisible ; Mouse visible? - bne Done ; Jump if no - -; Set the high X bit - -MoveSprite1: - lda VIC_SPR_HI_X ; Get high X bits of all sprites - and #$FE ; Clear bit for sprite #0 - ldy XPos+1 ; Test Y position - beq @L5 - ora #$01 ; Set high X bit -@L5: sta VIC_SPR_HI_X ; Set hi X sprite values - -; Set the low X byte - - lda XPos - sta VIC_SPR0_X ; Set low byte - -; Set the Y position - - ldy YPos+1 ; Negative or too large? - bne Done ; Jump if yes - lda YPos - sta VIC_SPR0_Y ; Set Y position - -; Done - -Done: rts - -; -------------------------------------------------------------------------- -; -; Move check routine, called for both coordinates. -; -; Entry: y = old value of pot register -; a = current value of pot register -; Exit: y = value to use for old value -; x/a = delta value for position -; - -.proc MoveCheck - - sty OldValue - sta NewValue - ldx #$00 - - sub OldValue ; a = mod64 (new - old) - and #%01111111 - cmp #%01000000 ; if (a > 0) - bcs @L1 ; - lsr a ; a /= 2; - beq @L2 ; if (a != 0) - ldy NewValue ; y = NewValue - rts ; return - -@L1: ora #%11000000 ; else or in high order bits - cmp #$FF ; if (a != -1) - beq @L2 - sec - ror a ; a /= 2 - dex ; high byte = -1 (X = $FF) - ldy NewValue - rts - -@L2: txa ; A = $00 - rts - -.endproc - -; -------------------------------------------------------------------------- -; Data - -.bss - -Initialized: .res 1 ; True if mouse initialized -OldInitStatus: .res 1 ; Old IRQ flag value -OldValue: .res 1 ; Temp for MoveCheck routine -NewValue: .res 1 ; Temp for MoveCheck routine -YCorr: .res 1 ; Correction for Y coordinate - -Invisible: .res 1 ; Is the mouse invisible? -OldPotX: .res 1 ; Old hw counter values -OldPotY: .res 1 - -XPos: .res 2 ; Current mouse position, X -YPos: .res 2 ; Current mouse position, Y - -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box - - diff --git a/packages/rpm/redhat/cc65.spec b/packages/rpm/redhat/cc65.spec index 220fb59c9..5cd963bd8 100644 --- a/packages/rpm/redhat/cc65.spec +++ b/packages/rpm/redhat/cc65.spec @@ -103,7 +103,7 @@ Requires: %{name} = %{version} Copyright: Freeware Summary: Apple ][ specific libraries and headers for the cc65 compiler. Group: Development/Languages - + %description apple2 This package contains the header files and libraries needed to write programs for the Apple ][ using the cc65 crosscompiler. @@ -200,6 +200,7 @@ programs for the Commodore C128 using the cc65 crosscompiler. %attr(644,root,root) /usr/lib/cc65/lib/c128.o %attr(644,root,root) /usr/lib/cc65/emd/c128-*.emd %attr(644,root,root) /usr/lib/cc65/joy/c128-*.joy +%attr(644,root,root) /usr/lib/cc65/mou/c128-*.mou %attr(644,root,root) /usr/lib/cc65/ser/c128-*.ser %attr(644,root,root) /usr/lib/cc65/tgi/c128-*.tgi @@ -291,7 +292,7 @@ This package contains the header files and libraries needed to write programs for the Commodore PET-II (CBM600/700) family of computers using the cc65 crosscompiler. -%files cbm610 +%files cbm610 %attr(644,root,root) /usr/lib/cc65/lib/cbm610.lib %attr(644,root,root) /usr/lib/cc65/lib/cbm610.o %attr(644,root,root) /usr/lib/cc65/emd/cbm610-*.emd