Atari Portfolio as a Linux-Terminal
Assemble APTerm.com on LINUX.
You need the assembler program apterm.s and the Linux assembler 'as'.
The terminalprogramm APTerm.com as a assembler program (apterm.s)
#-----------------------------------------------
# apterm.s
# Terminalprogram for Atari Portfolio
# 15.3.1998
#-----------------------------------------------
.code16 # generate 16-Bit code
_main:
#-----------------------------------------------
# procedure: read keyboard
L_READ_KEYBOARD:
.align 2,0x90
MOV $0x02,%AH # prepare read keyboard
INT $0x16
# Check if Shift left and right pressed
ANDB $0x03,%AL # clear bit 2-7
CMPB $0x03,%AL # bit 0 high and bit 1 high ?
JE L_EXIT # jump to the end of the program
# Check: is a char available?
MOV $0x01,%AH
INT $0x16
# if no char available: goto 'read serial port'
JZ L_READ_SERIAL_PORT
# if char available: get char (in AL)
MOV $0x00,%AH
INT $0x16
# send char (from AL) to serial port
MOV $0x01,%AH
INT $0x14
# goto 'read keyboard'
JMP L_READ_KEYBOARD
#-----------------------------------------------
# procedure: read serial port
L_READ_SERIAL_PORT:
.align 2,0x90
# insert two NOPs
NOP
NOP
# is a char in the serial port buffer ?
MOV $0x02,%AH
MOV $0x00,%DH
MOV $0x00,%DL
INT $0x14
# if there is no char: goto 'read keyboard'
ROL %AH
JB L_READ_KEYBOARD
# if there is a char: display it on the screen
MOV $0x0E,%AH
MOV $0x00,%BL
INT $0x10
# goto 'read keyboard'
JMP L_READ_KEYBOARD
#-----------------------------------------------
# Return to DOS
L_EXIT:
.align 2,0x90
# Call DOS-interrupt for exit the program
MOVB $0x4C,%AH
INT $0x21
# Ctrl-Z terminates the copy function
# on the Atari Portfolio
.align 2,0x90
.ascii "X1A"
LINUX: Assemble it with the shell script apt.sh:
#!/bin/sh
#
# assemble apterm.s and display the s-record file
# and the hexcode
# assemble apterm.s
as -a apterm.s -o tmp.o
# remove relocation and symbol information
objcopy -S tmp.o
# create a S-record file
objcopy -O srec tmp.o
echo "S-record file:"
cat tmp.o
# translate it back to a binary file (and ignore the warning)
objcopy -O binary tmp.o apterm.com 2> /dev/null
# delete the file tmp.o
rm tmp.o
# display the hexcode of apterm
echo "Hexcode of apterm.com:"
od -txC -Ax apterm.com
echo "Ok"
And you got the executable file apterm.com.The terminalprogramm APTerm.com (53 Bytes)
Here is the S-record file and the hexdump of apterm.com.
You can use it for the check of the apterm.com program.S-Record:
S00B00007374613030373331B1
S1180000B402CD1624033C037426B401CD16740AB400CD16B4ED
S118001501CD14EBE69090B402B600B200CD14D0C472D8B40E60
S10E002AB300CD10EBD0B44CCD211A74
S9030000FC
Hexdump:
000000 b4 02 cd 16 24 03 3c 03 74 26 b4 01 cd 16 74 0a
000010 b4 00 cd 16 b4 01 cd 14 eb e6 90 90 b4 02 b6 00
000020 b2 00 cd 14 d0 c4 72 d8 b4 0e b3 00 cd 10 eb d0
000030 b4 4c cd 21 1a
000035
Go to
[ Index ]
[ Minux ]
[ Program ]
[ Link ]
Questions ? Mail addresses are on the
contact page.
File: apterm_l.htm Last update: Thu Jul 3 08:40:10 2003