diff --git a/src/dos_m65/,aliases_dos.s b/src/dos_m65/,aliases_dos.s index 031df0f1..96b2f5c2 100644 --- a/src/dos_m65/,aliases_dos.s +++ b/src/dos_m65/,aliases_dos.s @@ -7,19 +7,19 @@ ; - additional 16KB RAM is reserved for DOS too ($14000-$17FFF), and can be banked-in if needed - ; - ; Page 0 + ; Page start+0 ; !addr MAGICSTR = $8000 ; magic string; if not matching, DOS considered non-functional ; General DOS configuration - !addr UNIT_SDCARD = $8005 - !addr UNIT_FLOPPY = $8006 - !addr UNIT_RAMDISK = $8007 + !addr UNIT_SDCARD = $8005 ; unit number for device, 0 = none + !addr UNIT_FLOPPY = $8006 ; as above + !addr UNIT_RAMDISK = $8007 ; as above ; General DOS status - !addr UNIT_HANDLER = $8008 + !addr IDX_LISTENER = $8008 ; listener idx * 2, >=$80 = none + !addr IDX_TALKER = $8009 ; talker idx * 2, >=$80 = none diff --git a/src/dos_m65/dos_init.s b/src/dos_m65/dos_init.s index 8ef2e514..2b537af7 100644 --- a/src/dos_m65/dos_init.s +++ b/src/dos_m65/dos_init.s @@ -31,4 +31,10 @@ dos_INIT: lda #CONFIG_UNIT_RAMDISK sta UNIT_RAMDISK + ; Clear listener / talker + + lda #$FF + sta IDX_LISTENER + sta IDX_TALKER + rts diff --git a/src/dos_m65/dos_listen_unlsn.s b/src/dos_m65/dos_listen_unlsn.s new file mode 100644 index 00000000..e3bf5700 --- /dev/null +++ b/src/dos_m65/dos_listen_unlsn.s @@ -0,0 +1,99 @@ + +; +; Implementation of LISTEN/UNLSN/TALK/UNTLK commands. +; For detailed description see 'm65dos_bridge.s' file. +; + + +; LISTEN + +dos_LISTEN: + + pha + and #$1F + beq dos_fail_TALK_LISTEN ; branch if device 0 (used to denote lack of device) + + cmp UNIT_SDCARD + bne @1 + + lda #$00 + bra dos_LISTEN_success +@1: + cmp UNIT_FLOPPY + bne @2 + + lda #$02 + bra dos_LISTEN_success +@2: + cmp UNIT_RAMDISK + bne dos_fail_TALK_LISTEN + + lda #$04 + + ; FALLTROUGH + +dos_LISTEN_success: + + sta IDX_LISTENER + bra dos_common_LSN_TALK_UN + +; TALK + +dos_TALK: + + pha + and #$1F + beq dos_fail_TALK_LISTEN ; branch if device 0 (used to denote lack of device) + + cmp UNIT_SDCARD + bne @1 + + lda #$00 + bra dos_TALK_success +@1: + cmp UNIT_FLOPPY + bne @2 + + lda #$02 + bra dos_TALK_success +@2: + cmp UNIT_RAMDISK + bne dos_fail_TALK_LISTEN + + lda #$04 + + ; FALLTROUGH + +dos_TALK_success: + + sta IDX_TALKER + bra dos_common_LSN_TALK_UN + +dos_fail_TALK_LISTEN: + + pla + sec + rts + +; UNLSN / UNTLK + +dos_UNLSN: + + pha + lda #$FF + sta IDX_LISTENER + bra dos_common_LSN_TALK_UN + +dos_UNTLK: + + pha + lda #$FF + sta IDX_TALKER + + ; FALLTROUGH + +dos_common_LSN_TALK_UN: + + pla + clc + rts diff --git a/src/dos_m65/dos_unitset.s b/src/dos_m65/dos_unitset.s index 49133f6d..9ef2326b 100644 --- a/src/dos_m65/dos_unitset.s +++ b/src/dos_m65/dos_unitset.s @@ -12,6 +12,8 @@ dos_UNITSET: bcc @1 rts @1: + ; XXX do not allow illegal device numbers... above 30 or below 8 ? + ; Check what kind of device was requested cmp #$00 diff --git a/src/dos_m65/stubs.s b/src/dos_m65/stubs.s index 17c67de7..2c8a2052 100644 --- a/src/dos_m65/stubs.s +++ b/src/dos_m65/stubs.s @@ -5,18 +5,12 @@ dos_ACPTR: +nop dos_CIOUT: +nop -dos_LISTEN: - +nop dos_SECOND: +nop -dos_TALK: - +nop dos_TKSA: +nop -dos_UNTLK: - +nop -dos_UNLSN: - +nop sec rts + +