Skip to content

Commit ddfd7a8

Browse files
committed
add int17 to printer.
1 parent 4bb4134 commit ddfd7a8

File tree

5 files changed

+99
-4
lines changed

5 files changed

+99
-4
lines changed

printer/header.asm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ _sys_hdr_ label near
2828
dw 8000h
2929
dw Strategy_
3030
dw Interrupt_
31-
db 'P', 'R', 'N', ' ', ' ', ' ', ' ', ' '
31+
db 'L', 'P', 'T', '1', ' ', ' ', ' ', ' '
3232

3333
_SYS_HEADER ends
3434

printer/init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cmdFrame_t cmd;
3939
union REGS regs;
4040
extern void *config_env, *driver_end;
4141

42-
extern void setf5(void);
42+
extern void set17(void);
4343

4444
#pragma data_seg("_CODE")
4545

@@ -68,6 +68,8 @@ uint16_t Init_cmd(SYSREQ far *req)
6868
check_uart();
6969

7070
consolef("Installed\n");
71+
set17();
72+
consolef("INT 17 functions installed\n");
7173

7274
return OP_COMPLETE;
7375
}

printer/int17.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include <dos.h>
2+
#include <i86.h>
3+
#include <fujicom.h>
4+
#include <stdint.h>
5+
#include "print.h"
6+
#include "commands.h"
7+
8+
static cmdFrame_t _cmdFrame;
9+
10+
#pragma data_seg("_CODE")
11+
12+
/*
13+
* DL == direction
14+
* AL == device
15+
* AH == command
16+
* CL == aux1
17+
* CH == aux2
18+
* SI == aux34
19+
* ES:BX == far buffer pointer
20+
* DI == buffer length
21+
*/
22+
int int17(uint16_t direction, uint16_t cmdchar, uint16_t aux12, uint16_t aux34,
23+
void far *ptr, uint16_t length)
24+
#pragma aux int17 parm [dx] [ax] [cx] [si] [es bx] [di] value [ax]
25+
{
26+
int reply;
27+
unsigned char ah=cmdchar >> 8;
28+
unsigned char al=cmdchar & 0xFF;
29+
30+
_enable();
31+
32+
_cmdFrame.device = 0x40;
33+
_cmdFrame.comnd = 'W';
34+
35+
switch (ah)
36+
{
37+
case 0:
38+
fujicom_command_write(&_cmdFrame,&al,1);
39+
return 0;
40+
case 1:
41+
return 0;
42+
case 2:
43+
return 0;
44+
}
45+
46+
return 0;
47+
}
48+
49+
void set17(void)
50+
{
51+
extern void int17_vect();
52+
53+
_dos_setvect(0x17, MK_FP(getCS(), int17_vect));
54+
}

printer/iwrap.asm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
_TEXT segment word public 'CODE'
2+
extern int17_:near
3+
4+
; Macro to create an interrupt wrapper for a given C function
5+
INTERRUPT MACRO func
6+
PUBLIC func&vect_
7+
func&vect_ PROC NEAR
8+
push bx
9+
push cx
10+
push dx
11+
push si
12+
push di
13+
push bp
14+
push ds
15+
push es
16+
17+
; Set up data segment
18+
push cs
19+
pop ds
20+
21+
call func
22+
23+
pop es
24+
pop ds
25+
pop bp
26+
pop di
27+
pop si
28+
pop dx
29+
pop cx
30+
pop bx
31+
iret
32+
func&vect_ ENDP
33+
ENDM
34+
35+
INTERRUPT int17_
36+
37+
_TEXT ends
38+
39+
end

printer/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ LDFLAGS = &
1515
OPTION MAP, NODEFAULTLIBS &
1616
LIBPATH ../fujicom
1717

18-
CFILES = commands.c dispatch.c init.c print.c
19-
AFILES = header.asm
18+
CFILES = commands.c dispatch.c init.c print.c int17.c
19+
AFILES = header.asm iwrap.asm
2020
OBJS = $(CFILES:.c=.obj) $(AFILES:.asm=.obj)
2121

2222
$(TARGET): $(OBJS)

0 commit comments

Comments
 (0)