Cturley2 wrote: > FROM: a2programmer > > I need to know the assembly commands to initiate a PR#3 command from > within PRODOS. It depends on the context. If you want to use the 80-column firmware (output via COUT, input via RDKEY, with 80-column mode active) then you must start up the 80-column firmware using the equivalent of PR#3. From assembly language, the minimum requirement for this would be JSR $C300 This should be sufficient if you are writing a standalone ProDOS application (SYS file). If you are running under BASIC.SYSTEM (your program is a BIN file, or machine code POKEd from a BASIC program), it is more complicated, because starting the 80-column firmware will disconnect the BASIC.SYSTEM I/O hooks. I'm not sure whether there is a simple solution to this. In theory, you should be able to copy and modify the I/O hooks with reference to the appropriate fields on BASIC.SYSTEM's global page, but there may be more to it than this. The safest solution is to issue a PR#3 command in a BASIC program before calling the machine code, or to get the machine code to issue a PR#3 via the BASIC.SYSTEM "DOSCMD" entry, but this only works if the machine code was called from a running BASIC program. You could rely on BASIC.SYSTEM eventually fixing up its own I/O hooks if you terminate by warm starting BASIC (JMP $3D0), but you will have to fix things yourself if you are going to return via RTS. If you want to experiment with saving and restoring the I/O hooks, the relevant locations are: * Zero page hooks CSW EQU $36 ; COUT character output hook KSW EQU $38 ; RDKEY character input hook * BASIC.SYSTEM global page fields VECTOUT EQU $BE30 ; Current character output vector VECTIN EQU $BE32 ; Current character input vector VDOSOUT EQU $BE34 ; ProDOS char out intercept routine VDOSIN EQU $BE36 ; ProDOS char in intercept routine After the JSR $C300, the zero page vectors (CSW and KSW) will be changed to point to the 80-column firmware character output and input routines. It is necessary to copy these vectors into VECTOUT and VECTIN, then copy VDOSOUT and VDOSIN back to the zero page locations. The code for this would be: * Turn on 80-column firmware JSR $C300 * Save the active I/O hooks for BASIC.SYSTEM LDA CSW STA VECTOUT LDA CSW+1 STA VECTOUT+1 LDA KSW STA VECTIN LDA KSW+1 STA VECTIN+1 * Restore BASIC.SYSTEM's I/O hooks LDA VDOSOUT STA CSW LDA VDOSOUT+1 STA CSW+1 LDA VDOSIN STA KSW LDA VDOSIN+1 STA KSW+1 I tried this, and it appeared to work correctly. BASIC.SYSTEM was reconnected after this code. To turn off the 80-column firmware firmware, output character 21 (Ctrl-U) via COUT. If you are running under BASIC.SYSTEM, you will also have to repeat the above code to restore the I/O hooks. LDA #$95 ; Output Ctrl-U with high order bit set JSR $FDED ; to shut down 80-column firmware (You could probably use LDA #$15 with the same effect. I prefer to use high-ASCII control characters in conjunction with the BASIC I/O hooks.) > The individual softswitches that need to be accessed would be great. It is only safe to use the 80-column softswitches directly if you are are also writing your own code to access the screen memory directly. You will not be able to use the COUT and RDKEY routines, or any firmware routines which call them. If you intend to do this, then make very sure that your screen access code does NOT write to the "screen holes", which are the last 8 bytes in every 128 bytes within screen memory ($0478-$047F, $04F8-$04FF, $0578-$057F, $05F8-$05FF, $0678-$067F, $06F8-$06FF, $0778-$077F, $07F8-$07FF). The relevant soft-switches are as follows. * The mode selection soft-switches are write-only (STA) DIS80STO EQU $C000 ; Disable 80-column store EN80STO EQU $C001 ; Enable 80-column store DIS80VID EQU $C00C ; Disable 80-column video EN80VID EQU $C00D ; Enable 80-column video PRICHAR EQU $C00E ; Select primary character set ALTCHAR EQU $C00F ; Select alternate character set * The page selection soft-switches change behaviour depending on * the state of the 80STORE soft switch. These locations can be * read (LDA) or written (STA) to activate the soft-switch. PAGE1 EQU $C054 PAGE2 EQU $C055 * You should start by ensuring you are in text mode, using the * following soft-switch, which is also read/write. TEXT EQU $C051 * If you want to test the state of any of these soft-switches, the * following locations let you read the switch, with bit 7 containing * its state. RD80STO EQU $C018 RDTEXT EQU $C01A RDPAGE2 EQU $C01C RDCHRSET EQU $C01E RD80VID EQU $C01F The PAGE1/PAGE2 switch serves two different purposes. If the 80STORE switch is disabled (its normal state in 40-column mode), then PAGE1 and PAGE2 select the video page which is displayed for text, lo-res and hi-res graphics modes. The text and lo-res graphics page buffers are $0400-$07FF for page 1, $0800-$0BFF for page 2. If the 80STORE switch is enabled (its normal state in 80-column mode), then PAGE1 and PAGE2 control memory mapping of the $0400-$07FF area, selecting between main memory (PAGE1) and auxiliary memory (PAGE2). Numbering the columns from zero, the odd numbered columns of 80-column text mode are stored in main memory, and the even numbered columns are in auxiliary memory. Enabling 80STORE also forces video page 1 to be displayed. If you want to display 80-column text page 2, you need to use another method of accessing auxiliary memory. The 80VID switch determines whether the screen is displaying 40-column or 80-column video mode. Note that the 80STORE and 80VID switches are completely independent. You can be displaying either video mode while having memory mapping set up for the other one. The primary character set is the traditional Apple II character set, used by the 40-column I/O routines. It has INVERSE and FLASH for upper case and symbols (but not lower case) and no mousetext. The alternate character is used by the 80-column firmware. It has no FLASH support, and extends INVERSE to include lower case characters. On an unenhanced IIe, it has two sets of uppercase inverse characters. On a IIgs, IIc or enhanced IIe, one of these sets is replaced by mousetext symbols. > I'd also like the PRODOS code to load a file! If I know the > file is on disk and I know where it is at, how do I change the > prefix, load the file (do I have to specify where to load it to?), I don't have time to write an article on how to use the MLI. I'd strongly suggest buying a book on the subject, as there is a lot of infomration which needs to be covered. > How can I write the above code with an assembler that does not have DB and DW > commands? Get a proper assembler. About the only assembler that doesn't have DB and DW commands (or an equivalent) is the mini-assembler (built into the monitor on the IIgs, IIc and enhanced IIe). If I remember right, the LISA816 assembler is freeware, and I think that some flavours of Merlin may be available on the same basis. If you need to enter individual bytes or words of data in the mini-assembler, then drop out to the monitor and use the store memory command to place the data bytes in the appropriate locations. Word data is entered as two bytes, with the low order byte first. > Also a PRODOS memory map would be nice. Here is a rather course one for main memory: $0000-$00FF Zero page $0100-$01FF Stack $0200-$02FF Input buffer (may be available) $0300-$03CF Free $03D0-$03EC BASIC.SYSTEM vectors (free for SYS applications) $03EE-$03FF Firmware vectors $0400-$07FF Text/Lo-res memory $0800-$BEFF Available for use by SYS applications $BF00-$BFFF ProDOS global page $C000-$CFFF I/O space $D000-$FFFF Firmware or ProDOS kernel ProDOS uses $003A through $004F, and some I/O drivers (SmartPort) use locations in the $5x range. I don't have an up-to-date list of auxiliary memory reserved areas. There are some technical notes which cover the recommended use of auxiliary memory, particularly TN.PDOS.026.