Serial Output Via Game Port Three

The game port three is used to transmit data from the ATARI to a printer with a serial input. One half of an RS232

interface is simulated by software. The connections to be made are shown in Fig 84.

(FIGURE)

Transmit Data

Signal Ground

SIGNAL GND

Fig 8-4 Transmit data from the ATARI to a printer or RS232 input.

This application also shows how to use machine code without using an assembler in FORTH. The program is listed in Fig 8-5.

The word CREATE <name> creates an entry into the vocabulary with the name <name>. It writes the parameter field address into the codefield address of this word. The bytes of the machine code are stored in the parameter field by C, . CREATE sets bit 6 of the length byte to one. This makes the name unknown to the search routine of the interpreter. The word SMUDGE sets this bit to zero. The last instruction of a FORTH word defined in machine code must be a JMP NEXT instead an RTS instruction. With JMP NEXT

the FORTH interpreter is called. The address of NEXT is $747 in QS-FORTH and $842 in POWER-FORTH.

The word INIT in text screen #140 initialises the port B. This word could be written with FORTH words. To get the exact timing for the data transfer rate of 300 baud, a subroutine BITWAIT is used. The code for this routine is placed into memory locations $6EB to $6F5. The word OUTCHR takes the byte on the top of the stack and sends it to the printer. During printing all interrupts of the ATARI are disabled. This causes the TV screen to become black and flickering.

The words defined in screen #145 to #149 print the content of a text screen and a TV screen.

.SCREEN ( n) Print text screen n. .SCRN Print TV screen.

( SCREENPRINT

RS232

9/29

ef

)

CREATE

INIT

(

PORT

B )

HEX

A9 C,

30

c,

(

LDA

#$30

)

8D C,

03

c.

D3

c, (

STA

$D3 03

)

A9 C,

01

c,

(

LDA

#$01

)

8D C,

01

c.

D3

C, (

STA

$D3 01

)

A9 C,

34

c,

(

LDA

#$34

)

8D C,

03

C,

D3

c, (

STA

$D3 03

)

A9 C,

00

c.

(

LDA

#$00

)

8D C,

01

c,

D3

c, (

STA

$D3 01

)

4C C,

47

C,

07

c, (

JMP

NEXT

)

SMUDGE

DECIMAL

—.

->

# 141

( SCREENPRINT

RS232

cntd

HEX

( BITWAIT

)

96A2

6 EB !

( LDX

#$96

)

06 AO

6 ED !

( LDY

#$06

)

88

6 EF C!

( DEY

)

FDDO

6F0 !

( BNE

-3

)

CA

6F2 C!

( DEX

)

F8D0

6F3 I

( BNE

-8

)

60

6F5 C!

( RTS

)

DECIMAL

( SCREENPRINT RS232 cntd ef ) HEX

CREATE OUTCHR ( c)

( SCREENPRINT RS232 cntd ef ) HEX

CREATE OUTCHR ( c)

B5

c,

00

c,

LDA

00fX

E8

c,

E8

c,

DEC

SPTR

86

c,

B5

C,

STX

XSAVE

49

C,

FF

C,

EOR

# $FF

8D

C,

F6

c,

06

c,

STA

BUFF

78

c,

SEI

A9

C,

00

c,

LDA

#00

8D

c,

0E

c,

D4

c,

STA

NMIEN

8D

c,

00

C,

D4

c,

STA

DMACTL

A9

c,

01

C,

LDA

#$01

8D

C,

01

c,

D3

c,

STA

PORTB

20

c,

EB

c,

06

c,

JSR

WAIT

>

#

143

( SCREENPRINT RS232 cntd ef

AO

c,

08

c,

LDY

#$08

84

c,

IF

c,

STY

COUNT

AD

c,

F6

c,

06

c,

LDA

BUFF

8D

c,

01

c,

D3

c,

STA

PORTB

6 A

c,

ROR

8D

c,

F6

C,

06

c,

STA

BUFF

20

c,

EB

C,

06

c,

JSR

WAIT

C6

c,

IF

C,

DEC

COUNT

DO

c,

EF

C,

BNE

-17

A9

c,

00

c,

LDA

#00

8D

c,

01

c,

D3

C,

STA

PORTB

20

c,

EB

c,

06

C,

JSR

WAIT

20

c,

EB

c,

06

C,

JSR

WAIT

AO

c,

01

c,

LDY

#01

— >

SMUDGE

S232 cntd ef )

( SCREENPRINT ef)

0 0

Post a comment

  • Receive news updates via email from this site