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 |
—. |
-> | |||||
|
( 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)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post a comment