2019-10-28 11:49:42 +01:00
|
|
|
ORG BIOS
|
2019-10-25 01:11:19 +02:00
|
|
|
CPU 8086
|
|
|
|
|
2019-10-27 19:59:42 +01:00
|
|
|
DISKCX: EQU 0x8
|
|
|
|
DISKDX: EQU 0xA
|
|
|
|
DISKBX: EQU 0xC
|
2019-10-25 01:11:19 +02:00
|
|
|
|
|
|
|
JMP NEAR BOOT
|
|
|
|
JMP NEAR WBOOT
|
|
|
|
JMP NEAR CONST
|
|
|
|
JMP NEAR CONIN
|
|
|
|
JMP NEAR CONOUT
|
|
|
|
JMP NEAR LIST
|
|
|
|
JMP NEAR PUNCH
|
|
|
|
JMP NEAR READER
|
|
|
|
JMP NEAR HOME
|
|
|
|
JMP NEAR SELDSK
|
|
|
|
JMP NEAR SETTRK
|
|
|
|
JMP NEAR SETSEC
|
|
|
|
JMP NEAR SETDMA
|
|
|
|
JMP NEAR READ
|
|
|
|
JMP NEAR WRITE
|
|
|
|
JMP NEAR LISTST
|
|
|
|
|
|
|
|
BOOT:
|
2019-10-28 11:38:18 +01:00
|
|
|
MOV AL, 0x86
|
2019-10-25 15:09:53 +02:00
|
|
|
CALL MSG
|
2019-10-28 11:38:18 +01:00
|
|
|
DB "BIOS", 0
|
2019-10-25 01:11:19 +02:00
|
|
|
|
|
|
|
WBOOT:
|
2019-10-29 12:08:11 +01:00
|
|
|
XOR CX, CX
|
2019-10-28 11:49:42 +01:00
|
|
|
JMP BDOS
|
2019-10-25 01:11:19 +02:00
|
|
|
RET
|
|
|
|
|
|
|
|
; CHAR I/O
|
|
|
|
CONST:
|
|
|
|
MOV AH, 1
|
|
|
|
INT 0x16
|
|
|
|
JZ .END
|
|
|
|
MOV AL, 0xFF
|
|
|
|
RET
|
|
|
|
.END:
|
|
|
|
XOR AL, AL
|
|
|
|
RET
|
|
|
|
|
|
|
|
CONIN:
|
|
|
|
XOR AX, AX
|
|
|
|
INT 0x16
|
|
|
|
TEST AL, AL
|
|
|
|
JZ CONIN
|
|
|
|
RET
|
|
|
|
|
2019-10-25 15:09:53 +02:00
|
|
|
MSG:
|
|
|
|
POP SI
|
|
|
|
.LOOP:
|
|
|
|
MOV DL, BYTE [SI]
|
|
|
|
INC SI
|
|
|
|
TEST DL, DL
|
|
|
|
JZ .END
|
|
|
|
CALL CONOUT
|
|
|
|
JMP .LOOP
|
|
|
|
.END:
|
|
|
|
MOV DL, 0x20
|
|
|
|
CALL CONOUT
|
|
|
|
CALL PRINTAL
|
|
|
|
MOV DL, 0x0A
|
|
|
|
CALL CONOUT
|
|
|
|
MOV DL, 0x0D
|
|
|
|
CALL CONOUT
|
|
|
|
PUSH SI
|
|
|
|
RET
|
|
|
|
|
|
|
|
PRINTAL:
|
|
|
|
PUSH AX
|
|
|
|
PUSH DX
|
|
|
|
AAM 16
|
|
|
|
MOV DL, AH
|
|
|
|
CALL PRINTNIB
|
|
|
|
MOV DL, AL
|
|
|
|
CALL PRINTNIB
|
|
|
|
POP DX
|
|
|
|
POP AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
PRINTNIB:
|
|
|
|
ADD DL, 0x30
|
|
|
|
CMP DL, 0x3a
|
|
|
|
JL CONOUT
|
|
|
|
ADD DL, 0x07
|
|
|
|
|
2019-10-25 01:11:19 +02:00
|
|
|
CONOUT:
|
|
|
|
PUSH AX
|
|
|
|
PUSH BX
|
|
|
|
MOV AH, 0x0E
|
|
|
|
MOV AL, DL
|
|
|
|
XOR BX, BX
|
|
|
|
INT 0x10
|
|
|
|
POP BX
|
|
|
|
POP AX
|
|
|
|
RET
|
|
|
|
|
|
|
|
LIST:
|
|
|
|
PUSH DX
|
|
|
|
XOR AH, AH
|
|
|
|
MOV AL, DL
|
|
|
|
INT 0x17
|
|
|
|
POP DX
|
|
|
|
RET
|
|
|
|
|
|
|
|
LISTST:
|
|
|
|
STC
|
|
|
|
RET
|
|
|
|
|
|
|
|
PUNCH:
|
|
|
|
STC
|
|
|
|
RET
|
|
|
|
|
|
|
|
READER:
|
|
|
|
STC
|
|
|
|
RET
|
|
|
|
|
|
|
|
; DISK I/O
|
|
|
|
HOME:
|
|
|
|
RET
|
|
|
|
|
|
|
|
SELDSK:
|
2019-10-25 15:09:53 +02:00
|
|
|
MOV BYTE [DISKDX], CL
|
2019-10-25 01:11:19 +02:00
|
|
|
XOR BX, BX
|
|
|
|
RET
|
|
|
|
|
|
|
|
SETTRK:
|
|
|
|
PUSH CX
|
|
|
|
PUSH DX
|
|
|
|
|
|
|
|
MOV DX, CX
|
|
|
|
; CH for headnum, CL for SAL
|
|
|
|
MOV CX, 0x0006
|
|
|
|
|
|
|
|
; Take off LSB as head number
|
|
|
|
XOR CH, CH
|
|
|
|
RCR DX, 1
|
|
|
|
RCL CH, 1
|
2019-10-25 15:09:53 +02:00
|
|
|
MOV BYTE [DISKDX+1], CH
|
2019-10-25 01:11:19 +02:00
|
|
|
|
|
|
|
; DX is sector number now
|
|
|
|
; Shift into format for int13
|
|
|
|
; DX ------9876543210
|
|
|
|
SAL DX, CL
|
|
|
|
; DX 9876543210------
|
|
|
|
ROL DX, 1
|
|
|
|
ROL DX, 1
|
|
|
|
; DX 76543210------98
|
|
|
|
SAL DL, CL
|
|
|
|
; DX 7654321098------
|
|
|
|
AND WORD [DISKCX], 0x003F
|
|
|
|
OR WORD [DISKCX], DX
|
|
|
|
|
|
|
|
POP DX
|
|
|
|
POP CX
|
|
|
|
RET
|
|
|
|
|
|
|
|
SETSEC:
|
2019-10-25 15:09:53 +02:00
|
|
|
AND WORD [DISKCX], 0xFFA0
|
|
|
|
OR BYTE [DISKCX], CL
|
2019-10-25 01:11:19 +02:00
|
|
|
RET
|
|
|
|
|
|
|
|
SETDMA:
|
|
|
|
MOV WORD [DISKBX], CX
|
|
|
|
RET
|
|
|
|
|
|
|
|
READ:
|
2019-10-25 15:09:53 +02:00
|
|
|
PUSH CX
|
|
|
|
PUSH DX
|
|
|
|
PUSH BX
|
|
|
|
|
|
|
|
MOV AX, 0x0201
|
|
|
|
MOV CX, [DISKCX]
|
|
|
|
MOV DX, [DISKDX]
|
|
|
|
MOV BX, [DISKBX]
|
|
|
|
INT 0x13
|
|
|
|
XCHG AH, AL
|
|
|
|
|
|
|
|
POP BX
|
|
|
|
POP DX
|
|
|
|
POP CX
|
|
|
|
|
|
|
|
JC DISKERR
|
2019-10-25 01:11:19 +02:00
|
|
|
RET
|
|
|
|
|
|
|
|
WRITE:
|
2019-10-25 15:09:53 +02:00
|
|
|
PUSH CX
|
|
|
|
PUSH DX
|
|
|
|
PUSH BX
|
|
|
|
|
|
|
|
MOV AX, 0x0301
|
|
|
|
MOV CX, [DISKCX]
|
|
|
|
MOV DX, [DISKDX]
|
|
|
|
MOV BX, [DISKBX]
|
|
|
|
INT 0x13
|
|
|
|
XCHG AH, AL
|
|
|
|
|
|
|
|
POP BX
|
|
|
|
POP DX
|
|
|
|
POP CX
|
|
|
|
|
|
|
|
JC DISKERR
|
2019-10-25 01:11:19 +02:00
|
|
|
RET
|
|
|
|
|
2019-10-25 15:09:53 +02:00
|
|
|
DISKERR:
|
|
|
|
PUSHF
|
|
|
|
PUSH SI
|
|
|
|
CALL MSG
|
|
|
|
DB "DISKERR", 0
|
|
|
|
POP SI
|
|
|
|
POPF
|
2019-10-25 01:11:19 +02:00
|
|
|
RET
|