; ; JR-IDE Project ; - (c) 2020 Alan Hightower ; ; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . ; include "jride.inc" DGROUP group _BIOSSEG,_TEXT,_CSUM _BIOSSEG segment public use16 'CODE' ; Few publics so symbols show up in map file public _bios_entry public _bios_start extrn print_char : near extrn print_string : near extrn print_dec : near assume cs:_BIOSSEG, ds:nothing, es:nothing org 0 ; ------------------------------- ; ----- Start of Option ROM ----- ; ------------------------------- ; BIOS Pre-amble bytes db 0x55 db 0xaa ; Number of 512 blocks included in check-sum db 29 ; 14.5 KB _bios_entry: jmp _bios_start db 0x00 ; Signature Magic db 0x23, 0x83, 0xa8, 0x51 version: db "2020-04-16", 0, 0 org 020h banner: db LF, "PCjr jrIDE BIOS version ", 0 website: db " (http://www.brutman.com/PCjr)", CR, LF, 0 CRLFMsg: db CR, LF, 0 ; Option BIOS code start _bios_start: push es push ds push ax push cx push di mov ax, cs mov ds, ax mov es, ax mov ax, 3 ; 80x25 text mode int 10h ; set video mode mov cx, JRIDE_SCRATCH_END mov di, JRIDE_SCRATCH_RAM sub cx, di xor ax, ax ; Clear drive parameter tables rep stosb ; & transient variables mov word ptr cs:[JRIDE_BOOT_MAGIC + 0], JRIDE_BOOT_MAGIC_LO mov word ptr cs:[JRIDE_BOOT_MAGIC + 2], JRIDE_BOOT_MAGIC_HI ; Announcement text mov si, banner call print_string mov si, version call print_string mov si, website call print_string ; Choose a flash remap segment that isn't our CS mov ax, cs cmp ax, 0c000h je alt_remap mov word ptr cs:[JDA_REMAP_SEGMENT], 0c000h alt_remap: mov word ptr cs:[JDA_REMAP_SEGMENT], 0c400h call displayMEM xor ax, ax mov ds, ax ; ds -> vector table base (0x00000) cli sti ; Clear virtual remap order and drive count. ; This scheme should allow future support for multiple ; hard drive BIOSs (SCSI) by adding an int 13h poll ; check here first. mov byte ptr cs:[JDA_DRIVE_COUNT], 0 mov byte ptr cs:[JDA_DRIVE0_INDEX], 0 mov byte ptr cs:[JDA_DRIVE1_INDEX], 0 mov byte ptr cs:[JDA_DRIVE2_INDEX], 0 bios_done: pop di pop cx pop ax pop ds pop es retf memSizeMsg: db "Base memory: ", 0 memSizeMsg2: db " Total memory: ", 0 displayMEM proc near public push ds mov ax, 40h ; BIOS Data Area (BDA) mov ds, ax mov si, memSizeMsg call print_string mov ax, ds:[BDA_MEMORY_SIZE] call print_dec mov si, memSizeMsg2 call print_string mov ax, 736 mov ds:[BDA_ADAPTER_MEMORY], ax mov ds:[BDA_MEMORY_SIZE], ax call print_dec mov si, CRLFMsg call print_string pop ds ret displayMEM endp driveMsg: db CR, LF, "Drive ", 0 printDriveNum proc near public push ax mov di, driveMsg call print_string mov al, cs:[JDA_DRIVE_COUNT] add al, '0' call print_char mov al, ':' call print_char pop ax ret printDriveNum endp _BIOSSEG ends ; Reserve the checksum byte at the end of the image _CSUM segment public 'CSUM' db 0xff _CSUM ends end