NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: NES-to-PC serial link cable  
Posted byblargg
Posted on7/3/04 11:50 AM
From IP199.170.89.169  



Here's the code I use in my dev cart to do 57.6kbps software-based serial through a MAX232 connected to the second controller port:

; write a to 57.6kbps serial
; modified: p, a

temp: equ $10

serial_write:
sta temp
sec ; stop bit = 1
dc.b $A9 ; lda #$18 start bit = 0

; 31 cycles/iter
write_loop:
clc ; 2
sta $4016 ; 4
lda temp ; 3
pha ; 3
pla ; 4
pha ; 3
pla ; 4
ror temp ; 5
bne write_loop ; 3
bcs write_loop

rts


; wait for and read byte from 57.6kbps serial into a
; modified: p, a

serial_read:

lda #$01 ; 2
wait_start:
bit $4017 ; 4
beq wait_start ; 3

lda #$80 ; 2 8 iterations
sta temp ; 3
; 30 cycles/iter
read_loop:
lda $4017 ; 4
lsr a ; 2
ror temp ; 5
pha ; 3
pla ; 4
pha ; 3
pla ; 4
nop ; 2
bcc read_loop ; 3
; -1
nop ; 2 last bit
lda $4017 ; 4
lsr a ; 2
lda temp ; 3
ror a ; 2
eor #$FF ; 3

; max 30 cycles until next read
rts




-
Entire Thread
Subject  Posted byPosted On
*NES-to-PC serial link cable  Memblers7/1/04 08:36 AM
.*Re: NES-to-PC serial link cable  Zipplet7/4/04 2:09 PM
.*Re: NES-to-PC serial link cable  abonetochew7/3/04 02:33 AM
..*Re: NES-to-PC serial link cable  Memblers7/3/04 03:38 AM
...*Subroutines on the EPROM?  tepples7/3/04 06:36 AM
...*Re: NES-to-PC serial link cable  abonetochew7/3/04 04:37 AM
....*Re: NES-to-PC serial link cable  Memblers7/3/04 06:42 AM
......Re: NES-to-PC serial link cable  blargg7/3/04 11:50 AM
......*Re: NES-to-PC serial link cable  Memblers7/3/04 10:10 PM
.......*Re: NES-to-PC serial link cable  abonetochew7/4/04 00:49 AM
........*Re: NES-to-PC serial link cable  Memblers7/4/04 01:59 AM
.........*Re: NES-to-PC serial link cable  blargg7/4/04 03:07 AM
.........*Re: NES-to-PC serial link cable  abonetochew7/4/04 02:50 AM
..........*Re: NES-to-PC serial link cable  Memblers7/4/04 05:32 AM
...........*Re: NES-to-PC serial link cable  nfg7/6/04 03:21 AM
............*Re: NES-to-PC serial link cable  Memblers7/6/04 08:33 AM
.............*Re: NES-to-PC serial link cable  nfg7/6/04 6:26 PM
..............*Re: NES-to-PC serial link cable  Memblers7/7/04 1:00 PM
...............*Re: NES-to-PC serial link cable  nfg7/7/04 3:45 PM
.....*Re: NES-to-PC serial link cable  koitsu7/3/04 11:18 AM
......*Re: NES-to-PC serial link cable  Memblers7/3/04 9:58 PM
....*Re: NES-to-PC serial link cable  tepples7/3/04 06:34 AM
.*With an NES RAM cart?  tepples7/1/04 6:39 PM
..*Status update?  tepples9/22/04 06:28 AM
...*Re: Status update?  Memblers9/22/04 1:34 PM
....*Re: Status update?  tepples9/22/04 4:20 PM
.....*Re: Status update?  Memblers9/22/04 6:16 PM
......*Re: Status update?  drk4219/23/04 02:21 AM
.*Re: NES-to-PC serial link cable  BrianProvinciano7/1/04 11:20 AM
..*Re: NES-to-PC serial link cable  Memblers7/1/04 11:53 PM
...*Re: NES-to-PC serial link cable  BrianProvinciano7/2/04 01:51 AM
..*Re: NES-to-PC serial link cable  koitsu7/1/04 1:35 PM
...*Re: NES-to-PC serial link cable  BrianProvinciano7/1/04 6:50 PM
....*Re: NES-to-PC serial link cable  koitsu7/1/04 8:32 PM
.....*KB/s or kbits/s?  tepples7/1/04 11:13 PM
......*Re: KB/s or kbits/s?  BrianProvinciano7/2/04 01:44 AM
.......*Re: KB/s or kbits/s?  koitsu7/2/04 05:19 AM
........*Re: KB/s or kbits/s?  BrianProvinciano7/2/04 05:28 AM
.*Re: NES-to-PC serial link cable  Necrosaro4207/1/04 08:44 AM
..*Re: NES-to-PC serial link cable  koitsu7/1/04 10:31 AM
..*Re: NES-to-PC serial link cable  Memblers7/1/04 09:18 AM
...*Re: NES-to-PC serial link cable  Necrosaro4207/1/04 09:51 AM
....*Re: NES-to-PC serial link cable  Memblers7/1/04 10:11 AM
.....*Re: NES-to-PC serial link cable  Anonymous7/1/04 7:33 PM
......*Re: NES-to-PC serial link cable  Memblers7/4/04 00:19 AM
.......*Re: NES-to-PC serial link cable  kik7/4/04 08:56 AM
........*Re: NES-to-PC serial link cable  Memblers7/5/04 04:46 AM
.........*Modchip?  tepples7/5/04 05:49 AM
..........*Re: Modchip?  Memblers7/5/04 7:06 PM
...........*Re: Modchip?  tepples7/5/04 7:22 PM
............*Re: Modchip?  Memblers7/5/04 8:36 PM
.............*Re: Modchip?  tepples7/5/04 11:23 PM
..............*Re: Modchip?  nfg7/6/04 03:37 AM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo