Skip to content

Commit 220ecc5

Browse files
committed
cleanup and docs
1 parent 6448c4a commit 220ecc5

14 files changed

+205
-139
lines changed

README.md

+21-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# 80188 single board modular computer
22

3-
v.0.1.0
3+
* testing and firmware development: r1
4+
* hardware development: r2
5+
6+
## Configuration
7+
8+
* 8MHz 8086-compatible CPU
9+
* 128KB low SRAM
10+
* 256KB EEPROM (27C020) or Flash (SST39SF020) with in-system programming and software programming capabilities
11+
* PC/104-compatible with 8-bit ISA bus
12+
- 80188 Timer A is routed to OSC
13+
* Dual channel 16550-compatible UART
14+
- FTDI USB-Serial/6-pin connector on port A
15+
- 5V 9pin connector on port B
16+
* AT-compatible RTC
417

518
## References
619
* [Tandy 2000 BIOS](https://www.retrotronics.org/svn/t2kbios/)
@@ -9,11 +22,17 @@ v.0.1.0
922

1023
## Notes
1124

12-
### 0.1.0r1
25+
### r1
1326

1427
* minor: SYSBUS socket is too close to the CPU socket and can'tbe used with the wide connector
1528
* minor: 16V8 /OE and GND pin names were swapped
1629
* minor: UART1 labels are wrong
1730
* major: 74x573 OE should be /OE
1831
* major: 16V8 /RESET can't be used as input
32+
* major: PLCC sockets are unreliable
1933
* unknown: 22V10 Verification failed at address 0x16C5: File=0x01, Device=0x00
34+
* feature: added in-system programming
35+
* major: 39x flash doesn't work as /PGM is floating
36+
37+
### r0
38+
* major: PCB socket is unreliable

fw/8250.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ _serial_puts:
100100
%macro _serial_puts 1
101101
mov bx, %1
102102
%%loop:
103-
mov al,[ds:bx]
103+
mov al, [ds:bx]
104104
cmp al, 0
105105
jz %%end
106106
mov cl, al

fw/Makefile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
sources = reset.S monitor.S
2+
targets = fw.bin debug.txt
3+
4+
all: $(targets)
25

36
# firmware
47
fw.bin: $(sources:.S=)
@@ -14,16 +17,19 @@ reset.sym: reset
1417
grep -f reset.glob reset.map | \
1518
awk 'BEGIN{print ";; autogenerated"}{print $$3,"equ","0x"$$1}' > $@
1619

20+
debug.txt: reset
21+
grep -e '^\s*say_what' -e '^[a-z_\.]*:$$' reset.S > $@
22+
1723
# assembly
1824
%: %.S
1925
nasm $< -o $@
2026

2127
clean:
22-
rm -f fw.bin $(sources:.S=.d) $(sources:.S=) reset.o reset.glob reset.map
28+
rm -f $(targets) $(sources:.S=.d) $(sources:.S=) reset.o reset.glob reset.map
2329

2430
# deps
2531
%.d: %.S
2632
nasm -M $^ > $@
2733
include $(sources:.S=.d)
2834

29-
.PHONY: clean
35+
.PHONY: all clean

fw/debug.txt

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
_mon:
2+
_putch:
3+
_getch:
4+
_setup:
5+
say_what 0xb007 ; jumped to the setup code
6+
say_what 0xb105
7+
_soc_failure:
8+
say_what 0xdead
9+
_soc_passed:
10+
say_what 0xc0de
11+
_set_mem:
12+
_set_pcs:
13+
_test_setup_rom:
14+
.loop:
15+
.check:
16+
.rom_failure:
17+
say_what 0x0bad
18+
.end:
19+
say_what bx ; checksum
20+
say_what 0x1337 ; rom check passed
21+
_set_sp:
22+
say_what ss ; 0x1000
23+
say_what sp ; 0xffff
24+
_test_ram_words:
25+
say_what si ; ram test address
26+
say_what cx ; ram test value to write
27+
say_what bx ; ram test value readback
28+
.ram_failure:
29+
.halt:
30+
say_what 0x2bad
31+
.end:
32+
say_what 0xcafe ; memory test passed
33+
_init_serial:
34+
_print_version:
35+
.loop:
36+
_finish:
37+
_restart:

fw/fw.bin

0 Bytes
Binary file not shown.

fw/monitor.S

-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ segment .text start=0xc0000 align=256
99
; 256k flash monitor entry point
1010
_mon:
1111
jmp _mon
12-
1312
_echo:
1413
call 0xf000:(_getch & 0xffff)
15-
mov cx,ax
1614
call 0xf000:(_putch & 0xffff)
1715
jmp _echo

fw/reset.S

+66-84
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,33 @@ GLOBAL UMCS, LMCS, PACS, MMCS, MPCS, MAXRAM, _restart, _putch, _getch, _version
2020
%include "amd80c188.inc"
2121
%include "platform.inc"
2222

23-
; uncomment for the full ram image
24-
; org 0x0
2523

26-
27-
segment .text start=0xc0000 align=256
24+
segment .stub start=0xc0000 align=256
2825
; 256k flash monitor stub
2926
_mon:
3027
jmp _mon
3128

3229

30+
segment .text start=0xf0000 align=256
31+
; BIOS functions
32+
_putch:
33+
;; write the content of BL over serial, blocking
34+
push ax
35+
push dx
36+
37+
_serial_putch bx
38+
39+
pop dx
40+
pop ax
41+
retf
42+
43+
_getch:
44+
push dx
45+
pop dx
46+
retf
47+
48+
49+
3350
segment .data start=0xffc00 align=256
3451
; platform constants in ROM space
3552
; useful to read/change parameters
@@ -41,12 +58,11 @@ MMCS: dw 0x0000 ; not handled yet
4158
MPCS: dw MPCS_DEF
4259
MAXRAM: dw 0x80 ; in KB
4360

61+
4462
segment .setup start=0xffd00 progbits
4563
; main setup code
46-
4764
_setup:
48-
;; entry point
49-
say_what 0xb007
65+
say_what 0xb007 ; jumped to the setup code
5066

5167

5268
;; proper init
@@ -79,39 +95,22 @@ _soc_passed:
7995
say_what 0xc0de
8096

8197
_set_mem:
82-
mov ax,0xf000
83-
mov ds,ax
84-
mov dx,UMCS_REG
85-
mov ax,[ds:UMCS]
86-
out dx,ax
87-
mov dx,LMCS_REG
88-
mov ax,[ds:LMCS]
89-
out dx,ax
98+
mov ax, 0xf000
99+
mov ds, ax
100+
mov dx, UMCS_REG
101+
mov ax, [ds:UMCS]
102+
out dx, ax
103+
mov dx, LMCS_REG
104+
mov ax, [ds:LMCS]
105+
out dx, ax
90106

91107
_set_pcs:
92-
mov dx,PACS_REG
93-
mov ax,[ds:PACS]
94-
out dx,ax
95-
mov dx,MPCS_REG
96-
mov ax,[ds:MPCS]
97-
out dx,ax
98-
99-
;_set_sp:
100-
; ;; ss = (((0x80 - 1) >> 6) << 12)
101-
; ;; sp = (0x80 << 10) - 1
102-
; mov ax, [ds:MAXRAM]
103-
; dec ax
104-
; shr ax, 6
105-
; shl ax, 12
106-
; mov ss, ax
107-
;
108-
; mov ax, [ds:MAXRAM]
109-
; shl ax, 10
110-
; dec ax
111-
; mov sp, ax
112-
;
113-
; say_what 0x1337
114-
108+
mov dx, PACS_REG
109+
mov ax, [ds:PACS]
110+
out dx, ax
111+
mov dx, MPCS_REG
112+
mov ax, [ds:MPCS]
113+
out dx, ax
115114

116115
_test_setup_rom:
117116
mov si, 0xfd00
@@ -123,32 +122,47 @@ _test_setup_rom:
123122
inc si
124123
loop .loop
125124
.check:
126-
mov ax,[ds:SETUPSUM16]
125+
mov ax, [ds:SETUPSUM16]
127126
cmp ax, bx
128127
jne .rom_failure
129128
jmp .end
130129
.rom_failure:
131130
say_what 0x0bad
132131
jmp .rom_failure
133132
.end:
134-
say_what bx
135-
say_what 0x1337
133+
say_what bx ; checksum
134+
say_what 0x1337 ; rom check passed
135+
136+
137+
_set_sp:
138+
;; ss = (((0x80 - 1) >> 6) << 12)
139+
;; sp = (0x80 << 10) - 1
140+
mov ax, [ds:MAXRAM]
141+
dec ax
142+
shr ax, 6
143+
shl ax, 12
144+
mov ss, ax
145+
say_what ss ; 0x1000
146+
147+
mov ax, [ds:MAXRAM]
148+
shl ax, 10
149+
dec ax
150+
mov sp, ax
151+
say_what sp ; 0xffff
136152

137153

138154
_test_ram_words:
139155
mov ax, 0x0
140156
mov es, ax
141157
mov si, 0x1234
142158
mov cx, 0xabcd
143-
say_what si
144-
say_what cx
145-
;; went past here
146-
mov [es:si],cx
147-
mov [es:si],cx
148-
mov bx,0x0
149-
mov bx,[es:si]
159+
say_what si ; ram test address
160+
say_what cx ; ram test value to write
161+
mov [es:si], cx
162+
mov bx, 0x0
163+
mov bx, [es:si]
164+
say_what bx ; ram test value readback
150165
cmp bx, cx
151-
say_what bx
152166
jne .ram_failure
153167
jmp .end
154168

@@ -157,7 +171,7 @@ _test_ram_words:
157171
say_what 0x2bad
158172
jmp .halt
159173
.end:
160-
say_what 0xcafe
174+
say_what 0xcafe ; memory test passed
161175

162176

163177
_init_serial:
@@ -166,7 +180,7 @@ _print_version:
166180
mov dx, UART_THR
167181
mov bx, _version
168182
.loop:
169-
mov al,[ds:bx]
183+
mov al, [ds:bx]
170184
cmp al, 0
171185
jz .end
172186
out dx, al
@@ -178,44 +192,12 @@ _print_version:
178192

179193
_finish:
180194
_serial_puts _ok
195+
sti
181196
jmp 0xc000:_mon
182197

183198
; text constants
184199

185200
_ok: db "OK",0x0a,0x0
186-
;_bad: db "failed",0x0a,0x0
187-
188-
189-
; BIOS functions
190-
_putch:
191-
; push ax
192-
; push dx
193-
;
194-
; _serial_putch cx
195-
;
196-
; pop dx
197-
; pop ax
198-
; retf
199-
;
200-
_getch:
201-
; push dx
202-
;
203-
; mov dx, I8251_C
204-
; mov al, 0x34 ; RTS, Reset Error Flag, RX
205-
; out dx, al
206-
;
207-
;.wait_ready: in al, dx
208-
; and al, 0x02 ; RXRDY
209-
; jz .wait_ready
210-
; mov al, 0x10 ; Reset Error Flag
211-
; out dx, al
212-
;
213-
; mov dx,I8251_D
214-
; in al, dx
215-
;
216-
; xor ah, ah
217-
; pop dx
218-
; retf
219201

220202

221203
segment .restart start=0xffff0 progbits

0 commit comments

Comments
 (0)