From a0f73360d1aa4e6a01adafebd51ae543bad20131 Mon Sep 17 00:00:00 2001 From: Porky Piggy <85091235+Piggy63@users.noreply.github.com> Date: Fri, 29 Mar 2024 11:36:06 +0000 Subject: [PATCH 1/2] Added .A86 to Assembly Added .A86 to the list of extensions for assembly language. .A86 was an extension used by 8086 assembly language source files. --- lib/linguist/languages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index bfe0ebe9cc..bd9f8dee57 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -412,6 +412,7 @@ Assembly: - nasm extensions: - ".asm" + - ".a86" - ".a51" - ".i" - ".inc" From 108e4e620ddf94fcc6f6dd1208f584a91e641bc6 Mon Sep 17 00:00:00 2001 From: Porky Piggy <85091235+Piggy63@users.noreply.github.com> Date: Wed, 3 Apr 2024 10:10:05 +0000 Subject: [PATCH 2/2] Added Sample .A86 Files Added 2 sample .A86 files, which are small enough. --- samples/Assembly/FDOS.A86 | 425 ++++++++++++++++++++++++++++++++++++ samples/Assembly/ROM.A86 | 442 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 867 insertions(+) create mode 100644 samples/Assembly/FDOS.A86 create mode 100644 samples/Assembly/ROM.A86 diff --git a/samples/Assembly/FDOS.A86 b/samples/Assembly/FDOS.A86 new file mode 100644 index 0000000000..0fa5a1f717 --- /dev/null +++ b/samples/Assembly/FDOS.A86 @@ -0,0 +1,425 @@ +title 'F_DOS - DOS file system' +; File : $FDOS.A86$ +; +; Description : +; +; Original Author : DIGITAL RESEARCH +; +; Last Edited By : $CALDERA$ +; +;-----------------------------------------------------------------------; +; Copyright Work of Caldera, Inc. All Rights Reserved. +; +; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, +; PROPRIETARY AND TRADE SECRET INFORMATION OF CALDERA, INC. +; ACCESS TO THIS WORK IS RESTRICTED TO (I) CALDERA, INC. EMPLOYEES +; WHO HAVE A NEED TO KNOW TO PERFORM TASKS WITHIN THE SCOPE OF +; THEIR ASSIGNMENTS AND (II) ENTITIES OTHER THAN CALDERA, INC. WHO +; HAVE ACCEPTED THE CALDERA OPENDOS SOURCE LICENSE OR OTHER CALDERA LICENSE +; AGREEMENTS. EXCEPT UNDER THE EXPRESS TERMS OF THE CALDERA LICENSE +; AGREEMENT NO PART OF THIS WORK MAY BE USED, PRACTICED, PERFORMED, +; COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED, ABRIDGED, +; CONDENSED, EXPANDED, COLLECTED, COMPILED, LINKED, RECAST, +; TRANSFORMED OR ADAPTED WITHOUT THE PRIOR WRITTEN CONSENT OF +; CALDERA, INC. ANY USE OR EXPLOITATION OF THIS WORK WITHOUT +; AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO CRIMINAL AND +; CIVIL LIABILITY. +;-----------------------------------------------------------------------; +; +; *** Current Edit History *** +; $Log$ +; FDOS.A86 1.23 93/12/15 03:07:08 +; New ddioif entry point so Int 25/26 bypasses address normalisation +; FDOS.A86 1.20 93/09/03 20:25:47 +; Add "no critical errors" support (int 21/6C) +; ENDLOG +; +; This is the DOS support function of Concurrent DOS 6.0 +; It is called via BDOS function #113, with DS:DX pointing +; to a parameter block. The first word of the parameter +; block is the subfunction number, the remainder are +; parameters or return values, depending on the function. + +; Date Who Modification +; --------- --- --------------------------------------- +; ?? Feb 86 Initial version +; 7 May 86 speedup MXdisk handling +; ?? Oct 86 used separate file handle & descriptors +; 5 Nov 86 combined with 5.1 BDOS; +; 7 Nov 86 added multiple file search +; 8 Nov 86 added open file checking +; 9 Nov 86 added lock/unlock code +; 14 Nov 86 converted to use new deblocking code +; 17 Nov 86 use RWXIOSIF code, select drive for flush +; 18 Nov 86 first attempt to support character devices +; on WRITE, CLOSE, LSEEK, DATTIM +; 19 Nov 86 some WRITE bugs fixed, MOVE implemented +; RMDIR redone locally (previously BLACK) +; 24 Nov 86 made changes for linked CDOS.CON +; 27 Nov 86 added FCB function entries for BLACK.A86 +; 30 Nov 86 added code to support FUNC13 (DRV_RESET) +; 3 Dec 86 added support for CHDIR ("l:=d:\path"); +; 16 Dec 86 update file time stamp on any write +; 23 Jan 86 added support for passwords +; 6 Feb 87 added support for IOCTL status +; 27 Feb 87 updated FCB r/w code to latest spec +; fixed FDOS_CREAT to truncate size to 0L +; 2 Mar 87 Changed FUNC62 to BDOS62 to avoid conflict +; with the linked PCMODE +; 7 Mar 87 changed MF_READ to 0-pad partial FCB records +; 17 Mar 87 fixed ES corruption in FCB_TERM code +; 29 Apr 87 Fixed CHDIR bug which failed to return an error when +; attempting to change to a filename. +; May 87 fixed some FCB bugs +; 19 May 87 changed password mode for FlexOS compatibility +; added IOCTL functions +; 4 Jun 87 zeroed current block on DOS FCB open +; 14 Jun 87 round up writes at end if > 1 sector and rt. fringe +; 19 Jun 87 supported freeing up floating drives +; 28 Jul 87 MX moved into individual funcs for DR NET support +; 29 Jul 87 WRITE_DEV moved to outside MXdisk +; 6 Aug 87 fix some password & partial close problems +; IOCTL(0) bug fixed +; 10 Aug 87 fixed CURDIR path too long problem +; 13 Aug 87 F1',F2' compatibility modes supported +; 20 Aug 87 LOCK_REGION fixed +; 5 Sep 87 lower case DOS FCBs converted to upper case +; 6 Sep 87 free up locked drives on process terminate +; 23 Sep 87 support \path1\path2\devname in DEVICE_ASCIZ: +; 28 Sep 87 use international upper case on ASCIZ paths +; 29 Sep 87 support IOCTL(4), IOCTL(5) +; 7 Oct 87 re-init dir entry on CREAT even if existing file +; return error if CURDIR can't find parent +; 8 Oct 87 don't release handles on disk change +; check OPEN_MAX and LOCK_MAX in SYSDAT +; 13 Oct 87 allow reduced F_OPEN if W,D password not supplied +; 22 Oct 87 support pseudo-networked drives via NET_VEC +; 26 Oct 87 use CBLOCK instead of HDSBLK for CP/M FCB check +; (can now CHDIR between F_OPEN and F_READ) +; 27 Oct 87 reject ".", ".." and " " names on MKDIR, CREAT, MKNEW +; 28 Oct 87 fixed OMODE_COMPAT compatibility checks, +; call SELECT_HANDLE in VFY_DOS_FCB to support +; FCB close after CHDIR +; 29 Oct 87 create label in root only, update VLDCNT in DPH +; delete label in root only, update VLDCNT in DPH +; also update VLDCNT in CREAT and UNLINK +; find labels in root if label only search +; 2 Nov 87 return ED_PATH if level doesn't exist in PATH_PREP +; reject "/path/" as legal ASCIZ specification +; 4 Nov 87 fix release_locks -- didn't work if any locks there +; test F6' on F_LOCK for file size check +; 10 Nov 87 fix F1' compatibility -- test 80h in P_CMOD +; support CREAT on file open in compatibility mode +; by the calling process +; 11 Nov 87 attempt to support multiple compatibility opens +; by several processes in read access mode or +; deny write/read access modes and still have the +; rest of the file sharing working... +; use PCM_ROUT as BIN flag for console handles +; 12 Nov 87 fix file sharing test on MF_OPEN (HM_FCB) +; fix DOS FCB rename of open file (WS 3.x) + +; 19 Nov 87 Release 6.0/2.0 +; --------- --------------- + +; 21 Nov 87 make NUL device first device in the list +; 1 Dec 87 various network fixes (dup, exec, exit, etc.) +; 2 Dec 87 implement DOS FCB calls across DR Net +; 3 Dec 87 fix CHECK_NOT_OPEN (CALL FILE_UPDATE) (fixes CB86) +; 4 Dec 87 pass drive on network FCB calls +; 7 Dec 87 supported FCB reads/writes across network (via handles) +; 10 Dec 87 fixed month dependant MKDIR bug. +; 11 Dec 87 fixed networked CURDIR bug (for SUBST) +; 5 Jan 88 don't delete labels via FDOS_UNLINK, +; don't access labels via FDOS_CHMOD +; 7 Jan 88 make NUL device first device in chain, in SYSDAT +; 12 Jan 88 setup MAKE_FLAG in FCB_MAKE_TEST +; 15 Jan 88 prevent SUBSTitution of networked drives +; 9 Feb 88 temporarily force door open interrupts +; add GET_FHND, FREE_FHND for dynamic handle create +; 10 Feb 88 update file size in DOS FCB for AutoCAD +; 15 Feb 88 update CUR_IFN in OPEN_HANDLE for MF_OPEN FCB setup +; 25 Feb 88 pass correct unit to driver on generic IOCTL request +; fix removable media check with DOS drivers +; 3 Mar 88 permit multiple compatibility mode opens +; 9 Mar 88 CHDIR ("d:=") always handled locally +; reject CHMOD on character devices +; use LUL_ALLOC for lock list allocation +; 10 Mar 88 Get PSP_XFNMAX before corrupting ES (RMCOBOL) +; 15 Mar 88 split file into three include files +; 28 Jul 88 Support PCMODE Private Device List +; 29 Jul 88 make PRN=LPT1, AUX=COM1 +; 27-Feb-89 change PID equate for CDOS, work around RASM bug +; ("PID equ RLR" would cause external ref's to PID!) +; 29-Jun-89 Split off IOCTL into seperate module +; 11-Sep-89 Split off MSNET into seperate module + + eject ! include i:psp.def + eject ! include i:modfunc.def + eject ! include i:fdos.equ + eject ! include rh.equ + eject ! include i:msdos.equ + eject ! include i:mserror.equ + eject ! include i:doshndl.def ; DOS Handle Structures + eject ! include i:driver.equ + eject ! include i:f52data.def ; DRDOS Structures + eject ! include bdos.equ + eject + +FD_EXPAND equ 55h + +PCMODE_DATA dseg + + extrn current_ddsc:dword + extrn current_device:dword + extrn current_dhndl:dword + extrn current_dsk:byte ; default drive + extrn current_ifn:word + extrn current_ldt:dword + extrn current_psp:word ; PSP segment + extrn dev_root:dword + extrn dma_offset:word ; DTA offset + extrn dma_segment:word ; DTA segment + extrn file_ptr:dword + extrn fdos_stub:dword + extrn internal_flag:byte + extrn ioexerr:byte + extrn join_drv:byte + extrn last_drv:byte + extrn ldt_ptr:dword ; Pointer to LDT's for the drives + extrn lock_tables:dword + extrn machine_id:word ; remote process + extrn name_buf:byte ; 32 byte name buffer + extrn nul_device:dword ; NUL in PCMODE data segment + extrn owning_psp:word ; remote PSP segment + extrn phys_drv:byte + extrn remote_call:word ; remote machine flag + extrn share_stub:dword + extrn srch_buf:byte + extrn pri_pathname:byte + extrn sec_pathname:byte + extrn temp_ldt:byte + extrn unlock_tables:dword + extrn WindowsHandleCheck:byte + extrn net_delay:word + +if KANJI + extrn DBCS_tbl:word ; Double Byte Character Table +endif + +BDOS_DATA dseg word + + extrn adrive:byte + extrn cur_dma:word + extrn cur_dma_seg:word + extrn mult_sec:word + extrn rwmode:byte + extrn valid_flg:byte + +NO_CRIT_ERRORS equ 0100$0000b ; critical error shouldn't be generated + ; warning - must match PCMODE.EQU + + extrn fdrwflg:byte + extrn chdblk:word + extrn dcnt:word + extrn dirp:word + extrn dirperclu:word + extrn finddfcb_mask:word + extrn hdsaddr:word + extrn intl_xlat:dword + extrn lastcl:word + extrn logical_drv:byte + extrn pblock:dword + extrn physical_drv:byte + extrn req_hdr:byte + + + extrn yearsSince1980:word + extrn month:byte + extrn dayOfMonth:byte + extrn hour:byte + extrn minute:byte + extrn second:byte + +orig_drive dw 0 +path_drive dw 0 + + + Public fdos_hds_blk, fdos_hds_root, fdos_hds_drv + +fdos_hds rw 0 ; temporary HDS that we make up +fdos_hds_blk dw 0 +fdos_hds_root dw 0 +fdos_hds_drv db 0 + +HDS_LEN equ offset $ - offset fdos_hds + +saved_hds rw 0 ; saved HDS on F_DOS rename +saved_hds_blk dw 0 +saved_hds_root dw 0 +saved_hds_drv db 0 + +saved_dcnt dw 0 ; saved DCNT on F_DOS rename + +dta_ofl db 0 ; non-zero if read/write > DTA size + +extflg dw 0 ; DOS FCB was extended FCB + +blk dw 0 ; temp variable for cluster # + +attributes db 0 ;fcb interface attributes hold byte + + public info_fcb +info_fcb rb 1+8+3 ;local user FCB drive+name+ext + +save_area rb 32 ;save area for dirbuf during rename and + ;info_fcb during create(mustbe_nolbl) + ;parental name during chdir + +; local variables for fdos operations + +sp_save dw 0 + +fdos_addr dw 0 ; address of F_DOS function + + Public fdos_info, fdos_pb, fdos_ret + +fdos_info rw 3 ; off, seg, size of parameter block +fdos_pb rw 7 ; copy of parameter block +fdos_ret dw 0 ; return value for function + +if PASSWORD +; Password support uses the following data stuctures: +; +; The global_password field is set by an IOCTL call and remains constant. +; +; When a password is encountered during parsing a path the ASCII form is +; copied into the password_buffer. It is then encrypted and stored in the +; local_password field. If a password protected file is encountered then +; it's encrypted password is compared with both the global and local passwords. +; +; During a file/directory create the local_password field is examnined. If +; non-zero then this encrypted password is applied to the file, which is given +; full protection. +; + Public global_password +global_password dw 0 +local_password dw 0 +password_buffer rb 8 + +endif + +eject +BDOS_CODE cseg + + + extrn pcmode_dseg:word ; Pointer to System Data Page + + extrn get_ldt:near + extrn get_ldt_raw:near + extrn islocal:near ; redirector support + extrn redir_asciiz_offer:near + extrn redir_asciiz_dev_offer:near + extrn redir_asciiz_file_offer:near + extrn redir_drv_offer:near + extrn redir_dhndl_offer:near + extrn redir_move_offer:near + extrn redir_snext_offer:near + + extrn alloc_cluster:NEAR + extrn allocdir:NEAR ; will extend subdirectory if full + extrn buffers_check:near + extrn discard_all:near + extrn close_dev:near ; close character device handle + extrn delfat:NEAR + extrn fdosrw:near ; read/write from/to disk file + extrn finddfcb:NEAR ; find next matching directory entry + extrn finddfcbf:NEAR ; find first matching directory entry + extrn first_dev:near ; find first matching character device + extrn fill_dirbuf:near + extrn flush_dirbuf:near + extrn flush_drive:near + extrn get_ddsc:near + extrn getdir:NEAR + extrn getnblk:NEAR + extrn hshdscrd:near ; discard hashing for drive AL + + extrn mark_ldt_unsure:near + extrn redir_build_path:near ; build ASCII path + + extrn open_dev:near ; open character device handle + extrn dup_dev:near ; call device driver on handle dup + extrn read_dev:near ; read from character device + extrn ReadTimeAndDate:near ; read date/time from CLOCK driver + extrn blockif:near + extrn ddioif:near + extrn select_logical_drv:near + extrn select_physical_drv:near + extrn setenddir:NEAR + extrn update_dat:NEAR ; flush dirty data buffers + extrn update_ddsc_free:NEAR ; count free blocks on drive + extrn update_dir:NEAR ; flush modified directory buffer + extrn update_fat:NEAR + extrn write_dev:near ; write to character device + extrn zeroblk:near ; fill cluster with 0's + + +eject + public bpb2ddsc ; build DDSC from a BPB + Public check_slash + public dbcs_lead + public discard_files ; discard open files (unconditional) + public fdos_ED_DRIVE ; Return ED_DRIVE error + public fdos_ED_FUNCTION ; Return ED_FUNCTION error + public find_dhndl + public find_xfn + public get_pb2_drive + public release_handle ; release file handle + public toupper ; upper case a character + Public unparse + public update_dir_fat ; flush DIR then FAT to disk + + public fdos_getdpb ; 0-disk information + public fdos_mkdir ; 1-make directory + public fdos_rmdir ; 2-remove directory + public fdos_chdir ; 3-change directory + public fdos_creat ; 4-create file + public fdos_open ; 5-open file + public fdos_close ; 6-close file + public fdos_read ; 7-read from file + public fdos_write ; 8-write to file + public fdos_unlink ; 9-delete file + public fdos_lseek ; 10-set file pointer + public fdos_chmod ; 11-get/set file attributes + public fdos_curdir ; 12-get current directory + public fdos_first ; 13-find first matching file + public fdos_next ; 14-find next matching file + public fdos_move ; 15-rename file + public fdos_dattim ; 16-get/set file name + public fdos_flush ; 17-flush buffers + public fdos_mknew ; 18-make new file + public fdos_lock ; 19-lock/unlock block + public fdos_dup ; 20-duplicate handle + public fdos_fdup ; 21-force duplicate handle + extrn fdos_fcb:near ; 22-FCB emulation + public fdos_exec ; 23-create child PSP + extrn fdos_exit:near ; 24-FCB close for PSP + public fdos_ddio ; 25-direct disk access + extrn fdos_ioctl:near ; 26-IOCTL emulation + public fdos_commit ; 27-commit file + public fdos_expand ; 28-expand file name + public fdos_mkddsc ; 29-build DDSC from BPB + public fdos_select ; 30-select drive + +if JOIN + Public check_join + Public mv_join_root +endif + +eject + +eject ! include funcs.fdo +eject ! include utils.fdo + + + END diff --git a/samples/Assembly/ROM.A86 b/samples/Assembly/ROM.A86 new file mode 100644 index 0000000000..747ed1fb08 --- /dev/null +++ b/samples/Assembly/ROM.A86 @@ -0,0 +1,442 @@ + title 'SBC86/12 w/ SBC204 Bootstrap EPROM' +; +; ROM bootstrap for CP/M-86 on an iSBC86/12 +; with the +; Intel SBC 204 Floppy Disk Controller +; + +; Copyright (C) 1980,1981 +; Digital Research, Inc. +; Box 579, Pacific Grove +; California, 93950 +; +;******************************************** +;* This is the BOOT ROM which is initiated * +;* by a system reset. First, the ROM moves * +;* a copy of its data area to RAM at loca- * +;* tion 00000H, then initializes the segment* +;* registers and the stack pointer. The * +;* various peripheral interface chips on the* +;* SBC 86/12 are initialized. The 8251 * +;* serial interface is configured for a 9600* +;* baud asynchronous terminal, and the in- * +;* terrupt controller is setup for inter- * +;* rupts 10H-17H (vectors at 00040H-0005FH) * +;* and edge-triggered auto-EOI (end of in- * +;* terrupt) mode with all interrupt levels * +;* masked-off. Next, the SBC 204 Diskette * +;* controller is initialized, and track 1 * +;* sector 1 is read to determine the target * +;* paragraph address for LOADER. Finally, * +;* the LOADER on track 0 sectors 2-26 and * +;* track 1 sectors 1-26 is read into the * +;* target address. Control then transfers * +;* to LOADER. This program resides in two * +;* 2716 EPROM's (2K each) at location * +;* 0FF000H on the SBC 86/12 CPU board. ROM * +;* 0 contains the even memory locations, and* +;* ROM 1 contains the odd addresses. BOOT * +;* ROM uses RAM between 00000H and 000FFH * +;* (absolute) for a scratch area, along with* +;* the sector 1 buffer. * +;******************************************** +true equ 0ffh +false equ not true +; +debug equ true +;debug = true indicates bootstrap is in same roms +;with SBC 957 "Execution Vehicle" monitor +;at FE00:0 instead of FF00:0 +; +cr equ 13 +lf equ 10 +; +; disk ports and commands +; +base204 equ 0a0h +fdccom equ base204+0 +fdcstat equ base204+0 +fdcparm equ base204+1 +fdcrslt equ base204+1 +fdcrst equ base204+2 +dmacadr equ base204+4 +dmaccont equ base204+5 +dmacscan equ base204+6 +dmacsadr equ base204+7 +dmacmode equ base204+8 +dmacstat equ base204+8 +fdcsel equ base204+9 +fdcsegment equ base204+10 +reset204 equ base204+15 +; +;actual console baud rate +baud_rate equ 9600 +;value for 8253 baud counter +baud equ 768/(baud_rate/100) +; +csts equ 0DAh ;i8251 status port +cdata equ 0D8h ; " data port +; +tch0 equ 0D0h ;8253 PIC channel 0 port +tch1 equ tch0+2 ;ch 1 port +tch2 equ tch0+4 ;ch 2 port +tcmd equ tch0+6 ;8253 command port +; +icp1 equ 0C0h ;8259a port 0 +icp2 equ 0C2h ;8259a port 1 +; +; + IF NOT DEBUG +ROMSEG EQU 0FF00H ;normal + ENDIF +; + IF DEBUG ;share prom with SBC 957 +ROMSEG EQU 0FE00H + ENDIF +; +; +; This long jump prom'd in by hand +; cseg 0ffffh ;reset goes to here (ffff0h) +; JMPF BOTTOM ;boot is at bottom of PROM +; EA 00 00 00 FF ;cs = bottom of prom (ff000h) +; ip = 0 +; EVEN PROM ODD PROM +; 7F8 - EA 7F8 - 00 +; 7F9 - 00 7F9 - 00 +; 7FA - FF ;this is not done if special = true +; + cseg romseg +; +;First, move our data area into RAM at 0000:0200 +; + mov ax,cs + mov ds,ax ;point DS to CS for source + mov SI,drombegin ;start of data + mov DI,offset ram_start ;offset of destination + mov ax,0 + mov es,ax ;destination segment is 0000 + mov CX,data_length ;how much to move in bytes + rep movs al,al ;move out of eprom a byte at a time +; + mov ax,0 + mov ds,ax ;data segment now in RAM + mov ss,ax + mov sp,stack_offset ;Initialize stack segment/pointer + cld ;clear the direction flag +; + IF NOT DEBUG +; +;Now, initialize the console USART and baud rate +; + mov al,0Eh + out csts,al ;give 8251 dummy mode + mov al,40h + out csts,al ;reset 8251 to accept mode + mov al,4Eh + out csts,al ;normal 8 bit asynch mode, * 16 + mov al,37h + out csts,al ;enable Tx & Rx + mov al,0B6h + out tcmd,al ;8253 ch.2 square wave mode + mov ax,baud + out tch2,al ;low of the baud rate + mov al,ah + out tch2,al ;high of the baud rate +; + ENDIF +; +;Setup the 8259 Programmable Interrupt Controller +; + mov al,13h + out icp1,al ;8259a ICW 1 8086 mode + mov al,10h + out icp2,al ;8259a ICW 2 vector @ 40-5F + mov al,1Fh + out icp2,al ;8259a ICW 4 auto EOI master + mov al,0FFh + out icp2,al ;8259a OCW 1 mask all levels off +; +;Reset and initialize the iSBC 204 Diskette Interface +; +restart: ;also come back here on fatal errors + out reset204,AL ;reset iSBC 204 logic and + mov AL,1 + out fdcrst,AL ;give 8271 FDC + mov al,0 + out fdcrst,AL ; a reset command + mov BX,offset specs1 + CALL sendcom ;program + mov BX,offset specs2 + CALL sendcom ; Shugart SA-800 drive + mov BX,offset specs3 + call sendcom ; characteristics +homer: mov BX,offset home + CALL execute ;home drive 0 +; + mov bx,sector1 ;offset for first sector DMA + mov ax,0 + mov es,ax ;segment " " " " + call setup_dma +; + mov bx,offset read0 + call execute ;get T0 S1 +; + mov es,ABS + mov bx,0 ;get loader load address + call setup_dma ;setup DMA to read loader +; + mov bx,offset read1 + call execute ;read track 0 + mov bx,offset read2 + call execute ;read track 1 +; + mov leap_segment,ES +; setup far jump vector + mov leap_offset,0 +; +; enter LOADER + jmpf dword ptr leap_offset +; +pmsg: + mov cl,[BX] + test cl,cl + jz return + call conout + inc BX + jmp pmsg +; +conout: + in al,csts + test al,1 + jz conout + mov al,cl + out cdata,al + ret +; +conin: + in al,csts + test al,2 + jz conin + in al,cdata + and al,7Fh + ret +; +; +; +execute: ;execute command string @ [BX] + ; points to length, + ;followed by Command byte + ;followed by length-1 parameter bytes +; + mov lastcom,BX ;remember what it was +retry: ;retry if not ready drive + call sendcom ;execute the command + ;now, let's see what type + ;of status poll was necessary + ;for that command type . . . + mov BX,lastcom ;point to command string + mov AL,1[BX] ;get command op code + and AL,3fh ;drop drive code bits + mov CX,0800h ;mask if it will be "int req" + cmp AL,2ch ;see if interrupt type + jb execpoll + mov CX,8080h ;else we use "not command busy" + and AL,0fh ;unless . . . + cmp AL,0ch ;there isn't + mov AL,0 + ja return ;any result at all +; +execpoll: ;poll for bit in b, toggled with c + in AL,FDCSTAT + and AL,CH + xor AL,CL ! JZ execpoll +; + in AL,fdcrslt ;get result register + and AL,1eh ;look only at result type & code + jz return ;zero means it was a good operation +; + cmp al,10h + jne fatal ;if other than "Not Ready", stop +; + mov bx,offset rdstat + call sendcom ;perform read status command +rd_poll: + in al,fdc_stat + test al,80h ;wait for command not busy + jnz rd_poll + mov bx,last_com ;recover last attempted command + jmp retry ;and try it over again +; +fatal: ; fatal error + mov ah,0 + mov bx,ax ;make 16 bits + mov bx,errtbl[BX] +; print appropriate error message + call pmsg + call conin ;wait for key strike + pop ax ;discard unused item + jmp restart ;then start all over +; +return: + RET ;return from EXECUTE +; +setupdma: + mov AL,04h + out dmacmode,AL ;enable dmac + mov al,0 + out dmaccont,AL ;set first (dummy) byte to + mov AL,40h + out dmaccont,AL ;force read data mode + mov AX,ES + out fdcsegment,AL + mov AL,AH + out fdcsegment,AL + mov AX,BX + out dmacadr,AL + mov AL,AH + out dmacadr,AL + RET +; +; +; +sendcom: ;routine to send a command string to SBC204 + in AL,fdcstat + and AL,80h + jnz sendcom ;insure command not busy + mov CL,[BX] ;get count + inc BX + mov al,[BX] ;point to and fetch command byte + out fdccom,AL ;send command +parmloop: + dec CL + jz return ;see if any (more) parameters + inc BX ;point to next parameter +parmpoll: + in AL,fdcstat + and AL,20h + jnz parmpoll ;loop until parm not full + mov AL,[BX] + out fdcparm,AL ;output next parameter + jmp parmloop ;go see about another +; +; +; Image of data to be moved to RAM +; +drombegin equ offset $ +; +clastcom dw 0000h ;last command +; +creadstring db 3 ;length + db 52h ;read function code for drive 0 + db 0 ;track # + db 1 ;sector # +; +creadtrk0 db 4 + db 53h ;read multiple + db 0 ;track 0 + db 2 ;sectors 2 + db 25 ;through 26 +; +creadtrk1 db 4 + db 53h + db 1 ;track 1 + db 1 ;sectors 1 + db 26 ;through 26 +; +chome0 db 2,69h,0 +crdstat0 db 1,6ch +cspecs1 db 5,35h,0dh + db 08h,08h,0e9h +cspecs2 db 5,35h,10h + db 255,255,255 +cspecs3 db 5,35h,18h + db 255,255,255 +; +cerrtbl dw offset er0 + dw offset er1 + dw offset er2 + dw offset er3 + dw offset er4 + dw offset er5 + dw offset er6 + dw offset er7 + dw offset er8 + dw offset er9 + dw offset erA + dw offset erB + dw offset erC + dw offset erD + dw offset erE + dw offset erF +; +Cer0 db cr,lf,'Null Error ??',0 +Cer1 equ cer0 +Cer2 equ cer0 +Cer3 equ cer0 +Cer4 db cr,lf,'Clock Error',0 +Cer5 db cr,lf,'Late DMA',0 +Cer6 db cr,lf,'ID CRC Error',0 +Cer7 db cr,lf,'Data CRC Error',0 +Cer8 db cr,lf,'Drive Not Ready',0 +Cer9 db cr,lf,'Write Protect',0 +CerA db cr,lf,'Trk 00 Not Found',0 +CerB db cr,lf,'Write Fault',0 +CerC db cr,lf,'Sector Not Found',0 +CerD equ cer0 +CerE equ cer0 +CerF equ cer0 +; +dromend equ offset $ +; +data_length equ dromend-drombegin +; +; reserve space in RAM for data area +; (no hex records generated here) +; + dseg 0 + org 0200h +; +ram_start equ $ +lastcom rw 1 ;last command +read0 rb 4 ;read track 0 sector 1 +read1 rb 5 ;read T0 S2-26 +read2 rb 5 ;read T1 S1-26 +home rb 3 ;home drive 0 +rdstat rb 2 ;read status +specs1 rb 6 +specs2 rb 6 +specs3 rb 6 +errtbl rw 16 +er0 rb length cer0 ;16 +er1 equ er0 +er2 equ er0 +er3 equ er0 +er4 rb length cer4 ;14 +er5 rb length cer5 ;11 +er6 rb length cer6 ;15 +er7 rb length cer7 ;17 +er8 rb length cer8 ;18 +er9 rb length cer9 ;16 +erA rb length cerA ;19 +erB rb length cerB ;14 +erC rb length cerC ;19 +erD equ er0 +erE equ er0 +erF equ er0 +; +leap_offset rw 1 +leap_segment rw 1 +; +; + rw 32 ;local stack +stack_offset equ offset $;stack from here down +; +; T0 S1 read in here +sector1 equ offset $ +; +Ty rb 1 +Len rw 1 +Abs rw 1 ;ABS is all we care about +Min rw 1 +Max rw 1 + end