annotate level1/modules/dwwrite.asm @ 3277:33d539c123cf

d64: Add mb.ddisk script for making Dragon boot floppy At least it works in XRoar when running off a 80d floppy and preparing a new 40d boot floppy in the second drive. The "format" must be run manually for now since there is not enough memory to run it from inside the script...
author Tormod Volden <debian.tormod@gmail.com>
date Sat, 07 Mar 2020 23:15:05 +0100
parents be3446f758ca
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
1 *******************************************************
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
2 *
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
3 * DWWrite
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
4 * Send a packet to the DriveWire server.
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
5 * Serial data format: 1-8-N-1
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
6 * 4/12/2009 by Darren Atkinson
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
7 *
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
8 * Entry:
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
9 * X = starting address of data to send
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
10 * Y = number of bytes to send
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
11 *
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
12 * Exit:
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
13 * X = address of last byte sent + 1
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
14 * Y = 0
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
15 * All others preserved
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
16 *
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
17
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
18
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
19 IFNE ARDUINO
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
20 DWWrite pshs a ; preserve registers
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
21 txByte
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
22 lda ,x+ ; get byte from buffer
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
23 sta $FF52 ; put it to PIA
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
24 loop@ tst $FF53 ; check status register
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
25 bpl loop@ ; until CB1 is set by Arduino, continue looping
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
26 tst $FF52 ; clear CB1 in status register
2773
ce3dba57003b boot_dw now uses dwinit.asm.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2770
diff changeset
27 leay -1,y ; decrement byte counter
ce3dba57003b boot_dw now uses dwinit.asm.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2770
diff changeset
28 bne txByte ; loop if more to send
ce3dba57003b boot_dw now uses dwinit.asm.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2770
diff changeset
29 puls a,pc ; restore registers and return
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
30
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
31 ELSE
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
32
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
33 IFNE SY6551N
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
34 IFNDEF SY6551B
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
35 SY6551B EQU $FF68 ; Set base address for future use
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
36 ENDC
3246
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
37 IFNDEF SYDATA
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
38 SYDATA EQU SY6551B
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
39 ENDC
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
40 IFNDEF SYCONT
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
41 SYCONT EQU SY6551B+3
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
42 ENDC
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
43 IFNDEF SYCOMM
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
44 SYCOMM EQU SY6551B+2
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
45 ENDC
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
46 IFNDEF SYSTAT
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
47 SYSTAT EQU SY6551B+1
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
48 ENDC
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
49 IFNDEF SYCONSET
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
50 SYCONSET EQU $10 ; Default baud rate 115200
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
51 ENDC
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
52 DWWrite pshs d,cc ; preserve registers
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
53 IFEQ NOINTMASK
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
54 orcc #IntMasks ; mask interrupts
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
55 ENDC
3246
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
56 lda #SYCONSET ; Set baud to value of SYCONSET
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
57 sta SYCONT ; write the info to register
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
58 lda #$0B ; Set no parity, no irq
3246
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
59 sta SYCOMM ; write the info to register
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
60 txByte
3246
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
61 lda SYSTAT ; read status register to check
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
62 anda #$10 ; if transmit buffer is empty
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
63 beq txByte ; if not loop back and check again
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
64 lda ,x+ ; load byte from buffer
3246
be3446f758ca Updated dwread.asm and dwwrite.asm so that the 6551 routines could have specially defined
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3239
diff changeset
65 sta SYDATA ; and write it to data register
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
66 leay -1,y ; decrement byte counter
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
67 bne txByte ; loop if more to send
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
68 puls cc,d,pc ; restore registers and return
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
69 ELSE
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
70 IFNE JMCPBCK
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
71 DWWrite pshs d,cc ; preserve registers
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
72 orcc #$50 ; mask interrupts
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
73 txByte
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
74 lda ,x+
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
75 sta $FF44
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
76 leay -1,y ; decrement byte counter
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
77 bne txByte ; loop if more to send
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
78
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
79 puls cc,d,pc ; restore registers and return
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
80
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
81 ELSE
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
82 IFNE BECKER
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
83 IFNDEF BECKBASE
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
84 BECKBASE EQU $FF41 ; Set base address for future use
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
85 ENDC
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
86 DWWrite pshs d,cc ; preserve registers
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
87 orcc #$50 ; mask interrupts
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
88 txByte
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
89 lda ,x+
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
90 sta BECKBASE+1
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
91 leay -1,y ; decrement byte counter
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
92 bne txByte ; loop if more to send
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
93
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
94 puls cc,d,pc ; restore registers and return
3035
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
95 ELSE
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
96 IFNE BECKERTO
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
97 IFNDEF BECKBASE
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
98 BECKBASE EQU $FF41 ; Set base address for future use
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
99 ENDC
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
100 DWWrite pshs d,cc ; preserve registers
3035
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
101 orcc #$50 ; mask interrupts
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
102 txByte
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
103 lda ,x+
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
104 sta BECKBASE+1
3035
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
105 leay -1,y ; decrement byte counter
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
106 bne txByte ; loop if more to send
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
107
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
108 puls cc,d,pc ; restore registers and return
1cef81d100ce added the missing BECKERTO section to the dwwrite.asm file.
David Ladd <drencor-xeen@users.sf.net>
parents: 2898
diff changeset
109 ENDC
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
110 ENDC
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
111 ENDC
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
112 ENDC
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
113
3239
a47ee8f14eb8 Added new routine to dwread.asm and dwwrite.asm for using the SY6551 chips.
David Ladd <drencor-xeen@users.sourceforge.net>
parents: 3037
diff changeset
114 IFEQ BECKER+JMCPBCK+ARDUINO+BECKERTO+SY6551N
2770
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
115 IFEQ BAUD38400+H6309
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
116 *******************************************************
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
117 * 57600 (115200) bps using 6809 code and timimg
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
118 *******************************************************
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
119
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
120 DWWrite pshs dp,d,cc ; preserve registers
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
121 orcc #$50 ; mask interrupts
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
122 ldd #$04ff ; A = loop counter, B = $ff
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
123 tfr b,dp ; set direct page to $FFxx
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
124 setdp $ff
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
125 ldb <$ff23 ; read PIA 1-B control register
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
126 andb #$f7 ; clear sound enable bit
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
127 stb <$ff23 ; disable sound output
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
128 fcb $8c ; skip next instruction
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
129
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
130 txByte stb <BBOUT ; send stop bit
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
131 ldb ,x+ ; get a byte to transmit
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
132 nop
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
133 lslb ; left rotate the byte two positions..
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
134 rolb ; ..placing a zero (start bit) in bit 1
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
135 tx0020 stb <BBOUT ; send bit (start bit, d1, d3, d5)
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
136 rorb ; move next bit into position
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
137 exg a,a
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
138 nop
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
139 stb <BBOUT ; send bit (d0, d2, d4, d6)
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
140 rorb ; move next bit into position
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
141 leau ,u
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
142 deca ; decrement loop counter
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
143 bne tx0020 ; loop until 7th data bit has been sent
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
144
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
145 stb <BBOUT ; send bit 7
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
146 ldd #$0402 ; A = loop counter, B = MARK value
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
147 leay ,-y ; decrement byte counter
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
148 bne txByte ; loop if more to send
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
149
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
150 stb <BBOUT ; leave bit banger output at MARK
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
151 puls cc,d,dp,pc ; restore registers and return
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
152 setdp $00
2770
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
153 ELSE
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
154
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
155 IFNE BAUD38400
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
156 *******************************************************
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
157 * 38400 bps using 6809 code and timimg
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
158 *******************************************************
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
159
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
160 DWWrite pshs u,d,cc ; preserve registers
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
161 orcc #$50 ; mask interrupts
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
162 ldu #BBOUT ; point U to bit banger out register
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
163 lda 3,u ; read PIA 1-B control register
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
164 anda #$f7 ; clear sound enable bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
165 sta 3,u ; disable sound output
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
166 fcb $8c ; skip next instruction
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
167
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
168 txByte stb ,--u ; send stop bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
169 leau ,u+
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
170 lda #8 ; counter for start bit and 7 data bits
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
171 ldb ,x+ ; get a byte to transmit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
172 lslb ; left rotate the byte two positions..
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
173 rolb ; ..placing a zero (start bit) in bit 1
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
174 tx0010 stb ,u++ ; send bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
175 tst ,--u
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
176 rorb ; move next bit into position
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
177 deca ; decrement loop counter
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
178 bne tx0010 ; loop until 7th data bit has been sent
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
179 leau ,u
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
180 stb ,u ; send bit 7
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
181 lda ,u++
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
182 ldb #$02 ; value for stop bit (MARK)
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
183 leay -1,y ; decrement byte counter
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
184 bne txByte ; loop if more to send
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
185
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
186 stb ,--u ; leave bit banger output at MARK
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
187 puls cc,d,u,pc ; restore registers and return
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
188
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
189
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
190 ELSE
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
191 *******************************************************
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
192 * 57600 (115200) bps using 6309 native mode
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
193 *******************************************************
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
194
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
195 DWWrite pshs u,d,cc ; preserve registers
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
196 orcc #$50 ; mask interrupts
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
197 * ldmd #1 ; requires 6309 native mode
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
198 ldu #BBOUT+1 ; point U to bit banger out register +1
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
199 aim #$f7,2,u ; disable sound output
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
200 lda #8 ; counter for start bit and 7 data bits
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
201 fcb $8c ; skip next instruction
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
202
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
203 txByte stb -1,u ; send stop bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
204 tx0010 ldb ,x+ ; get a byte to transmit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
205 lslb ; left rotate the byte two positions..
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
206 rolb ; ..placing a zero (start bit) in bit 1
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
207 bra tx0030
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
208
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
209 tx0020 bita #1 ; even or odd bit number ?
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
210 beq tx0040 ; branch if even (15 cycles)
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
211 tx0030 nop ; extra (16th) cycle
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
212 tx0040 stb -1,u ; send bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
213 rorb ; move next bit into position
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
214 deca ; decrement loop counter
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
215 bne tx0020 ; loop until 7th data bit has been sent
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
216 leau ,u+
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
217 stb -1,u ; send bit 7
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
218 ldd #$0802 ; A = loop counter, B = MARK value
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
219 leay -1,y ; decrement byte counter
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
220 bne txByte ; loop if more to send
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
221
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
222 stb -1,u ; final stop bit
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
223 puls cc,d,u,pc ; restore registers and return
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
224
2772
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
225
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
226 ENDC
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
227 ENDC
0a3f4d8ea6d5 Found ENDC in wrong location in dwread.asm and dwwrite.asm. Corrected.
drencor-xeen
parents: 2771
diff changeset
228 ENDC
2770
bfe3de781ddf Added Arduino dwread/dwwrite changes
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2725
diff changeset
229 ENDC