Software



At this time i have only software for a minimal bootstrap of the computer with 65C816 CPU. All I/O port work, the keyboard and video (either onboard or with optional video board) are managed near to full, serial port handled in full (with a test for communicate vith a PC or another mainboard).
FDC controller work fine, and i provide basic function for read,write and format a floppy (also in CBM 1581 format). Now i'm able to read and write to ATA device, detect them, and detect the file system. The driver for FAT is under development.
After the boot the machine start a sytem monitor (to view memory, register, fill memory and do some test, as full memory test). I'm working also to write a small assembler/disassembler tu use in monitor.
Some pieces of software are complete (and seem to work fine):
- the mult/div operation for integer (either signed and unsigned) up to 64 bit and conversion from string to integer and from integer to decimal/hex string (see intp.asm source code).
- the four basic operations with float point number (15bit exponent, 64bit mantissa, significant digits 19/20, as the extended real in 80x87 FPU) and conversion from string to float and from float string (see fpuemu.asm source code). Planning for the future: implementation of the sqrt(), ln(), exp(), sin(), cos(), tan().
- the vprinter family of functions for format string as done by sprintf() family functions in C. I attempted to replicate as near possible the C-function and result seem to good (see vprint.asm source code). Also exist a function that print in the screen as the C-style printf() function.

The purpose is to write a complete BIOS and a mini operating system that can be stored in flash memory, that can handle the FAT file system, and with the support for long file names (LFN). System calls are not managed by COP instruction (an idea that I had initially) but through long jump to subroutine (JSL).

I use the assembler/linker from Avocet, but i think that the source code can be assembled with other tools also. The format for object files is motorola s26 and at end of linking the binary file (to put in flash/emulator) is created by hexform.exe utility. For build all i use an old dos utility (make.exe) from Borland.

The source code is free and anyone can use it (no warranty!) without limitation; i appreciate if someone would exchange her impression and suggestion about this code.


   Zipped Source code (65C816)


The firmware for keyboard controller (PIC18F4420). This was developed with MPLAB IDE (from microchip). Debugging & uploading firmware into PIC made by ICD3 MPLAB in-circuit debugger and programmer.
   Zipped firmware source code (PIC18F4420)


Linker output summary:
******************************************************************************
*                      S E C T I O N      S U M M A R Y                      *
******************************************************************************
*    Section Name                  Start      End         Description        *
******************************************************************************
* CBMFSW                           000000    0000FF    CBM FS work area      *
* CBMHIM                           000000    0000FF    CBM text work area    *
* CBMHIV                           000000    0000FF    CBM var/p-code area   *
* CBMJMP                           FEFF00    FEFFFB   CBM Jmp-Table $FE      *
* CBMVIEC                          000000    000092    CBM Virtual IEC       *
* CODE                             F8FE00    F8FFB0                          *
* CODEF8                           F80200    F88421   Segment F8             *
* CODEF9                           F9001D    F96510   Segment F9             *
* CODEFA                           FA0009    FA07EA   Segment FA             *
* CODEFB                           FB0000    FB0001   Segment FB             *
* CODEFC                           FC0000    FC0001   Segment FC             *
* CODEFD                           FD0000    FD229D   Segment FD             *
* CODEFE                           FE0000    FEA45C   Segment FE             *
* CODEFF                           FF000E    FF3508   Segment FF             *
* DIRP00                           000000    0000BD   Direct-Page 00         *
* DIRP01                           000000    0000FB   Direct-Page 01         *
* DIRP02                           000000    0000CB                          *
* DPCBM                            000000    0000E6                          *
* DPCBMFS                          000000    0000F9                          *
* DPFAT                            000000    00008D   FAT D.P.               *
* DPFSW                            000000    0000A4                          *
* DPLDT                            000000    0000DB   LDT D.P.               *
* DPOS                             000000    000053   OS Main D.P.           *
* DPSP                             000056    000085   ACIA D.P.              *
* DPSP2                            000000    000067   UART D.P.              *
* MONSEG                           FF0000    FF000D   Start Monitor          *
* SLIBFA                           FA0000    FA0008   Segment FA             *
* STARTF9                          F90000    F9001C   Start F9               *
* SYSCODE                          F8F000    F8F681   System                 *
* SYSTBLE                          F8FA00    F8FDFF   Sys Funcs Table        *
* SYSVECTRS                        F8FFE0    F8FFFF   Vectors                *
* VDCFONT                          FFF800    FFFFFF   VDC Font               *
* _BCB                             000000    00000F   BCB Struct             *
* _DPDSK                           000000    0000DD   DISK ID D.P.           *
* _FATTMP                          000032    00004C                          *
* _FSTMP                           000004    000053                          *
* _HCB                             000000    000007   HCB Struct             *
* _HCBS                            040000    040007   HCB's List             *
* _HPL                             000000    00000F   HPL Struct             *
* _LDT                             000000    000029   LDT Struct             *
* _P0BTMP                          000094    0000AB    DP Tmp. BIOS          *
* _TOS1                            019E00    01CE1F   FAT Struct's           *
******************************************************************************



******************************************************************************
*                             L O A D      M A P                             *
******************************************************************************
*    Section Name              Starting Address    Ending Address    Size    *
******************************************************************************
* obj\F8\start.obj                                                           *
*   -DPSP2                          000000             000067       000068   *
*    SYSCODE                        F8F000             F8F681       000682   *
*    CODE                           F8FE00             F8FFB0       0001B1   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
*    SYSVECTRS                      F8FFE0             F8FFFF       000020   *
*   -DPSP                           000056             000085       000030   *
* obj\F8\systble.obj                                                         *
*    SYSTBLE                        F8FA00             F8FDFF       000400   *
* obj\F8\bios.obj                                                            *
*    CODEF8                         F80200             F8045A       00025B   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\F8\sp.obj                                                              *
*    CODEF8                         F8045B             F80ABB       000661   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPSP                           000056             000085       000030   *
*   -_P0BTMP                        000094             00009D       00000A   *
* obj\F8\sp2.obj                                                             *
*    CODEF8                         F80ABC             F8103D       000582   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPSP2                          000000             000067       000068   *
* obj\F8\lcd.obj                                                             *
*    CODEF8                         F8103E             F81285       000248   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\F8\reset.obj                                                           *
*    CODEF8                         F81286             F82132       000EAD   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
*   -DPSP                           000056             000085       000030   *
*                                   000000             000067       000068   *
* obj\F8\vprint.obj                                                          *
*    CODEF8                         F82133             F827BA       000688   *
*   -DIRP02                         000000             0000CB       0000CC   *
* obj\F8\intp.obj                                                            *
*    CODEF8                         F827BB             F83386       000BCC   *
*   -DIRP02                         000000             0000CB       0000CC   *
* obj\F8\fpuemu.obj                                                          *
*    CODEF8                         F83387             F8455B       0011D5   *
*   -DIRP02                         000000             0000CB       0000CC   *
* obj\F8\fpu.obj                                                             *
*    CODEF8                         F8455C             F854CE       000F73   *
*    _DPFPU                         000000             000065       000066   *
* obj\F8\ata.obj                                                             *
*    CODEF8                         F854CF             F85EB0       0009E2   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_DPDSK                         000000             0000DD       0000DE   *
*   -_P0BTMP                        000094             0000B7       000024   *
* obj\F8\fdc.obj                                                             *
*    CODEF8                         F85EB1             F86E9C       000FEC   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_P0BTMP                        000094             0000BB       000028   *
*    _BIOS                          010000             0187FF       008800   *
* obj\F8\vdc.obj                                                             *
*    CODEF8                         F86E9D             F87C18       000D7C   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\F8\rtc.obj                                                             *
*    CODEF8                         F87C19             F87EE8       0002D0   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_P0BTMP                        000094             0000B3       000020   *
* obj\F8\usbdsk.obj                                                          *
*    CODEF8                         F87EE9             F88421       000539   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_P0BTMP                        000094             0000B1       00001E   *
*   -_LDT                           000000             000029       00002A   *
* obj\F9\start.obj                                                           *
*    STARTF9                        F90000             F9001C       00001D   *
*   -DIRP00                         000000             0000BD       0000BE   *
* obj\F9\toscmd.obj                                                          *
*    CODEF9                         F9001D             F902F2       0002D6   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_LDT                           000000             000029       00002A   *
*   -_HPL                           000000             00000F       000010   *
*   -_BCB                           000000             00000F       000010   *
*   -_HCB                           000000             000007       000008   *
*   -_TOS1                          019E00             01CE1F       003020   *
*   -_HCBS                          040000             040007       000008   *
*   -DPOS                           000000             000053       000054   *
*   -DPLDT                          000000             0000DB       0000DC   *
*   -DPFAT                          000000             00008D       00008E   *
*   -_FSTMP                         000004             000053       000050   *
* obj\F9\fsstart.obj                                                         *
*    CODEF9                         F902F3             F90304       000012   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
*   -_LDT                           000000             000029       00002A   *
*    _FATS                          018C00             0193FF       000800   *
*    _DPLDT                         000000             0000FB       0000FC   *
*    _DPFAT                         000000             000061       000062   *
*   -_FATTMP                        000032             00004C       00001B   *
* obj\F9\fsint.obj                                                           *
*    CODEF9                         F90305             F91CE8       0019E4   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
*   -_LDT                           000000             000029       00002A   *
*   -_HPL                           000000             00000F       000010   *
*   -_BCB                           000000             00000F       000010   *
*   -_HCB                           000000             000007       000008   *
*   -_TOS1                          019E00             01CE1F       003020   *
*   -_HCBS                          040000             040007       000008   *
*   -DPOS                           000000             000053       000054   *
*   -DPLDT                          000000             0000DB       0000DC   *
*   -DPFAT                          000000             00008D       00008E   *
*   -_FSTMP                         000004             000053       000050   *
* obj\F9\fatdir.obj                                                          *
*    CODEF9                         F91CE9             F92411       000729   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_LDT                           000000             000029       00002A   *
*   -_HPL                           000000             00000F       000010   *
*   -_BCB                           000000             00000F       000010   *
*   -_HCB                           000000             000007       000008   *
*   -_TOS1                          019E00             01CE1F       003020   *
*   -_HCBS                          040000             040007       000008   *
*   -DPOS                           000000             000053       000054   *
*   -DPLDT                          000000             0000DB       0000DC   *
*   -DPFAT                          000000             00008D       00008E   *
* obj\F9\fatsys.obj                                                          *
*    CODEF9                         F92412             F92422       000011   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_LDT                           000000             000029       00002A   *
*   -_HPL                           000000             00000F       000010   *
*   -_BCB                           000000             00000F       000010   *
*   -_HCB                           000000             000007       000008   *
*   -_TOS1                          019E00             01CE1F       003020   *
*   -_HCBS                          040000             040007       000008   *
*   -DPOS                           000000             000053       000054   *
*   -DPLDT                          000000             0000DB       0000DC   *
*   -DPFAT                          000000             00008D       00008E   *
* obj\F9\utils.obj                                                           *
*    CODEF9                         F92423             F92A6E       00064C   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_LDT                           000000             000029       00002A   *
*   -_HPL                           000000             00000F       000010   *
*   -_BCB                           000000             00000F       000010   *
*   -_HCB                           000000             000007       000008   *
*   -_TOS1                          019E00             01CE1F       003020   *
*   -_HCBS                          040000             040007       000008   *
*   -DPOS                           000000             000053       000054   *
*   -DPLDT                          000000             0000DB       0000DC   *
*   -DPFAT                          000000             00008D       00008E   *
* obj\F9\fscbm.obj                                                           *
*    CODEF9                         F92A6F             F95EBD       00344F   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPCBMFS                        000000             0000F9       0000FA   *
*   -CBMFSW                         000000             FFFFFF       000000   *
*                                   00E100             00E1FF       000100   *
*                                   000000             FFFFFF       000000   *
*                                   00E200             00E292       000093   *
* obj\F9\sysf9.obj                                                           *
*    CODEF9                         F95EBE             F95F22       000065   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPFSW                          000000             0000A4       0000A5   *
* obj\F9\biosmem.obj                                                         *
*    CODEF9                         F95F23             F9609C       00017A   *
*   -DIRP00                         000000             0000BD       0000BE   *
* obj\F9\fdir.obj                                                            *
*    CODEF9                         F9609D             F96510       000474   *
*   -DPFSW                          000000             0000A4       0000A5   *
* obj\FA\slib.obj                                                            *
*    SLIBFA                         FA0000             FA0008       000009   *
* obj\FA\getopt.obj                                                          *
*    CODEFA                         FA0009             FA03F6       0003EE   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -_P0BTMP                        000094             0000AB       000018   *
* obj\FA\string.obj                                                          *
*    CODEFA                         FA03F7             FA07EA       0003F4   *
* obj\FD\qedt.obj                                                            *
*    DPQEDT                         000000             0000E1       0000E2   *
*    CODEFD                         FD0000             FD229D       00229E   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\FE\main.obj                                                            *
*    CODEFE                         FE0000             FE1942       001943   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPCBM                          000000             0000E6       0000E7   *
*   -CBMHIM                         000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
*                                   000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
* obj\FE\pcode.obj                                                           *
*    CODEFE                         FE1943             FE410F       0027CD   *
*   -DPCBM                          000000             0000E6       0000E7   *
*   -CBMHIM                         000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
*                                   000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
* obj\FE\pcstd.obj                                                           *
*    CODEFE                         FE4110             FE82E4       0041D5   *
* obj\FE\pcerr.obj                                                           *
*    CODEFE                         FE82E5             FE938C       0010A8   *
* obj\FE\float.obj                                                           *
*    CODEFE                         FE938D             FE9DAA       000A1E   *
*   -DPCBM                          000000             0000E6       0000E7   *
*   -CBMHIM                         000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
*                                   000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
* obj\FE\kcbm.obj                                                            *
*    CODEFE                         FE9DAB             FEA45C       0006B2   *
*    CBMJMP                         FEFF00             FEFF05       000006   *
*                                   FEFF30             FEFF4D       00001E   *
*                                   FEFF7A             FEFFFB       000082   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DPCBM                          000000             0000E6       0000E7   *
*   -CBMHIM                         000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
*                                   000000             FFFFFF       000000   *
*                                   00FF00             00FFFF       000100   *
* obj\FF\monitor.obj                                                         *
*    MONSEG                         FF0000             FF000D       00000E   *
*    CODEFF                         FF000E             FF1CD7       001CCA   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\FF\masmx.obj                                                           *
*    CODEFF                         FF1CD8             FF25D0       0008F9   *
*   -DIRP01                         000000             0000FB       0000FC   *
* obj\FF\mond.obj                                                            *
*    CODEFF                         FF25D1             FF3508       000F38   *
*   -DIRP00                         000000             0000BD       0000BE   *
*   -DIRP01                         000000             0000FB       0000FC   *
*   -DPSP                           000056             000085       000030   *
*                                   000000             000067       000068   *
* obj\FF\font.obj                                                            *
*    VDCFONT                        FFF800             FFFFFF       000800   *
* obj\FB\dummy.obj                                                           *
*    CODEFB                         FB0000             FB0001       000002   *
* obj\FC\dummy.obj                                                           *
*    CODEFC                         FC0000             FC0001       000002   *
******************************************************************************