[Coco] DS-69B Reverse Engineering
Joel Ewy
jcewy at swbell.net
Sat Aug 5 20:45:38 EDT 2006
Arthur Flexser wrote:
> My guess (unless you've ruled this out) is that it's code that doesn't actually
> get executed, existing in a gap between assembled code segments and containing
> junk left over from previous assemblies.
>
> Art
>
>
Well, it appears to me to be called when digitizing column 0, but it's
entirely possible I'm misunderstanding the code. FWIW, here's the whole
thing, with my comments, so far as I have worked it out. Plenty of
things may be wrong in my annotations. According to the DS-69 manual
you use the routine by POKEing the X coordinate you want to digitize
into address 241 (which I would think would be in the Direct Page), the
Y coordinate into 242, EXECing the subroutine, and then PEEKing address
243 to get the 6-bit brightness value. Alternately you can use USRn.
0:=7EDC/ 32476
1:=7EEC/ 32492
2:=7EFA/ 32506
3:=7EF5/ 32501
4:=AC46/ 44102 Color BASIC error routine
5:=B740/ 46912 Color BASIC load X w/ lower 2 bytes of
FPA0 floating pt acc
6:=7F48/ 32584
7:=7F82/ 32642
8:=7F9D/ 32669
9:=7F92/ 32658
10:=7FC2/ 32706
11:=7F72/ 32626
12:=B4F4/ 46324 Return Brightness Value
7EDC 3402 0: PSHS 2#
7EDE EC61 LDD 1,S
7EE0 1083B166 CMPD 45414#
7EE4 2706 BEQ 1:
7EE6 1083B2D1 CMPD 45777#
7EEA 260E BNE 2:
7EEC 6DE4 1: TST S+0
7EEE 2705 BEQ 3:
7EF0 C618 LDB 24#
7EF2 7EAC46 JMP 4: Err.
7EF5 BDB740 3: JSR 5:
7EF8 9FF1 STX 241$ X Coordinate Parameter
7EFA 3502 2: PULS 2#
7EFC 3401 PSHS 1#
7EFE 1A50 ORCC 80#
7F00 7FFF40 CLR 65344$ Clear Drive Selector
7F03 B6FF01 LDA 65281$ Save IRQ flags for HSYNC
7F06 3402 PSHS 2#
7F08 84FE ANDA 254# Disable HSYNC Int.
7F0A B7FF01 STA 65281$
7F0D B6FF03 LDA 65283$ Save VSYNC flags
7F10 3402 PSHS 2#
7F12 84FE ANDA 254# Disable VSYNC (field) Int.
7F14 B7FF03 STA 65283$
7F17 B6FF23 LDA 65315$ Save CART interrupt flags
7F1A 3402 PSHS 2#
7F1C 84FC ANDA 252# Disable CART IRQ
7F1E B7FF23 STA 65315$ and set to falling edge
7F21 8611 LDA 17#
7F23 B7FF7F STA 65407$ MultiPAK control
7F26 7FFF71 CLR 65393$ Select DS-69 DDR A
7F29 7FFF73 CLR 65395$ Select DS-69 DDR B
7F2C 86FF LDA 255# Config all lines of A and B
7F2E B7FF70 STA 65392$ to OUT
7F31 B7FF72 STA 65394$
7F34 8606 LDA 6# Set port A act hi IRQ(dis) &
7F36 B7FF71 STA 65393$ select Port A register
7F39 863E LDA 62# Set port B act hi IRQ(dis),
7F3B B7FF73 STA 65395$ CB2 is high, & select port B
7F3E 7FFF72 CLR 65394$ Clear port B
7F41 96F1 LDA 241$ Get X Coordinate from BASIC
7F43 8407 ANDA 7# ANDA 00000111
7F45 5F CLRB
7F46 1A01 ORCC 1# Set Carry
7F48 56 6: RORB Roll Carry into B, A times [A<=7]
7F49 4A DECA
7F4A 2AFC BPL 6:
7F4C 3404 PSHS 4# Stack B,A
7F4E 96F1 LDA 241$ Get X Coordinate from BASIC
7F50 8418 ANDA 24# ANDA 00011000
7F52 3402 PSHS 2# Stack A
7F54 CCFF57 LDD 65367#
7F57 EAE0 ORB S+
7F59 1F01 TFR 1# Transfer B to X
7F5B 96F1 LDA 241$ Get X Coordinate from BASIC
7F5D 43 COMA
7F5E 44 LSRA
7F5F 44 LSRA
7F60 44 LSRA
7F61 44 LSRA
7F62 44 LSRA
7F63 B7FF70 STA 65392$ STA PIA A
7F66 8620 LDA 32#
7F68 3402 PSHS 2# PSHS A
7F6A B6FF23 LDA 65315$
7F6D 8A01 ORA 1#
7F6F B7FF23 STA 65315$ Enable FIRQ*
7F72 A6E4 11: LDA S+0 S-> #32 initially...
7F74 BAFF72 ORA 65394$ Set bit [S] of FF72
7F77 B7FF72 STA 65394$ first bit 5; then 5,4; then 5,4,3, etc.
7F7A 860E LDA 14#
7F7C B7FF71 STA 65393$ Enable FIRQ A on CA2, Disable FIRQ on CA1
7F7F B6FF72 LDA 65394$
7F82 B6FF73 7: LDA 65395$ Poll B port (Wait for V blanking?)
7F85 2AFB BPL 7:
7F87 B6FF22 LDA 65314$ Reset Int. Flag (CART (F?)IRQ)
7F8A B6FF70 LDA 65392$
7F8D 13 SYNC Wait for FIRQ
7F8E D6F2 LDB 242$ Get Y Coordinate from BASIC
7F90 270B BEQ 8:
7F92 B6FF22 9: LDA 65314$
7F95 B6FF70 LDA 65392$
7F98 13 SYNC Wait for FIRQ
7F99 5A DECB
7F9A 26F6 BNE 9:
7F9C 12 NOP
7F9D 8607 8: LDA 7#
7F9F B7FF71 STA 65393$
7FA2 10AC9DDEF4 CMPY ( 57076,PC) Mysterious section begins
7FA7 12 NOP
7FA8 12 NOP
7FA9 12 NOP
7FAA 1012 ???? End of mysterious section
7FAC E661 LDB 1,S
7FAE B6FF22 LDA 65314$
7FB1 B6FF70 LDA 65392$
7FB4 13 SYNC Wait for FIRQ
7FB5 E484 ANDB X+0
7FB7 A6E4 LDA S+0
7FB9 5D TSTB
7FBA 2606 BNE 10:
7FBC B8FF72 EORA 65394$
7FBF B7FF72 STA 65394$
7FC2 64E4 10: LSR S+0
7FC4 24AC BCC 11:
7FC6 3262 LEAS 2,S
7FC8 B6FF72 LDA 65394$
7FCB 97F3 STA 243$ Store brightness value
7FCD B6FF71 LDA 65393$
7FD0 84FE ANDA 254#
7FD2 B7FF71 STA 65393$
7FD5 B6FF23 LDA 65315$
7FD8 84FC ANDA 252# (Disable FIRQ*?)
7FDA B7FF23 STA 65315$
7FDD B6FF22 LDA 65314$
7FE0 B6FF70 LDA 65392$
7FE3 3502 PULS 2#
7FE5 B7FF23 STA 65315$
7FE8 3502 PULS 2#
7FEA B7FF03 STA 65283$
7FED 3502 PULS 2#
7FEF B7FF01 STA 65281$
7FF2 8633 LDA 51#
7FF4 B7FF7F STA 65407$
7FF7 4F CLRA
7FF8 D6F3 LDB 243$
7FFA 3501 PULS 1#
7FFC 7EB4F4 JMP 12: Return brightness value to BASIC
7FFF 42 ????
More information about the Coco
mailing list