# HG changeset patch # User Boisy Pitre # Date 1343314582 18000 # Node ID 8399491c0821de27ac0fb012abf54b046f5d7a5e # Parent 37d3ee1458b6e002bc9c5cccbde85a68fa76d1bd Reworked sources so that serial polling for the atari works. diff -r 37d3ee1458b6 -r 8399491c0821 defs/atari.d --- a/defs/atari.d Wed Jul 25 11:25:34 2012 -0500 +++ b/defs/atari.d Thu Jul 26 09:56:22 2012 -0500 @@ -112,7 +112,7 @@ * (Yes, we are stealing an existing variable that is so old it should be * removed from os9defs) D.IRQENShdw equ D.WDBtDr -D.ATARIFLAGS equ D.SWPage +D.SKCTLShdw equ D.SWPage * The clock interrupt is driven by the unmaskable NMI. Therefore, * the rbdw3 driver uses the DWIOSEMA flag in the D.ATARIFLAGS field as @@ -270,6 +270,8 @@ SKCTL equ POKEY+$0F ;serial port and keyboard control SKCTL.FORECEBREAK equ %10000000 SKCTL.SERMODECTRLMASK equ %01110000 +SKCTL.SERMODEOUT equ %00100000 +SKCTL.SERMODEIN equ %00010000 SKCTL.TWOTONEMODE equ %00001000 SKCTL.FASTPOTSCAN equ %00000100 SKCTL.KEYBRDSCAN equ %00000010 diff -r 37d3ee1458b6 -r 8399491c0821 level1/atari/modules/vtio.asm --- a/level1/atari/modules/vtio.asm Wed Jul 25 11:25:34 2012 -0500 +++ b/level1/atari/modules/vtio.asm Thu Jul 26 09:56:22 2012 -0500 @@ -135,15 +135,15 @@ bcs initex * set POKEY to active - lda #3 + lda #$13 sta SKCTL * tell POKEY to enable keyboard scanning - lda #%11000000 + lda #(IRQST.BREAKDOWN|IRQST.KEYDOWN) pshs cc orcc #IntMasks - ora D.IRQENSHDW - sta D.IRQENSHDW + ora >D.IRQENSHDW + sta >D.IRQENSHDW puls cc sta IRQEN @@ -463,8 +463,8 @@ IRQPkt equ * -Pkt.Flip fcb %11000000 flip byte -Pkt.Mask fcb %11000000 mask byte +Pkt.Flip fcb (IRQST.BREAKDOWN|IRQST.KEYDOWN) flip byte +Pkt.Mask fcb (IRQST.BREAKDOWN|IRQST.KEYDOWN) mask byte fcb $0A priority @@ -472,7 +472,15 @@ * IRQ routine for keyboard * IRQSvc +* check if BREAK key pressed; if so, it's a C$QUIT char + ldb IRQST + bitb #IRQST.BREAKDOWN + bne getcode + lda #C$QUIT + bra noctrl@ +getcode ldb KBCODE get keyboard code from POKEY +gotcode pshs b andb #$7F mask out potential CTRL key leax ATASCI,pcr @@ -517,12 +525,12 @@ * re-enable the keyboard interrupt pshs cc orcc #IntMasks - lda D.IRQENShdw + lda >D.IRQENShdw tfr a,b - anda #^%11000000 - orb #%11000000 + anda #^(IRQST.BREAKDOWN|IRQST.KEYDOWN) + orb #(IRQST.BREAKDOWN|IRQST.KEYDOWN) sta IRQEN - stb D.IRQENShdw + stb >D.IRQENShdw stb IRQEN puls cc,pc diff -r 37d3ee1458b6 -r 8399491c0821 level1/modules/clock.asm --- a/level1/modules/clock.asm Wed Jul 25 11:25:34 2012 -0500 +++ b/level1/modules/clock.asm Thu Jul 26 09:56:22 2012 -0500 @@ -131,9 +131,8 @@ stb D.SvcIRQ] else service other possible IRQ +L0032 + lda #$FF + sta AUDF1 + lda D.IRQENShdw + ora #IRQEN.SERINRDY + sta >D.IRQENShdw sta IRQEN ldd #$0000 loop@ @@ -46,17 +47,19 @@ beq outtahere@ pshs b ldb IRQST - bitb #%00100000 + bitb #IRQST.SERINRDY puls b bne loop@ ldb SERIN - lda D.IRQENSHDW + lda >D.IRQENShdw + anda #^IRQEN.SERINRDY + sta >D.IRQENShdw sta IRQEN * check for framing error lda SKSTAT bpl outtahere@ framing error lsla - bpl outtahere@ data input overrun + bcc outtahere@ data input overrun stb ,u+ abx leay -1,y @@ -319,4 +322,4 @@ ENDC ENDC ENDC - ENDC \ No newline at end of file + ENDC diff -r 37d3ee1458b6 -r 8399491c0821 level1/modules/dwwrite.asm --- a/level1/modules/dwwrite.asm Wed Jul 25 11:25:34 2012 -0500 +++ b/level1/modules/dwwrite.asm Thu Jul 26 09:56:22 2012 -0500 @@ -20,57 +20,68 @@ * Based on the hipatch source for the Atari and translated * into 6809 assembly language by Boisy G. Pitre. * -RMSEND equ %11101111 -SKSEND equ %00100011 -MSKSEND equ %00010000 -IMSEND equ %00010000 -IMSCPL equ $08 DWWrite andcc #^$01 ; clear carry to assume no error pshs d,cc ; setup pokey - lda #$28 - sta AUDCTL +* lda #$28 +* sta AUDCTL * lda #$A0 - lda #$A8 - sta AUDC4 -* short delay before send - clra -shortdelay@ - deca - bne shortdelay@ +* lda #$A8 +* sta AUDC4 +* delay before send + pshs y + ldy #50 +delay@ + leay -1,y + bne delay@ + puls y orcc #$50 ; mask interrupts - lda #SKSEND ; set pokey to transmit data mode +; set pokey to transmit data mode + lda #SKCTL.SERMODEOUT|SKCTL.KEYBRDSCAN|SKCTL.KEYDEBOUNCE sta SKCTL sta SKRES - lda D.IRQENSHDW - ora #MSKSEND + lda >D.IRQENSHDW + ora #IRQEN.SEROUTNEEDED + sta >D.IRQENSHDW sta IRQEN +* bsr somedelay lda ,x+ sta SEROUT leay -1,y beq ex@ byteloop@ lda ,x+ - ldb #IMSEND + ldb #IRQST.SEROUTNEEDED * NOTE: Potential infinite loop here! waitloop@ bitb IRQST bne waitloop@ - ldb #RMSEND + ldb >D.IRQENSHDW + andb #^IRQEN.SEROUTNEEDED stb IRQEN - ldb D.IRQENSHDW - orb #MSKSEND + ldb >D.IRQENSHDW stb IRQEN sta SEROUT leay -1,y bne byteloop@ ex@ - lda #IMSCPL + lda #IRQST.SEROUTDONE wt bita IRQST ; wait until transmit complete bne wt + bsr somedelay puls cc,d,pc + +somedelay + pshs y + ldy #20 +delay@ + leay -1,y + bne delay@ + puls y,pc + + ELSE IFNE BECKER