1 ; Virtual Ports for the BIOS Interaction
3 ; Copyright (C) 2010 Leo C.
5 ; This file is part of avrcpm.
7 ; avrcpm is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; avrcpm is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
25 ; Port Direction Function
27 ;-------------------------------------------------------------------------
28 ;00 0 in - Con status.
29 ; Returns 0xFF if the UART has a byte, 0 otherwise.
30 ;01 1 in/out - Console input, aka UDR. / Console Output
31 ;02 2 out - Console Output (deprecated)
32 ;03 3 in - "UART" status: bit 0 = rx, bit 1 = tx
33 ;04 4 in - "UART" data register, no wait
35 ;0D,0E 13,14 in/out - Set address of Bios Controll Block
36 ;0F 15 in/out - Disk select
37 ;10,11 16,17 in/out - Track select
38 ;12,13 18,19 in/out - Sector select
39 ;14,15 20,21 in/out - Write addr
41 ;16 22 out - Trigger disk i/o operations
42 ; Bit 7 = 1: Read sector
43 ; Bit 6 = 1: Write sector
44 ; Bit 5 = 1: BIOS WBOOT
45 ; Bit 4 = 1: BIOS Home
46 ; Only one of bits 4..7 may be set.
47 ; If Write function (bit 6=1):
48 ; Bits 0..2: 0 - write to allocated
49 ; 1 - write to directory
50 ; 2 - write unallocated
51 ; 3 - write to directory
53 ;16 22 in - Result of last read/write operation.
54 ; 0x00 = ok, 0xff = error (--> Bad Sector)
56 ;40 64-71 in/out - Timer/Clock controll.
60 ; ---------------------------------------------- Start of Code Segment
63 .db 00,1 ;Port 0, length 1
69 .db 02,1 ;Port 2 (old console output)
71 .dw uartputc ; deprecated
79 .db 13,9 ; Port 13-21, (lenth 9)
91 ;---------------------------------------------------------------------
93 ;Called with port in temp2 and value in temp.
98 ;Called with port in temp2. Should return value in temp.
105 brne dvp_1 ;don't debug console status
111 printstring "Port In: "
114 printstring "Port Out: "
127 breq vprw_exit ;no more ports
130 sub temp3,_tmp0 ;base port
131 brcs vprw_next ;port # too high
132 cp temp3,temp4 ;may be in range
134 vprw_next: ;port # not in range, test next block.
147 printstring ", exec: "
150 printstring ", rel port: "
155 printstring ", val: "
164 ijmp ; relative port # in temp3
170 ; trap for nonexistent port?
172 printstring ", not found!"
217 printstring "Debug: "
222 ;---------------------------------------------------------------------
223 ; vim:set ts=8 noet nowrap