From 823329443f35f0beeaa6a7537ca3f9571345cbbc Mon Sep 17 00:00:00 2001 From: izydorst Date: Tue, 3 Jul 2001 20:24:28 +0000 Subject: [PATCH] added dio interface, standard mouse and joystick functions, osmaperrno git-svn-id: svn://svn.cc65.org/cc65/trunk@773 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/Makefile | 1 + libsrc/geos/Makefile | 9 +- libsrc/geos/devel/Makefile | 2 +- libsrc/geos/devel/oserror.s | 86 ++++++++++++++ libsrc/geos/disk/Makefile | 3 +- libsrc/geos/disk/dio_cts.s | 188 ++++++++++++++++++++++++++++++ libsrc/geos/disk/dio_openclose.s | 84 +++++++++++++ libsrc/geos/disk/dio_params.s | 32 +++++ libsrc/geos/disk/dio_read.s | 25 ++++ libsrc/geos/disk/dio_stc.s | 180 ++++++++++++++++++++++++++++ libsrc/geos/disk/dio_write.s | 25 ++++ libsrc/geos/disk/dio_writev.s | 25 ++++ libsrc/geos/inc/dio.inc | 19 +++ libsrc/geos/mousesprite/Makefile | 3 +- libsrc/geos/mousesprite/mouse.s | 160 +++++++++++++++++++++++++ libsrc/geos/mousesprite/readjoy.s | 40 +++++++ 16 files changed, 871 insertions(+), 11 deletions(-) create mode 100644 libsrc/geos/devel/oserror.s create mode 100644 libsrc/geos/disk/dio_cts.s create mode 100644 libsrc/geos/disk/dio_openclose.s create mode 100644 libsrc/geos/disk/dio_params.s create mode 100644 libsrc/geos/disk/dio_read.s create mode 100644 libsrc/geos/disk/dio_stc.s create mode 100644 libsrc/geos/disk/dio_write.s create mode 100644 libsrc/geos/disk/dio_writev.s create mode 100644 libsrc/geos/inc/dio.inc create mode 100644 libsrc/geos/mousesprite/mouse.s create mode 100644 libsrc/geos/mousesprite/readjoy.s diff --git a/libsrc/Makefile b/libsrc/Makefile index 4636e8c13..8b3b0592a 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -114,6 +114,7 @@ geoslib: for i in geos common runtime; do \ CC=$(CC) \ AS=$(AS) \ + AR=$(AR) \ CFLAGS="-Osir -g -t geos -I../../include" \ AFLAGS="-t geos" \ $(MAKE) -C $$i || exit 1; \ diff --git a/libsrc/geos/Makefile b/libsrc/geos/Makefile index 30b48a2f2..acf28e5c4 100644 --- a/libsrc/geos/Makefile +++ b/libsrc/geos/Makefile @@ -2,14 +2,7 @@ # Makefile for GEOS lib # for cc65 # -# Maciej 'YTM/Alliance' Witkowiak - -export CC = ../../../src/cc65 -export CFLAGS = -O -export AS = ../../../src/ca65/ca65 -export ASFLAGS = -AR = ../../src/ar65/ar65 - +# Maciej 'YTM/Elysium' Witkowiak OBJ_DIRS=disk dlgbox file graph menuicon memory mousesprite process system diff --git a/libsrc/geos/devel/Makefile b/libsrc/geos/devel/Makefile index ef41ffbcb..62fb3c53c 100644 --- a/libsrc/geos/devel/Makefile +++ b/libsrc/geos/devel/Makefile @@ -8,7 +8,7 @@ @$(AS) -o $@ $(AFLAGS) $< -S_OBJS = crt0.o +S_OBJS = crt0.o oserror.o all: $(S_OBJS) diff --git a/libsrc/geos/devel/oserror.s b/libsrc/geos/devel/oserror.s new file mode 100644 index 000000000..48ed39317 --- /dev/null +++ b/libsrc/geos/devel/oserror.s @@ -0,0 +1,86 @@ +; +; Ullrich von Bassewitz, 17.05.2000 +; GEOS port: Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; int __fastcall__ _osmaperrno (unsigned char oserror); +; /* Map a system specific error into a system independent code */ +; + + .export __osmaperrno + .include "../../common/errno.inc" + .include "../inc/const.inc" + +.code + +__osmaperrno: + ldx #ErrTabSize +@L1: cmp ErrTab-2,x ; Search for the error code + beq @L2 ; Jump if found + dex + dex + bne @L1 ; Next entry + +; Code not found, return EINVAL + + lda #EINVAL + rts + +; Found the code + +@L2: lda ErrTab-1,x + ldx #$00 ; High byte always zero + rts + +.rodata + +ErrTab: + .byte NO_BLOCKS, EINVAL ; ??? + .byte INV_TRACK, EINVAL ; invalid track§or pair + .byte INSUFF_SPACE, ENOSPC ; out of space + .byte FULL_DIRECTORY, ENOSPC ; directory is full + .byte FILE_NOT_FOUND, ENOENT ; file not found + .byte BAD_BAM, EIO ; bam inconsistent + .byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening + .byte INV_RECORD, EINVAL ; using >128 VLIR record number + .byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record + .byte STRUCT_MISMAT, EINVAL ; ??? + .byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file + .byte CANCEL_ERR, EIO ; ??? + .byte DEV_NOT_FOUND, ENODEV ; device not found + .byte INCOMPATIBLE, EINVAL ; ??? + +; .byte 20, ; Read error +; .byte 21, ; Read error +; .byte 22, ; Read error +; .byte 23, ; Read error +; .byte 24, ; Read error +; .byte 25, ; Write error + .byte 26, EACCES ; Write protect on +; .byte 27, ; Read error +; .byte 28, ; Write error +; .byte 29, ; Disk ID mismatch +; .byte 30, ; Syntax error +; .byte 31, ; Syntax error +; .byte 32, ; Syntax error + .byte 33, EINVAL ; Syntax error (invalid file name) + .byte 34, EINVAL ; Syntax error (no file given) +; .byte 39, ; Syntax error +; .byte 50, ; Record not present +; .byte 51, ; Overflow in record +; .byte 52, ; File too large + .byte 60, EINVAL ; Write file open + .byte 61, EINVAL ; File not open + .byte 62, ENOENT ; File not found + .byte 63, EEXIST ; File exists + .byte 64, EINVAL ; File type mismatch +; .byte 65, ; No block +; .byte 66, ; Illegal track or sector +; .byte 67, ; Illegal system track or sector + .byte 70, EBUSY ; No channel +; .byte 71, ; Directory error +; .byte 72, ; Disk full +; .byte 73, ; DOS version mismatch + +ErrTabSize = (* - ErrTab) diff --git a/libsrc/geos/disk/Makefile b/libsrc/geos/disk/Makefile index 0ec9ac8ea..da38f9a30 100644 --- a/libsrc/geos/disk/Makefile +++ b/libsrc/geos/disk/Makefile @@ -11,7 +11,8 @@ S_OBJS = blkalloc.o calcblksfree.o changediskdevice.o chkdkgeos.o enterturbo.o e findbambit.o freeblock.o getblock.o getdirhead.o getptrcurdknm.o newdisk.o\ nxtblkalloc.o opendisk.o purgeturbo.o putblock.o putdirhead.o readblock.o\ readbuff.o setnextfree.o setgeosdisk.o writeblock.o writebuff.o verwriteblock.o\ - gettrse.o + gettrse.o\ + dio_openclose.o dio_cts.o dio_stc.o dio_read.o dio_write.o dio_writev.o all: $(S_OBJS) diff --git a/libsrc/geos/disk/dio_cts.s b/libsrc/geos/disk/dio_cts.s new file mode 100644 index 000000000..38f924573 --- /dev/null +++ b/libsrc/geos/disk/dio_cts.s @@ -0,0 +1,188 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; +; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle, +; dio_phys_pos *physpos, /* input */ +; sectnum_t *sectnum); /* output */ +; +; dhandle_t - 16bit (ptr) +; sectnum_t - 16bit +; + + .export _dio_phys_to_log + .export sectab_1541_l, sectab_1541_h ; for log_to_phys + .import popax,__oserror + .importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4 + .include "../inc/dio.inc" + .include "../inc/geossym.inc" + .include "../inc/const.inc" + +.proc _dio_phys_to_log + sta ptr1 + stx ptr1+1 ; pointer to result + + jsr popax + sta ptr2 + stx ptr2+1 ; pointer to input structure + + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle + + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid + + + ldy #diopp_head + bne _inv_data ; there is only head 0 + ldy #diopp_track + lda (ptr2),y + beq _inv_data ; there is no track 0 + sta tmp1 + iny + lda (ptr2),y + bne _inv_data ; there are no more than 256 tracks + dec tmp1 ; normalize track to start from 0 + ldy #diopp_sector + lda (ptr2),y + sta tmp2 + iny + lda (ptr2),y + bne _inv_data ; there are no more than 256 sectors + +; tmp1 (int) holds track+sector, translate it using device info + + ldy #sst_driveno + lda (ptr3),y + tay + lda driveType,y + and #%00000011 ; this is for RamDrive compatibility + cmp #DRV_1541 + beq dio_cts1541 + cmp #DRV_1571 + beq dio_cts1571 + cmp #DRV_1581 + beq dio_cts1581 + +; unknown device, return what you have got + +dio_ctsend: + ldy #1 + lda tmp2 + sta (ptr1),y + dey + lda tmp1 + sta (ptr1),y + + ldx #0 + txa +ret: + sta __oserror + rts ; return success + +; errors + +_inv_data: + lda #INV_TRACK + .byte $2c +_inv_hand: + lda #INCOMPATIBLE + ldx #0 + beq ret + +; device-depended stuff, tmp1=track-1, tmp2=sector + +dio_cts1541: + ldy tmp1 + cpy #35 + bcs _inv_data + lda sectab_1541_l,y + clc + adc tmp2 + sta tmp1 + lda sectab_1541_h,y + adc #0 + sta tmp2 + jmp dio_ctsend + +dio_cts1571: + lda tmp1 + cmp #70 + bcs _inv_data + cmp #35 ; last track of one side + bcs _sub35 + jmp dio_cts1541 ; track <=35 - same as 1541 + +_sub35: + sec + sbc #35 + sta tmp1 + jsr dio_cts1541 ; get offset on second side of disk + lda tmp1 ; add second side base + clc + adc #<683 + sta tmp1 + lda tmp2 + adc #>683 + sta tmp2 + jmp dio_ctsend + +dio_cts1581: +; 1581 has 80 tracks, 40 sectors each secnum=track*40+sector + ldx #0 + stx tmp3 + stx tmp4 + lda tmp1 + beq _nomult + cmp #80 + bcs _inv_data + +; mul40 by Christian Groessler + sta tmp4 + asl a + rol tmp3 + asl a + rol tmp3 ; val * 4 + adc tmp4 + bcc L1 + inc tmp3 ; val * 5 +L1: asl a + rol tmp3 ; val * 10 + asl a + rol tmp3 + asl a + rol tmp3 ; val * 40 = AX + ldx tmp3 + sta tmp3 + stx tmp4 + +_nomult: + lda tmp2 + clc + adc tmp3 + sta tmp1 + lda tmp4 + adc #0 + sta tmp2 + jmp dio_ctsend + +.endproc + +.rodata + +sectab_1541_l: + .byte $00, $15, $2a, $3f, $54, $69, $7e, $93 + .byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b + .byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7 + .byte $ea, $fc, $0e, $20, $32, $44, $56, $67 + .byte $78, $89, $9a, $ab +sectab_1541_h: + .byte $00, $00, $00, $00, $00, $00, $00, $00 + .byte $00, $00, $00, $00, $00, $01, $01, $01 + .byte $01, $01, $01, $01, $01, $01, $01, $01 + .byte $01, $01, $02, $02, $02, $02, $02, $02 + .byte $02, $02, $02, $02 diff --git a/libsrc/geos/disk/dio_openclose.s b/libsrc/geos/disk/dio_openclose.s new file mode 100644 index 000000000..8fb859018 --- /dev/null +++ b/libsrc/geos/disk/dio_openclose.s @@ -0,0 +1,84 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; +; based on Atari version by Christian Groessler +; 2.7.2001 +; +; dhandle_t __fastcall__ dio_open (driveid_t drive_id); +; unsigned char __fastcall__ dio_close (dhandle_t handle); +; +; dio_open sets given device as current and initializes disk +; dio_close does nothing special + + .export _dio_open, _dio_close + .import __oserror, _OpenDisk + .importzp ptr1, tmp1 + .include "../inc/dio.inc" + .include "../inc/jumptab.inc" + .include "../inc/geossym.inc" + .include "../inc/const.inc" + +.bss + +sectsizetab: + .res 4 * sst_size ; this is hardcoded + +.code + +.proc _dio_open + pha + tax + lda driveType,x ; check if there's a device + bne _inv_drive + clc + adc #8 ; normalize devnum + sta curDevice + jsr SetDevice + jsr _OpenDisk ; take care for errors there + + pla + tay ; drive # + asl a ; make index from drive id + asl a + tax + + lda #0 + sta sectsizetab+sst_sectsize,x + lda #128 + sta sectsizetab+sst_flag,x ; set flag that drive is "open" + lda #1 + sta sectsizetab+sst_sectsize+1,x + tya + sta sectsizetab+sst_driveno,x + + stx tmp1 + lda #sectsizetab + adc #0 + tax + lda tmp1 + + rts + +_inv_drive: + lda #DEV_NOT_FOUND + sta __oserror + lda #0 + tax + rts + +.endproc + +.proc _dio_close + sta ptr1 + stx ptr1+1 + lda #0 + ldy #sst_flag + sta (ptr1),y + sta __oserror ; success + tax + rts ; return no error +.endproc diff --git a/libsrc/geos/disk/dio_params.s b/libsrc/geos/disk/dio_params.s new file mode 100644 index 000000000..77ba92732 --- /dev/null +++ b/libsrc/geos/disk/dio_params.s @@ -0,0 +1,32 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; this function is used by dio_read and dio_write to fix parameters (secnum) +; + + .import popax,pushax,_dio_log_to_phys + .export dio_params,dio_secnum + .include "../inc/geossym.inc" + +.bss +dio_secnum: .res 2 + +.code +.proc dio_params + + sta r4L + stx r4H + + jsr popax + sta dio_secnum + stx dio_secnum + lda #dio_secnum + jsr pushax + + lda #r1H + jmp _dio_log_to_phys + +.endproc diff --git a/libsrc/geos/disk/dio_read.s b/libsrc/geos/disk/dio_read.s new file mode 100644 index 000000000..757009016 --- /dev/null +++ b/libsrc/geos/disk/dio_read.s @@ -0,0 +1,25 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; this file provides the _dio_read function +; +; unsigned char __fastcall__ dio_read(dhandle_t handle,sectnum_t sect_num,void *buffer); +; dhandle_t - 16bit (ptr) +; sectnum_t - 16bit +; + + .import dio_params + .export _dio_read + .include "../inc/geossym.inc" + .include "../inc/jumptab.inc" + +.proc _dio_read + + jsr dio_params + jsr ReadBlock + stx errno + txa + rts + +.endproc diff --git a/libsrc/geos/disk/dio_stc.s b/libsrc/geos/disk/dio_stc.s new file mode 100644 index 000000000..ea6369fde --- /dev/null +++ b/libsrc/geos/disk/dio_stc.s @@ -0,0 +1,180 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle, +; sectnum_t *sectnum, /* input */ +; dio_phys_pos *physpos); /* output */ +; +; dhandle_t - 16bit (ptr) +; sectnum_t - 16bit +; + + .export _dio_log_to_phys + .importzp ptr1,ptr2,ptr3,tmp1,tmp2 + .import popax,__oserror + .import sectab_1541_l, sectab_1541_h + .include "../inc/dio.inc" + .include "../inc/geossym.inc" + .include "../inc/const.inc" + +.proc _dio_log_to_phys + +; check device type + sta ptr1 + stx ptr1+1 ; pointer to result (struct dio_phys_pos) + + jsr popax + sta ptr2 + stx ptr2+1 ; pointer to input structure (pointer to int) + + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle + + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid + +; fill in all we have + ldy #diopp_head + lda #0 ; head 0 + sta (ptr1),y + ldy #diopp_track+1 + sta (ptr1),y ; track <256 + ldy #diopp_sector+1 + sta (ptr1),y ; sector <256 + + ldy #0 + lda (ptr2),y + sta tmp1 + iny + lda (ptr2),y + sta tmp2 + +; get drive info + ldy #sst_driveno + lda (ptr3),y + tay + lda driveType,y + and #%00000011 ; this is for RamDrive compatibility + cmp #DRV_1541 + beq dio_stc1541 + cmp #DRV_1571 + beq dio_stc1571 + cmp #DRV_1581 + beq dio_stc1581 + +; ... + +dio_stcend: + ldy #diopp_track + lda tmp1 + sta (ptr1),y + ldy #diopp_sector + lda tmp2 + sta (ptr1),y + + ldx #0 + txa +_ret: + sta __oserror + rts ; return success + +; errors +_inv_data: + lda #INV_TRACK + .byte $2c +_inv_hand: + lda #INCOMPATIBLE + ldx #0 + beq _ret + +dio_stc1541: +; if 1541: +; - compare with table to find track +; - subtract and find sector + + ldx #0 ; index=(track-1) +_loop41: + lda tmp2 + cmp sectab_1541_h+1,x + bne _nxt + lda tmp1 + cmp sectab_1541_l+1,x + bcc _found +_nxt: inx + cpx #35 + bne _loop41 + beq _inv_data + +_found: + lda tmp1 + sec + sbc sectab_1541_l,x + sta tmp2 +_fndend: + inx + stx tmp1 + jmp dio_stcend + +dio_stc1571: +; if 1571: +; - check size, if too big - subtract and add 35 to track +; - fall down to 1541 + lda tmp2 + cmp #>683 + bne _cnt71 + lda tmp1 + cmp #<683 + bcc dio_stc1541 + +_cnt71: + lda tmp1 + sec + sbc #<683 + sta tmp1 + lda tmp2 + sbc #>683 + sta tmp2 + jsr dio_stc1541 ; will fall through here + + ldy #diopp_track + lda (ptr1),y + clc + adc #35 + sta (ptr1),y + lda #0 + beq _ret + +; if 1581: +; - subtract 40 in loop (at most 80 times) to find track +; - the remainder is sector +dio_stc1581: + ldx #0 ; index=(track-1) +_loop81: + lda tmp2 + bne _sub81 + lda tmp1 + cmp #40 + bcc _got81 +_sub81: lda tmp1 + sec + sbc #40 + sta tmp1 + lda tmp2 + sbc #0 + sta tmp2 + inx + cpx #81 + bne _loop81 + beq _inv_data + +_got81: lda tmp1 + sta tmp2 + inx + stx tmp1 + jmp dio_stcend + +.endproc diff --git a/libsrc/geos/disk/dio_write.s b/libsrc/geos/disk/dio_write.s new file mode 100644 index 000000000..1a6d679b8 --- /dev/null +++ b/libsrc/geos/disk/dio_write.s @@ -0,0 +1,25 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; this file provides the _dio_write function +; +; unsigned char __fastcall__ dio_write(dhandle_t handle,sectnum_t sect_num,const void *buffer); +; dhandle_t - 16bit (ptr) +; sectnum_t - 16bit +; + + .import dio_params + .export _dio_write + .include "../inc/geossym.inc" + .include "../inc/jumptab.inc" + +.proc _dio_write + + jsr dio_params + jsr WriteBlock + stx errno + txa + rts + +.endproc diff --git a/libsrc/geos/disk/dio_writev.s b/libsrc/geos/disk/dio_writev.s new file mode 100644 index 000000000..2885629a5 --- /dev/null +++ b/libsrc/geos/disk/dio_writev.s @@ -0,0 +1,25 @@ +; +; Maciej 'YTM/Elysium' Witkowiak +; 2.7.2001 +; +; this file provides the _dio_write function +; +; unsigned char __fastcall__ dio_write_verify(dhandle_t handle,sectnum_t sect_num,const void *buffer); +; dhandle_t - 16bit (ptr) +; sectnum_t - 16bit +; + + .import dio_params + .export _dio_write_verify + .include "../inc/geossym.inc" + .include "../inc/jumptab.inc" + +.proc _dio_write_verify + + jsr dio_params + jsr VerWriteBlock + stx errno + txa + rts + +.endproc diff --git a/libsrc/geos/inc/dio.inc b/libsrc/geos/inc/dio.inc new file mode 100644 index 000000000..24ae0e5e4 --- /dev/null +++ b/libsrc/geos/inc/dio.inc @@ -0,0 +1,19 @@ + +;------------------------------------------------------------------------- +; OFFSETS INTO SECTSIZETAB (DIO functions) +;------------------------------------------------------------------------- + +sst_flag = 0 ; length 1 +sst_sectsize = 1 ; 2 +sst_driveno = 3 ; 1 (drive #) +sst_size = 4 ; size of one entry + ; if changed, adapt diopncls.s + +;------------------------------------------------------------------------- +; OFFSETS INTO dio_phys_pos +;------------------------------------------------------------------------- + +diopp_head = 0 ; head +diopp_track = 1 ; track / cylinder +diopp_sector = 3 ; sector +diopp_size = 5 ; size of structure diff --git a/libsrc/geos/mousesprite/Makefile b/libsrc/geos/mousesprite/Makefile index 0fb3cad23..842c3bf37 100644 --- a/libsrc/geos/mousesprite/Makefile +++ b/libsrc/geos/mousesprite/Makefile @@ -11,7 +11,8 @@ S_OBJS = startmousemode.o clearmousemode.o mouseup.o mouseoff.o\ drawsprite.o possprite.o enablsprite.o disablsprite.o\ ismseinregion.o inittextprompt.o promptoff.o prompton.o\ - getnextchar.o + getnextchar.o\ + mouse.o readjoy.o all: $(S_OBJS) diff --git a/libsrc/geos/mousesprite/mouse.s b/libsrc/geos/mousesprite/mouse.s new file mode 100644 index 000000000..ce4e2927b --- /dev/null +++ b/libsrc/geos/mousesprite/mouse.s @@ -0,0 +1,160 @@ +; +; 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, _mouse_info + .export _mouse_x, _mouse_y + .export _mouse_move, _mouse_buttons + + .import popax, popsreg, addysp1 + .importzp sp, sreg + + .include "../inc/const.inc" + .include "../inc/jumptab.inc" + .include "../inc/geossym.inc" + +; .macpack generic + +.code + +; -------------------------------------------------------------------------- +; +; unsigned char __fastcall__ mouse_init (unsigned char port, +; unsigned char sprite, +; unsigned char type); +; + +_mouse_init: + jsr popax ; ignore all parameters + + jsr StartMouseMode + jsr MouseOff + + lda #0 + sta mouseTop + sta mouseLeft + sta mouseLeft+1 + lda #199 + sta mouseBottom + lda #<319 + sta mouseRight + lda #>319 + sta mouseRight+1 + + lda #0 +; -------------------------------------------------------------------------- +; +; 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 +; stx YMax+1 ; maxy + + lda (sp),y + sta mouseRight + iny + lda (sp),y + sta mouseRight+1 ; maxx + + iny + lda (sp),y + sta mouseTop + iny +; lda (sp),y +; sta YMin+1 ; miny + + iny + lda (sp),y + sta mouseLeft + iny + lda (sp),y + sta mouseLeft+1 ; minx + + jmp addysp1 ; Drop params, return + +; -------------------------------------------------------------------------- +; +; int __fastcall__ mouse_x (void); +; + +_mouse_x: + lda mouseXPos + ldx mouseXPos+1 + rts + +; -------------------------------------------------------------------------- +; +; int __fastcall__ mouse_y (void); +; + +_mouse_y: + lda mouseYPos + ldx #0 + rts + +; -------------------------------------------------------------------------- +; +; void mouse_info (...); +; + +_mouse_info: + rts + + +; -------------------------------------------------------------------------- +; +; void __fastcall__ mouse_move (int x, int y); +; + +_mouse_move: + jsr popsreg ; Get X + sei ; Disable interrupts + + sta mouseYPos +; stx YPos+1 + lda sreg + ldx sreg+1 + sta mouseXPos + stx mouseXPos+1 + rts + +; -------------------------------------------------------------------------- +; +; unsigned char mouse_buttons (void); +; + +_mouse_buttons: + lda pressFlag + and #SET_MOUSE + lsr + rts diff --git a/libsrc/geos/mousesprite/readjoy.s b/libsrc/geos/mousesprite/readjoy.s new file mode 100644 index 000000000..e96a0e58d --- /dev/null +++ b/libsrc/geos/mousesprite/readjoy.s @@ -0,0 +1,40 @@ +; +; Ullrich von Bassewitz, 23.09.1998 +; +; unsigned readjoy (unsigned char joy); +; + + .export _readjoy + + .include "../inc/geossym.inc" + +.proc _readjoy + + tax ; Joystick number into X + bne joy2 + +; Read joystick 1 + +joy1: lda #$7F + sei + sta cia1base + lda cia1base+1 + cli + and #$1F + eor #$1F + rts + +; Read joystick 2 + +joy2: ldx #0 + lda #$E0 + ldy #$FF + sta cia1base+2 + lda cia1base+1 + sty cia1base+2 + and #$1F + eor #$1F + rts + +.endproc + -- 2.39.5