Announcement

Collapse

Forum Rules and Etiquette

Our mission ...

This forum is part of our mission to promote the preservation of vintage computers through education and outreach. (In real life we also run events and have a museum.) We encourage you to join us, participate, share your knowledge, and enjoy.

This forum has been around in this format for over 15 years. These rules and guidelines help us maintain a healthy and active community, and we moderate the forum to keep things on track. Please familiarize yourself with these rules and guidelines.


Rule 1: Remain civil and respectful

There are several hundred people who actively participate here. People come from all different backgrounds and will have different ways of seeing things. You will not agree with everything you read here. Back-and-forth discussions are fine but do not cross the line into rude or disrespectful behavior.

Conduct yourself as you would at any other place where people come together in person to discuss their hobby. If you wouldn't say something to somebody in person, then you probably should not be writing it here.

This should be obvious but, just in case: profanity, threats, slurs against any group (sexual, racial, gender, etc.) will not be tolerated.


Rule 2: Stay close to the original topic being discussed
  • If you are starting a new thread choose a reasonable sub-forum to start your thread. (If you choose incorrectly don't worry, we can fix that.)
  • If you are responding to a thread, stay on topic - the original poster was trying to achieve something. You can always start a new thread instead of potentially "hijacking" an existing thread.



Rule 3: Contribute something meaningful

To put things in engineering terms, we value a high signal to noise ratio. Coming here should not be a waste of time.
  • This is not a chat room. If you are taking less than 30 seconds to make a post then you are probably doing something wrong. A post should be on topic, clear, and contribute something meaningful to the discussion. If people read your posts and feel that their time as been wasted, they will stop reading your posts. Worse yet, they will stop visiting and we'll lose their experience and contributions.
  • Do not bump threads.
  • Do not "necro-post" unless you are following up to a specific person on a specific thread. And even then, that person may have moved on. Just start a new thread for your related topic.
  • Use the Private Message system for posts that are targeted at a specific person.


Rule 4: "PM Sent!" messages (or, how to use the Private Message system)

This forum has a private message feature that we want people to use for messages that are not of general interest to other members.

In short, if you are going to reply to a thread and that reply is targeted to a specific individual and not of interest to anybody else (either now or in the future) then send a private message instead.

Here are some obvious examples of when you should not reply to a thread and use the PM system instead:
  • "PM Sent!": Do not tell the rest of us that you sent a PM ... the forum software will tell the other person that they have a PM waiting.
  • "How much is shipping to ....": This is a very specific and directed question that is not of interest to anybody else.


Why do we have this policy? Sending a "PM Sent!" type message basically wastes everybody else's time by making them having to scroll past a post in a thread that looks to be updated, when the update is not meaningful. And the person you are sending the PM to will be notified by the forum software that they have a message waiting for them. Look up at the top near the right edge where it says 'Notifications' ... if you have a PM waiting, it will tell you there.

Rule 5: Copyright and other legal issues

We are here to discuss vintage computing, so discussing software, books, and other intellectual property that is on-topic is fine. We don't want people using these forums to discuss or enable copyright violations or other things that are against the law; whether you agree with the law or not is irrelevant. Do not use our resources for something that is legally or morally questionable.

Our discussions here generally fall under "fair use." Telling people how to pirate a software title is an example of something that is not allowable here.


Reporting problematic posts

If you see spam, a wildly off-topic post, or something abusive or illegal please report the thread by clicking on the "Report Post" icon. (It looks like an exclamation point in a triangle and it is available under every post.) This send a notification to all of the moderators, so somebody will see it and deal with it.

If you are unsure you may consider sending a private message to a moderator instead.


New user moderation

New users are directly moderated so that we can weed spammers out early. This means that for your first 10 posts you will have some delay before they are seen. We understand this can be disruptive to the flow of conversation and we try to keep up with our new user moderation duties to avoid undue inconvenience. Please do not make duplicate posts, extra posts to bump your post count, or ask the moderators to expedite this process; 10 moderated posts will go by quickly.

New users also have a smaller personal message inbox limit and are rate limited when sending PMs to other users.


Other suggestions
  • Use Google, books, or other definitive sources. There is a lot of information out there.
  • Don't make people guess at what you are trying to say; we are not mind readers. Be clear and concise.
  • Spelling and grammar are not rated, but they do make a post easier to read.
See more
See less

Small ROM-able monitor/assembler for PC?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Small ROM-able monitor/assembler for PC?

    So the machine I'm working on (a V40-based XT cloneish sort of thing) has a 32k PROM mounted at F800:0000, and "practical purposes" are using about 12k of it (8k main BIOS, 4k option ROM to handle a special disk system).

    I figure there's something more useful or whimsical I can fit into the remaining 20k. My dream was to use the space for a small debugger/monitor, along the lines of that included on early Zenith PCs. This would be a useful to try to kick the disc controller into submission sometimes, when you can't boot enough to get to DEBUG.

    As a proof of concept, I modified the main BIOS to believe it had Cassette Basic at F900:0000. At that point, I put a little stub there that will copy whatever I stash from F900:0100 to F900:4FFF down to 0000:7C00 and execute it.

    This seems to allow running self-contained boot-sector programs like https://github.com/daniel-e/tetros or https://github.com/nanochess/pillman.

    With some additional setup (initializing the sector registers to 07C0, putting the code at 0000:7D00, and moving the jump to 07C0:0100, to give a "more realistic" environment), I was able to get a DOS .COM executable running (the Palo Alto Tiny Basic from https://www.vcfed.org/forum/forum/te...basic-download)

    The problem now is finding something better to put in. Tiny Basic is cute and obviously a neat throwback to "real" Cassette Basic, but a real monitor still feels more desirable. I originally figured DEBUG.COM would be a perfect drop in-- after all, it's been there since the dawn of time, odds are it uses very little more than BIOS functionality. Wrong. The version from DOS 2.0 basically explodes on launch, and from the source release, it appears to start making operating system calls early in its lifecycle. (I figured it MIGHT crash when you tried to read or write disc files, but not before that )

    Has anyone else tried this path? What monitor did you use? I'm assuming there are some "ROM-ready" designs that require less pre-load shimming, but I'm guessing there are more options if I can load a .COM into RAM and start at address 100.

    It looks like the s100computers.com one is very elaborate, but also fairly dependent on their unusual hardware/firmware setup, rather than just relying on the BIOS features you'd find on a conventional PC clone, so it might need a fair bit of rework to get to a usable state.

    There are some other "vintage" monitor scripts floating around, likely designed for other non-IBM 8086 platforms (again requiring rework), and even a few "512 byte monitor in a boot sector" but many of them don't include even rudimentary (dis) assemblers, which feels like it would be very useful.

    #2
    Hi. The author of Debug, Tim Paterson, describes the history of the program in the book "Undocumented DOS". A short excerpt is shown in the attached photo. He original wrote the program as a monitor to fit in a 2KB ROM. In the book Tim refers to the source files being included with a disk that was part of the book. I spent alot of time looking for those files! Here is a link to a Zip file containg all the source code programs he mentions in the excerpt.

    http://www.mtmscientific.com/CHAP7.zip

    If memory serves, there may be some calls to DOS functions in the code. I also played around with creating a standalone BIOS for the IBM 5150 PC. I called that MIOS, and is just fun to play around with. Ruud has a ton of stuff related to this, and maybe he will comment as well.

    http://www.mtmscientific.com/mios.html

    Michael undoc_excerpt.jpg

    Comment


      #3
      I took a bit of time and OCR'd the Keyboard Code.

      Code:
      00010 ;
      00020 ;
      00030 ; EXAMPLE OF CUSTOM KEYBOARD SUPPORT SOFTWARE
      00040 ;
      00050 STACK SEGMENT PARA STACK 'STACK'
      00060 DB 256 DUP (0) ;256 BYTES OF STACK SPAACE
      00070 STACK ENDS
      00080 ;
      00090 DATA SEGMENT PARA PUBLIC 'DATA'
      00100 BUFFER DB 10 DUP (0) ;TEN BYTE KEYBOARD BUFFER
      00110 BUFPTR1 DW 0 ;POINTS TO START OF BUFFER
      00120 BUFPTR2 DW 0 ;POINTS TO END OF BUFFER
      00130 ; NOTE: WHEN BUFPTR1 = BUFPTR2 , THEN THE BUFFER IS EMPTY
      00140 ; SCANTABLE CONVERTS SCAN CODES RECEIVED FROM THE KEYBOARD
      00150 ; INTO THEIR CORRESPONDING ASCII CHARACTER CODES:
      00160 SCANTABIE DB 0,0,'1234567890-=',8,0
      00170 DB 'QWERTYUIOP[]',0DH,0
      00180 DB 'ASDFGHJKL;',0,0,0,0
      00190 DB 'ZXCVBNM,./'.0,0,0
      00200 DB ' ',0,0,0,0,0,0,0,0,0,0,0,0,0
      00210 DB '789-456+1230.'
      00220 DATA ENDS
      00230 ; ,
      00240 CODE SEGMENT PARA PUBLIC 'CODE'
      00250 START PROC FAR
      00260 ;
      00270 ; STANDARD PROGRAM PROLOGUE
      00280 ;
      00290 ASSUME CS:CODE
      00300 PUSH DS ;SAVE PSP SEG ADDR
      00310 MOV AX,0
      00320 PUSH AX ;SAVE RET ADDR OFFSET (PSP+0)
      00330 MOV AX,DATA
      00340 MOV DS,AX ;ESTABLISH DATA SEG ADDRESSABILITY
      00350 ASSUME DS:DATA
      00360 ;
      00370 ; PART1: SETUP OUR OWN KEYBOARD INTERRUPT SERVICE ROUTINE
      00380 ;
      00390 CLI ;DISABLE ALL INTERRUPTS
      00400 M0V AX,0
      00410 MOV ES,AX ;POINT EXTRA SEGMENT AT THE...
      00420 ; ...INTERRUPT SERVICE ROUTINE ADDRESS TABLE
      00430 MOV DI,24H ;OFFSET OF ENTRY FOR TYPE CODE 09H
      00440 MOV AX,OFFSET KBINT ;OFFSET OF OUR SERVICE ROUTINE
      00450 CLD ; SET 'FORWARD' STRING OPERATIONS
      00460 STOSW ;PLACE IT IN THE TABLE
      00470 MOV AX,CS ;SEG OF OUR SERVICE ROUTINE
      00480 STOSW ;PLACE IT IN THE TABLE
      00490 MOV AL,0FCH ;ENABLE TIMER AND KYBD INTERRUPTS
      00500 OUT 21H,AL ;WRITE INTERRUPT MASK REGISTER
      00510 STI ;ENABLE INTERRUPTS TO THE 8088
      00520 ;
      00530 ; PART2: READ FROM KEYBOARD AND DISPLAY CHARACTERS ON SCREEN
      00540 ;
      00550 FOREVER: CALL KBGET ;WAIT FOR A CHARACTER FROM THE KEYBOARD
      00560 PUSH AX ;SAVE THE CHARACTER
      00570 CALL DISPCHAR ;DISPLAY THE CHARACTER RECEIVED
      00580 POP AX ;RESTORE THE CHARACTER
      00590 CMP AL,0DH ;WAS IT A CARRIAGE RETURN?
      00600 JNZ FOREVER ;BRANCH IF NOT
      00610 MOV AL,0AH ;YES IT WAS, WE MUST ALSO DISPLAY...
      00620 CALL DISPCHAR ;...A LINE FEED!
      00630 JMP FOREVER ;STAY IN THIS LOOP FOREVER
      00640 ;
      00650 ; CALL KBGET TO WA1T FOR A CHARACTER TO BE RECEIVED FROM
      00660 ; THE KEYBOARD. THE CHARACTER IS RETURNED IN REG AL.
      00670 KBGET PROC NEAR
      00680 PUSH BX ;SAVE REGISTER BX
      00690 CLI ;DISABLE INTERRUPTS
      00700 MOV BX,BUFPTR1 ;START OF BUFFER
      00710 CMP BX,BUFPTR2 ;IS BUFFER EMPTY?
      00720 JNZ KBGET2 ;-->N0
      00730 STI ; RE-ENABLE INTERRUPTS
      00740 POP BX ;RESTORE REGISTER BX
      00750 JMP KBGET ;WAIT UNTIL SOMETHING IN BUFFER
      00760 ; THERE IS SOMETHING IN THE BUFFER, GET IT :
      00770 KBGET2: MOV AL,[BUFFER+BX] ;GET CHAR AT BUFFER START
      00780 INC BX ;INCREMENT BUFFER START
      00790 CMP BX,10 ;HAVE WE WRAPPED AROUND?
      00800 JC KBGET3 ;BRANCH IF NOT
      00810 MOV BX,0 ;YES, WRAP AROUND
      00820 KBGET3: MOV BUFFPTR1,BX ;INDICATE NEW START OF BUFFER
      00830 STI ;RE-ENABLE INTERRUPTS
      00840 POP BX ;RESTORE REGISTER BX
      00850 RET ;RETURN FROM KBGET
      00860 KBGET ENDP
      00870 ;
      00880 ; KBINT IS OUR OWN KEYBOARD INTERRUPT SERVICE ROUTINE:
      00890 ;
      00900 KBINT PROC FAR
      00910 PUSH DS ;SAVE ALL ALTERED REGISTERS!!
      00920 PUSH BX
      00930 PUSH AX
      00940 ;
      00950 ; ESTABLISH ADDRESSABILITY TO OUR DATA SEGMENT:
      00960 ;
      00970 MOV AX,DATA
      00980 MOV DS,AX
      00990 ;
      01000 ; READ THE KEYBOARD DATA AND SEND THE ACKNOWLEDGE SIGNAL:
      01010 ;
      01020 IN AL,60H ;READ KEYBOARD INPUT
      01030 PUSH AX ;SAVE KEYBOARD INPUT
      01040 IN AL,61H ;READ 8255 PORT PB
      01050 OR AL,80H ;SET KEYBOARD ACKNOWLEDGE SIGNAL
      01060 OUT 61H,AL ;SEND KEYBOARD ACKNOWLEDGE SIGNAL
      01070 AND AL,7FH ;RESET KEYBOARD ACKNOWLEDGE SIGNAL
      01080 OUT 61H,AL ;RESTORE ORIGINAL 8255 PORT PB
      01090 ;
      01100 ; DECODE THE SCAN CODE RECEIVED:
      01110 ;
      01120 POP AX ;REGAIN THE KEYBOARD INPUT (AL)
      01130 TEST AL,80H ;IS IT A KEY BEING RELEASED?
      01140 JNZ KBINT2 ;BRANCH IF YES, WE IGNORE THESE
      01150 MOV BX,OFFSET SCANTABLE ;SCAN CODE - ASCII TABLE
      01160 XLATB ;CONVERT THE SCAN CODE TO AN ASCII CHAR
      01170 CMP AL,0 ;IS IT A VALID ASCII KEY?
      01180 JZ KBINT2 ;BRANCH IF NOT
      01190 ;
      01200 ; PLACE THE ASCII CHARACTER INTO THE BUFFER:
      01210 ;
      01220 MOV BX,BUFPTR2 ;GET POINTER TO END OF BUFFER
      01230 MOV [BUFFER+BX],AL ;PLACE CHAR IN BUFFER AT END
      01240 INC BX ;INCREMENT BUFFER END
      01250 CMP BX,10 ;HAVE WE WRAPPED AROUND?
      01260 JC KBINT3 ;BRANCH IF NOT
      01270 MOV BX,0 ;YES, WRAP AROUND
      01280 KBINT3: CMP BX,BUFPTR1 ;IS BUFFER FULL?
      01290 JZ KBINT2 ;BRANCH IF YES, WE LOSE THIS CHAR
      01300 MOV BUFPTR2,BX ;INDICATE NEW END OF BUFFER
      01310 ;
      01320 ; NOW INDICATE "END OF INTERRUPT" TO THE INTERRUPT CONTROLLER:
      01330 ;
      01340 KBINT2: MOV AL,20H ;SEND "EOI" COMMAND...
      01350 OUT 20H,AL ;...TO 8259 COMMAND REGISTER
      01360 POP AX ;RESTORE ALL ALTERED REGISTERS!!
      01370 POP BX
      01380 POP DS
      01390 IRET ;RETURN FROM INTERRUPT
      01400 KBINT ENDP
      01410 ;
      01420 ; SUBROUTINE TO DISPLAY A CHARACFER ON THE SCREEN.
      01430 ; ENTER WITH AL = CHARACTER TO BE DISPLAYED.
      01440 ; USES VIDEO INTERFACE IN BIOS.
      01450 ;
      01460 DISPCHAR PROC NEAR
      01470 PUSH BX ;SAVE BX REGISTER
      01480 MOV BX,0 ;SELECT DISPLAY PAGE 0
      01490 MOV AH,14 ;FUNCTION CODE FOR "WRITE"
      01500 INT 10H ;CALL VIDEO DRIVER IN BIOS
      01510 POP BX ;RESTORE BX REGISTER
      01520 RET ;RETURN TO CALLER OF 'DISPCHAR'
      01530 DISPCHAR ENDP
      01540 ;
      01550 START ENDP
      01560 CODE ENDS
      91570 END START
      Hopefully, it doesn't have any errors.


      Linux commands:

      $ pdftk mios_kbd.pdf burst

      $ convert -density 600 pg_0003.pdf -depth 8 pg_03.tiff
      $ convert -density 600 pg_0004.pdf -depth 8 pg_04.tiff

      Then use Irfanview & the KADMOS Plugin to OCR the *.tiff files.
      Correct the OCR'd ERRORS.



      Larry

      pg01.txt
      Attached Files
      Last edited by ldkraemer; November 25, 2021, 09:12 AM.

      Comment


        #4
        The original SCP 8086 monitor (which begat our beloved DEBUG.COM) was indeed written as a 2KB ROM monitor, communicating over the console/serial port of the SCP 8086 card. The source for this version is apparently in the public domain, here's the original manual with source code listing for it:

        http://www.s100computers.com/Hardwar...%20Monitor.pdf

        I've seen electronic versions of the source floating around as well (perhaps it was on Bitsavers?) and the code is designed to be assembled using the SCP 8086 assembler. You can get the assembler v2.44 (ASM.COM) from the 86DOS 1.14 floppies and run it directly under early MS-DOS (I'd recommend 1.x) to produce a binary. Would just need to tweak the monitor's I/O routines to use BIOS services for character output and keyboard input.

        If you look at the SCP monitor side-by-side with the DEBUG sources from MS-DOS 2.xx you'll find many sections where the code is unchanged. The Microsoft additions all use lowercase mnemonics while the original SCP code is in uppercase...

        Comment

        Working...
        X