File tree 14 files changed +265
-74
lines changed
14 files changed +265
-74
lines changed Original file line number Diff line number Diff line change 1
1
.DS_Store
2
2
fp-info-cache
3
- * .d
4
- fw /reset
5
3
* .swp
6
4
* .bak
5
+
6
+ fw /* .d
7
+ fw /* .gen
8
+ fw /* .o
9
+ fw /* .glob
10
+ fw /reset
11
+ fw /monitor
12
+
13
+ gal /* .chp
14
+ gal /* .fus
15
+ gal /* .pin
Original file line number Diff line number Diff line change
1
+ [submodule "gal/GALasm "]
2
+ path = gal/GALasm
3
+ url = https://github.com/daveho/GALasm
Original file line number Diff line number Diff line change
1
+ all :
2
+ make -C fw
3
+
4
+ .PHONY : all
Original file line number Diff line number Diff line change 1
- # 80188 single board computer
1
+ # 80188 single board modular computer
2
2
3
- v.0.0.7
3
+ v.0.0.11
4
4
5
5
## References
6
6
* [ Tandy 2000 BIOS] ( https://www.retrotronics.org/svn/t2kbios/ )
7
+ * AMD 80C186/80C188 Preliminary
8
+ * Intel 80C186EA/80C188EA Microprocessor User's Manual
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- sources = reset.S
1
+ sources = reset.S monitor.S
2
2
3
- # final build
4
- fw.bin : reset
5
- cp $< $@
3
+ # firmware
4
+ fw.bin : $(sources:.S= )
5
+ dd if=reset of=$@ .gen bs=1024 skip=255 seek=255
6
+ dd if=monitor of=$@ .gen bs=1024 conv=notrunc
7
+ mv $@ .gen $@
8
+
9
+ # exports symbols as constants
10
+ reset.sym : reset
11
+ nasm -DNOMAP -f elf reset.S
12
+ objdump -t reset.o | awk ' ($$2 == "g"){print $$5}' > reset.glob
13
+ grep -f reset.glob reset.map | \
14
+ awk ' BEGIN{print ";; autogenerated"}{print $$3,"equ","0x"$$1}' > $@
6
15
7
16
# assembly
8
17
% : % .S
9
18
nasm $< -o $@
10
19
11
20
clean :
12
- rm -f fw.bin reset $(sources:.S=.d )
21
+ rm -f fw.bin $(sources:.S=.d ) $( sources:.S= )
13
22
14
23
# deps
15
24
% .d : % .S
Original file line number Diff line number Diff line change
1
+ ;; AMD 80C188
2
+ ;; partially compatible with Intel 80188
3
+
4
+ RELREG_REG equ 0xfffe
5
+ RELREG_DEF equ 0x00ff
6
+
7
+ UMCS_REG equ 0xffa0
8
+ LMCS_REG equ 0xffa2
9
+ PACS_REG equ 0xffa4
10
+ MMCS_REG equ 0xffa6
11
+ MPCS_REG equ 0xffa8
12
+
13
+ UMCS_256K_W3 equ 0xc03f
14
+ LMCS_128K_W3 equ 0x1fff
15
+
16
+ PACS_0x00000_W3 equ 0x3f
17
+ MMCS_DEF equ 0x21ff
18
+ MPCS_DEF equ 0xc0bf
19
+
20
+ TIMER0_MAXCNTA equ 0xff52
21
+ TIMER0_CON equ 0xff56
22
+
23
+ TIMER1_MAXCNTA equ 0xff5a
24
+ TIMER1_CON equ 0xff5e
Original file line number Diff line number Diff line change
1
+ CPU 186
2
+ USE16
3
+
4
+ %include "amd80c188.inc"
5
+ %include "platform.inc"
6
+ %include "reset.sym"
7
+
8
+ segment .bss
9
+
10
+ segment .text start= 0xc0000 align= 256
11
+ ; 256k flash monitor entry point
12
+ _mon:
13
+
14
+ say_wh at 0xc001
15
+ say_wh at 0x5afe
16
+ say_wh at 0xcafe
17
+
18
+ ;; and now just loop here
19
+ .nevermind:
20
+ jmp .nevermind
21
+
22
+
Original file line number Diff line number Diff line change 1
- UMCS_256K_W3 equ 0xc03f
2
- LMCS_128K_W3 equ 0x1fff
3
-
4
- ; base address will be be 0x0000
5
- ; pcs0 0x0000
6
- ; pcs1 0x0080
7
- ; pcs2 0x0100
8
- ; ...
9
- ; hex(int('0000' + bin(0x00000)[2:].zfill(20)[4:10] + '111' + bin(0x7)[2:], 2))
10
-
11
- ;PACS_0x00000_W3_TANDY equ 0x003e
12
- PACS_0x00000_W3 equ 0x3f
13
- ;MPCS_TANDY equ 0xc0be
14
- MMCS_DEF equ 0x21ff
15
- MPCS_DEF equ 0xc0bf
1
+ LMCS_STACK equ 0x1fff
16
2
17
3
I8251_D equ 0x0000
18
4
I8251_C equ 0x0002
19
- I8251_8n1_1x equ 0x4d ; 01 00 11 01
20
- I8251_8e2_1x equ 0xfd
5
+ I8251_8n1_1x equ 0x4d ; 01 00 11 01
6
+ I8251_8n1_16x equ 0x4e ; 01 00 11 10
7
+
8
+ BAUD_9600_16x equ 13
21
9
22
10
%macro say_wh at 1
23
11
;; destroys AX, DX
24
- mov dx , 0x220
25
- mov ax , % 1
26
- out dx , ax
12
+ mov dx , 0x220
13
+ mov ax , % 1
14
+ out dx , ax
15
+
16
+ %endmacro
27
17
18
+ %macro _baud_timer 1
19
+ ;; baud timer init
20
+ ;; destroys AX, DX
21
+ mov ax , % 1
22
+ mov dx , TIMER0_MAXCNTA
23
+ out dx , ax
24
+ mov ax , 0xc001 ; 1100000000000001
25
+ mov dx , TIMER0_CON
26
+ out dx , ax
28
27
%endmacro
29
28
30
29
%macro _serial_init 1
31
30
;; serial init
32
31
;; destroys AX, DX
33
- mov dx , I8251_C
34
- mov al , 0xff ; dummy
35
- out dx , al
32
+ mov dx , I8251_C
33
+ mov al , 0xff ; dummy
34
+ out dx , al
36
35
nop
37
36
nop
38
- mov al , 0x40 ; reset
39
- out dx , al
37
+ mov al , 0x40 ; reset
38
+ out dx , al
40
39
nop
41
40
nop
42
41
43
- mov al , % 1 ; mode
44
- out dx , al
42
+ mov al , % 1 ; mode
43
+ out dx , al
45
44
%endmacro
46
45
47
46
%macro _serial_put_ch 1
Original file line number Diff line number Diff line change 1
1
CPU 186
2
2
USE16
3
+ GLOBAL _restart
3
4
4
- %include "80188.inc"
5
+ %ifndef NOMAP
6
+ [map all reset.map]
7
+ %endif
8
+
9
+ %include "amd80c188.inc"
5
10
%include "platform.inc"
6
11
7
12
; uncomment for the full ram image
8
13
; org 0x0
9
14
10
-
11
- segment .bss
12
-
13
15
segment .text start= 0xc0000 align= 256
14
- ; 256k flash monitor
15
- mon:
16
-
17
- say_wh at 0xc001
18
- say_wh at 0x5afe
19
- say_wh at 0xcafe
20
- ;; and now just loop here
21
- .nevermind:
22
- jmp .nevermind
23
-
24
-
16
+ ; 256k flash monitor stub
17
+ _mon: jmp _mon
18
+
25
19
26
20
segment .data start= 0xffc00 align= 256
27
- ; platform constants in BIOS space
21
+ ; platform constants in ROM space
28
22
; useful to read/change parameters
29
23
UMCS: dw UMCS_256K_W3
30
24
LMCS: dw LMCS_128K_W3
31
25
PACS: dw PACS_0x00000_W3
32
- MMCS: dw MMCS_DEF
26
+ MMCS: dw 0x0000 ; not handled yet
33
27
MPCS: dw MPCS_DEF
34
28
35
29
segment .setup start= 0xffe00 progbits
36
30
; main setup code
37
31
38
- setup :
32
+ _setup :
39
33
;; entry point
40
34
say_wh at 0xb007
41
35
@@ -89,16 +83,19 @@ _set_pcs:
89
83
mov ax ,[ ds :MPCS ]
90
84
out dx , ax
91
85
92
- ; _set_sp:
93
- ; mov ax, 0x0
94
- ; mov ss, ax
95
- ; mov sp, 0x1000
86
+ _set_sp:
87
+ mov ax , 0x0
88
+ mov ss , ax
89
+ mov sp , LMCS_STACK
96
90
97
- _test_serial:
98
- _serial_init I8251_8n1_1x
91
+ _init_serial:
92
+ _baud_timer BAUD_9600_16x
93
+ _serial_init I8251_8n1_16x
99
94
nop
100
95
nop
101
96
97
+
98
+ _test_serial:
102
99
_serial_put_ch 0xaa
103
100
104
101
mov cx , 0xff
@@ -110,18 +107,17 @@ _finish:
110
107
say_wh at 0x7331
111
108
112
109
jmp _test_serial
113
- ;jmp 0xc000:mon
110
+ ;jmp 0xc000:_mon
114
111
115
112
116
113
segment .restart start= 0xffff0 progbits
117
114
; 80188 entrypoint
118
115
; CS = 0xffff
119
116
; we have only 15 bytes here, so just
120
117
; setting the cs and doing a "long jump"
121
- cli
122
- jmp 0xffe0 : 0
118
+ _restart: cli
119
+ jmp 0xffe0 : 0
123
120
124
121
; padding and version
125
- db 0x0 , 0x0
126
- db " V0.0.10"
127
-
122
+ db 0x0 , 0x0
123
+ db " V0.0.11"
You can’t perform that action at this time.
0 commit comments