diff --git a/DEBUGGER.TXT b/DEBUGGER.TXT deleted file mode 100644 index 1d7ec4c..0000000 --- a/DEBUGGER.TXT +++ /dev/null @@ -1,373 +0,0 @@ -Debugger in Emu48/Tools/Debugger... ------------------------------------ - -This is a short description of the internal assembly debugger of Emu48. - -The debugger was designed to help customers inspecting assembler code objects, a part that cannot be handled satisfactorily by the JAZZ package. Thanks to Mika Heiskanen and all the others supporting this great program. - -After starting the debugger the emulation will stop at the current program counter position. The emulation will continue after closing the debugger window. Please remember that the clock now shows the wrong time. - -1.) System Menu / Debugger Settings - -This is the configuration dialog for the debugger. - -In the "Disassembler" section you can switch between HP and Class Mnemonics for the disassembler. This switch is exactly the same like in the main Settings dialog. - -In the "Symbolic" section you can setup the debugger for symbolic debugging. Therefore the debugger needs a reference file. The reference file must contain a table for converting an absolute address into a symbolic name. I decided to use the HP-TOOLS object files (file extension *.o) with the supported entries. These object files are usually provided by HP for the HP48 and HP49 series and are necessary for linking object files. In the case of older calculators you have to make them by your own. Using the object file for the linker as reference has two disadvantages. First such an object file has an assembler specific output format, in our case the debugger only understands the output format of HP SASM v3.x. Second, in some cases an entries has two or more different names and I cannot control which name is returned. - -Example from ENTRIES.A (HP48 Supported ROM Entry Points) - -=UNROT EQU #60FAC * -=3UNROLL EQU #60FAC * -=XYZ>ZXY EQU #60FAC * - -My implementation returns the last name inside the linker object file to the chosen address. - -If you don't have the linker object file, the HP28S entry point list for example is only distributed as assembler source file SUPROM28.A, you can simply generate it with - -sasm -N SUPROM28.A - -- Enable - -With an unchecked Enable check box you can disable the symbolic debugging without removing the reference file. - -- Model - -Each calculator model needs his own symbol reference file. The given models exactly corresponds to the one used in the KML script. When you opening the settings dialog automatically the actual model is chosen in the combo box. You can switch to all other possible calculator models to enter the corresponding reference files. When you exit the dialog with the Ok button all filenames are saved. - -- Edit field - -The edit field must contain the filename to the model specific symbol reference file which is chosen by the combo box. - - -2.) Menu Debug - -- Run F5 - -Continue calculator emulation under debugger control. The emulation will stop at a breakpoint. Please remember that the emulation speed is slower than without debugger control. - -- Run to Cursor F6 - -Execute program until address at cursor position is reached. Breakpoints are still active and may stop execution before. - -- Step Into F7 - -Execute one code instruction. - -- Step Over F8 - -Execute a GOSUB, GOSUBL or GOSBVL as one instruction. Normally the instruction cursor will set to the position behind the GOSUB instruction. - -But this makes trouble in the following code part: - - GOSUB + - NIBASC /Hello world/ -+ C=RSTK - -The program counter will never reach the address behind the GOSUB instruction. The debugger solve this problem by breaking the emulation when the stack has the same level before the GOSUB instruction. In this example the single step execution will continue after the C=RSTK instruction. - -- Step Out F9 - -Continue the program until a RTI, RTN, RTNC, RTNCC, RTNNC, RTNSC, RTNSXN, RTNYES instruction is found above the current stack level. - -At some code constructions (mostly used to save space on the hardware stack) like - - C=RSTK - PC=C - -and - - C=RSTK - RSTK=C - RTN - -the stop address will be wrong. The problem in both code fragments is the C=RSTK opcode. In the first example there is no RTN instruction to stop. In the second one the C=RSTK instruction purge the original return address and then the RSTK=C instruction is interpreted as a GOSUB instruction. - -In opposite the following code will work fine: - - RSTK=C - .. - code <- F9 was pressed here - .. - GOSUB - - C=RSTK - RTN <- emulation will stop after this instruction -- RTN - -So be careful using the F9 key. - -- Break F11 - -Stops the emulation at the current program counter position. - - -3.) Menu Breakpoints - -- Set Breakpoint F2 - -Toggle a code breakpoint at the cursor position in the Code window. - -- Edit Breakpoints... - -You get a sorted list of all current breakpoints. When the breakpoint is checked it's enabled otherwise it's disabled. With "Add" you can add a new or enable an existing breakpoint, with "Delete" you can delete the selected ones. Addresses greater than #FFFFF are cut after the fifths nibble. When adding a new breakpoint, you must select if this is a "Code", "RPL", "Memory Access", "Memory Read" or "Memory Write" breakpoint. - - - "Code" stop before opcode execution on this address - - "RPL" stop on the first opcode of the selected RPL address - - "Memory Access" stop before reading or writing to the selected address - - "Memory Read" stop before reading the selected address - - "Memory Write" stop before writing to the selected address - -With a left mouse button double click on a breakpoint you can toggle the check box inside. When you use the space key instead, on all selected breakpoints the check box is toggled. - -- Clear All Breakpoints - -Clear all address specific breakpoints. - -- NOP3 Code Breakpoints - -What are NOP3 code breakpoints? As you know user programs are loaded somewhere in memory and can be moved after a garbage collection. So it's very difficult to break a user program at a hard set breakpoint with F2. To solve this problem the debugger will stop emulation at a NOP3 opcode. So you can easily add a NOP3 command into your sources to force a break condition. To enable this you have to check this item. - -NOP3 and NOP3, what's the difference? The Saturn CPU has no NOP command, so NOP3 is an opcode that is three nibbles long and doesn't change a register. In the HP SASM.DOC document two different opcodes are defined for NOP3: - - Opcode 820 for HST=0 0 - -and - - Opcode 420 for GOC + (next line) - -In the assembler of the HPTOOLS 3.x package NOP3 is defined as opcode 820. The advantage of the opcode is that the execution time is always the same, independent from the carry flag. This code is used in the HP48 ROM as well. So I decided to use the GOC opcode for a code breakpoint condition. - -A short example how to use a NOP3 Code breakpoint: - -ASSEMBLE - NIBASC /HPHP48-E/ - -BREAK MACRO - CON(3) #024 NOP3 - ENDM - -RPL -CODE - BREAK code breakpoint - - GOSBVL =SAVPTR save register - - GOSUB + problem for step over - NIBASC /Hello world/ -+ C=RSTK - - GOVLNG =GETPTRLOOP -ENDCODE - -- CODE Object Breakpoints - -If this item is checked, the debugger stops program execution at the first instruction of every DOCODE object which isn't located in ROM. For inspecting DOCODE objects in ROM use address CODE breakpoints instead please. - -- RPL Breakpoints - -If this item is checked, the debugger stops program execution on every instruction called after a PC=(A) or PC=(C) opcode. This is normally the begin of a new RPL command. RPL breakpoints use a "-R" marker instead of the assembler "->" PC position marker. - - -4.) Menu Interrupts - -- Step Over Interrupts - -If this item is checked, interrupt handler code will be skipped. This option is useful when you don't want to debug the interrupt handler. But be careful, when you disable the interrupts all code until interrupt enable belong to the interrupt handler code and couldn't executed in single step any more. Enabled breakpoints are still active. - -You can also use this option if you want to quit the interrupt handler. Just check this option, press F7 for "Step Into" for stopping the debugger behind the RTI instruction, and uncheck this option again. - - -5.) Menu Info - -- Last Instructions... - -This is a short viewer for the last 255 executed CPU addresses. The disassembled opcode maybe wrong, because only the CPU address of each command was saved and memory mapping may have changed meanwhile. In the "Last Instructions" dialog you can copy selected lines to the clipboard or clear this list. - -- Profiler... - -This opens a small toolbox window which shows the number of CPU cycles and the corresponding execution time of the instruction sequence between the last two breakpoints. The CPU cycles are only approximate values, the real cycles are depending mostly on the used ROM to Saturn CPU core interface. - -- Write Only Registers... - -Some of the display registers have a different meaning on reading and writing. This dialog shows the data written to the write only I/O registers. - - -6.) Code window - -This windows shows you the disassembled code. The line with the current PC is marked with a "->" or "-R" between the address and the disassembly. - -You can use the UP, PAGE UP, DOWN and PAGE DOWN keys to scroll the window content. There is one strange behavior, when you move to higher addresses the debugger is able to disassemble the next line correctly, but when you move to cursor to lower addresses the debugger does not know if this address is at the begin or inside of an opcode. In result you get wrong disassembled lines. - -Context menu pressing the right mouse button: - -- Go to address... G - -Moves the cursor to the specified code address. Therefore you can enter a hexadecimal number or the symbolic reference name. - -- Go to PC - -Sets the cursor to the actual position of the PC. - -- Set breakpoint F2 - -Toggle a code breakpoint at the cursor position in the Code window. - -- Set PC to selection - -Set the PC to the cursor position. Be careful with this command, you change the execution order of the commands! - -- Find - -Search in the mapped CPU address area for an address which contain a PCO (Primitive Code Object) header. The disassembled code of this address is shown in the Code window. - -- Previous PCO - -Search for a PCO before the address shown in the first line of the Code window. - -- Next PCO - -Search for a PCO behind the address shown in the first line of the Code window. - - -7.) Register window - -Here you can see the actual contents of the CPU registers. The values are only updated at a program execution stop. All changed CPU registers are highlighted. - -With the left mouse button you change the content of the register. On bit registers, like CY and Mode, the state change immediately without any request. - - -8.) Memory window - -This windows shows the memory content in the selected context. - -You can use the arrow, PAGE UP and PAGE DOWN keys to move the cursor to a memory position, the + and - keys change the memory position by one nibble under the cursor. With a double click on the left mouse button (only in Map mode) you can change the content of the two addresses. When the memory position is read only (ROM or write protected RAM) the content wouldn't change. - -Context menu pressing the right mouse button: - -- Go to address... G - -Moves the cursor to the specified memory address. Therefore you can enter a hexadecimal number or the symbolic reference name. - -- Go to PC - -Sets the cursor to the actual position of the PC. - -- Go to D0 - -Sets the cursor to the actual position of the D0 register. - -- Go to D1 - -Sets the cursor to the actual position of the D1 register. - -- Go to Stack - -Sets the cursor to the return address placed in the top level of the stack. - -- Follow - -Follow is a Pop-up menu to change the address behavior of the memory window. Normally the address of the memory window is static and only change by entering a new address. With Follow the memory window view follow the content of a selected address or register. In follow mode the memory window is only updated after an emulation step. - -- Follow none - -This is the default mode. The address of the memory window is static. - -- Follow Address Content - -This is a special mode of indirect addressing. You can specify an address which content will we interpreted as memory pointer. The memory window follow this memory pointer. - -- Follow Register PC/D0/D1 - -The Memory window follow the content of the selected register. - -- Find... F - -Calls the "Find" dialog box, allowing you to search for a data sequence in hexadecimal or ASCII mode. The search area is selected by the memory view Mapping mode described in the following section. If the data sequence is found the Memory window and an opened "RPL Object Viewer" window will be updated. - -With the button "Previous" you can search for the previous and with the button "Next" you can search for the next occurrence of the data sequence. - -When you close the "Find" dialog box, you will loose all saved strings in the data combo box. - -- Mapping - -Mapping is a Pop-up menu to select the memory view of the Memory window. Normally the CPU see only 512KB of the total memory, the rest is banked or covered by other modules. The following menu entries select the memory chip connected with the chosen Chip Select signal of the MMU. The connections are calculator model dependent. - -- Mapping Map - -This is the default mode. Here the Memory window shows what the CPU see. In this mode you can also change the memory content of writeable memory. - -- Mapping NCE1/NCE2/CE1/CE2/NCE3 - -Here the Memory window shows the content of the selected Chip Select signal. The content is showed in a linear address model and it's content can't be changed in this mode. - -Here's a comparison of the mapping of the emulated calculator models: - -Abbreviations: ROM = Read Only Memory - RAM = Random Access Memory - Flash = electrical reprogramming ROM - Slt = Memory Card Slot - BS = Bank Switcher (no memory) - nc. = not connected - - | HP38G | HP39/40G | HP48S/SX | HP48G/G+/GX | HP49G ------------------------------------------------------------------------------ -NCE1 | ROM 512KB | ROM 1024KB | ROM 256KB | ROM 512KB | Flash 2048KB -NCE2 | RAM 32KB | RAM 128KB | RAM 32KB | RAM 32/128KB | RAM 256KB -CE1 | nc. | BS | Slt1 32/128KB | BS | BS -CE2 | nc. | nc. | Slt2 32/128KB | Slt1 32/128KB | RAM 128KB -NCE3 | nc. | RAM 128KB | nc. | Slt2 32KB-4MB | RAM 128KB - -- Load Memory Data... - -The "Load Memory Data" dialog box allows loading memory dump files to the specified address inside the Saturn address area. The specified address must point to RAM, writing into ROM areas isn't possible. The memory dump file must be in packed data format, meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address. The disadvantage of packed files is that you cannot load memory files with an odd number of data nibbles, but the advantage is that you can directly load an assembler output to memory. - -- Save Memory Data... - -The "Save Memory Data" dialog box allows saving the data of the specified Saturn address area into a memory dump file. The memory dump file contain the data in packed data format, meaning each byte in file contain two Saturn data nibbles with the low nibble containing the even and the high nibble the following odd address. - -- RPL Object Viewer... - -This opens a small toolbox window showing the decompiled RPL object in the selected memory map mode at the memory address marked by the cursor. If the toolbox window is already open the content will be updated. There's a problem if you want to select an address inside the marked two addresses. The easiest way to switch the address is the use of the + and - keys changing the memory position by one nibble under the cursor. - - -9.) Stack window - -The content of the hardware stack is viewed here. In "1:" is the current return address. A double click on an item shows the address content in the Code window. - -Context menu pressing the right mouse button: - -- Push - -Push a new element before the current selection onto the stack. - -- Pop - -Pop the selected element from the stack. - -- Modify - -Modifies the stack content of the current selection. - - -10.) MMU window - -The configuration of the memory controllers is viewed here. The viewed addresses are the first address of each module area and may differ from the given address in the CONFIG command. - -This example - - LC(5) #C0000 128KB size - CONFIG - LC(5) #98765 start address of module - CONFIG - -will config a 128KB module at address #80000 and not at the given address. So the MMU viewer will show you the address #80000. - - -11.) Miscellaneous window - -The Miscellaneous window show you the internal state of the interrupt flag, the 1ms keyboard handler and the contents of the Bank Switcher latch. The Bank Switcher item is only enabled on calculators with a latch inside. You see the loaded value of the address lines A6-A0. You have to ignore the last bit (A0), because it isn't wired to the six bit latch. - -You can change the values by pressing the left mouse button over the old content. - - -01/09/13 (c) by Christoph Gießelink diff --git a/EMU48.TXT b/EMU48.TXT deleted file mode 100644 index ea9ed1f..0000000 --- a/EMU48.TXT +++ /dev/null @@ -1,482 +0,0 @@ - - - - Emu48 - A freeware HP38/39/40/48/49 Emulator - for Windows 9x, ME, NT, 2000, XP, Vista and 7 - - - - ******************** - * OPERATING SYSTEM * - ******************** - -This version of Emu48 should work with all Intel x86 and x64 platforms. - - - **************** - * INSTALLATION * - **************** - -Emu48 is distributed in 1 archive: -- Emu48v15xSetup.zip All files and sources - -To install Emu48, just start the executable file inside the Emu48v15xSetup.zip -archive. The installer will guide you through the installation. When you first -run Emu48, it will detect the directory in which you installed it, and will -write its configuration to the registry HKCU\Software\Emu48. If you move the -Emu48 directory to another place you have to change the directory path inside -the "Choose Your KML Script" dialog. - -You can also update your current version with the Service Packs: -- E48BP5x.ZIP New EXE-File -- E48SP5x.ZIP Sources of the Service Pack - -Replace the original EXE file please. - - - ************************ - * YOU NEED A ROM IMAGE * - ************************ - -Emu48 needs an image of a calculator ROM to be able to run. Since fall 2000 the -emulator ROM's for the HP38, 39, 40, 48 and 49 are freely available on different -internet sites. Because there's no license for the distribution of the ROM -images, they aren't included in the Emu48 package. You can still use the classic -way extracting them from your own calculator. But in mostly all cases you have -to convert the ROM files into the Emu48 ROM format. - -- HP38: -To upload the ROM of your HP38G, you will need a special aplet called "ROM -UPLOAD", available at http://www.hpcalc.org/details.php?id=633. Once you've -uploaded the ROM, you have to convert it using the Convert utility. - -To do that, start a Command Prompt while running Windows, and type: - Convert ROM.38G - -Where is the path to your ROM image. This will create a file named -ROM.38G. This tool will also check its validity. - -- HP39/40: -To upload the ROM of your HP39G/HP40G, you will need a special aplet called "ROM -UPLOAD", available at http://hp.giesselink.com/emu48.htm. Once you've uploaded -the ROM, you have to convert it using the Rom2emu utility. - -To do that, start a Command Prompt while running Windows, and type: - Rom2emu ROM.39G - -There's also a HP39G/HP40G beta ROM for emulators inside an old Emu48 package -available at http://www.hpcalc.org/details.php?id=4272. - -- HP48: -If you have already used another HP48 emulator, you can convert the ROM using -the Convert utility. - -To do that, start a Command Prompt while running Windows, and type: - Convert ROM.48G -or Convert ROM.48S - -Where is the path to your old ROM image. This will create a file -named ROM.48G or ROM.48S, depending on the version you own. This tool should be -able to read any style of ROM image, and will also check its validity. Note that -if you run it with only one parameter, no file will be written, but it will -still check the validity of the ROM. - -If you have never used an HP48 emulator, and don't have a ROM dump, you can -either use Jean-Yves Avenard's ROMUPL.BIN or the ROMDump Wizard V1.x, which will -almost automatically get the ROM from your HP48. After the download you may have -to convert your dump with the CONVERT utility into the Emu48 format. - -You can find the latest version of the ROM dump programs on: -ROMUPL.BIN http://www.hpcalc.org/details.php?id=3686 -ROMDump Wizard http://hp.giesselink.com/emu48.htm - -- HP49G: -There's no ROM download program available so far. But you can create a ROM image -with the UPD49ROM tool available at http://hp.giesselink.com/emu48.htm and a ROM -update file for the HP49G calculator available at -http://www.hpcalc.org/hp49/pc/rom/. I suggested to use version 1.19-6 -(http://www.hpcalc.org/details.php?id=3240). - -To create a HP49G ROM image file, start a Command Prompt while running Windows, -and type: - UPD49ROM -f hp49119-6.flash ROM.49G - -This will create a HP49G ROM image file with an empty User Port 2. - - - **************** - * HOW TO START * - **************** - -When Emu48 is installed and you have put the ROM image(s), which must be in the -Emu48 ROM format, into the Emu48 directory, you can start Emu48. You'll see a -"Choose Your KML Script" box. - -KML Scripts in fact define the visual aspect of Emu48, the behavior of the -buttons, of the keyboard, ... It's a GREAT way to customize your copy of Emu48. - -Check that the path in the "Emu48 Directory" text area is correct. Modify it if -the directory in which you installed Emu48 is not the directory displayed. Click -the refresh button ("V") after modifying it to update the list box or use the -("...") button to start the directory browser. - -Choose a KML script in the list box for your calculator ROM you put into Emu48's -directory. - -Several HP48 scripts are included in the Emu48 archive: - * Emu48's Default Faceplate for HP48G/GX - * Emu48's Default Faceplate for HP48S/SX - These two are simple scripts, good for 800x600 display resolution. - * Casey's Gx with Toolbar and Touch Screen - * Casey's Sx with Toolbar and Touch Screen - These script uses many advanced features, and is a good demonstration of - the power of Emu48's scripting language KML. Try it, it is really great! - * Floating buttons - This one looks really great. - * Small but realistic HP48 Gx - This one has been designed for small resolutions such as 640x480. - Note: some things in this script have to be fixed. - -If you want other great scripts, visit Rechlin's great HP archive - http://www.hpcalc.org/ - -And if you are interested in writing new scripts, get the KML 2.0 documentation -from Christoph's page at http://hp.giesselink.com/emu48.htm - -Once you have selected a script, press OK to start the emulator. In most cases, -when Emu48 crash after pressing the OK button, you forgot to convert the ROM -image into the emulator format. While it's running, you can use the View/Change -KML Script... command to change the visual aspect of Emu48. - - - *************** - * KML SCRIPTS * - *************** - -Don't use TRUELCD.KMI for emulating display contrast in your scripts. It's not -fully correct. The hardware contrast values are in the area from 0 to 31. But -the ROMs bounds them to useful values. The HP48 S(X) ROM use only display -contrast values between 3 and 19 and the HP48 G(X) ROM values between 9 and 24. - -Maybe you have to adjust the "Rom" filename in the "Global" section. This mostly -happen with the HP49G ROM name. Some KML files use the name ROM.E49, that's the -name of the emulator ROM file published by HP. But Emu48 state files for the -HP49G have the same file extension, so the use of ROM.49G is preferred now. - - - **************** - * COMMAND LINE * - **************** - -The command line syntax is "Emu48 [E48file [Port2file]]". The first parameter -sets the filename for the emulation data, the second parameter the Port2 file. -You're not able to set a Port 2 file without setting the emulation data file. -The arguments are optional. - - - ******************* - * LOAD/SAVE FILES * - ******************* - -There are two ways to transfer files from or to the emulator. The one way is to -use the serial port to transfer the data directly from your HP to the emulator. -The second way is to load data, saved on your PC, into the stack of the -emulator. You can do this by using the Edit/Load Object... command or with the -file Drag and Drop feature. But there's one important restriction, the data must -a HP binary file (begin with HPHP48- or HPHP49-, this depends on your emulated -calculator)! If not, the data is load as string. The Edit/Save Object... command -will save the data in stack level 1 on the PC (always binary mode). Be sure, -when you use the second way for data transfer, that no program is running on the -emulator. The second way doesn't work on a HP38, because he has no stack. So you -can load aplets only from the serial port. - - - ***************** - * DRAG AND DROP * - ***************** - -Dropping HP objects over the emulator window will load program files (like the -command "Load object...") on the stack. Be sure that the emulator isn't busy -before doing this. - - - ******************* - * SHARED RAM CARD * - ******************* - -You can add a SHARED (explained below) RAM card of up to 4MB to a HP48. By -default, no such card will be created when you start Emu48. The MkShared.exe -utility will allow you to create it. - -To create a Port 2 RAM Card, call the program, select the RAM Card size, enter -the card file name and press the 'Create' button. That's it. Please remember, -this program replace the destination file without any request! - -If you use RAM cards greater than 128 KB in a HP48SX, you can only see the first -128 KB of the card. Please remember, the firmware of all HP48GX versions has a -bug when using a 4MB RAM card. You always get the message "Warning: Invalid Card -Data" at startup and Port 33 is unaccessible. This is not a bug of the emulator! - -When you have created this file, run Emu48, and call File/Settings. In the "Port -2" text area, type the name of the file you created (if you don't include a -path, it will be searched for in Emu48's directory) or press the "..." button -for the file browser. If this field is disabled you have chosen the Port 2 file -over the 2nd command line argument, so change the name there please. - -The "Port 2 is Writeable" check box represents the actual read/write state of -the Port 2 file. Changing the state will also change the state for the -calculator by modifying the Read-Only attribute of the file. - -You can also tick the check box "Port 2 Is Shared". When the box is cleared, -only the first instance of Emu48 will allow you to use the RAM card in Port 2. -When this box is checked, the first instance of Emu48 will give you both read -and write access to this RAM card. If you start Emu48 in another instance, the -RAM card in Port 2 will be write-protected. Thus you can transfer files very -easily between two calculators. This RAM card is used by both S/SX and G/GX -types. - -Please remember, all port configuration changes mostly behave like on the -original calculator. This means when you do this changes with the emulated -calculator on, it's the same like when you do this with a real calculator on. In -many times, this depends on the current state of the calculator, this will work -without any problems by doing an automatically calculator warmstart. But for the -most secure way, switch off the emulated calculator first, please! - - - *********************** - * FLASH ROM EMULATION * - *********************** - -The HP49G save the operation system in a reprogramable memory, a so called flash -memory. The flash memory is divided into two parts, into the Operating System -and into a User Data area. The User Data area is viewed as Port 2 in the HP49G. -Emu48 saves the Port 2 data in the ROM file (normally ROM.49G). As default -setting the ROM file is writeable in the first instance of Emu48. When you open -another instance of a HP49G emulation the Port 2 area is READ ONLY, that mean -all changes in Port 2 are lost when you exit this instance. If you don't want to -save data in Port 2 and want to protect the operating systems from overwriting, -you're able protect the ROM file. To do this, close all Emu48 instances and set -the variable 'Writeable' defined in the Emu48.ini file, section [ROM] to zero. - - - *********************** - * COPY / PASTE STRING * - *********************** - -With the menu items "Copy Stack" and "Paste Stack" in the "Edit" menu you're -able to copy real and complex numbers and string objects from the stack to the -PC clipboard and vice versa. - - - ********** - * BACKUP * - ********** - -Emu48 includes a backup feature (in the Edit menu). It save the complete state -of the calculator (excepting the ROM and Port 2 content) in the computer's -memory. You might want to use it before doing something risky, and if you don't -want to save to the disk. It provides some kind of Undo feature. It is also used -by Emu48 when you want to save or load a new document, to restore its old state -if you cancel the operation or of something goes wrong. - - - ************ - * KEYBOARD * - ************ - -To enter a character to the emulator use the PC keyboard (key translation -depends on the used KML script) or the mouse. If you press the left mouse -button, the emulator key is pressed as long as you press the mouse button or -leaving the area of the emulator button. Sometimes you need to press more then -one key (contrast setting, warmstart, ...). To do this, press the right mouse -button. All "locked" buttons are released after enter a key with the left mouse -button. - - - ********* - * CLOCK * - ********* - -The emulator time is synchronized with the PC time at startup of the emulator. -This may cause problems with other non original operating systems running on the -HP. On HP48 S(X) calculators the address area #00052-#00070, on all other -emulated calculators the address area #00058-#00076 in System RAM are rewritten -with the actual time information. - - - ******************************** - * Registry HKCU\Software\Emu48 * - ******************************** - -The section [Timers] in the Emu48.ini file isn't used any more. The variable -values are replaced by useful constants. You may delete this section if you -want. Starting an old version of Emu48 (V1.07 and earlier) will add this section -again. If you move the Emu48 directory to another place, you have to adjust the -variable 'Emu48Directory' in the [Files] section. - - - ************************ - * REAL SPEED EMULATION * - ************************ - -As you recognized the speed of the emulated HP is much faster than an original -one. The reason is, the assembler commands are emulated faster than the original -CPU can execute them. On one side this is a big advantage (faster execution of -programs) on the other side this cause many trouble. In Emu48 only the timers -work with the original speed. In result all commands like User-RPL WAIT wait -more or less the correct time. But many programs like shells or editors use an -own key handler to realize an autorepeat implementation. Normally these programs -use the execution time of each assembler command for waiting. On Emu48 this time -is much shorter, so the time between each key read is shorter as well and you -get a very fast key repetition. The editor ED from the JAZZ package hasn't this -problem, because the key input is synchronized with one of the timers. To solve -this problem Emu48 generally slow down emulation if a key is pressed. To solve -some other speed depending problems you are able to slow down the whole -emulation speed. There are two variables 'SXCycles=82' and 'GXCycles=123' -defined in the Emu48.ini file, section [Emulator] which control the "real" speed -and key repetition slow down for each calculator type. Each numeric value is -representing the allowed CPU cycles in a 16384Hz time frame. Because the used -cycle statements (from SASM.DOC) in Emu48 doesn't correspond to the real values -of the CPU, the saved values are estimated by comparing the execution time of a -program to the real calculator. Increasing the value fitting to your ROM will -make the "real speed" HP faster and vice versa. No warranty to the functionality -of Emu48 when you go below the default values. - - - ************************* - * SERIAL PORT EMULATION * - ************************* - -The serial ports are emulated as well now. You may choose the same serial port -for wire and IR. Remember that the IR port only work with 2400 Baud. If you want -to change the serial port settings, but they are disabled, close the serial port -with the command CLOSEIO or power cycle the HP first. - -Now it's possible to make transfers between the real calculator and Emu48. If -you have problems with the connection please try the following. There's a simple -way to check if your serial port is used by another program. First disable the -serial settings in both combo boxes and very important close the settings -dialog. Reopen the settings dialog and choose the COM port in the wire combo box -to the port the HP is connected with. When you open this combo box you only see -valid (unused) serial ports. Don't use the IR combo box, it only works with 2400 -Baud. The next important thing are the serial settings of the real calculator -and Emu48, they must be equal. If this doesn't work then mostly there's a -hardware or a resource problem of the serial port. Check this with connecting -the HP with a transfer program you like on the same serial port. - - - ******************************* - * INFRARED PRINTER SIMULATION * - ******************************* - -The emulator has the ability to print decoded data to a HP82240A/B printer -simulation. The data transfer to the printer simulator is done over UDP. You can -the define the IPv4 address and the port the printer simulator is listening. - - - **************** - * DISASSEMBLER * - **************** - -With the internal disassembler you're able to disassemble the Saturn chip -address area. With the default Map setting the disassembler always see the -mapped memory address. If for example you configured the RAM at #00000 you will -see the RAM and not the ROM at this address. With the other module settings you -specify a special module for disassembly. Each module use a linear address mode, -beginning at address #00000 and will not overlapped by other modules. So, for -example, you can access the second port of a HP48 RAM card greater than 128KB at -address #40000 (128 * 1024 * 2). The "Copy Data" button copies the selected -disassembler lines to the PC clipboard. - - - ************ - * DEBUGGER * - ************ - -Emu48 has an integrated Saturn assembler debugger inside. For further -information read the separated "Debugger.txt" documentation please. - - - ************** - * DDE SERVER * - ************** - -I implemented a DDE server in Emu48 to transmit data from and to the HP stack -with DDE. You have the same restrictions like with the commands "Load object..." -and "Save Object...", that a running program may corrupt memory. In difference -you can choose the stack level for the transfer in the DDE item field. Take care -to transmit data only after the acknowledge of the last DDE transaction. - -Technical data: - -Servername: Emu48 -Topicname: Stack -Item: 1 (stack level) -Clipboardformat: "CF_HPOBJ" (user defined) - -The DDE commands CONNECT, POKE and REQUEST are supported. - -The structure of the clipboard format "CF_HPOBJ": - -+--------+------------------------------------+ -| 4 Byte | HP object | -+--------+------------------------------------+ - \ \ - \ +--- normal HP object - +----------- length of object (LSB first) - - - ******************** - * TROUBLE SHOOTING * - ******************** - -Visit the Emu48 FAQ site at http://hp.giesselink.com/index.htm to get more -information please. - - - *********** - * SUPPORT * - *********** - -We cannot provide any individual support for Emu48. Information about Emu48 will -be on the Emu48 Homepage or on the Emu48 FAQ at - - http://hp.giesselink.com/index.htm - -It's also a good idea to look at the Usenet forum comp.sys.hp48. Emu48 topics -have discussed there in different threads for years now. - - - *************** - * LEGAL STUFF * - *************** - -Emu48 - An HP38/39/40/48/49 Emulator -Copyright (C) 2013 Sebastien Carlier & Christoph Gießelink - -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 2 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, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - - - *************** - * The Authors * - *************** - - Sebastien Carlier - Christoph Giesselink - -E-Mail: - c dot giesselink at gmx dot de - -Homepage: - http://hp.giesselink.com/ diff --git a/EMU48PLUS.TXT b/EMU48PLUS.TXT deleted file mode 100644 index 968ff65..0000000 --- a/EMU48PLUS.TXT +++ /dev/null @@ -1,29 +0,0 @@ -Emu48 1.56+ (based on Emu48 1.58) - -Emu48+ is a modified version of Emu48 to add support for the ARM-based -calculators. It does not emulate the ARM CPU, but it enhances the -Saturn emulation to more closely match the emulation provided by the -Saturn emulator on the ARM-based calculators. - -Emu48+ adds support for many of the Saturn+ instructions, including -some of the BUSCC instructions, and it also adds support for the 80-line -display used on the 49g+ and 50g. - -At present, the additional calculators supported in Emu48+ are the -49g+, 48gII (hardware revision 1), 50g, and 39g+. - -To create KML scripts for the additional calculator models, use the -following model codes: - -39g+: Model "P" - -49g+: Model "Q" - -48gII: Model "2" - -50g: Model "Q" - Class 50 - -Most of the code that was changed in Emu48+ over Emu48 was provided by -Cyrille de Brebisson of Hewlett-Packard. - diff --git a/Emu48.dll b/Emu48.dll index becb20a..226115e 100644 Binary files a/Emu48.dll and b/Emu48.dll differ diff --git a/Emu48.exe b/Emu48.exe index 1fb1dc5..69b0a49 100644 Binary files a/Emu48.exe and b/Emu48.exe differ diff --git a/Emu48.htm b/Emu48.htm new file mode 100644 index 0000000..a0a4c0e --- /dev/null +++ b/Emu48.htm @@ -0,0 +1,651 @@ + + + + +Emu48 Manual + + + + + + + +
+

Emu48 - A freeware HP38G/39G/40G/48SX/48GX/49G Emulator
+ for Windows 9x, ME, NT, 2000, XP, Vista, 7, 8 and 10

+
+ +
+

1. General

+

Emu48 is an emulator for the Hewlett Packard HP38G, HP39G, + HP40G, HP48SX, HP48GX and HP49G calculator hardware. These calculators + are based on the 1LT8 Clarke (HP48SX) and on the Yorke chip.

+

2. Acknowledgements

+

First of all a big thank to Sébastien Carlier for publishing + Emu48 v1.0 under the GPL. Without this decision newer versions of the + emulator wouldn't have been possible or ports to other similar + calculators wouldn't have been made. Also a big thank to Jean-Yves + Avenard for his technical assistance in the beginning. And finally I + want to thank all the unnamed authors for publishing material about + these calculators.

+

3. ROM Images

+

Emu48 needs an image of a calculator ROM to be able to run. ROM + images are valid in a packed (even address lower nibble, odd address + higher nibble) or unpacked (one nibble per byte with even address first) + form.

+

Since fall 2000 the emulator ROM's for the HP38, 39, 40, 48 and 49 + are freely available on different Internet sites. Because there's no + license for the distribution of the ROM images, they aren't included + in the Emu48 package. You can still use the classic way extracting + them from your own calculator. But in mostly all cases you have to + convert the ROM files into the Emu48 ROM format.

+
    +
  • HP38 +

    To upload the ROM of your HP38G, you will need a special aplet + called "ROM UPLOAD". + Once you've uploaded the ROM, you have to convert it using the + Convert utility.

    +

    To do that, start a Command Prompt while running Windows, and + type:

    +
    Convert <rom-file> ROM.38G
    +

    Where <rom-file> is the path to your ROM image. This will + create a file named ROM.38G. This tool will also check its validity. +

  • +
  • HP39/40 +

    To upload the ROM of your HP39G/HP40G, you will need a special aplet + called "ROM UPLOAD". + Once you've uploaded the ROM, you have to convert it using the Rom2emu utility. +

    +

    To do that, start a Command Prompt while running Windows, and + type:

    +
    Rom2emu <rom-file> ROM.39G
    +

    There's also a HP39G/HP40G beta ROM for emulators inside an old + Emu48 package. +

  • +
  • HP48 +

    If you have already used another HP48 emulator, you can convert + the ROM using the Convert utility. +

    +

    To do that, start a Command Prompt while running Windows, and + type:

    +
    Convert <rom-file> ROM.48G
    +

    or

    +
    Convert <rom-file> ROM.48S
    +

    Where <rom-file> is the path to your old ROM image. This + will create a file named ROM.48G or ROM.48S, depending on the version + you own. This tool should be able to read any style of ROM image, and + will also check its validity. Note that if you run it with only one + parameter, no file will be written, but it will still check the + validity of the ROM.

    +

    If you have never used an HP48 emulator, and don't have a ROM + dump, you can either use Jean-Yves Avenard's ROMUPL.BIN or the + ROMDump Wizard V1.x, which will almost automatically get the ROM from + your HP48. After the download you may have to convert your dump with + the CONVERT utility into the Emu48 format.

    +

    You can find the latest version of the ROM dump programs on:

    +
    + ROMUPL.BIN + http://www.hpcalc.org/details.php?id=3686
    + ROMDump Wizard + + http://hp.giesselink.com/emu48.htm +
  • +
  • HP49G +

    There's no ROM download program available so far. But you can + create a ROM image with the + UPD49ROM tool + and a + ROM update file for the HP49G calculator. I suggested to use + version 1.19-6 +

    +

    To create a HP49G ROM image file, start a Command Prompt while + running Windows, and type:

    +
    UPD49ROM -f hp49119-6.flash ROM.49G
    +

    This will create a HP49G ROM image file with an empty User + Port 2.

  • +
+

4. Installation

+

To install Emu48 you may use the installer package which contain, + among the binaries, some HP48 KML scripts or just unzip the emulator + and the required emulator skins from archives into an empty directory. + Finally you have to copy your ROM images into this directory and + adjust the ROM image name to the name used in the corresponding KML + script. When you first run Emu48, it will detect the directory in + which you installed it, and will write the configuration to the + registry at HKCU\Software\Emu48.

+

5. How to Start

+

When Emu48 is installed and you have put valid KML scripts and the + corresponding ROM image(s) into your Emu48 installation directory, you + can start Emu48. You'll see a "Choose Your KML Script" + box.

+

KML scripts in fact define the visual aspect of Emu48, the behavior of + the buttons, of the keyboard, ... It's a GREAT way to customize your copy + of Emu48.

+

Check that the path in the "Emu48 Directory" text area is + correct. Modify it if the directory in which you installed Emu48 is not + the directory displayed. Click the refresh button ("V") after + modifying it to update the list box or use the ("...") button to + start the directory browser.

+

Choose a KML script in the list box for your calculator ROM you put + into Emu48's directory.

+

Several HP48 scripts are included in the Emu48 archive:

+
    +
  • Emu48's Default Faceplate for HP48G/GX
  • +
  • Emu48's Default Faceplate for HP48S/SX +

    These two are simple scripts, good for 800x600 display + resolution.

  • +
  • Casey's Gx with Toolbar and Touch Screen
  • +
  • Casey's Sx with Toolbar and Touch Screen +

    These script uses many advanced features, and is a good + demonstration of the power of Emu48's scripting language KML. + Try it, it is really great!

  • +
  • Floating buttons +

    This one looks really great.

  • +
  • Small but realistic HP48 Gx +

    This one has been designed for small resolutions such as + 640x480. +

  • +
+

If you want other great scripts, visit Rechlin's great HP archive +

+

And if you are interested in writing new scripts, get the KML 2.0 + documentation from the + authors Emu48 page.

+

Once you have selected a script, press OK to start the emulator. In + most cases, when Emu48 crash after pressing the OK button, you are using + an invalid ROM image. While it's running, you can use the View/Change KML + Script... command to change the visual aspect of Emu48.

+

6. Command Line

+

The command line syntax is "Emu48 [E48file [Port2file]]". + The first parameter sets the filename for the emulation data + independent from the "LastDocument" setting, the second + parameter the Port2 file. You're not able to set a Port 2 file without + setting the emulation data file. The arguments are optional.

+

7. Virtual Keyboard

+

There are two ways to use the virtual keyboard on the emulated + calculator:

+
    +
  1. by Mouse
  2. +
  3. by PC keyboard
  4. +
+

+ The easiest way to use the emulated calculator is using the mouse. The KML + script define buttons with an area where mouse input is active. The mouse + cursor change from an arrow to a hand cursor in these areas. The state of + the virtual key follow the state of your left mouse button. When the mouse + cursor leaves the virtual key area the virtual button automatically + release. In some cases you need to press more than one key on the + emulator. For these cases press the virtual key with the right mouse + button. When you release the mouse button or leave the area of the virtual + key, the key is still hold. To release all hold virtual buttons, just use + the left mouse button again. A single release of a hold virtual key isn't + possible.

+

+ Another convenient way is using the PC keyboard. The KML script language + support a large variety of commands to implement this feature. So keyboard + usage depends on your used KML script and not on the emulator. Because of + this it's impossible to say what's happen when you press a key on the PC + keyboard. For further details read the KML 2.0 documentation mentioned + before please.

+

8. File Menu

+

8.1 New...

+

Creates a new emulation session. You're asked for a new KML script + where you can select the calculator type and skin to emulate.

+

8.2 Open...

+

Opens an existing emulation session. The emulation continues at the + same position where the loaded session was aborted. Loading emulation + sessions made with a different ROM revision may destroy the memory + content or may cause other unpredictable results.

+

8.3 Save

+

Saves the current running session with the actual name.

+

8.4 Save As...

+

Saves the current running session with a new name. You're also get in + this dialog when you Exit a new session without a state file name.

+

8.5 Close

+

Closes the current session without closing the emulator.

+

8.6 Settings

+

This calls the Settings dialog. This dialog has three tabs: + General, Memory and Peripheral.

+

8.6.1 Settings General

+

8.6.1.1 Section General

+
    +
  • Authentic Calculator Speed +

    When this option is checked, the emulation speed will be similar + to the real calculator depending on the RATE control register + content.

  • +
  • Enable Virtual LCD Delay +

    Try this option for a better 4 color gray scale display simulation + output.

  • +
  • Always On Top +

    When this option is checked, the emulator window will always be the + topmost one.

  • +
  • Activation Follows Mouse +

    This option enables a X-Mouse style windows activation. When the + mouse is moved over the emulator window, the emulator is getting the + focus and popping up into foreground.

  • +
  • Single Instance +

    When this option is checked, the program is only allowed to run in + a single instance. If another running instance is detected, the detected + instance is set into foreground as active window and get a request to + change his state file to the given one by the current instance. Finally + the current instance is terminated.

  • +
  • Automatically Save Files +

    When this option is checked, the current state file will automatically + saved when you change to another state file, but not when you close the + emulator program.

  • +
  • Automatically Save Files On Exit +

    When this option is checked, the current state file will be saved + automatically at the end when the emulator program is closed.

  • +
  • Show Load Object Warning +

    When this option is checked, you'll get a warning message box when you + try to load an object with the Load Object... menu command. If + this option is unchecked, the warning will be skipped.

  • +
  • Always Show KML Compilation Result +

    When this option is checked, you see the results of the KML + (Keyboard Macro Language) interpreter at every KML script load.

  • +
+

8.6.1.2 Section Style

+
    +
  • Show Title +

    When this option is checked, the window title bar is visible.

  • +
  • Show Menu +

    When this option is checked, the menu bar is enabled. If unchecked, + the menu is accessible as context menu in the client area outside the + calculator button definitions.

  • +
+

8.6.1.3 Section Disassembler

+

Choosing the assembler syntax:

+
    +
  • HP Mnemonics +

    This is the standard syntax used by HP.

  • +
  • Class Mnemonics +

    Class (Clarke assembler) was written by Lutz Vieweg in 1991, at a time + when HP had not published their own development tools. The syntax is very + similar to the AG and STAR mnemonics used at this time. Especially + published assembler programs written for the HP28S use the similar AG + syntax.

  • +
+

8.6.2 Settings Memory

+

8.6.2.1 Section Memory Cards

+
    +
  • Port 1 is Plugged +

    When this option is checked, a 128 KB RAM card is emulated in card + Port 1. The RAM card content is saved in the current emulator state + file.

  • +
  • Port 1 is Writeable +

    When this option is checked, the RAM card in card Port 1 is + writable else the card is Read-Only by simulating the card write + protect switch.

  • +
  • Port 2 is Shared +

    When this option is unchecked, only the first instance of Emu48 + will allow you to use the RAM card in Port 2. When this option is + checked, the first instance of Emu48 will give you both read and + write access to this RAM card. If you start Emu48 in another + instance, the RAM card in Port 2 will be write-protected. Thus you + can transfer files very easily between two calculators. This RAM card + is used by both S/SX and G/GX types.

  • +
  • Port 2 is Writeable +

    This option represents the actual read/write state of the Port 2 + file. Changing the option will also change the state for the + calculator by modifying the Read-Only attribute of the file.

  • +
  • Port 2 File +

    You can add a RAM card of up to 4MB to a HP48. By default, no such + card will be created when you start Emu48. The MkShared.exe utility + will allow you to create one. To create a Port 2 RAM Card, call the + program, select the RAM Card size, enter the card file name and press + the 'Create' button. That's it. Please remember, this program replace + the destination file without any request!

    +

    If you already have a Port 2 card file in unpacked format, you + have to copy the file into the emulator directory. If you choose a + different directory you have to use a full path file name.

    +

    If you use RAM cards greater than 128 KB in a HP48SX, you can only + see the first 128 KB of the card. Please remember, the firmware of + all HP48GX versions has a bug when using a 4 MB RAM card. You always + get the message "Warning: Invalid Card Data" at startup + and Port 33 is inaccessible. This is not a bug of the emulator!

    +

    When you have created or copied the file, enter the card file + name into the Port 2 File edit box.

    +

    Please remember, all port configuration changes mostly behave + like on the original calculator. This means when you do this changes + with the emulated calculator on, it's the same like when you do this + with a real calculator on. In many times, this depends on the current + state of the calculator, this will work without any problems by doing + an automatically calculator warmstart. But for the most secure way, + switch off the emulated calculator first, please!

  • +
+

8.6.3 Settings Peripheral

+

8.6.3.1 Section Sound

+

A new implementation of the sound engine made ROM patches for sound + output obsolete. The new sound engine emulates the behavior of the beeper + output ports and only work in connection with a sound card. Using the + internal PC speaker isn't possible any more. The old beeper method with a + ROM patch is still working but deprecated, it's strongly recommended to + remove all beep patches from your current KML scripts to enable the new + sound engine. The support of the old sound implementation by a ROM patch + maybe removed in later versions of the emulator and remaining beep + patches will corrupt the ROM with an illegal opcode then. +

+

+ For the sound generation the calculator must know his own CPU strobe + frequency. On the real calculator the speed depends on various settings + like component tolerances, actual temperature, humidity and other + variables. The resulting speed is measured by the calculator firmware + at a cold- or at a warmstart and stored in the =CSPEED variable. The + content of this calculator variable has direct influence on the + resulting frequency and duration. On the emulator the HP48SX CPU + strobe frequency is set by the registry key + HKCU\Software\Emu48\Emulator\SXCycles, for all other + calculators at HKCU\Software\Emu48\Emulator\GXCycles. + For some reasons the CPU cycles are only estimated and so the + strobe frequency value in the registry is not the exact CPU strobe + frequency of the calculator in Hz divided by 16384 like in the + other emulators. Because older versions of the emulator were not + able to measure the CPU strobe frequency properly or the strobe + frequency registry content has been changed since the last + measurement, the =CSPEED variable of this session file may contain + a wrong frequency value. You easily may discover this by measuring + the real duration of a 10s beep. Is the difference to 10s less + than 1s everything is ok, if not, you should perform a + warmstart of the calculator in this + session file. Alternatively you may execute a + Reset Calculator. This recalls the measuring + routine and save the result in the speed variable. Both restart + variants purge the stack content! +

+
    +
  • Volume +

    The output volume can be selected with the Volume slider relative to + the Master Volume control. +

  • +
  • Device +

    By default the sound device is set to "Standard Audio", but + you can also manually choose the output device. The device name is + somehow cut since Window Vista, but the method of reading the device + name is used for backwards compatibility to older versions of the + Operating System. When you change the Standard Audio device in the + Operating System settings dialog, the internal device numbering may + change, and so the manually selected audio device.

  • +
+

8.6.3.2 Section Infrared Printer

+

The emulator has the ability to print data to a HP82240A/B printer + simulation. The data transfer to the printer simulator is done over UDP. + In this section you can the define the IPv4 address and the port the + printer simulator is listening. A suitable HP82240B printer simulation can + be found here.

+

8.6.3.3 Section Serial Ports

+
    +
  • Wire +

    In the Wire combo box you can select the COM port device connected + to the wire port of the calculator.

  • +
  • Ir +

    In the Ir combo box you can select the COM port device connected + to the IR port of the calculator. Please remember that the IR port + only work with 2400 baud.

  • +
+

8.7 Exit

+

Quit emulation. The default actions at finishing are defined in the + Settings dialog. If the current session is + "Untitled" you are asked for a session file name using the + Save As... dialog. If you quit the emulator + without a given filename, you're asked for choosing a KML script at + next startup.

+

9. Edit Menu

+

9.1 Load Object...

+

This is only valid for the HP48SX, HP48GX and the HP49G emulation. + You can load HP48 and HP49G binary objects to stack level 1. Therefore + the object must begin with "HPHP48-x" for a HP48 or with + "HPHP49-x" for a HP49G binary object where x can be any + alphanumeric character. If the binary header isn't present, the object + is loaded as string. Dropping HP objects over the emulator window will + also load objects. Be sure that the emulator isn't busy before doing + this.

+

9.2 Save Object...

+

This is only valid for the HP48SX, HP48GX and the HP49G emulation. + Save the current object in stack level 1 as binary object to disk.

+

9.3 Copy Screen

+

Copy the screen content as bitmap to the clipboard.

+

9.4 Copy Stack

+

This is only valid for the HP48SX, HP48GX and the HP49G emulation.

+

Copy a "Real Number", "Complex Number" or + "String" object in stack level 1 to the clipboard. On all + other objects, the command will be ignored. This prevents sending + binary objects to the clipboard.

+

The decimal point (radix mark) of "Real Numbers" in the + clipboard is equal to the calculator setting. This point maybe + important when you try to paste the numbers into a program using the + locale settings of the host operating system.

+

9.5 Paste Stack

+

This is only valid for the HP48SX, HP48GX and the HP49G emulation.

+

Paste the text field content of the clipboard to stack level 1 of + the emulated calculator. If the clipboard content is representing a + real number, the number will be saved as "Real Number" + object. Is the content a complex number object, the number will be + saved as "Complex Number" object, in all other cases as + "String" object.

+

To import "Real or Complex Numbers" from the clipboard, + the decimal point (radix mark) of the clipboard and calculator + must be equal. A real or complex number is only detected in the + case of valid real number characters in the clipboard. Especially + heading and tailing white spaces aren't valid number characters + also.

+

Complex numbers must be in the form (a,b) when using the + point radix mark or in the form (a;b) when using the comma + radix mark. The Cartesian or algebraic form a+bi is not + supported.

+

9.6 Reset Calculator

+

This emulates the Reset pin of the internal CPU.

+

9.7 Backup

+

9.7.1 Backup Save

+

This saves the current emulator status into a backup slot. If the + backup slot already contain data, it will be overwritten.

+

9.7.2 Backup Restore

+

This restores a previous saved emulator status without request. If you + changed the calculator model meanwhile, the emulator will switch back to + the old model.

+

9.7.3 Backup Delete

+

This deletes the data in the backup slot.

+

10. View Menu

+

10.1 Change KML Script...

+

This allows you to change the skin of the current emulated calculator. + In opposite to the New... command you see only scripts emulating the same + calculator model.

+

11. Tools Menu

+

11.1 Disassembler...

+

This is a simple disassembler.

+

Enter the address to disassemble in hexadecimal into the "Address + (HEX)" field and press <Return>. With the "Next Address" + button the next opcode is disassembled. With the "Copy Data" button + you can copy all selected lines inside the list box to the clipboard.

+

11.2 Debugger...

+

The assembler code debugger of the emulator. For more details refer to the + extra documentation of the debugger please.

+

11.3 Macro

+

The keyboard macro recorder unit.

+

11.3.1 Macro Record...

+

Prompts a dialog to enter the macro file for the data to record. After + accepting the confirm message, every key event is recorded into the macro + file with it's time information.

+

11.3.2 Macro Play...

+

Prompts a dialog box to ask for the keyboard macro file to play. The + replay starts immediately after selecting the file.

+

11.3.3 Macro Stop

+

Stops recording or replaying a keyboard macro file.

+

11.3.4 Macro Settings...

+

Settings for the Macro Replay mode

+
    +
  • Real +

    Replay macro with the original recording speed.

  • +
  • Manual +

    Replay macro with the speed set by the speed slider.

  • +
+

12. Help Menu

+

12.1 Help Topics

+

Call this document.

+

12.2 About Emu48...

+

The version, copyright and license message...

+

13. DDE Server

+

Emu48 has an integrated DDE server to transmit data from and to the HP + stack. Because only the HP48 and HP49 have a stack, all DDE transfers + are ignored on the other calculators. You have the same restrictions like + with the commands "Load object..." and "Save + Object...", that a running program may corrupt memory. In difference + you can choose the stack level for the transfer in the DDE item field. + Take care to transmit data only after the acknowledge of the last DDE + transaction.

+

Technical data:

+ + + + + + + + + + + + + + + + + +
Servicename:Emu48
Topicname:Stack
Item:1 (stack level)
Clipboardformat:"CF_HPOBJ" (user defined)
+

The DDE commands CONNECT, POKE and REQUEST are supported.

+

The structure of the clipboard format "CF_HPOBJ":

+ + + + + +
4 Byte (length of object, LSB first)HP object (normal HP object)
+

14. Emu48+ Changes

+

Emu48+ is a modified version of Emu48 to add support for the ARM-based + calculators. It does not emulate the ARM CPU, but it enhances the + Saturn emulation to more closely match the emulation provided by the + Saturn emulator on the ARM-based calculators.

+

Emu48+ adds support for many of the Saturn+ instructions, including + some of the BUSCC instructions, and it also adds support for the 80-line + display used on the 49g+ and 50g.

+

At present, the additional calculators supported in Emu48+ are the + 49g+, 48gII (hardware revision 1), 50g, and 39g+/39gs/40gs.

+

To create KML scripts for the additional calculator models, use the + following model codes:

+ + + + + + + + + + + + + + + + + + + + + +
39g+/39gs:Model "P"
+ Class 39
40gs:Model "P"
+ Class 40
48gII:Model "2"
49g+:Model "Q"
50g:Model "Q"
+ Class 50
+

Most of the code that was changed in Emu48+ over Emu48 was provided by + Cyrille de Brebisson of Hewlett-Packard.

+

15. License

+

Emu48 - A HP38G/39G/40G/48SX/48GX/49G Emulator
+ Copyright (C) 2017 Christoph Gießelink

+

Emu48+ - A 39g+/39gs/40gs/48gII/49g+/50g Emulator
+ Copyright (C) 2017 Cyrille de Brebisson
+ Additional changes by Bill Graves and Eric Rechlin

+

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 2 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, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

+
+ + diff --git a/PROBLEMS.TXT b/PROBLEMS.TXT index edfff3e..90f7604 100644 --- a/PROBLEMS.TXT +++ b/PROBLEMS.TXT @@ -1,4 +1,10 @@ -Known bugs and restrictions of Emu48 V1.58 +Additional known bugs and restrictions of Emu48 V1.57+ +------------------------------------------------------ + +- some display issues, such as when scrolling up, that were fixed in + regular Emu48 haven't yet been merged into Emu48+ + +Known bugs and restrictions of Emu48 V1.59 ------------------------------------------ - the following I/O bits aren't emulated (incomplete) @@ -47,4 +53,4 @@ Known bugs and restrictions of Emu48 V1.58 - quitting the emulator while programming the flash isn't allowed, because the content of flash state machine isn't saved so far -08/16/16 (c) by Christoph Gießelink, c dot giesselink at gmx dot de +08/15/17 (c) by Christoph Gießelink, c dot giesselink at gmx dot de diff --git a/source/CHANGES.TXT b/source/CHANGES.TXT index 4ddf7ef..a01143a 100644 --- a/source/CHANGES.TXT +++ b/source/CHANGES.TXT @@ -1,345 +1,21 @@ --------------------------------------------------------------------- -Service Pack 56 for Emu48 Version 1.0 +Service Pack 57+ based on Emu48 Service Pack 59 -DDESERV.C -- bugfix in function DdeCallback(), improved input data checking and - avoided multiple DDE data fetch in XTYP_POKE case +See CHANGES.TXT in Emu48 for full history. +Only changes specifically made to Emu48+ are shown below. -DEBUGGER.C -- changed function UpdateStackWnd(), OnStackPush() and OnStackPop(), - fixed signed/unsigned mismatch -- changed function UpdateProfileWnd(), fixed signed/unsigned - mismatch and optimized ENG unit search break - -DISPLAY.C -- bugfix in function ResizeWindow(), the WM_PAINT message wasn't - generated by the InvalidateRect() call when the title and menu bar - was disabled and the client area was empty, so we got a main - window with zero size which could not be activated any more -> - issue solved by forcing a menu bar when client area is empty - -EMU48.C -- changed szLicence string, updated to the latest revision of the - GPLv2 - -EMU48.RC -- changed IDD_SET_PERIPHERAL, enlarged width of slider - IDC_SOUND_SLIDER and combo box IDC_SOUND_DEVICE -- changed version and copyright - -KML.C -- changed function InitLcd(), removed zoom factor 4 limitation -- changed function iSqrt(), changed implementation to Heron's method - for speed optimization - - -Service Pack 55 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function OnLButtonUp(), fixed a buffer overflow when - converting a 3 byte hexadecimal string to variable Chipset.out - which overwrite the content of variable Chipset.in, fixed a buffer - overflow when converting a 4 byte hexadecimal string to variable - Chipset.in which overwrite the following two padding bytes and - changed method converting a 2 byte hexadecimal string to variable - Chipset.Bank_FF -- bugfix in function OnContextMenu(), when the context menu was - generated from the keyboard it was opened at the wrong position -- bugfix in function Debugger(), use critical section for secure - deletion of the last instruction buffer -- changed function InfoWoRegister(), changed function prototype to - DLGPROC +Service Pack 55+ for Emu48 Version 1.0 DEBUGDLL.C - bugfix in function EmuInitLastInstr(), use critical section for secure deletion of the last instruction buffer -DISPLAY.C -- changed function ResizeWindow(), optimized implementation now - works independent from window style and menu bar setting - -DISMEM.C -- changed function SetMemRomType(), fixed signed/unsigned mismatch - -DISRPL.C -- changed function PutSn(), minor optimization -- changed function DoHexStream(), DoIntStream(), DoBint(), DoReal(), - DoERel(), DoCmp(), DoECmp(), DoChar(), DoCStr(), DoHxs(), - DoIdnt(), DoLam(), DoRomp(), Semi() and DoFlashPtr(), added - UNREFERENCED_PARAMETER statement -- changed function DoERel(), made function static -- changed function Getfp(), fixed signed/unsigned mismatch - -EMU48.C -- added global variable dwTColor and dwTColorTol for the background - transparency color matching -- added global variable hRgn to hold a region resource handle for - a transparent background bitmap -- added global variables bTitleBar, bShowTitle, bShowMenu and - bClientWinMove -- added Critical Section initialization -- added function UpdateWindowBars(), helper function to update state - of title and menu bar -- changed function SettingsGeneralProc(), added "Show Title" and - "Show Menu" checkbox handling -- changed function SettingsPeripheralProc(), added - UNREFERENCED_PARAMETER statement -- bugfix in function SettingsGeneralProc(), SettingsMemoryProc() and - SettingsPeripheralProc(), changed function prototype to DLGPROC - for getting a 64 bit lParam pointer when compiling for x64 - architecture -- changed function OnPaint(), added UpdateWindowBars() call -- changed function OnInitMenu(), added MRU list update -- changed function OnViewSettings(), removed DLGPROC typecasts -- added function OnContextMenu(), context menu implementation -- added function OnNcHitTest(), when no title bar check if mouse - position is in client not over a button area -- changed function MainWndProc(), minor change in WM_PALETTECHANGED - implementation and added WM_CONTEXTMENU, WM_NCRBUTTONUP and - WM_NCHITTEST message handler -- changed function WinMain(), changed method of memory leak - detection by adding _CrtSetDbgFlag() at begin and removing - _CrtDumpMemoryLeaks() at end of program - -EMU48.H -- added window styles definition -- changed function prototypes -- extern declaration of global variables and function - -EMU48.RC -- changed IDD_SET_GENERAL, added "Show Title" and "Show Menu" - checkbox -- added menu IDM_MENU -- changed version - -ENGINE.C -- bugfix in function SaveInstrAddr(), added critical section to be - sure that last instruction buffer is still available - -FETCH.C -- added typecast to all pLnk entries for compatibility with C++ - compiling on GCC 4.8.1 - -FILES.C -- defined abs() and labs() as intrinsic -- changed function DecodeGif(), changed function prototype by adding - an argument overwritten by the transparent color if found -- changed function LoadBitmapFile(), adjusted to new prototype of - function DecodeGif() -- added function AbsColorCmp() and LabColorCmp(), compare colors - with tolerance -- added function CreateRgnFromBitmap(), create opaque bitmap region - -KML.C -- added keyword "SysItem" to pLexToken[] table -- changed function InitGlobal(), added implementation of keyword - "Color" -- changed function RunLine(), added implementation of keyword - "SysItem" -- changed function KillKML(), added reset of variables hRgn, - dwTColor and dwTColorTol -- changed function iSqrt(), made some speed optimizations -- added function MouseIsButton() to check if mouse over button area -- changed function MouseMovesTo(), changed _ASSERT implementation to - make sure that class cursor is NULL and use function - MouseIsButton() to select cursor type now - -KML.H -- added TOK_SYSITEM definition -- changed structure KmlToken, replaced TCHAR array szName[20] with - LPCTSTR szName pointer -- added MouseIsButton() function prototype - -MRU.C -- changed all function argument types from INT to UINT -- removed global variables hMruMenu and nMruPos -- removed all update menu calls in this module and made functions - robust against non initialized MRU list and ID index out of range -- changed function GetMenuPosForId(), changed function prototype so - the resulting menu handle and menu position aren't global - variables any more -- changed function MruInit(), changed return value from FALSE to - TRUE for success and changed implementation like used in the PPC - emulator variants -- changed function MruUpdateMenu(), changed function prototype by - adding the HMENU argument for updating the selected menu and added - initialization prior done in function MruInit() -- changed function MruWriteList(), if there are no entries don't - write the "FileCount" setting any more - -PCH.H -- added _WINSOCK_DEPRECATED_NO_WARNINGS definition -- added GCLP_HCURSOR, SetClassLongPtr, GetClassLongPtr and ULONG_PTR - definitions for MSVC6.0 SDK and earlier - -REDEYE.C -- changed function CreateCorrectionBits(), fixed signed/unsigned - mismatch - -RESOURCE.H -- added definitions - -SERIAL.C -- changed function CommOpen(), fixed signed/unsigned mismatch - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added item - "ShowTitle", "ShowMenu" and "ClientWinMove" in section [Emulator] - in the INI-File - -STACK.C -- changed function SetBcd(), fixed signed/unsigned mismatch -- bugfix in function RPL_GetComplex(), function arguments nMantLen - and nExpLen hadn't been used - -SYMBFILE.C -- changed function RplLoadTable(), made optimizations and added - integrity checks - - -Service Pack 54 for Emu48 Version 1.0 - -DEBUGGER.C -- removed INSTRSIZE definition -- changed function GetAddr(), made function more general by adding - address range check and the ability of decoding a symbolic entry - into an address -- changed function Debugger(), removed initialization of global - variable wInstrSize and added call of "RPL Object Viewer" handling - function -- changed function OnFindOK(), in the case of a search match update - also the RPL object viewer window -- added functions for "RPL Object Viewer" dialog box -- changed function EnterAddr(), changed parameter storage from - static variable to window user data and replaced address decoder - code by GetAddr() function call -- changed function EnterBreakpoint(), replaced address decoder code - by GetAddr() function call and so added decoding a symbolic entry - into an address -- bugfix in function LoadMemData(), forgot to check if file content - fit into Saturn address range, loading now stops also after last - Saturn address written -- changed function SaveMemData(), added assertion for Saturn address - verification -- bugfix in function DebugMemLoad() and DebugMemSave(), adjusted to - new prototype of function GetAddr() and so added checking if the - given addresses are in the Saturn address range because Saturn - read/write functions don't do the range check; this also cause a - change in behavior, on empty address fields the operation fails - and the dialog still remains open - -DISRPL.C -- new module for RPL object decoding - -DISRPL.H -- header file for RPL object decoding part - -EMU48.C -- added function SetSoundDeviceList(), helper function for filling - sound device combo box with waveform-audio output devices -- changed function SettingsPeripheralProc(), removed sound radio - button handlers and added implementation of sound device combo box -- changed function OnFileNew(), removed call of function - SaveBackup() which is already a part of function NewDocument() -- changed function OnFileNew(), OnFileOpen(), OnFileMruOpen(), - OnFileSave(), OnFileSaveAs() and OnFileClose(), switched detection - of document is available from variable pbyRom (ROM image loaded) - to variable bDocumentAvail -- changed function OnViewCopy(), removed MONOCHROME source code part -- changed function WinMain(), preset MRU list length (overloaded by - registry setting) now with 4 elements, added more flexible CPU - binding for the Saturn core emulation thread on Windows NT4.0 and - later, added sound engine initialization and clean up and added - non modal "RPL Object Viewer" dialog box in main message handler - -EMU48.DSP -- added disrpl.c and sound.c sources - -EMU48.H -- extern declaration of global variables and functions -- removed extern declaration of global variable - -EMU48.RC -- added dialog IDD_RPLVIEW -- changed IDD_SET_PERIPHERAL dialog, removed "Speaker" and "Wave" - radio buttons and added "Device" combo box in the sound section -- added "Rpl Object Viewer..." menu entry in debugger "Memory" - context menu -- changed version and copyright +Service Pack 54+ for Emu48 Version 1.0 EMU48DLL.C - changed function DLLCreateWnd(), added sound engine initialization - changed function DLLDestroyWnd(), added sound engine clean up -ENGINE.C -- initialized variable wInstrSize with size of last instruction - array (the circular buffer can hold (wInstrSize-1) instructions) - -EXTERNAL.C -- removed global variable bWaveBeep -- moved global variable dwWaveVol to module sound.c -- removed functions BeepWave(), BeepWin9x() and Beeper() -- changed function External() and RCKBp(), removed PC speaker - support and used function SoundBeep() instead of Beeper() for beep - output over sound card - -FETCH.C -- made typedef of jump table struct constant, so the const keyword - was removed from all references of JMPTAB -- changed function EvalOpcode(), minor code optimization - -FILES.C -- bugfix in function PatchRom(), removed limitation that patch file - must have 6 characters minimum, fixed a buffer overflow when end - of patch file consists of white space characters and return - failure on syntax errors now - -PCH.H -- added include winsock2.h and malloc.h -- added GWLP_USERDATA, SetWindowLongPtr, GetWindowLongPtr and - LONG_PTR definitions for MSVC6.0 SDK and earlier - -RESOURCE.H -- added definitions for sound settings and RPL object viewer - handling -- removed IDC_SOUND_SPEAKER and IDC_SOUND_WAVE - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added item - "LastInstrBufSize" in section [Debugger] and item "WaveTime" in - section [Emulator] and deleted item "WaveBeep" in section - [Emulator] in the INI-File - -SOUND.C -- new module for native beeper emulation over wave output device - -STACK.C -- added function Trim(), create a trimmed copy of the input string -- added function SetZInt(), contain implementation of prior function - RPL_SetZInt() -- changed function RPL_SetZInt(), wrapper for function SetZInt() to - trim data before decoding -- added function SetBcd(), contain implementation of prior function - RPL_SetBcd() -- changed function RPL_SetBcd(), wrapper for function SetBcd() to - trim data before decoding -- changed function RPL_SetComplex(), create a trimmed working copy - before decoding the outline brackets and because of the changed - function RPL_SetBcd() the real number arguments are accepted with - white spaces around now -- removed disabled function IsRealNumber(), it was more or less - functional compatible with actual modified function RPL_SetBcd() - -TIMER.C -- removed UNIX_0_TIME definition - -UDP.C -- changed function SendByteUdp(), replaced malloc() by _alloca() - call for UNICODE wchar to char string translation to get rid of - freeing the allocated memory manually - - -Service Pack 53 for Emu48 Version 1.0 +Service Pack 53+ for Emu48 Version 1.0 APPLE.C - added functions WrDirtyPage() and EraseBlock() for access to the @@ -347,165 +23,10 @@ APPLE.C - changed function o80B14() and o80B24(), changed implementation using the new ROM buffer access functions -DDESERV.C -- prepared for C++ compiling - -DEBUGGER.C -- prepared for C++ compiling -- added new function OnCodeFindPCO(), search for a PCO object in the - code window -- bugfix in function OnSetCursor(), on "Activation follows mouse" - enabled child dialogs lost focus when cursor moved over parent - debugger dialog -- changed function Debugger(), added context menu commands handler - in the WM_COMMAND section -- changed function OnFindOK(), added downwards search direction -- changed function Find(), added and changed message handler for the - "Previous" and "Next" buttons - -DISMEM.C -- prepared for C++ compiling - -DISPLAY.C -- prepared for C++ compiling - -EMU48.C -- prepared for C++ compiling -- replaced global variable lThreadId with local variable dwThreadId -- added global variable with the identifier for the waveform-audio - output device -- added property sheet page handlers SettingsGeneralProc(), - SettingsMemoryProc() and SettingsPeripheralProc() -- bugfix in function SettingsGeneralProc(), on "Activation follows - mouse" enabled debugger dialog maybe got focus even if it's not - the last active one -- removed function SettingsProc(), replaced by the property sheet - page handler functions -- bugfix in function OnViewScript(), ROM image change wasn't handled -- added function PropSheetProc(), callback function for setup the - property sheet -- changed function OnViewSettings(), now creating a propery sheet - instead of a settings dialog -- added function OnCopyData() as WM_COPYDATA message handler - implementation for changing the state file to the given state file - name -- changed function MainWndProc(), added WM_COPYDATA message handler -- changed function WinMain(), expanded single instance case by - transmitting the given state file name to the already opened - program instance - -EMU48.H -- prepared for C++ compiling -- added WM_COPYDATA identifier definition -- added definitions for sound interface -- extern declaration of global variables - -EMU48.RC -- changed IDD_FIND, added a "Previous" button for previous search, - shorten the text of the "Find Next" button to "Next" and changed - the ID of the next search button -- split IDD_SETTINGS dialog into the property pages IDD_SET_GENERAL, - IDD_SET_MEMORY and IDD_SET_PERIPHERAL and added item - "Single Instance" in the "General" property page -- removed IDD_SETTINGS dialog -- added "Previous PCO" and "Next PCO" menu entries in debugger - "Code" context menu -- changed version and copyright - EMU48DLL.C - replaced global variable ThreadId with local variable dwThreadId -ENGINE.C -- added global variable bEnableSlow for global disabling slowing - down the CPU -- added global variable bSoundSlow slowing down the CPU core at - sound output -- changed function AdjustSpeed() and InitAdjustSpeed, added sound - slow down implementation -- changed function WorkerThread(), added sound engine control - -EXTERNAL.C -- changed PCM sampling frequency and definition name -- bugfix in function BeepWave(), eliminated DC offset from waveform, - use global waveform-audio output device identifier for opening and - made a more general initialization of the waveform-audio output - device - -FILES.C -- prepared for C++ compiling -- changed function MapRom(), removed using of memory mapped files - which has the major advantage that packed ROM files are also valid - now -- changed function UnmapRom(), adjusted to changed MapRom() function -- changed function MapPort2(), improved file size validation and - freeing of file mapping in error case -- changed function UnmapPort2(), added ability to free incomplete - file mapping -- changed function SaveBackup() and RestoreBackup(), improved - document available detection and added check at port data copy if - port source buffer is allocated - -I28F160.C -- added functions WrDirtyPage(), EraseBlock(), WriteByte() and - ReadByte() for access to the ROM buffer -- changed function WrStateE8C(), WrState40D(), WrState20C(), - WrState30C() and RdStateData(), changed implementation using the - new ROM buffer access functions - -KML.C -- prepared for C++ compiling -- added global variable wKeybLocId to hold the keyboard layout input - locale at begin of KML loading -- activated keyword "Locale" in pLexToken[] table -- changed function ParseBlocks(), use variable wKeybLocId instead - of input locale reading -- bugfix in function KillKML(), key mapping state table wasn't - cleared at the end and added reset of variable wKeybLocId -- bugfix in function InitKML(), changed implementation by reading - the current keyboard layout and convert the layout data to the - input locale setting - -MRU.C -- prepared for C++ compiling - -OPCODES.C -- changed function o801(), call beeper handler function on beeper - port change - -RESOURCE.H -- added some definitions -- removed IDD_SETTINGS and IDC_FIND_CASE definition - -RPL.C -- prepared for C++ compiling - -SETTINGS.C -- bugfix in function GetRegistryString(), ignored target buffer size - when copying the default to the target string buffer -- changed function ReadSettings() and WriteSettings(), added item - "WaveDeviceId" in section [Emulator] in the INI-File - -STACK.C -- prepared for C++ compiling - -SYMBFILE.C -- prepared for C++ compiling - - -Service Pack 52 for Emu48 Version 1.0 - -EMU48.C -- changed function SettingsProc(), added infrared printer settings - -EMU48.DSP -- added redeye.c and udp.c sources -- added library Ws2_32.lib - -EMU48.H -- extern declaration of global variables and functions - -EMU48.RC -- changed version and copyright +Service Pack 52+ for Emu48 Version 1.0 EMU48DLL.C - added function DllMain(), implemented "CEmu48" window class @@ -516,124 +37,13 @@ EMU48DLL.C registration to DllMain(), so it's now possible to unregister the window class automatically at DLL detach -KML.C -- added global variable bLocaleInc for checking if locale block - content already included -- added keyword "Locale" to pLexToken[] and token TOK_LOCALE to - eIsGlobalBlock[] table -- changed function ParseLine() and ParseBlock(), preset szLexString - variable with NULL after freeing -- changed function IncludeLines() and IncludeBlocks(), changed - function prototype by adding a boolean argument for selecting the - text message "Including" or "Parsing" in the log file -- bugfix in function ParseLines(), return a TOK_NONE line for an - empty block instead of a NULL pointer which regular stands for a - syntax error -- bugfix in function ParseLines() and ParseBlocks(), changed - function prototype by adding a boolean argument for selecting the - mode "include" or "parse" for the next lines or blocks and - verifying the "Include" argument was incomplete and may caused - memory leaks at error condition -- bugfix in function ParseBlock(), verifying the block command - argument was incomplete and may caused a memory leak at error - condition -- changed function ParseBlocks(), changed function prototype by - adding a boolean argument if an "End" token is also valid and - added implementation of block "Locale" -- changed function KillKML(), added reset of variable bLocaleInc -- changed function ReleaseButton(), for speed optimization skip - function if button is already released -- bugfix in function LoadKMLGlobal(), fixed a memory leak caused by - the error condition that expected block command is a string -- changed function InitKML(), added current keyboard input locale - setting log file text - -KML.H -- added TOK_LOCALE definition - MOPS.C - bugfix in function WriteIO(), removed implementation of the ELBE bit in the LCR (0x11C) register for apples; the Saturnator has no ELBE bit simulation so the LSRQ bit in SRQ2 register is untouched -REDEYE.C -- new module for decoding the redeye data stream for a HP82240B - printer - -RESOURCE.H -- added some definitions - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added the - items "Address" and "Port" in section [IrPrinter] in the INI-File - -TIMER.C -- changed function SetHP48Time(), time calculation now work properly - for host system dates before 1970/01/01 and after 2106/02/07 - -UDP.C -- new module for sending a byte over UDP - - Service Pack 51 for Emu48 Version 1.0 -DEBUGGER.C -- removed structure MODEL_MAP_T, variables pbyNoMEM, MemMap[], - pbyMapData, dwMapDataSize and pMapping, the implementation behind - moved to module DISMEM.C -- changed function SetMappingMenu(), changed to DISMEM.C - implementation and added control of memory data menu items -- changed function GetMemCurAddr(), OnMemGoAdr(), OnKeyUpDown() and - OnKeyPlusMinus(), variable dwMapDataSize isn't global any more, - use function GetMemDataMask() instead -- changed function InitMemMap(), ViewMemWnd() and OnFindOK(), - changed to DISMEM.C implementation -- changed function ViewCodeWnd(), set disassembler to memory mapped - mode -- bugfix in function OnDblClick(), added update of code window -- changed function Debugger(), changed disassembler mode setting and - added calls of "Load Memory Data..." and "Save Memory Data..." - handling functions -- added functions OnBrowseLoadMem(), OnBrowseSaveMem(), - LoadMemData(), SaveMemData(), GetAddr(), DebugMemLoad(), - OnMemLoadData(), DebugMemSave() and OnMemSaveData() to handle the - Load/Save Memory Data feature - -DISASM.C -- removed global variable disassembler_map -- removed functions rn_map(), rn_rom(), rn_ram(), rn_port1() and - rn_port2() -- changed function read_nibble(), call function GetMemNib() from the - new module DISMEM.C for mapping mode memory access and made - function static again - -DISMEM.C -- new module for accessing memory data for debug view purpose - -EMU48.C -- changed function Disasm(), replaced the radio button - implementation for the memory mapping mode by a combo box - solution; the combo box solution don't work with the HP48 module - names any more, it now use the memory controller names used in the - debugger memory viewer for a more general approach for the non - HP48 calculator models - -EMU48.DSP -- added dismem.c sources - -EMU48.H -- replaced old "memory module definitions" by the enum MEM_MAPPING -- extern declaration of global functions -- removed extern declaration of global variables - -EMU48.RC -- changed IDD_DISASM dialog, replaced the radio buttons for the - memory mapping mode by a more general combo box -- added dialogs IDD_DEBUG_MEMSAVE and IDD_DEBUG_MEMLOAD -- added "Load Memory Data..." and "Save Memory Data..." menu entries - in debugger "Memory" context menu -- changed version and copyright - EMU48DLL.C - bugfix in function DLLCreateWnd(), when starting an emulator session the function was trying to register the window class, but @@ -642,619 +52,44 @@ EMU48DLL.C other further registration the content of the ATOM variable pointing to window class got lost -KML.C -- bugfix in function ReloadButtons(), ON key button wasn't handled - -RESOURCE.H -- added several definitions -- deleted some radio button definitions from the IDD_DISASM dialog - - -Service Pack 50 for Emu48 Version 1.0 +Service Pack 50+ for Emu48 Version 1.0 APPLE.C - added BUSCC 56 (opcode 80B65) implementation -DDESERV.C -- replaced all HeapAlloc() with malloc() memory requests - -DEBUGGER.C -- replaced all HeapAlloc() with malloc() memory requests -- changed function ToggleBreakpoint() and EditBreakpoint(), minor - code optimization purging breakpoint -- changed function ViewMemWnd(), removed initialized but unused - variable -- bugfix in function OnDblClick(), fixed buffer overflow when - converting a 2 byte hexadecimal string to a byte -- bugfix in function LoadBreakpointList(), added check of breakpoint - entries against breakpoint table size - -DISPLAY.C -- changed DIBPIXEL() define, generates the same code on MSVC6.0 but - made it GCC4 compiler compatible - -EMU48.C -- removed global variable hHeap -- replaced all HeapAlloc() with malloc() memory requests -- changed function SaveChanges(), detect if document is available - now over the variable bDocumentAvail and not over the variable - pbyRom any more; in the case of an illegal KML script there maybe - a document loaded, but no ROM image, so pbyRom will be NULL in - this case -- bugfix function OnViewScript(), when quitted the dialog "Choose - Your KML Script" with the Cancel button when chosen an invalid - script the function returned without the possibility of saving the - current document; now the function try to reload the primarily KML - script and if this also fails then the current document is saved -- changed function WinMain(), replaced multiple class name usage - with atom variable, moved read settings before window creation, - added check for setting "SingleInstance" to switch to an already - running program instance instead of creating a new one and added - call of _CrtDumpMemoryLeaks() at end of program to detect malloc() - memory leaks - -EMU48.H -- removed extern declaration of hHeap -- extern declaration of global variables and functions -- replaced all HeapAlloc() with malloc() memory requests - -EMU48.RC -- changed version - EMU48DLL.C - changed function DLLCreateWnd(), replaced multiple class name usage with atom variable and moved read settings before window creation -ENGINE.C -- added global variable nOpcSlow to hold the number of CPU opcodes - slowing down the CPU core -- changed function AdjustSpeed(), added CPU opcode slow down - implementation -- added function InitAdjustSpeed(), initialize CPU slow down part - if necessary -- changed function AdjKeySpeed() and SetSpeed(), use function - InitAdjustSpeed() to initialize the CPU slow down variables - -EXTERNAL.C -- replaced all HeapAlloc() with malloc() memory requests - -FILES.C -- replaced all HeapAlloc() with malloc() memory requests -- changed function CrcRom(), if no ROM available return without - modifying the checksum -- changed function ResetDocument(), NewDocument(), OpenDocument() - and RestoreBackup(), added state variable if document is available -- bugfix in function DecodeBmp() and DecodeGif(), a 2nd bitmap load - allocated and bound a 2nd palette to the main window, now only the - 1st bitmap (mostly the KML background bitmap) bound his palette to - the main window - -IO.H -- added LBR and LBO bit definitions - -KEYMACRO.C -- changed function EventThread(), added minimum key hold time for - keyboard macro playing and subtract minimum key hold time from - saved waiting time, this is more accurate when the user has - selected a different minimum key hold time than the default one -- changed function KeyMacroRecord(), now saving the complete waiting - time including the key state holding time, the key state holding - time is now subtract in the player function thread EventThread() -- changed function OnToolMacroNew(), removed adding the key state - holding time to the reference time, this is not necessary any more - -KML.C -- changed table pLexToken[], defined table as constant and changed - last token id table preset from constant number to member of token - id enumerator -- replaced all HeapAlloc() with malloc() memory requests -- bugfix in function ParseString(), decoding the \" sequence as - quotation mark inside a string was incomplete, so every single '\' - character was also removed -- bugfix in function ParseBlock(), string argument wasn't freed in - error case - -MOPS.C -- added function ReadT2Acc(), reading timer2 value with checking for - CPU speed measurement behaviour -- bugfix in function ReadIO(), added implementation of the LED and - ELBE bit in the LCR (0x11C) register and of the LBO bit in the LBR - (0x11D) register -- changed function ReadIO(), the timer2 register content is now read - by function ReadT2Acc() to analyze the read access scheme -- bugfix in function WriteIO(), added implementation of the ELBE bit - in the LCR (0x11C) register and of the LBO bit in the LBR (0x11D) - register - -MRU.C -- replaced all HeapAlloc() with malloc() memory requests -- changed function MruUpdateMenu(), changed variable type of - variable hMenu -- changed function MruReadList(), removed initialized but unused - variable - -RPL.C -- replaced all HeapAlloc() with malloc() memory requests - -SETTINGS.C -- changed function ReadSettings(), moved CPU speed setting to - MainWndProc() -- changed function ReadSettings() and WriteSettings(), added item - "KeyMinDelay" in section [Macro] and added item "SingleInstance" - in section [Emulator] in the INI-File - -STACK.C -- replaced all HeapAlloc() with malloc() memory requests - -SYMBFILE.C -- replaced all HeapAlloc() with malloc() memory requests - - -Service Pack 49 for Emu48 Version 1.0 - -DEBUGGER.C -- changed function Debugger(), removed all UpdateWindowStatus() - function calls - -EMU48.C -- renamed function UpdateWindowStatus() to OnInitMenu() and modified - it to a WM_INITMENU message handler -- changed function OnFileNew() and WinMain(), removed all - UpdateWindowStatus() function calls -- changed function MainWndProc(), added WM_INITMENU message handler +Service Pack 49+ for Emu48 Version 1.0 EMU48.H - added definitions to detect Apple platform -- removed declaration of global function UpdateWindowStatus() - -EMU48.RC -- changed version and copyright - -ENGINE.C -- changed function SwitchToState(), removed all UpdateWindowStatus() - function calls - -FILES.C -- changed TREENODE structure, added prev element for a double linked - list -- changed function PatchNibble(), added prev element handling -- bugfix in function UpdatePatches(), in the case an address was - patched more than one time, the ROM was patched in wrong order and - moreover the original content of the double defined ROM address - was destroyed -- changed function ResetDocument(), OpenDocument(), - SaveDocumentAs(), SaveBackup(), RestoreBackup() and ResetBackup(), - removed all UpdateWindowStatus() function calls -- bugfix in function OpenDocument(), added check of KML script name - length against target buffer size -- changed function DibNumColors(), changed function prototype from - UINT to WORD return -- changed function CreateBIPalette(), changed variable - UINT nNumColors to WORD wNumColors to avoid variable overflow - loading palNumEntries of LOGPALETTE structure - -KEYMACRO.C -- changed function OnToolMacroNew(), OnToolMacroPlay() and - OnToolMacroStop(), removed all UpdateWindowStatus() function calls - -KML.C -- changed function ParseLines(), BOOL expression was missing in main - while() loop, worked because TOK_NONE is 0 -- changed function KillKML(), removed UpdateWindowStatus() function - call -- changed function LoadKMLGlobal(), used wrong variable type for - variable eToken MOPS.C - changed function ReadIO() and WriteIO(), on Apple hardware the BAUD (0x10D) register use 4 bits for baud rate setting, the UCK bit isn't supported on this platform -OPS.H -- bugfix in function FASTPTR(), longest opcode calculation from - buffer size was wrong, so MMU boundary fixup wasn't working - properly - SERIAL.C - changed function CommSetBaud(), expanded dwBaudrates[] table and enabled the access to these baud rates on the Apple platform -STACK.C -- bugfix in function RPL_GetBcd(), fixed possible uninitialized - bExpflag variable -- bugfix in function OnStackCopy(), fixed possible uninitialized - uClipboardFormat variable in DOCSTR case - - -Service Pack 48 for Emu48 Version 1.0 - -DEBUGGER.C -- changed table MemMap[], replaced Chipset_t memory pointer Port0, - Port1 and Port2 by new variables - -DISASM.C -- changed function rn_ram(), rn_port1() and rn_port2(), replaced - Chipset_t memory pointers Port0, Port1 and Port2 by new variables - -EMU48.C -- changed function Disasm(), added if opcode should be interpreted - as PCO - -EMU48.H -- extern declaration of global variables - -EMU48.RC -- changed IDR_DEBUG_MEM, added several accelerator keys -- changed version - -ENGINE.C -- changed function WorkerThread(), replaced structure Chipset_t - element Port2 by new variable - -FILES.C -- added global variables to hold the memory module pointer prior - located in the Chipset_t structure -- bugfix in function PatchRom(), if first patch address in a line - was outside the ROM area, the emulator crashed with an access - violation, removed the patch address wrap around -- changed function ResetDocument(), NewDocument(), OpenDocument(), - SaveDocument(), SaveBackup(), RestoreBackup() and ResetBackup(), - replaced Chipset_t memory pointer Port0, Port1 and Port2 by new - variables - -KML.C -- changed function InitKML(), pointed out that a packed ROM image is - an error - -MOPS.C -- changed function MapP0(), MapP1() and MapP2(), replaced Chipset_t - memory pointer Port0, Port1 and Port2 by new variables - -OPCODES.C -- bugfix in function o807(), a pressed ON key prevented the CPU - going into shutdown mode - -OPS.H -- changed function Nunpack(), new coding for speed optimization, - this solved also a bug in the code optimizer of VS2010 (the - optimizer generated wrong code, another possible workaround for - this problem was declaring the function argument "BYTE *a" as - "volatile BYTE *a") - -PCH.H -- added INVALID_FILE_ATTRIBUTES definition - -RPL.C -- changed function Metakernel(), replaced structure Chipset_t - element Port1 by new variable - -SETTINGS.C -- changed function WriteReg() and DelReg(), changed function - protoytypes to make them compatible with the functions - WritePrivateProfileString() and WritePrivateProfileInt() -- changed function GetRegistryInt(), changed function protoytype to - make it compatible with function GetPrivateProfileInt() - -TIMER.C -- changed function SetHP48Time(), replaced structure Chipset_t - element Port0 by new variable - -TYPES.H -- changed structure Chipset_t, replaced Port0, Port1 and Port2 with - a DWORD placeholder each, because when compiling for x64 - architecture these 3 byte pointers grow up to 8 bytes and destroy - the state file structure - - -Service Pack 47 for Emu48 Version 1.0 - -DDESERV.C -- changed function DdeCallback(), made ON key hold time variable - -DEBUGGER.C -- changed function Debugger(), added Debugger Settings to the system - menu - -EMU48.C -- changed function OnDropFiles() and OnObjectLoad(), made ON key - hold time variable -- changed function OnFileMruOpen(), on success move selected entry - to top of MRU table - -EMU48.DSP -- changed to REGISTRY (HKCU/Software/Emu48) saving in Release, - Debug, Release Unicode and Debug Unicode configuration -- added symbfile.c sources - -EMU48.H -- extern declaration of global variables and functions - -EMU48.RC -- changed IDD_DEBUG_SETTINGS, replaced "Ok" with "OK" and removed - accelerator keys from "OK" and "Cancel" -- changed version and copyright - -KEYBOARD.C -- changed function KeyboardEvent(), made key switch time variable - -KML.C -- enabled "IfMem" KML keyword -- changed function RunLine(), removed warning when compiling for x64 - architecture - -MRU.C -- changed function MruAdd(), added entry moving to top when the - entry is already in the table -- added function MruMoveTop(), move MRU entry to top of table - -OPS.H -- bugfix in function FASTPTR(), longest opcode is 21 nibbles long - and fixed problem executing an opcode over a MMU boundary - -PCH.H -- enabled WinXP style under VS2005 and VS2008 - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added items - "WakeupDelay" and "KeyMinDelay" in section [Emulator] in the - INI-File - -STACK.C -- bugfix in function RPL_GetBcd(), detection for exponent writing - was wrong -> on negative exponents sometimes the result format was - wrong, on positive exponents from E12 until E14 with 12 digit - mantissa setting the result itself was wrong -- added helper functions RPL_GetComplex() and RPL_SetComplex() to - handle complex number objects -- added function DoComplex() to handle a complex number object -- changed function OnStackCopy(), added complex number support -- changed function OnStackPaste(), made ON key hold time variable, - added flag to disable automatic clipboard object detection and - added complex number support - -SYMBFILE.C -- new module for loading external symbols from a Saturn3 linker file - - -Service Pack 46 for Emu48 Version 1.0 +Service Pack 46+ for Emu48 Version 1.0 APPLE.C - added BUSCC 09 (opcode 80B90) data streamer implementation as NOP -DDESERV.C -- bugfix in function DdeCallback(), readded delay at XTYP_POKE after - ON key state change switching calculator on, bug introduced in - SP37 - DEBUGDLL.C - added dummy functions CreateBackupBreakpointList() and RestoreBackupBreakpointList() for linking -DEBUGGER.C -- added backup breakpoint list -- bugfix in function InfoWoRegister(), changed WM_COMMAND message - handler from IDOK to IDCANCEL to make the close button working - properly -- added functions SaveBreakpointList() and - CreateBackupBreakpointList() to handle the backup breakpoint list - -DEBUGGER.H -- extern declaration of global functions - -DISPLAY.C -- made gobal variable pbyLcd static - -EMU48.C -- bugfix in function OnDropFiles() and OnObjectLoad(), readded - delay after ON key state change switching calculator on, bug - introduced in SP37 -- changed function OnFileOpen(), added MruAdd() call -- added new function OnFileMruOpen(), command handler for MRU menu - selections -- changed function OnFileSaveAs(), added MruAdd() call -- changed function OnObjectLoad(), changed load object warning - message -- changed function MainWndProc(), added MRU message handler -- changed function WinMain(), added MRU handling -- bugfix in function WinMain(), getting the full path name of the - current state file failed in the case of an empty name buffer - -EMU48.DSP -- added mru.c sources - -EMU48.H -- removed extern declaration of pbyLcd -- extern declaration of global functions - -EMU48.RC -- changed IDD_WRITEONLYREG, changed ID of OK control from IDOK to - IDCANCEL -- changed IDD_SETTINGS, replaced "Ok" with "OK" and removed - accelerator keys from "OK" and "Cancel" -- added Menuitem Files "Recent Files..." -- changed version and copyright - EMU48DLL.C - bugfix in function DLLDestroyWnd(), getting the full path name of the current state file failed in the case of an empty name buffer -FILES.C -- bugfix in function OpenDocument(), if document reload was refused - the function returned no success -> this caused trouble in - function OnFileMruOpen() removing the MRU entry of this document -- bugfix in function SaveBackup(), a backup of the debugger - breakpoint list wasn't created -- bugfix in function RestoreBackup(), the debugger breakpoint list - wasn't restored so the breakpoints got lost when saving the state - file and added preserving debugger open state, this feature was - lost as a result of a bugfix in an earlier version -- changed function GetOpenFilename(), added file filter for all - Emu48 specific filenames which is default, changed filter names - and removed model specific file extention selection -- changed function GetSaveAsFilename(), changed filter names and use - small size characters for file extentions -- changed function DecodeGif(), fixed a GCC type mismatch warning - -KML.C -- added token TOK_IFMEM to eIsBlock[] table -- added function UpdateScriptList(), filling the KML script combo - box with all found script titles and select the current used one -- changed function ChooseKMLProc(), call function UpdateScriptList() - to update the KML script combo box now -- removed function FatalError() -- bugfix in function ParseString(), replaced error text -- bugfix in function IncludeLines(), removed fatal error message - text -- bugfix in function ParseLines(), in some cases parsing hadn't - stopped with an error inside a block with an unreferenced include - file and removed a fatal error message text -- bugfix in function ParseBlock(), block argument checking generated - wrong error messages in the case of syntax errors -- bugfix in function IncludeBlocks(), removed fatal error message - text -- changed function ParseBlocks(), removed "Invalid block." message - text and made some code optimizations calling the function - FatalError() -- changed function InitGlobal(), changed some punctuation and - capital letters -- changed function InitButton(), source code improvement checking - the size of button array -- changed function RunLine(), added implementation of "IfMem" - command -- bugfix in function ReloadButtons(), global variable bKeyPressed - wasn't updated - -KML.H -- added TOK_IFMEM definition - -MRU.C -- new module for MRU routines - -STACK.C -- bugfix in function OnStackPaste(), readded delay after ON key - state change switching calculator on - - -Service Pack 45 for Emu48 Version 1.0 - -DEBUGGER.C -- added function LoadSymbTable(), loading symbol table defined in - INI-File -- added function GetMemCurAddr(), get address of cursor in memory - window -- changed function ViewCodeWnd(), function now returns the line - number with the pc, adjusted address to Saturn address area, added - label line if address is a known entry and added a check if the 5 - nibble sequence on an address should be interpreted as PCO -- changed function ViewCodeWnd() and InfoIntr(), adjusted to new - prototype of function disassemble() -- changed function UpdateCodeWnd(), if pc should shown at first line - but the pc is the begin of a PCO, show PCO address as first line - instead, added handling for label line -- changed function OnKeyF5(), for label line support changed - detection of PC line -- changed function OnCodeGoAdr(), removed limitation to Saturn - address area, limitation now done in function ViewCodeWnd() -- added function OnKeyPlusMinus(), +/- key handler for memory window -- changed function OnKeyCodeWnd(), added handling for label line and - removed limitation going back before address 0 -- changed function OnDrawCodeWnd(), added draw style for label line -- changed function Debugger(), added initialization and - uninitialization of smybol table and bold font and added +/- key - handling for memory window -- added functions for Debugger Settings handling -- changed function EnterAddr(), added decoding a symbolic entry into - an address -- changed function InfoIntr(), added label line if instruction - address is a known entry - -DISASM.C -- added variable disassembler_symb to enable symbolic address - disassembly -- changed function read_nibble(), made function public -- changed function append_imm_nibble(), if the immediate data is 5 - nibbles long and the decoded data is a known symbolic entry, show - the symbolic name instead of the data -- added new function append_numaddr(), numeric output of an address -- changed function append_addr(), if the address is a known symbolic - entry, show the symbolic name instead of the address -- bugfix in function append_r_addr(), in some rare conditions the - program counter value got larger than 0xFFFFF, if the calculated - absolute address is a known symbolic entry show the symbolic name - instead of the relative address, in the case of showing the - relative address the corresponding absolute address is now printed - by this function and not by the function append_pc_comment(), so - there's no difference between VIEW_SHORT and VIEW_LONG any more -- removed function append_pc_comment(), implementation is obsolete - now because absolute address printing is now done in function - append_r_addr() -- changed function disasm_8() and disassemble(), changed function - prototypes by removing the view argument - -DISPLAY.C -- changed DIBPIXEL() define, generates the same code on MSVC6.0 but - made it GCC compiler compatible - -EMU48.C -- changed function Disasm(), adjusted to new prototype of function - disassemble() - -EMU48.H -- removed VIEW_SHORT and VIEW_LONG definition -- changed function prototypes -- extern declaration of global variable and functions - -EMU48.RC -- added dialog IDD_DEBUG_SETTINGS -- changed name order in copyright messages -- changed version - -FILES.C -- changed function IsDataPacked(), made a DWORD pointer copy of the - VOID pointer argument to avoid type casting, this generates the - same code on MSVC6.0 but made it GCC compiler compatible -- added function DecodeBmp(), contain the BMP image file decoder - prior located in function LoadBitmapFile() and added check of - bitmap file size -- added functions ReadGifByte(), ReadGifWord() and DecodeGif() for - decoding GIF image files -- bugfix in function LoadBitmapFile(), check for a valid file handle - was missing, moved BMP image file decoder to function DecodeBmp() - and added GIF image file support - -KML.C -- changed szText variable qualifier from LPTSTR to LPCTSTR -- changed function CreateKmlList(), adjusted to new prototype of - function GetStringParam() -- bugfix in function FatalError() and ParseToken(), modifying the - script buffer content isn't allowed -- changed function InitLex(), IncludeLines() and IncludeBlocks(), - adjusted to constant pointer of variable szText -- changed function GetStringParam(), changed return variable - qualifier from LPTSTR to LPCTSTR - -PCH.H -- added INVALID_SET_FILE_POINTER definition - -RESOURCE.H -- added definitions for Debugger Settings handling - -RPL.C -- renamed definition DOEREAL to DOEREL and adjusted usage in - function RPL_SkipOb() and RPL_ObjectSize() -- bugfix in function RPL_SkipOb() and RPL_ObjectSize(), the object - at address 0x02BAA was always interpreted as =DOACPTR, a - constant-length object consisting of two 5-nibble addresses, on - the HP48S series the object is interpreted as =DOEXT1, an object - with 5-nibble length information followed by data - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added item - "Symbolic" in section [Disassembler] in the INI-File - - -Service Pack 44 for Emu48 Version 1.0 +Service Pack 44+ for Emu48 Version 1.0 APPLE.C - changed function o80BReg164(), o80BReg264() and o80BRegWrite(), @@ -1272,92 +107,19 @@ APPLE.C setting carry flag to tell that SETFLDn failed (SETFLDn not implemented so far) -DDESERV.C -- bugfix in function DdeCallback(), readded delay after ON key state - change, bug introduced in SP36 - -DISASM.C -- bugfix in function disassemble(), the NOP5 opcode returned wrong - address for next instruction (GOTO opcode skipping one nibble) - -EMU48.C -- changed function SettingsProc(), added "Always On Top" and - "Activation Follows Mouse" checkbox handling and adjusted to new - prototype of function GetLoadObjectFilename(), use (*.BIN) as - default file filter now -- changed in function SaveChanges() and OnFileSaveAs(), removed call - of last document saving -- changed function OnPaint(), removed mixture of BitBlt() calls with - argument hPaintDC and hWindowDC inside critical section -- bugfix in function OnDropFiles() and OnObjectLoad(), readded delay - after ON key state change, bug introduced in SP36 -- changed function OnObjectLoad() and OnObjectSave(), adjusted to - new prototype of function GetLoadObjectFilename() and - GetSaveObjectFilename(), use (*.HP;*.LIB) as default file filter - now -- changed function WinMain(), added last document saving at end of - program - -EMU48.H -- added file filter definitions -- extern declaration of global variable and global functions -- changed function prototypes - -EMU48.RC -- added item "Always On Top" and "Activation Follows Mouse" in - settings dialog -- changed version and copyright - EMU48DLL.C - changed in function DLLDestroyWnd(), added last document saving -EXTERNAL.C -- removed inline function Return(), replaced by a rstkpop() call -- added function Beeper() for beeping without taking care about - the different beeping methods -- added function RCKBp() simulating the ROM Check Beep +EMU48.H +- changed function RPL_CreateTemp() FILES.C -- changed function GetCutPathName(), removed warning when compiling - for x64 architecture - changed function PatchRom() and MapRom(), if szRomDirectory contain data, the data is used as path to the ROM image else the ROM image in the standard szRomDirectory is used - -FILES.C -- changed function GetOpenFilename() and GetSaveAsFilename(), - removed some NULL characters at end of file filter definition - string -- changed function GetLoadObjectFilename() and - GetSaveObjectFilename(), changed function prototype, added - arguments for the file filter and the default extention - changed function WriteStack(), adjusted to new prototype of function RPL_CreateTemp() -I28F160.C -- adjusted implementation to the new bit array of the block lock - table - -I28F160.H -- changed structure WSMset_t, replaced byte array byLockCnfg[32] - with the bit array dwLockCnfg variable - -KEYMACRO.C -- changed function OnToolMacroNew() and OnToolMacroPlay(), removed - some NULL characters at end of file filter definition string - -KML.C -- changed function GetStringOf(), changed for better reading -- changed function SkipWhite(), optimized and better readable - implementation -- bugfix in function ParseToken(), optimized string delimeter - searching among other optimizations and removed increment of line - counter on LF character to correct the line numbering on UNIX - files with LF instead of CR LF at line end -> line counter - increment is done in function SkipWhite() on decoding next keyword - in function Lex() -- changed function ParseLine(), replaced main loop "goto" construct - OPCODES.C - bugfix in function o81B1(), on ARM-based calculators return to RPL preserve Carry flag @@ -1366,145 +128,15 @@ RPL.C - changed function RPL_CreateTemp(), added garbage collection argument to disable automatic garbage collection -SETTINGS.C -- changed function ReadSettings(), added item "RomDirectory" in - section [Files] in the INI-File - -STACK.C -- bugfix in function OnStackPaste(), readded delay after ON key - state change, bug introduced in SP36 and adjusted to new prototype - of function RPL_CreateTemp() - TYPES.H -- renamed structure Chipset_t to CHIPSET and removed CHIPSET define - added structure APPLE_CHIPSET containing Apple specific data - -Service Pack 43 for Emu48 Version 1.0 - -DEBUGGER.C -- changed function OnLButtonUp(), NewValue(), EnterAddr() and - EnterBreakpoint(), replaced WM_GETTEXT message call with function - GetWindowText() - -DISASM.C -- disabled automatic inline code -- fixed source file formatting error -- changed function append_field(), defined as inline code -- changed function append_r_addr(), code optimization - -EMU48.C -- changed function SetCommList(), don't try all possible COM ports - any more, get current serial device list from registry - "HKLM\Hardware\\DeviceMap\\SerialComm" and fill both combo boxes - at one loop for speed up scanning -- changed function SettingsProc(), adjusted to new prototype of - function SetCommList() -- bugfix in function SaveChanges(), function GetSaveAsFilename() - returns a boolean and not a button id -- bugfix in function OnFileNew(), function SaveBackup() was called - when emulator engine was running -> this may caused inconsistent - backup data -- bugfix in function OnFileSaveAs(), function GetSaveAsFilename() - returns a boolean and not a button id -- changed function OnFileSaveAs() and OnObjectSave(), minor - optimizations -- changed function OnFileClose(), removed call of DisableDebugger() - because it's now done in function ResetDocument() -- changed function OnMouseMove(), added "Activation follows mouse" - feature -- added function OnNcMouseMove() for "Activation follows mouse" - feature in non client area -- changed function MainWndProc(), added WM_NCMOUSEMOVE message - handler -- changed function WinMain(), added StartupBackup handling +Service Pack 43+ for Emu48 Version 1.0 EMU48DLL.C - changed function DLLCreateWnd(), added StartupBackup handling -EMU48.H -- extern declaration of global variable and global functions -- changed prototype of function RPL_ObjectSize() - -EMU48.RC -- cosmetic changes in dialog IDD_CHOOSEKML to improve WinXP style -- changed version - -FILES.C -- changed function GetCutPathName(), better support for UNC names -- changed function ResetDocument(), added call of DisableDebugger() -- changed function SaveBackup(), added assertion for checking - emulator engine state -- changed function WriteStack(), adjusted to new prototype of - function RPL_ObjectSize() and added new error state for bad - objects -- changed function LoadObject(), added error message for bad objects - -OPCODES.C -- changed function o83n(), o88n() and o89n(), speed optimization - -OPS.H -- changed function Tbit0(), Tbit1(), Ta(), Tb(), Tae() and Tbe(), - speed optimization - -RESOURCE.H -- added definition for MRU handling - -RPL.C -- bugfix in RPL_ObjectSize(), changed function prototype for adding - buffer size parameter preventing reading outside buffer area when - decoding bad objects - -SETTINGS.C -- added function DelReg() for deleting a registry item -- changed function ReadSettings() and WriteSettings(), added item - "StartupBackup" in section [Files] and item "ActFollowsMouse" and - "AlwaysOnTop" in section [Emulator] -- added functions ReadSettingsString(), WriteSettingsString(), - ReadSettingsInt(), WriteSettingsInt() and DelSettingsKey(), - universal settings interface used for MRU data handling - -TIMER.C -- bugfix in function TimeProc(), under certain conditions this - function is called with a zero uEventId and this may clash with a - reset timer event identifier - - -Service Pack 42 for Emu48 Version 1.0 - -DEBUGGER.C -- added new function OnSetCursor(), message handler for - "Activation Follows Mouse" implementation -- changed function Debugger(), added "Always On Top" and - "Activation Follows Mouse" handling -- bugfix in function OnToolDebug(), argument for owner window handle - was wrong, but over the years I has liked this debugger dialog - behavior so I put in the correct argument for this behavior - -DISPLAY.C -- changed function ResizeWindow(), added "Always on top" feature - -EMU48.C -- removed global variable bClassicCursor -- added function ForceForegroundWindow() forcing window to - foreground -- major changes in function SettingsProc(), added "Port 2 is - Writeable" handling, make port2 changeable without closing the - current emulation session and adjusted to new CRC handling of - port2 -- bugfix in function WinMain(), moved additional DDE stuff just - behind DDE server initialization, adjusted length for cutted - filenames preventing negative values and call ShowWindow() before - asking for a new document preventing a KML script dialog without a - parent window - -EMU48.H -- removed declaration of bClassicCursor -- extern declaration of global variables and functions - -EMU48.RC -- added item "Port 2 is Writeable" in settings dialog -- changed version and copyright +Service Pack 42+ for Emu48 Version 1.0 EMU48DLL.C - bugfix in function DLLCreateWnd(), moved additional DDE stuff just @@ -1512,177 +144,18 @@ EMU48DLL.C filenames preventing negative values and call ShowWindow() before asking for a new document preventing a KML script dialog without a parent window - -FILES.C -- added global variables holding the patched ROM checksum and the - port2 CRC - changed function SetWindowPathTitle(), adjusted length for cutted filename -- changed function CrcRom(), change function prototype, added - unpacked data check and made function public -- bugfix in function CrcRom(), hadn't detected address content - changes at addresses ending with a 0x2 and 0x3 because only lower - 16 bit of checksum was used -> modified function cause a warmstart - because of new checksum -- changed function MapRom(), removed check for packed ROM image -> - a more complete check is implemented in InitKML() now -- changed function UnmapRom(), added reset of ROM checksum variable - changed function CrcPort2(), change function prototype, added unpacked data check and made it global accessible -- changed function MapPort2(), added CRC calculation with saving - result in global variable and added unpacked data check - changed function UnmapPort2(), added reset of Port 2 CRC variable -- new function IsDataPacked() for unpacked data check -- changed function OpenDocument(), use ROM checksum made in - InitKML() and port2 CRC made in MapPort2() and added checks for - packed memory data -- changed function SaveDocument(), changed document signature to - "Emu48 Document\xFE" without the calculator model dependent - variations and adjusted implementation to new prototypes of - CrcRom() and CrcPort2() -- bugfix in function GetSaveAsFilename(), removed "Win48 Document" - from filter list because Emu48 cannot create such a document -KML.C -- bugfix in function KillKML(), class member variable wasn't reset -- bugfix in function TransparentCircle(), there was no radius value - check for preventing division by 0 and color low adjust value - wasn't reached because of wrong color offset divisor -> adjusted - LOWADJ definition to get similar output to buggy earlier version -- changed function MouseMovesTo(), removed bClassicCursor switch - for using arrow cursor over button -- changed function InitKML(), added full check for unpacked ROM - image and build checksum of patched ROM - -OPCODES.C -- bugfix in function o807(), Chipset.in register must be refreshed - before checking for a pressed key - -PCH.H -- added include stddef.h -- restricted DWORD_PTR type definition for MSVC6.0 and earlier - -RESOURCE.H -- added some definitions - -SETTINGS.C -- bugfix in function WriteSettings(), in the INI-File in section - [Files] the item "SaveDefaultConfirm" was missing and saving item - "AutoSaveOnExit" was called twice -- changed function ReadSettings() and WriteSettings(), removed item - "ClassicCursor" from [KML] section in the INI-File - -TIMER.C -- changed function CalcT2(), in the case of a pending timer2 - interrupt return always the timer2 value 0xFFFFFFFF - - -Service Pack 41 for Emu48 Version 1.0 - -DDESERV.C -- removed warnings when compiling under VS2005 -- changed function DdeCallback(), case XTYP_POKE and XTYP_REQUEST - now decode the item name for the stack level - -DEBUGGER.C -- removed warnings when compiling under VS2005 - -DISASM.C -- bugfix in function disasm_8(), the ?HS=0 n opcode showed always as - ?=0 opcode - -DISPLAY.C -- changed function StopDisplay(), adjusted to new prototype of - ReadIO() - -EMU48.C -- removed warnings when compiling under VS2005 -- moved CF_HPOBJ definition to EMU48.H -- changed function OnFileClose(), removed call of KillKML() because - will be done in ResetDocument() - -EMU48.H -- added CF_HPOBJ definition from EMU48.C -- changed function prototypes - -EMU48.RC -- changed version -- replaced CREATEPROCESS_MANIFEST_RESOURCE_ID definition in manifest - declaration by 1 +Service Pack 41+ for Emu48 Version 1.0 EMU48DLL.C - added DDE server -EXTERNAL.C -- changed function BeepWave(), removed VS2005 warning -- changed function BeepWin9x(), disabled implementation for x64 - architecture - -FILES.C -- changed function PatchNibble(), added saving state that ROM - address is patched -- bugfix in function UpdatePatches(), the function maybe called for - patching the ROM when it's already patched, in this case the patch - restore list was overwritten with the patched data -- changed function PatchRom(), removed VS2005 warning -- changed function MapPort2(), improved checking for valid size -- changed function WriteStack(), added stack level argument -- changed function LoadObject(), adjusted call of WriteStack() to - new function prototype - -KEYBOARD.C -- bugfix in function ScanKeyboard(), if keyboard reading wasn't - active a released ON key wasn't cleared in the "in" register - -KEYMACRO.C -- removed warnings when compiling under VS2005 -- changed function OnToolMacroNew(), minor optimization writing - macro file header - -KML.C -- changed function DisplayChooseKml(), changed return type of dialog - box -- changed function ParseLine(), change typecast of szLexString from - DWORD to DWORD_PTR - -KML.H -- changed variable type of nParam[] element of KmlLine structure - because element is also used as pointer - -MOPS.C -- changed function Npeek() and Nread(), adjusted to new prototype of - ReadIO() -- changed prototype of function ReadIO(), added update argument -- bugfix in function ReadIO(), the LPE (0x109), RBR LSB (0x114) and - RBR MSB (0x115) register access had to differ between peek and - read mode - -PCH.H -- added _CRT_SECURE_NO_DEPRECATE definition -- added DWORD_PTR type definition - -RESOURCE.H -- removed CREATEPROCESS_MANIFEST_RESOURCE_ID and RT_MANIFEST - definition - -RPL.C -- added definition of EDITLINE -- added function RPL_Depth() returning stack depth -- changed function RPL_Pick(), added check of stack depth -- changed function RPL_Push(), new implementation with stack level - argument - -STACK.C -- adjusted calls of RPL_Push() to new function prototype -- changed function RPL_SetBcd(), removed compiler warning -- bugfix in function OnStackPaste(), case "any other format" must be - treated as string and not as binary object - -TIMER.C -- removed warnings when compiling under VS2005 - - -Service Pack 40 for Emu48 Version 1.0 +Service Pack 40+ for Emu48 Version 1.0 APPLE.C APPLE.H @@ -1693,27 +166,9 @@ APPLE.H - added BUSCC 40 (opcode 80B04) implementation - added BUSCC 42 (opcode 80B24) implementation -EMU48.C -- bugfix in function OnViewScript(), removed error message because - it's wrong when script is ok, but log report was leaved with - Cancel button, also if clause of error message box was never - reached because error message box had no Cancel button -- changed function OnViewScript(), added call of - SetWindowPathTitle() to adjust length of window title -- changed function WinMain(), simplified document loading at startup - and replaced full filename title with length cutted filename - EMU48.DSP - added apple.c and apple.h sources -EMU48.H -- added definition with valid calculator models -- added macro with model validation code -- extern declaration of global functions - -EMU48.RC -- changed version - EMU48DLL.C - changed function DLLCreateWnd(), simplified document loading at startup and replaced full filename title with length cutted @@ -1722,171 +177,17 @@ EMU48DLL.C EMU48DLL.DSP - added apple.c and apple.h sources -FETCH.C -- changed function EvalOpcode(), included assertion for detecting - access to packed memory data - -FILES.C -- moved function WriteStack() inside file -- added new function GetCutPathName(), creating a length cutted - filename -- added new function SetWindowPathTitle(), replacement for calling - SetWindowTitle() for getting length cutted filenames as title -- bugfix in function OpenDocument(), after reading CPU state, port - pointers must immediately be deleted because on error condition - function ResetDocument() tries to free this memory; added check - for valid calculator model -- changed function OpenDocument(), SaveDocumentAs() and - RestoreBackup(), replaced call of function SetWindowTitle() with - SetWindowPathTitle() -- changed function GetOpenFilename(), GetSaveAsFilename(), - GetLoadObjectFilename() and GetSaveObjectFilename(), moved - storage place of local file buffer from heap to stack - -I28F160.C -- bugfix in function WrStateE8N(), removed "Write to Buffer command - failed when requesting for the buffer length" code part introduced - in SP27; this was in reality a workaround for the actually fixed - Nwrite() flash access bug and illegal data length information - wasn't handled correctly - -KML.C -- changed function CreateKmlList(), select only KML files with a - valid Model statement -- bugfix in function Lex(), EOF without LF at end of non empty line - wasn't detected as EOL -- bugfix in function InitButton(), nested scancode block commands - hadn't handled correctly -- changed function InitKML(), changed checking for valid Model - argument and changed the corresponding error message - -MOPS.C -- bugfix in function UckBit(), when UART is off then the UCK bit - was always cleared, but it's always set -- bugfix in function Npeek(), Nread() and Nwrite(), flash access - over a 2KB MMU boundary caused problems in some cases -- bugfix in function WriteIO(), race condition when clearing the SON - bit in the IOC (0x110) register, the UART was still working so the - cleared IOC (0x110), RCS (0x111), TCS (0x112), RBR (0x114,0x115) - and TBR (0x116,0x117) register can be overwritten by the serial - thread - OPCODES.C - moved function DecodeReg64(), o80BReg164(), o80BReg264(), EncodeReg64() and o80BRegWrite() to apple.c - changed function o80B(), moved Saturnator extentions to apple.c -SERIAL.C -- bugfix in function CommOpen(), method of port closing was illegal - because COM port dependent threads hadn't been stopped - - -Service Pack 39 for Emu48 Version 1.0 - -DDESERV.C -- bugfix in function DdeCallback(), used wrong return in XTYP_POKE - case for calculator models without stack - -DEBUGGER.C -- changed function UpdateMemoryWnd(), added follow dispatcher -- new fuction OnMemFollow() to handle follow menu entries -- changed function OnDblClick() and OnKeyUpDown(), replaced all - function calls of UpdateMemoryWnd() with ViewMemWnd() because of - the modified behavior of UpdateMemoryWnd() -- changed function Debugger(), added "Follow" menu entry - initialization in WM_INITDIALOG and menu commands handler in - WM_COMMAND section - -EMU48.C -- changed function SaveChanges(), default button for confirming the - "Do you want to save changes ?" message depends now on the - "SaveDefaultConfirm" INI-File setting (1=yes / 0=no button) +Service Pack 39+ for Emu48 Version 1.0 EMU48.DSP - added new build modes using Debug4x registry settings of Emu48.dll -EMU48.H -- extern declaration of global variable - -EMU48.RC -- changed IDD_KMLLOG, replaced "Always" text with "Show Script - compilation result next time" -- added "Follow" menu entries in debugger "Memory" context menu -- changed version and copyright - -FILES.C -- bugfix in function NewDocument(), the backup now behave like with - function OpenDocument() -> the backup now contain the emulator - state before the new session and not the new session itself -- bugfix in function RestoreBackup(), window title wasn't updated -- bugfix in function CreateBIPalette(), for 16 and 32 bitcount - bitmaps no logical palette was created -- bugfix in function LoadBitmapFile(), function blocked loading - bitmap when ROM file was missing - -IO.H -- added DISP1CTL, LINENIBS, DISP2CTL and BAUD bit definitions - -KML.C -- changed table szLexDelim[], removed first element -- added new table eIsGlobalBlock[] with valid block tokens -- added new function IsGlobalBlock(), checking if token inside - eIsGlobalBlock[] table -- changed function Lex(), added assertion for mode checking -- changed function ParseLines(), added syntax checking for command - tokens and removed "Open block." message -- changed function ParseBlocks(), added syntax checking for block - tokens -- changed function InitLcd(), added zoom factor 3 to range check of - TOK_ZOOM -- bugfix in function LoadKMLGlobal(), keyword "Global" had only been - detected as first command in KML script - -KML.H -- adjusted definitions of LEX_BLOCK, LEX_COMMAND and LEX_PARAM to - modified table szLexDelim[] -- added TOK_TOPBAR and TOK_VGA definition - -RESOURCE.H -- added several definitions - -RPL.C -- added new function RPL_GarbageCol() for doing a garbage collection -- changed function RPL_CreateTemp(), added garbage collection on low - memory condition - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added item - "SaveDefaultConfirm" in section [Files] in the INI-File - - -Service Pack 38 for Emu48 Version 1.0 - -DISPLAY.C -- bugfix in function UpdateContrast(), used background Color 0 in - calculator off state even if Color 32 was defined -- bugfix in function CreateLcdBitmap(), DIB section shouldn't - created from the memory DC - -EMU48.C -- added function IsPort2Writeable() to check if read only file - attribute is not set on port2 file -- changed function SettingsProc(), added sound handling -- moved function OnStackCopy() and OnStackPaste() to STACK.C -- changed function WinMain(), added accelerator key access for menus - -EMU48.H -- extern declaration of global variables and functions - -EMU48.RC -- added "Sound" group in Settings dialog -- changed menu text "Copy String" to "Copy Stack" and menu text - "Paste String" to "Paste Stack" -- added accelerator resource -- changed version - -EMU48.DSP -- added stack.c sources +Service Pack 38+ for Emu48 Version 1.0 EMU48DLL.C - changed function DLLCreateWnd(), added accelerator table resource @@ -1901,30 +202,9 @@ EMU48DLL.DSP EMU48DLL.H - extern declaration of global function -ENGINE.C -- bugfix in function WorkerThread(), when changing into SM_RUN state - display constrast must also be restored - -EXTERNAL.C -- added function BeepWave(), beeper function using sound card -- added function BeepWin9x(), PC speaker function for working on - Win9x -- changed function External(), removed range checking of duration; - call function BeepWin9x() on Win9x instead of Beep() or in the - case of wave sound the function BeepWave() - FILES.C -- bugfix in function SaveObject(), calculator models HP48GII and - HP49G+ hasn't used the HP49G object header - -KML.C -- bugfix in function SkipWhite(), skipping remark text hadn't stop - at string end -- bugfix in function ParseBlocks(), stopped script parsing without - error at unknown block token -- bugfix in function SkipLines(), TOK_END was handeled wrong -> - this caused a RunKey end if condition of TOK_IFPRESSED or - TOK_IFFLAG was false and there was no TOK_ELSE inside this level +- bugfix in function SaveObject(), calculator models HP48gII and + HP49g+ hasn't used the HP49G object header OPCODES.C - bugfix in function o80BdecodeReg64(), WP and XS case worked wrong @@ -1943,51 +223,7 @@ OPS.H - added function Npack64() and Nunpack64() for 64bit register packing/unpacking -PCH.H -- added include conio.h - -RESOURCE.H -- added definition - -RPL.C -- added function RPL_GetSystemFlag() returning the state of the - given system flag - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added item - "WaveBeep" in section [Emulator] in the INI-File - -STACK.C -- new modul with the message handler functions OnStackCopy() and - OnStackPaste() prior located in EMU48.C -- changed function OnStackCopy() and OnStackPaste(), they can now - also copy real numbers and HP49G Precision Integer (limited to - 127/128 digits incl. sign) from and to the clipboard - -TIMER.C -- changed function CheckT1() and CheckT2(), minor optimization in - checking if INT or WAKE bit is set - - -Service Pack 37 for Emu48 Version 1.0 - -DISPLAY.C -- replaced the DIBPIXELGRAY and DIBPIXELBW use with DIBPIXEL macro - to avoid the "if (bGrayscale)" construct in the inner loop of - display drawing -- renamed the bmiLcdGray structure to bmiLcd -- removed the bmiLcdBW structure, use bmiLcd instead -- replaced UpdateContrast() implementation by a optimized one -- bugfix in function CreateMainBitmap(), in error case hMainDC - variable wasn't cleared -- changed function UpdateMainDisplay() and UpdateMenuDisplay(), - added display buffer ckecking in debug mode -- bugfix in function GetLineCounter() and StartDisplay(), VBL down - counter counted 62,...,0,63 instead of 63,...,0 - -EMU48.C -- changed function SettingsProc(), make "grayscale" mode online - switchable +Service Pack 37+ for Emu48 Version 1.0 EMU48.H - bugfix in definition MENUHEIGHT, calculated number of lines was @@ -1995,82 +231,17 @@ EMU48.H this caused a buffer overflow in function UpdateMenuDisplay() which prevented program execution on Win9x -EMU48.RC -- changed menu text order from "Copy Stack/Copy Screen/Paste Stack" - to "Copy Screen/Copy Stack/Paste Stack" -- changed "Enable Virtual LCD Delay" in Settings dialog to the Emu48 - style without a group box - EMU48DLL.C - changed function EmuCalculatorType(), removed workaround for older Debug4x versions -FILES.C -- changed function PatchRom(), changed ASCII string handling from - BYTE to CHAR data type +Service Pack 36+ for Emu48 Version 1.0 -KML.C -- bugfix in function InitKML(), changed log message for no "Model" - definition found and a missing "Bitmap" definition wasn't detected - -OPS.H -- changed function Nsrb(), speed optimization - -TIMER.C -- bugfix in function SetT1(), fixed unsynchronized access to timer1 - value, stop timer1 only if running and restart timer1 only when - timer2 is running - - -Service Pack 36 for Emu48 Version 1.0 - -- changed display management to use stretchBlit instead of doing it +DISPLAY.C +- changed display management to use stretchBlt instead of doing it by hand - debugged usage of Apple header display to allow one to change the header size to any size -- added runtime-configurable grayscale simulation support - -CHECKBOX.BMP -- fixed one pixel with wrong color - -DDESERV.C -- changed function DdeCallback(), removed delays after ON key state - change - -DEBUGGER.C -- bugfix in function Debugger(), used function to set icon which - hasn't worked properly under WinXP - -DISPLAY.C -- changed function UpdateMenuDisplay(), minor code optimizations - -EMU48.C -- changed function UpdateWindowStatus(), added macro specifiy menu - control -- changed function CopyItemsToClipboard(), simplified implementation - in UNICODE mode by saving the data in the CF_UNICODETEXT format -- changed function SettingsProc(), added IDC_PORT2LOAD button - handling -- changed function OnStackPaste(), minor code optimization -- changed function OnDropFiles(), OnStackPaste() and OnObjectLoad(), - removed delays after ON key state change -- changed function OnLButtonDown(), OnLButtonUp(), OnMouseMove(), - OnKeyDown() and OnKeyUp(), disable function handling when in macro - play mode -- bugfix in function WinMain(), szCurrentKml wasn't initialized -- changed function MainWndProc(), added some macro handler functions - -EMU48.DSP -- added keymacro.c sources - -EMU48.RC -- added "..." button Settings dialog -- changed "Always" checkbox in "KML Script Compilation Result" - dialog from a pushlike to normal one for better readability under - Windows XP style -- added "Macro Settings" dialog -- added Menuitem Tools "Macro..." -- changed version and copyright EMU48.H - replaced T2CYCLES with the one from OPCODES.H @@ -2078,2734 +249,73 @@ EMU48.H EMU48DLL.DSP - added keymacro.c sources -ENGINE.C -- bugfix in function AdjustSpeed(), on large operations the - workaround condition for Win2k was detected and the following - synchronizing failed because the CPU didn't got the free running - cycles for the waited time -- bugfix in function UpdateKdnBit(), wrong DWORD truncation of - Chipset.cycles variable -- changed function WorkerThread(), close running keyboard macros - when switching into invalid state +Service Pack 35+ for Emu48 Version 1.0 -FILES.C -- changed function WriteStack(), minor optimization when saving as - string -- changed function MapRom(), added detection for packed ROM images -- bugfix in function OpenDocument(), check for empty KML file name - was wrong, so the error handler of the following InitKML() was - always called in this case -- bugfix in function OpenDocument(), reload KML button state from - last document close -- changed function LoadObject(), file access is now shared -- changed function DibNumColors() and CreateBIPalette(), changed - argument qualifier - -KEYBOARD.C -- changed function KeyboardEvent(), added call to key recording - function KeyMacroRecord() -- bugfix in function KeyboardEvent(), prevent buffer overflow with - too big out codes on Chipset.Keyboard_Row array - -KEYMACRO.C -- new modul supporting keyboard macro functions - -KML.C -- changed variable qualifier of eIsBlock[] table and removed - TOK_NONE item from it -- bugfix, global variables pKml and pKmlList hadn't be initialized -- removed usage of global variables bKmlLogOkEnabled and nKmlFiles -- changed function AddToLog(), changed argument qualifier and minor - code optimization -- changed function PrintfToLog(), use a local buffer instead of the - heap for the output buffer of the wvsprintf() function, this helps - to reduce fragmentation of the heap -- changed function KMLLogProc(), minor code optimization and removed - use of global variable bKmlLogOkEnabled and windows redraw in the - WM_INITDIALOG case -- changed function DisplayKMLLog(), removed use of global variable - bKmlLogOkEnabled and transfer state of bOkEnabled over the lParam - argument to the dialog box procedure -- bugfix in function CreateKmlList(), fixed a memory leak in the - case of no title -- changed function ChooseKMLProc(), minor code optimization -- changed function IsBlock(), minor code optimization -- bugfix in function ParseString(), fixed memory leak in error case - and optimized implementation -- changed function IncludeLines(), IncludeBlocks(), LoadKMLGlobal() - and InitKML(), file access is now shared -- added function ReloadButtons(), update internal button state from - chip keyboard matrix content -- added function PlayKey(), handle button with OutIn code - -KML.H -- added ReloadButtons() and PlayKey() function prototype - -MOPS.C -- bugfix in function WriteIO(), writing to timer2 failed if first - writing address was before the timer2 address area -- changed function WriteIO(), changing the CONTRLSB (0x101) or the - DISPTEST (0x102) register doesn't effect any display pointer, so - update request for recalculating the pointers removed - -OPCODES.C -- bugfix in function o802() and o803(), the r=IN opcodes work also - on odd addresses in the IO register memory mapping area - -OPS.H -- bugfix in function Nsub() and Nrsub(), in some situations wrong - results in dec mode with illegal decimal number entry as 2nd - operator - -PCH.H -- added VERIFY macro - -RESOURCE.H -- added several definitions - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added section - [Macro] in INI-File - -TIMER.C -- bugfix in function RescheduleT2(), better accuracy on conversation - of timer2 ticks into multimedia timer ms -- changed function StartTimers(), added calculation of maximum - timer2 ticks that can be handled by one timer event -- changed function StartTimers() and StopTimers(), changed - multimedia timer to best possible timer resolution instead of - risking to fail with 1 ms resolution preset - - -Service Pack 35 for Emu48 Version 1.0 +DEBUGDLL.C +EMU48DLL.C +EMU48DLL.DSP +EMU48DLL.DSW +EMU48DLL.H +- new files DDESERV.C -- replaced all LocalAlloc() with HeapAlloc() memory requests +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. DEBUGGER.C -- replaced all LocalAlloc() with HeapAlloc() memory requests -- changed function UpdateProfileWnd(), replaced CONST TCHAR * with - LPCTSTR - -DISASM.C -- changed several variable qualifiers from TCHAR * to LPCTSTR and - replaced rest of TCHAR * by LPTSTR -- changed variable qualifier of hp_reg_1_af and hp_reg_2_af -- changed function append_tab(), speed optimization -- changed function append_field(), removed use of temporary variable - -DISPLAY.C -- renamed variable nLcdDoubled to nLcdZoom -- changed function UpdateMainDisplay() and UpdateMenuDisplay(), - minor improvement by reading each display line now with the actual - display start pointer - -EMU48.C -- renamed variable nLcdDoubled to nLcdZoom -- replaced all LocalAlloc() with HeapAlloc() memory requests -- bugfix in function CopyItemsToClipboard(), don't worked in UNICODE - mode because character translation was missing - -EMU48.H -- extern declaration of global variable -- moved T2CYCLES definition from OPCODES.H -- renamed variable nLcdDoubled to nLcdZoom -- changed function DuplicateString(), replaced LocalAlloc() with - HeapAlloc() memory request - -EMU48.RC -- changed version -- changed resource language description to English - -FILES.C -- replaced all LocalAlloc() with HeapAlloc() memory requests -- changed function CreateBIPalette(), allocated memory for - LOGPALETTE isn't initialized with zero any more - -KML.C -- renamed variable nLcdDoubled to nLcdZoom -- replaced all LocalAlloc() with HeapAlloc() memory requests -- bugfix in function PrintfToLog(), temporary buffer was half of - size in UNICODE mode -- changed function BrowseFolder() and ChooseKMLProc(), renamed - IDC_EMU48DIR to IDC_EMUDIR and IDC_EMU48DIRSEL to IDC_EMUDIRSEL -- bugfix in function BrowseFolder(), the shell's allocator release - was missing in one case -- changed function ChooseKMLProc(), optimized IDC_EMUDIRSEL command - case -- bugfix in function ParseString(), strings greater 127 characters - caused a buffer overflow in UNICODE mode -- bugfix in function KillKML(), display size wasn't reset to the - preset value at the end - -RESOURCE.H -- renamed IDC_EMU48DIR to IDC_EMUDIR -- renamed IDC_EMU48DIRSEL to IDC_EMUDIRSEL - -RPL.C -- replaced all LocalAlloc() with HeapAlloc() memory requests - -OPCODES.H -- moved T2CYCLES definition to EMU48.H - -OPS.H -- changed function Nadd(), optimized "illegal number in dec mode" - detection -- changed function Ninc(), Ndec(), Nsub() and Nrsub(), removed - register wrap handling -- changed function Nneg(), optimized non zero value handling -- bugfix in function Nsrc(), the Sticky Bit (SB) wasn't handled in - all rSRC opcodes - -TIMER.C -- bugfix in function CalcT2(), estimated timer2 ticks were sometimes - to large because there was a misbehavior between real time clock - and counted CPU cycles when in free running mode -- changed function RescheduleT2(), optimized initialization of - synchronization variables used in CalcT2() -- changed function SetHP48Time(), changed variable typ of ticks and - time from LONGLONG to ULONGLONG -- changed function ReadT2(), minor optimization calculating the - timer2 value - -Service Pack 34+ for Emu48 Version 1.0 -- added new calcualtor type: P, 2 and Q for 39G+, 48Gii and 49G+. -- added 80 lines display and header support - added extra speed for Apple series +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. + +DISMEM.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. + +DISPLAY.C +- added 80 line display and header support + +EMU48.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. +- added 80 line display and header support +- changed version number + +EMU48.DSP +- added new files + +EMU48.H +- added extra speed for Apple series +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. +- adjusted to new prototype of function RPL_CreateTemp() +- changed signature of FlashROMAddr + +ENGINE.C +- added extra speed for Apple series +- added 80 line display and header support + +EXTERNAL.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. + +FILES.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. + +KML.C +- added new calculator type: P for 39g+ + +MOPS.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. +- added 80 line display and header support +- changed signature of FlashROMAddr + +OPCODES.C - added BUSCC function support -- change the compile always visible by default - -Service Pack 34 for Emu48 Version 1.0 - -CURSOR.C -- new modul to create a hand cursor - -DEBUGGER.C -- bugfix in function NewValue(), EnterAddr(), EnterBreakpoint(), - EditBreakpoint(), InfoIntr() and InfoWoRegister(), uncompleted - wParam argument decoding in WM_COMMAND case -- replaced function OnToggleCheck() with ToggleBreakpointItem(), a - more general function to toggle a breakpoint check box -- changed function EditBreakpoint(), adjusted LBN_DBLCLK case to use - the new ToggleBreakpointItem() function and modified behavior of - VK_SPACE to toogle all selected items - -DISPLAY.C -- replaced variable use of hOldLcdBitmap with hLcdBitmap -- replaced variable use of hOldMainBitmap with hMainBitmap - -EMU48.C -- removed limitation to 16 COM ports -- changed variable qualifier of szLicence -- added global variables -- added Critical Section initialization for CPU slow down -- changed function SetWindowTitle(), changed argument qualifier -- bugfix in function SettingsProc(), Disasm() and About(), - uncompleted wParam argument decoding in WM_COMMAND case -- changed function OnCreate() and OnDestroy(), added load and - destroy of two new cursor resources -- bugfix in function MainWndProc(), wrong wParam argument decoding - in WM_SYSCOMMAND case -- changed function WinMain(), removed class cursor from main window -- bugfix in function WinMain(), fixed possible buffer overflows in - state file loading message - -EMU48.DSP -- added cursor.c sources - -EMU48.H -- extern declaration of global variables and functions - -EMU48.RC -- changed IDC_DEBUG_MEM from static to listbox control, looks better - in connection with WinXP style -- changed version and copyright - -FILES.C -- renamed variable szEmu48Directory[] to szEmuDirectory[] -- changed buffer size information of files and pathes from 260 to - MAX_PATH definition -- bugfix in function GetOpenFilename(), GetSaveAsFilename(), - GetLoadObjectFilename() and GetSaveObjectFilename(), adjusted - size of temporary buffer to size of destination buffer and fixed - memory allocation bug in UNICODE mode -- changed function LoadBitmapFile(), it's better to validate the - pbyRom instead of the hRomFile variable to check if the ROM is - loaded to avoid possible side effects (ROM loaded by resource) and - removed uncalled code part - -ENGINE.C -- bugfix in function AdjustSpeed(), AdjKeySpeed() and SetSpeed(), - reference setting wasn't synchronized - -KML.C -- renamed variable szEmu48Directory[] to szEmuDirectory[] -- bugfix in function KMLLogProc(), uncompleted wParam argument - decoding in WM_COMMAND case and update of the bAlwaysDisplayLog - variable only in the IDOK and IDCANCEL case -- bugfix in function ChooseKMLProc(), uncompleted wParam argument - decoding in WM_COMMAND case and added UNREFERENCED_PARAMETER - statement -- bugfix in function ParseLines() and ParseBlocks(), fixed problem - of uninitialized variable which may occur on parsing corrupt KML - files -- bugfix in function KillKML(), set variables bDebug and nKMLFlags - to there startup values -- changed function MouseMovesTo(), added code part to select cursor - -OPCODES.C -- bugfix in function o3X(), o8082X(), oBb0(), oBb1(), oBb2(), - oBb3(), oBb4(), oBb5(), oBb6() and oBb7(), used wrong cpu cycles - -PCH.H -- added IDC_HAND definition for non Win2k OS project - -SETTINGS.C -- renamed variable szEmu48Directory[] to szEmuDirectory[] -- changed function ReadSettings() and WriteSettings(), added item - "ClassicCursor" in section [KML] in the INI-File - - -Service Pack 33 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function Debugger(), removed illegal call of - DestroyMenu() in WM_DESTROY message handler -- added function UpdateDbgCycleCounter() to handle a 64 bit CPU - cycles counter in debug mode -- added implementation of "Profiler" dialog box - -DEBUGGER.H -- extern declaration of global function - -EMU48.C -- changed function WinMain(), added non modal "Profiler" dialog box - in main message handler - -EMU48.H -- extern declaration of global variable - -EMU48.RC -- changed version and copyright -- bugfix in dialogs, some WS_EX_ styles (especially window borders) - don't worked on some operating systems -- added Menuitem Info "Profiler..." in debugger menu -- added "Profiler" dialog - -ENGINE.C -- bugfix in function Debugger(), fixed problem at quitting debugger - when last executed opcode was SHUTDN -- changed function Debugger(), added call for 64 bit cpu cycle - counter adjust - -KEYBOARD.C -- bugfix in function KeyboardEvent(), CPU slow down by calling the - function AdjKeySpeed() on key pressed must be activated here - -OPCODES.C -- changed function o802() and o803(), removed AdjKeySpeed() call - -RESOURCE.H -- added definitions RPL.C -- replaced object prolog entries by definitions - -SERIAL.C -- bugfix in function CommSetBaud(), changed DCB setting from 1 to 2 - stop bits which is closer to the original 2-3/16 stop bits - -TIMER.C -- changed function TimeProc(), removed check if timer running - - -Service Pack 32 for Emu48 Version 1.0 - -DDESERV.C -- bugfix in function DdeCallback(), DDE commands POKE and REQUEST - worked also on machines with no stack and debugger control in DDE - command POKE was missing - -DEBUGGER.C -- bugfix in function OnKeyF7() and OnKeyF8(), on expected longer - operations like with skipping interrrupt code, the menu and - toolbar should be set into run mode; a general setting into run - mode wasn't used because of menu flickering -- changed function OnStackPush() and OnStackPop(), stack elements - can be pushed or poped on any stack level now -- bugfix in function OnLButtonUp(), forgot P and WP field selection - update on P register changing -- changed function OnKeyRightLeft(), code optimizations -- changed function NotifyDebugger(), handle changed argument type -- bugfix in function Debugger(), set the menu and toolbar into run - mode at startup, this prevents wrong active buttons when interrupt - code should be skipped and the calculator can't leave the - interrupt code because the ON key is permanently down or another - interrupt source prevent leaving the interrupt handler - -DEBUGGER.H -- added new debugger notify defines - -EMU48.C -- changed function OnCreate(), don't enable DragAcceptFiles() here -- changed function OnDropFiles(), checking calculator model to - disable stack writing isn't necessary any more - -EMU48.DSP -- new makefile for MSVC 6.0 - -EMU48.H -- extern declaration of global function (DLL version) -- added hardware type define - -EMU48.RC -- changed version - -ENGINE.C -- changed function Debugger(), added ability to detect an ASM and - RPL breakpoint on the same address -- bugfix in function ResumeDebugger(), resume may hung in CPU - shutdown mode - -FILES.C -- changed function OpenDocument() and SaveDocumentAs(), added - callback notify function call for DLL version - -KML.C -- added "Hardware" keyword in Global section -- changed function CreateKmlList(), added checking the "Hardware" - keyword to ignore KML scripts for other emulators -- changed function InitGlobal(), added logfile output for the - "Hardware" keyword -- changed function InitKML(), enable object "Drag and Drop" - calculator model dependend here now - -KML.H -- added TOK_HARDWARE definition - - -Service Pack 31 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function Debugger(), used wrong background color in - WM_CTLCOLORSTATIC message handler for WinXP style - -DISPLAY.C -- bugfix in function WriteToMainDisplay() and WriteToMenuDisplay(), - drew to display even if the DON bit in the =BITOFFSET (0x100) - register was cleared - -EMU48.C -- added global variable -- changed function SettingsProc(), added IDC_OBJECTLOADWARNING check - box handling -- bugfix in function OnViewSettings(), removed calling of function - ReadSettings() because INI file settings may be invalid here -- changed function OnObjectLoad(), to disable warning message use a - global variable now - -EMU48.H -- extern declaration of global variable -- changed prototype of function ScanKeyboard() - -EMU48.RC -- added item "Show Load Object Warning" in Settings dialog -- added "..." button in "Choose Your KML Script" dialog -- changed version - -ENGINE.C -- bugfix in function UpdateKdnBit(), update KDN bit only when - keyboard interrupt is on and the timer is running - -FILES.C -- bugfix in function NewDocument(), set the RST bit in the LPE - (0x109) register to indicate a POR (Power On Reset) -- bugfix in function RestoreBackup(), when the KML script - initialization failed the Chipset.Port0, Chipset.Port1 and - Chipset.Port2 pointer referenced to unallocated memory - -IO.H -- added LPD and LPE definitions - -KEYBOARD.C -- bugfix in function ScanKeyboard(), a stopped timer don't prevent - keyboard status update, it prevents the 1ms keyboard polling and - generating a keyboard interrupt; also now distinguish keyboard - update between 1ms keyboard poll and direct update with A=IN and - C=IN command -- changed function KeyboardEvent(), call function ScanKeyboard() in - the 1ms poll context now - -KML.C -- new functions BrowseCallbackProc() and BrowseFolder(), helper - functions to browse a directory -- changed function ChooseKMLProc(), added implementation of browser - button, removed WM_SETTEXT message handler and changed WM_COMMAND - handler from 'if' to 'switch' structure -- bugfix in function ChooseKMLProc(), used wrong array size of - szEmu48Directory in UNICODE mode - -MOPS.C -- bugfix in function CpuReset(), set the RST bit in the LPE (0x109) - register to indicate NRES reset -- bugfix in function Npeek(), Nread() and Nwrite(), wrap around over - address #FFFFF failed -- bugfix in function ReadIO(), reset the RST bit in the LPE (0x109) - register after reading -- bugfix in function WriteIO(), added implementation of the RST bit - in the LPE (0x109) register - -OPCODES.C -- renamed define BIGENDIAN to _BIGENDIAN to avoid problems with the - definition in WINSOCK2.H -- bugfix in function o158x(), o159x(), o15Cx(), o15Dx(), o15Ax(), - o15Bx(), o15Ex(), o15Fx(), o807(), o819f0(), o819f1(), o819f2(), - o819f3(), oF0(), oF1(), oF2(), oF3(), oF4(), oF5(), oF6() and - oF7(), used wrong cpu cycles -- changed function o800() and o801(), call function ScanKeyboard() - in the 1ms poll context now -- bugfix in function o802() and o803(), added ScanKeyboard() - function call for direct Chipset.in update -- bugfix in function o8080(), added ScanKeyboard() function call to - activate 1ms keyboard polling -- changed function o80810(), call function ScanKeyboard() in the - direct update context now - -OPCODES.H -- changed some remarks - -PCH.H -- added include shlobj.h - -RESOURCE.H -- added definition +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. SETTINGS.C -- changed definitions, allows setting of INI filename and registry - path in the makefile now -- changed function ReadSettings() and WriteSettings(), added item - "LoadObjectWarning" in section [Files] in the INI-File +- added extra speed for Apple series +- added RomDirectory - -Service Pack 30 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function Debugger(), used wrong debugger window position - when task bar was on top or left side -- added implementation of "Write-Only Register" dialog box - -DDESERV.C -- added io.h in header definition -- removed usage of Chipset.dispon variable - -DISPLAY.C -- added sources of gray scale emulation (experimental) -- replaced the LCD1_ROW by the LCD_ROW definition and the use of the - LCD2_ROW and the LCD3_ROW definitions by a calculation base on - LCD_ROW -- changed macro LINES(), added brackets forcing operator priority -- changed BITMAPINFO color table variable type from DWORD to RGBQUAD -- changed LCD bitmap from 64 palette entries to the number of used - colors in the LCD area, so function UpdateContrast() do not change - the drawing patterns to a new palette entry, it change the palette - itself now -- bugfix in function UpdateContrast(), switch palette to LCD off - background color if display is off -- bugfix in function DestroyLcdBitmap(), contrast palette wasn't - restored to startup colors -- changed function WriteToMainDisplay(), used wrong sizeof argument - to get the 4 byte x-multiplier in the calculation of the memory - position in the LCD bitmap -- bugfix in function StartDisplay(), the VBL counter of a switched - on display starts at the LINECOUNT (0x128,0x129) register content - -EMU48.C -- removed usage of Chipset.dispon variable -- bugfix in function SetCommList(), used wrong NO_SERIAL string - definition for UNICODE mode -- bugfix in function OnDestroy(), call function SwitchToState() only - if CPU emulation thread is running -- bugfix in function OnViewCopy(), clipboard contained wrong data - when left display margin was unequal to zero - -EMU48.H -- changed prototype of function StartDisplay() -- extern declaration of global function - -EMU48.RC -- fixed misspellings "hexdezimal" to "hexadecimal" -- added "Write-Only Register" dialog -- added Windows XP manifest resource -- changed version and copyright - -EMU48.XML -- manifest file for Windows XP - -ENGINE.C -- changed function WorkerThread(), added parameter to StartDisplay() - function call - -FILES.C -- bugfix in function NewDocument(), OpenDocument() and - RestoreBackup(), used wrong window restore position when task bar - was on top or left side -- bugfix in function SaveBackup(), get workspace instead of screen - coordinates of main window -- changed function LoadObject(), changed text output of "load error" - message boxes - -KML.C -- changed function InitAnnunciator() and DrawAnnunciator(), - determine the number of valid entries now from the annunciator - array size - -MOPS.C -- removed usage of Chipset.dispon variable -- bugfix in function Npeek(), fixed most of the wrong read values in - the I/O register area -- changed function Nwrite(), added conditional gray scale compiling - and added parameter to StartDisplay() function call -- bugfix in function WriteIO(), after changing the DON bit in - BITOFFSET (0x100) the display contrast must be updated as well - -RESOURCE.H -- added some definitions - -SERIAL.C -- redesign of character transmit part, on some PC systems corrupted - characters were sent - -TIMER.C -- workaround for Win2k in function CalcT2(), when detecting a - "negative" time use the CPU cycles for new timer2 value - - -Service Pack 29 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function UpdateMiscWnd(), readded trailing spaces in - "On" text -- changed function Debugger(), replaced bDbgEnable with nDbgState - access - -DEBUGGER.H -- added new debugger state defines - -DISPLAY.C -- added variable and functions from MOPS.C -- new functions StartDisplay() and StopDisplay() to control display - -EMU48.C -- added VOID as parameter in functions with no argument -- added Critical Section initialization for gray scale emulation -- changed function UpdateWindowStatus(), OnDropFiles(), - OnStackPaste() and OnObjectLoad(), replaced bDbgEnable with - nDbgState access -- changed function OnDropFiles(), OnFileClose(), OnStackPaste() and - OnObjectLoad(), added debugger control - -EMU48.H -- added defines for conditional gray scale compiling -- removed declaration of bDbgEnable -- extern declaration of global variables and functions - -EMU48.RC -- changed version and copyright - -ENGINE.C -- removed global variable bDbgEnable, replaced by a state in the - nDbgState variable -- added new functions SuspendDebugger() and ResumeDebugger() for - debugger control -- changed functions Debugger(), WaitForSleepState(), SwitchToState() - and WorkerThread(), added debugger control instead of general - debugger switching off -- changed function CheckSerial(), removed interrupt handling and - made function public -- changed function SwitchToState() and WorkerThread(), replaced - bDbgEnable with nDbgState access -- changed function WorkerThread(), main loop don't check status of - serial port any more, serial port must be initialized before - entering the RUN state now, added start/stop VBL counter at - entering/leaving the RUN state - -FILES.C -- changed function WriteStack(), minor optimization - -MOPS.C -- removed variable ioc_acc -- moved variable byVblRef and the functions F4096Hz() and - GetLineCounter() to DISPLAY.C -- changed function CpuReset(), must close serial port here -- changed function WriteIO(), control of the BITOFFSET (0x100) - register calls now the functions StartDisplay() and StopDisplay() - to modify the VBL counter reference -- changed function WriteIO(), changing the IOC (0x110) register - must also update the serial port status, because this isn't - handled in the CPU main loop any more - -TIMER.C -- changed function RescheduleT2(), calculate now ceil of time delay - to reduce checking of timer2 value without timer2 overflow - - -Service Pack 28 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in table MemMap[], NCE3 reference in HP39/40 part was wrong -- bugfix in function SetMappingMenu(), used wrong variable type for - UNICODE mode -- changed function UpdateMiscWnd(), removed trailing spaces in text -- new functions OnStackPush(), OnStackPop() and OnStackModify() and - other changes for implementation of the stack context menu -- changed function OnFindOK(), minor optimizations -- changed function OnNewValue(), now returns exit condition - -DISPLAY.C -- removed usage of Chipset.dispon variable - -EMU48.C -- bugfix in function SetCommList(), detection of COM ports larger - than COM9 failed -- moved shutdown of CPU emulation thread from the WinMain() to the - OnDestroy() function to avoid trouble with closed window DC - -EMU48.DSP -- added configuration "Release Unicode" -- added configuration "Debug Unicode" - -EMU48.RC -- added "Stack" menu entries -- added accelerator key in "Find" dialog -- changed version and copyright - -I28F160.C -- bugfix in table byQueryTab[], content of not specified offset 0x03 - is 0x02; offset 0x1B and 0x1D contain 0x30 in the real chip -- changed function WrStateE8N(), WrStateE8D() and WrState60D(), use - device specific data from query table instead of program constants -- bugfix in function WrStateE8C(), don't set the BWSLBS bit in the - status register on trying to set a 0 bit -- changed function WrState40D(), removed useless increment -- bugfix in function WrState30C(), don't set the ECLBS bit in the - status register when trying to erase a lock bit with WP# = low -- changed function WrState20C() and WrState30C(), use device - dimensions from query table now and optimized data filling part -- bugfix in function WrState60D(), the BWSLBS or the ECLBS bit in - the status register is set when trying to modify lock bits with - WP# = low -- bugfix in function RdStateId() and RdStateQuery(), Flash commands - "Read Identifier Codes" and "Read Query" now behave on illegal - address access like the original calculator - -RESOURCE.H -- added definitions - -SERIAL.C -- bugfix in function SerialThread(), added implementation of the RER - bit in the RCS (0x111) register for receiver BREAK condition -- bugfix in function CommOpen(), opening COM ports larger than COM9 - failed -- bugfix in function CommTxBRK(), added LPB (Loop Back) emulation - - -Service Pack 27 for Emu48 Version 1.0 - -DEBUGGER.C -- various changes in many functions for implementation of the module - memory view -- changed function CreateToolbar(), replaced InitCommonControlsEx() - with InitCommonControls() function call to be compatible with the - project version 0x0200 - -EMU48.C -- changed function Disasm(), can use value of external port2 size - directly now - -EMU48.RC -- added "Mapping" menu entries -- changed version - -FILES.C -- changed function MapPort2(), don't limit port2 to 128KB here - -I28F160.C -- bugfix in function WrStateE8N(), a "Write to Buffer" command - failed when requesting for the buffer length - -KML.C -- added VOID as parameter in function prototypes -- replaced structure names changed in KML.H into the new ones - -KML.H -- changed structure names Token to KmlToken, Line to KmlLine, Block - to KmlBlock, Button to KmlButton and Annunciator to KmlAnnunciator - because the Line and Button definition clash with the MacOS API - -MOPS.C -- changed function MapP2(), limit port2 mapping size to 128KB here - -OPCODES.C -- changed function o138(), o139(), o13A(), o13B(), o13C(), o13D(), - o13E(), o13F(), o19d2(), o1Ad4(), o1Dd2() and o1Ed4(), added big - endian machine support (use define BIGENDIAN) - -PCH.H -- added _WIN32_IE definition for project version - -RESOURCE.H -- added definitions - - -Service Pack 26 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function ViewMemWnd(), wrong ASCII view of characters in - text area, strings are saved in LSB, MSB order -- changed function Debugger(), save and restore debugger window - position in session now -- bugfix in function Debugger(), missing initialization of menu - entry CODE Object Breakpoints -- bugfix in function OnFindOK(), search for ASCII character in - LSB, MSB order - -DISPLAY.C -- bugfix in function ResizeWindow(), 'Offset' command in KML script - section 'Background' hasn't worked - -EMU48.C -- added Critical Section initialization -- bugfix in function OnPaint(), 'Offset' command in KML script - section 'Background' hasn't worked - -EMU48.H -- extern declaration of global variable and function - -EMU48.RC -- changed version - -FILES.C -- changed functions ResetDocument(), ResetBackup() and - InitializeOFN(), replaced function FillMemory() with ZeroMemory() -- changed function OpenDocument(), can handle various Chipset sizes - now - -KML.C -- bugfix in function DrawButton() and ClipButton, 'Offset' command - in KML script section 'Background' hasn't worked - -MOPS.C -- bugfix function WriteIO(), when writing to the IOC (0x110) - register a possible USRQ interrupt wasn't generated -- changed function WriteIO(), writing the RER bit of the RCS (0x111) - register and writing the TBF bit of the TBR (0x116,0x117) register - is thread save now -- bugfix function WriteIO(), added implementation of the BRK bit in - the TCS (0x112) register -- changed function WriteIO(), removed NINT2 line update at writing - TBR (0x116,0x117) register, is doing in function CommTransmit() - -PCH.H -- added include ctype.h - -SERIAL.C -- minimized size of PC receive buffer -- bugfix in function SerialThread(), CommOpen(), CommClose() and - CommTransmit(), added implementation of the RER bit (only for - framing errors) in the RCS (0x111) register and of the TBF and TBZ - bit in the TCS (0x112) register -- new function CommTxBRK(), handle BREAK condition on Tx line - - -Service Pack 25 for Emu48 Version 1.0 - -DDESERV.C -- replaced variable type _TCHAR with TCHAR -- added some UNREFERENCED_PARAMETER statements - -DEBUGGER.C -- replaced variable type _TCHAR with TCHAR -- added UNREFERENCED_PARAMETER statement -- bugfix in function UpdateCodeWnd(), used uninitialized variables - at first call and optimized actual address searching -- changed function UpdateStackWnd(), save stack content also as - value for easier access -- changed function OnKeyF6(), optimized getting address of selected - item -- changed function OnKeyF8(), optimized GOSUB, GOSUBL, GOSBVL - decoding -- replaced functions OnNOP3Break(), OnRplBreak() and - OnInterruptsStepOverInt() with OnToggleMenuItem() -- changed function OnDblClick(), double click on stack window item - now shows the address content in the code window -- bugfix in function InfoIntr(), variable lIndex may be used without - having been initialized - -DISASM.C -- replaced variable type _TCHAR with TCHAR -- bugfix in function disassemble(), the r=-r fs opcodes showed - always as r=r-1 fs opcodes - -DISPLAY.C -- added UNICODE support in debug output parts -- used wrong black and white RGB definition, so default display - color was white on black background and not vice versa -- changed function UpdateContrast(), optimization - -EMU48.C -- replaced variable type _TCHAR with TCHAR -- changed function CopyItemsToClipboard(), SetCommList(), - OnStackCopy() and OnStackPaste(), added some brackets - -EMU48.H -- replaced variable type _TCHAR with TCHAR -- added MapData defines -- extern declaration of global variable and function -- removed declaration of Npack() and Nunpack() - -EMU48.RC -- changed properties of IDC_DEBUG_STACK -- added Menuitem Debug "CODE Objects Breakpoints" in debugger menu -- changed version and copyright - -ENGINE.C -- replaced variable type _TCHAR with TCHAR -- changed function Debugger(), added DOCODE breakpoint handling - -EXTERNAL.C -- added ops.h in header definition - -FILES.C -- replaced variable type _TCHAR with TCHAR -- added ops.h in header definition -- changed function PatchRom(), added typecast for GCC compiler -- bugfix in function PatchRom(), lines beginning with a remark were - sometimes decoded as a valid line -- bugfix in function MapPort2(), 32KB cards were rejected - -I28F160.C -- changed table definitions fnWrState[] and fnRdState[], removed a - CONST statement - -KML.C -- replaced variable type _TCHAR with TCHAR -- changed function ParseLines(), added some brackets -- changed prototypes of function GetStringParam(), GetIntegerParam() - and SkipLines(), fixed argument mismatch -- changed function RunLine(), added default case for GCC compiler -- changed function SkipWhite(), If() and InitKML(), removed unused - variables -- changed function KillKML(), optimizations -- changed function DrawAnnunciator(), optimizations - -KML.H -- replaced variable type _TCHAR with TCHAR - -MOPS.C -- added UNICODE support in debug output parts -- added ops.h in header definition -- moved MapData defines to EMU48.H -- made function MapData() public -- changed function Npeek(), Nread() and Nwrite(), added brackets for - better code understanding - -OPCODES.C -- changed function o8Cd4() and o8Ed4(), added some spaces for better - code understanding - -OPS.H -- changed function Npack() and Nunpack(), made them static -- changed function Nneg(), added some brackets - -RESOURCE.H -- added definition - -RPL.C -- added ops.h in header definition -- added missing HP39/40G entries in RAM entry table - -SERIAL.C -- replaced variable type _TCHAR with TCHAR -- changed function UpdateUSRQ(), added return type -- changed function CommTransmit() and CommReceive(), derivate - interrupt generation from the state of the USRQ bit now - -SETTINGS.C -- replaced variable type _TCHAR with TCHAR -- bugfix in registry macro WriteString(), used wrong data size in - UNICODE mode -- bugfix in function GetRegistryString(), returned wrong string - length and used wrong read buffer size in UNICODE mode - -TIMER.C -- added ops.h in header definition -- changed function MAX(), had no definition of return value -- changed function RescheduleT2(), added some brackets - - -Service Pack 24 for Emu48 Version 1.0 - -DBGTOOL.BMP -- bitmap with debugger toolbar buttons - -DEBUGGER.C -- added toolbar to debugger window -- changed function EnterBreakpoint(), DrawBreakpoint() and - EditBreakpoint(), added RPL breakpoint handling -- changed function OnToggleCheck(), changed method of item redraw -- changed function EditBreakpoint(), added multiple selection for - deleting breakpoints - -DEBUGGER.H -- added new breakpoint define - -DISASM.C -- bugfix in function rn_map(), handle NULL pointer pages now -- bugfix in function disasm_8(), fixed broken opcode 80810 - mnemonic - -EMU48.C -- changed function SetWindowTitle(), optimization - -EMU48.DSP -- added library comctl32.lib - -EMU48.RC -- added debugger toolbar -- added RPL breakpoint in "Enter breakpoint" dialog -- changed version and copyright - -ENGINE.C -- changed function Debugger(), added RPL breakpoint handling - -PCH.H -- added include commctrl.h - -RESOURCE.H -- added definitions - - -Service Pack 23 for Emu48 Version 1.0 - -DDESERV.C -- replaced numbers with state machines defines - -DEBUGGER.C -- new function DisableMenuKeys(), replace menu item disable in - function OnKeyF5() and OnKeyF9() -- bugfix in function StrToReg() and OnLButtonUp(), used ASCII - instead of a member function of TCHAR.H -- changed function OnLButtonUp(), skip automatically disabled - windows -- bugfix in function OnKeyF9(), "Run to Cursor" menu item wasn't - disabled - -DISASM.C -- bugfix in function disasm_8(), illegal opcodes beginning with 8081 - crashed emulator, illegal opcodes beginning with 818f were shown - as r=r+CON fs,n and r=r-CON fs,n opcodes, illegal opcodes - beginning with 819f were shown as rSRB.F opcodes - -EMU48.C -- replaced numbers with state machines defines -- moved the ShowWindow() call in main program behind the state file - load to avoid viewing the window at the standard startup position - -EMU48.RC -- changed version and copyright - -ENGINE.C -- replaced numbers with state machines defines -- bugfix in function Debugger(), checked wrong data breakpoint - addresses in connection with the P,WP,XS,S,M fields - -FILES.C -- bugfix in function SaveDocument(), when the emulator window is - minimized the wrong window position was saved in the Chipset - structure - -IO.H -- changed LINECOUNT MSB definitions - -KEYBOARD.C -- replaced numbers with state machines defines - -KML.C -- replaced numbers with state machines defines - -MOPS.C -- bugfix in function CpuReset(), BS-FF must be cleared as well - -OPCODES.C -- bugfix in function o807(), added BS-FF reset handling -- removed function o_invalid() - -OPCODES.H -- removed prototype of function o_invalid() - - -Service Pack 22 for Emu48 Version 1.0 - -DEBUGGER.C -- moved global variables to EMU48.C and ENGINE.C -- changed function ViewCodeWnd() and NotifyDebugger(), changed "->" - PC position marker to "-R" on RPL breakpoints -- bugfix in function DisableDebugger(), don't destroy handle before - windows closed -- changed function Debugger(), set signal for window and last - instruction buffer closed at end of WM_DESTROY message handler, - init additional variables -- added implementation of "Find" dialog box -- bugfix in function NewValue(), EnterAddr() and EnterBreakpoint(), - used ASCII instead of a member function of TCHAR.H -- changed function OnToggleCheck(), OnDrawBreakWnd(), - DrawBreakpoint() and EditBreakpoint(), now the list box element - use a link to the corresponding breakpoint element -- bugfix in function OnDrawBreakWnd(), sometimes the old focus - rectangle wasn't purged -- changed function EditBreakpoint(), checkbox can also be toggled - with the space key now -- bugfix in function OnEditBreakpoint(), redrawed code window always - at PC position and not at actual address - -DEBUGGER.H -- moved extern declaration of global variables to EMU48.H - -DISPLAY.C -- bugfix in function UpdateDisplayPointers(), UpdateMainDisplay(), - UpdateMenuDisplay(), WriteToMainDisplay(), WriteToMenuDisplay(), - calculated wrong display areas when LINECOUNT (0x128,0x129) - register was zero - -EMU48.C -- replaced numbers with state machines defines -- added global variable from DEBUGGER.C -- changed function UpdateWindowStatus(), use groups for - enable/disable menu items now -- changed function SettingsProc(), use global variable if COM port - is open instead of calling CommConnect() -- bugfix in function OnPaint(), calculated wrong rectangle for - display area when LINECOUNT (0x128,0x129) register was zero -- bugfix in function OnDropFiles(), OnStackPaste(), OnObjectLoad(), - can't switch on if in debugger mode -- changed function WinMain(), added non modal "Find" dialog box in - main message handler -- bugfix in function WinMain(), fixed a resource leak - -EMU48.DSP -- added library advapi32.lib - -EMU48.H -- removed extern declaration of global variable and function -- removed COM port state defines -- added state machine defines -- extern declaration of global variables -- changed function prototype - -EMU48.RC -- changed properties of IDC_BREAKEDIT_WND -- added "Find" dialog -- changed version - -ENGINE.C -- replaced numbers with state machines defines -- made COM port open flag public -- added global variables from DEBUGGER.C -- changed function Debugger(), a RPL breakpoint is now set on the - destination address of a PC=(A) or a PC=(C) instruction and the - RPL breakpoint detection with a prior A=DAT0 A D0=D0+ 5 sequence - has been removed -- changed function CheckSerial(), use return value of CommOpen() - instead of calling CommConnect() -- changed function WaitForSleepState(), close debugger before going - into sleep state -- changed function SwitchToState(), changed detection of emulation - thread termination and debugger now can be active when changing - from Run to Sleep state - -FILES.C -- changed function OpenDocument(), because of changed function - CpuReset() additional work for automatic restart on changed ROM - needed - -IO.H -- added BITOFFSET definition - -MOPS.C -- removed variable ir_ctrl_acc, was never used -- bugfix in function CpuReset(), changed some initial settings -- bugfix in function WriteIO(), force new COM port initialization - when the EIRU bit in the IRC (0x11A) register has changed -- bugfix in function WriteIO(), reading from the LINECOUNT - (0x128,0x129) register destroyed the settings for the - Chipset.lcounter variable - -RESOURCE.H -- added some definitions - -RPL.C -- changed function RPL_CreateTemp(), changed remarks - -SERIAL.C -- removed function CommConnect(), not used any more -- changed function CommOpen(), changed function return type -- bugfix in function CommOpen(), receiver state variables weren't - resetted -- bugfix in function CommClose(), changed detection of thread - termination and fixed a resource leak -- bugfix in function CommTransmit(), receive buffer may be - overflowed when LPB (Loop Back) bit was set - -SETTINGS.C -- prepared for registry support - - -Service Pack 21 for Emu48 Version 1.0 - -CHECKBOX.BMP -- bitmap with checked and unchecked box - -DDESERV.C -- prepared for UNICODE support - -DEBUGGER.C -- prepared for UNICODE support -- added implementation of "Run to Cursor" -- added HP39/40G stuff to function InitBsArea() and UpdateMiscWnd() -- added Enable/Disable of breakpoints in the Edit breakpoints dialog -- added breakpoint load/save file functions -- bugfix in function NewValue(), EnterAddr(), EnterBreakpoint(), - EditBreakpoint() and InfoIntr(), try to get a window handle at - begin of a dialog message handler cause illegal handles in some - cases - -DEBUGGER.H -- extern declaration of global variable and functions - -DISASM.C -- prepared for UNICODE support -- changed function rn_port2(), select internal or external port2 - memory by the Chipset.Port2Size variable now - -DISPLAY.C -- prepared for UNICODE support - -EMU48.C -- prepared for UNICODE support -- added HP39/40G stuff to function UpdateWindowStatus(), - SettingsProc(), OnDropFiles() and Disasm() -- bugfix in function OnPaint(), redraw display and button area even - if emulation is suspended, redraw only requested bitmap area and - redraw display without updating bitmap with display data -- bugfix in function OnFileNew(), overwrite title only on new - document - -EMU48.H -- prepared for UNICODE support - -EMU48.ICO -- deleted unused device images - -EMU48.RC -- changed properties of IDC_BREAKEDIT_WND -- added Menuitem Debug "Run to Cursor" in debugger menu -- changed version and copyright - -ENGINE.C -- prepared for UNICODE support -- added part for debugger function "Run to Cursor" - -EXTERNAL.C -- added HP39/40G stuff to the SFLAG53_56 definition - -FILES.C -- prepared for UNICODE support -- added new document type for HP39/40G in several functions -- bugfix in function MapPort2(), in the first program instance in - not shared mode a read only port2 file couldn't be loaded -- bugfix in function ResetDocument(), delete MMU mappings as well -- bugfix in function OpenDocument(), ask for new KML script when - emulator state file and KML script file use different 'Model' - settings -- changed function OpenDocument() and SaveDocument(), added debugger - breakpoint data handling - -IO.H -- added LINECOUNT definition - -KML.C -- prepared for UNICODE support -- added "Class" keyword in Global section -- deleted function IsDigit(), replaced by function _istdigit() -- bugfix in function AddToLog(), fixed a memory leak -- new function MapKMLFile(), map KML file into memory -- new functions iSqrt(), AdjustPixel() and TransparentCircle(), - subroutines for new button type -- changed function DrawButton(), changed button type 5 (was same - implementation as type 0) to draw transparent circles -- changed function RefreshButtons(), redraw only buttons in - requested area - -KML.H -- prepared for UNICODE support -- added TOK_CLASS definition - -MOPS.C -- new function UpdateDisplay(), handle display update -- changed function MapP2(), select internal or external port2 memory - by the Chipset.Port2Size variable now -- added HP39/40G stuff to function MapROM(), RomSwitch(), Nread(), - Nwrite() and ReadIO() -- bugfix in function Nwrite(), update display with address content -- changed function ReadIO(), set RX bit in the RCS (0x111) register - for no character receive -- bugfix in function ReadIO(), wrong implementation of TBR register - (0x116,0x117), read return last written byte -- bugfix in function WriteIO(), clearing the SON bit in the IOC - (0x110) register clears also the IOC (0x110), RCS (0x111), TCS - (0x112), RBR (0x114,0x115) and TBR (0x116,0x117) register -- bugfix in function WriteIO(), writing to the RCS (0x111), TCS - (0x111) and TBR (0x116,0x117) register only works when the SON bit - in the IOC (0x110) register is set - -OPCODES.C -- prepared for UNICODE support -- removed InfoMessage in SREQ? opcode - -PCH.H -- added include tchar.h - -RESOURCE.H -- added some definitions -- removed IDC_DISASM_MNEMONICS - -RPL.C -- bugfix in function Metakernel(), check for port1 memory before - reading - -SERIAL.C -- prepared for UNICODE support -- bugfix in function UpdateUSRQ(), USRQ bit in SRQ1 (0x118) register - only set on serial interrupt condition when UART enabled - -SETTINGS.C -- prepared for UNICODE support -- changed function ReadSettings(), use variable content as default - -TIMER.C -- bugfix in function StartTimers(), check for timer interrupts at - timer start - - -Service Pack 20 for Emu48 Version 1.0 - -DEBUGGER.C -- changed function UpdateStackWnd(), index of topmost item is now - saved at content update -- changed function CheckBreakpoint(), allow breakpoints in an area - now (used by memory breakpoints to get all touched addresses on a - r=DATx fs access) - -DEBUGGER.H -- changed prototype of function CheckBreakpoint() - -EMU48.C -- use semaphores to avoid GDI trouble with NT in OnPaint() -- specify processor affinity for the cpu emulation thread to avoid - problems with the QueryPerformanceCounter() function - -EMU48.H -- extern declaration of global variable - -EMU48.RC -- fixed multiple use of accelerator key in debugger menu -- changed version and copyright - -ENGINE.C -- bugfix in function Debugger(), check complete address range of - memory access area -- workaround for Win2k in function AdjustSpeed(), when command - sequence took over 50ms new synchronizing of the emulation slow - down part -- bugfix in function WorkerThread(), update NINT and NINT2 lines - after port status changing - -KML.C -- use semaphores to avoid GDI trouble with NT in RefreshButtons() - -MOPS.C -- bugfix in function UckBit() and F4096Hz(), depending on clock - value functions returned wrong results - -OPCODES.C -- moved address field start and length array from OPS.H and made - them public - -OPCODES.H -- extern declaration of global address field start and length - variables - -OPS.H -- moved address field start and length array to OPCODES.C -- bugfix in function FASTPTR(), address area is only 5 nibbles long - -RESOURCE.H -- deleted several unused definitions - -RPL.C -- added function Metakernel() to detect MK2.30 and prior -- changed function RPL_Pick() and RPL_Push() to support - "Save/Load Object" with a stack incompatible Metakernel versions - -SERIAL.C -- use own OVERLAPPED stucture for reading and writing -- bugfix in function CommClose(), added additional delay to fix - problems with some Kermit server -- bugfix in function CommTransmit(), wait until write completed - -SETTINGS.C -- changed function ReadSettings(), use variable content as default - - -Service Pack 19 for Emu48 Version 1.0 - -DEBUGGER.C -- several modifications for memory breakpoint handling -- added step over interrupt code part setting -- bugfix in function NewValue(), at wrong input numbers ignore input - string at and set focus to edit control -- bugfix in function EnterAddr(), at wrong input numbers set focus - to edit control - -DEBUGGER.H -- added breakpoint type defines -- extern declaration of global variable -- changed prototype of function CheckBreakpoint() - -DISPLAY.C -- added io.h in header definition -- bugfix in function CreateMainBitmap(), check error condition and - realize palette also in memory DC -- bugfix in CreateLcdBitmap(), must set color palette for LCD DC -- bugfix in function UpdateAnnunciators(), annunciators are off if - timer2 is stopped - -EMU48.C -- added io.h in header definition -- changed function SettingsProc(), added HP/Class mnemonic setting -- bugfix in function SettingsProc(), new implementation of card - detection port 1 -- moved initialize/remove of the Critical Section part from main - program to message handler -- changed function OnDropFiles(), OnStackCopy(), OnStackPaste(), - OnObjectLoad() and OnObjectSave(), don't wait for changed state - after function WaitForSleepState() -- bugfix in function OnObjectSave(), set info message when emulator - is busy -- changed function Disasm(), removed HP/Class mnemonic setting -- bugfix in function Disasm(), addresses > 0x1869F showed in wrong - format -- bugfix in function WinMain(), synchronized thread start - -EMU48.H -- changed definition of PORT1_PRESENT, PORT1_WRITE, PORT2_PRESENT - and PORT2_WRITE - -EMU48.RC -- added HP/Class mnemonics in "Settings" dialog -- added "Interrupts" part in debugger menu -- added "Enter breakpoint" dialog -- changed version and copyright - -ENGINE.C -- moved debugger part from function WorkerThread() to own function -- added C=DAT0 A, D0=D0+ 5, PC=(C) code sequence detection for RPL - breakpoint in debugger -- added step over interrupt code part handler in debugger section -- bugfix in function SwitchToState(), when switch from Invalid into - Run state then don't enter opcode loop on interrupt request or in - SHUTDN mode -- changed function WorkerThread(), added memory breakpoint handler -- bugfix in function WorkerThread(), timer emulation in debugger - part must check the timer RUN bit -- bugfix in function WorkerThread(), must set wakeup flag on SHUTDN - on interrupt request condition -- changed function WorkerThread(), minor optimization - -FILES.C -- added io.h in header definition -- bugfix in function OpenDocument(), check card detection only if - enabled and set NINT line to low on a MP interrupt -- changed function DibNumColors(), optimized by removing case switch - -IO.H -- added ANNCTRL and CARDSTAT definitions - -MOPS.C -- removed conditional compiling with WSMSET -- bugfix in function RomSwitch(), mirror smaller ROMs than 2MB -- bugfix in function Npeek(), wrong content of SRQ2 (0x119) register -- bugfix in function ReadIO(), wrong implementation of the SMP and - SWINT bit in the CARDCTL (0x10E) register -- bugfix in function ReadIO(), wrong implementation of the NINT2 and - NINT bit in the SRQ2 (0x119) register -- bugfix in function WriteIO(), wrong implementation of the SMP and - ECDT bit and removed some wrong stuff in the CARDCTL (0x10E) - register -- bugfix in function WriteIO(), the DA19 bit in the LINECOUNT - (0x129) register is also available in the Clarke hardware -- bugfix in function WriteIO(), the RUN bit in the TIMER2CTRL - (0x12F) register has an affection to the display annunciators - -OPCODES.C -- added io.h in header definition -- bugfix in RTI command, low NINT2 or NINT line reenter interrupt -- bugfix in function o808C() and o808E(), opcodes PC=(A) and PC=(C) - modify the CRC register - -OPCODES.H -- moved HST bit definition to TYPES.H - -RESOURCE.H -- added several definitions - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added section - [Disassembler] in INI-File +STACK.C +- added new calculator type: P, 2 and Q for 39g+, 48gII and 49g+. +- adjusted to new prototype of function RPL_CreateTemp() TYPES.H -- added definition of HST bits - - -Service Pack 18 for Emu48 Version 1.0 - -EMU48.RC -- changed version and copyright - -ENGINE.C -- bugfix in function WorkerThread(), ignore SHUTDN on interrupt - request - -SERIAL.C -- bugfix in function CommOpen(), must wait for EV_RXCHAR event - thread directly after opening the serial port - - -Service Pack 17 for Emu48 Version 1.0 - -DEBUGGER.C -- bugfix in function StrToReg() and OnLButtonUp(), wrong string to - HEX conversation with lowercase letters -- bugfix in function Debugger(), used wrong background color in - WM_CTLCOLORSTATIC message handler - -EMU48.C -- bugfix in function SettingsProc(), don't overwite Serial-Ir - setting in HP49 mode - -EMU48.DSP -- added i28f160.c sources - -EMU48.H -- extern declaration of global variable and functions - -EMU48.RC -- changed version and copyright - -FILES.C -- added new functions in the ROM patch part -- changed function PatchRom(), original content of patched address - is saved now -- changed function MapRom(), added ROM writing feature -- changed function UnmapRom(), restore original content before - closing -- bugfix in function MapPort2(), shared mode now works, when first - program instance opened the file with Read/Write access -- changed function NewDocument() and OpenDocument(), initialize - flash memory structure - -I28F160.C -- new modul with I28F160 flash memory implementation - -I28F160.H -- header file for flash memory implementation - -MOPS.C -- changed function MapROM(), added flash register mode -- changed function Npeek(), added flash access part -- changed function Nread(), completed flash access part -- changed function Nwrite(), completed flash access part - -OPS.H -- bugfix in function FASTPTR(), handle NULL pointer pages now -- bugfix in function Ninc(), Ndec(), Nadd(), Nsub(), Nrsub(), Nnot() - and Nneg(), wrong results in dec mode with illegal decimal number - entry - -SETTINGS.C -- changed function ReadSettings() and WriteSettings(), added section - [ROM] in INI-File - -TIMER.C -- bugfix in function CalcT2(), workaround to minimize skipping - timer2 values - - -Service Pack 16 for Emu48 Version 1.0 - -DEBUGGER.C -- added "MMU" and "Miscellaneous" view in debugger dialog -- added RPL exit breakpoint on A=DAT0 A, D0=D0+ 5, PC=(A) sequence -- added last instruction viewer in debugger -- renamed function name ViewStackWnd() to UpdateStackWnd() -- bugfix in function UpdateRegisterWnd() and OnCtlColorStatic(), - fixed problems of register update in RUN mode -- bugfix in function OnKeyF11(), in sleep mode break hasn't worked -- bugfix in function OnLButtonUp(), register setting wasn't disabled - in running state -- changed function NotifyDebugger(), added argument to detect RPL - breakpoint -- bugfix in function Debugger(), code disassembler wasn't reset to - mapped mode at startup and fixed a resource leak -- bugfix in function EditBreakpoint(), added breakpoint buffer - overflow check at add breakpoint command - -DEBUGGER.H -- extern declaration of global variables - -DISASM.C -- bugfix in function disasm_1(), the C=ss, ss=C and CssEX opcodes - showed always as A=ss, ss=A and AssEX opcodes -- bugfix in function disasm_8(), the r register in the rSRB.F fs - opcodes and the opcode lenght was wrong - -EMU48.C -- new function CopyItemsToClipboard(), copy selected items from - listbox to clipboard, extracted from function Disasm() -- added HP38G64K stuff to function UpdateWindowStatus() and - SettingsProc() -- changed function Disasm(), call function CopyItemsToClipboard() - now - -EMU48.H -- extern declaration of global functions - -EMU48.RC -- added "MMU" and "Miscellaneous" part in debugger dialog -- changed copyright date in IDD_ABOUT -- changed version and copyright - -ENGINE.C -- added RPL breakpoint handling -- added last instruction buffer update handling -- changed function WorkerThread(), added timer emulation in debugger - mode -- bugfix infunction WorkerThread(), in debugger mode Chipset.pc may - have been changed, so the FASTPTR access must be updated as well - -EXTERNAL.C -- some minor changes for the HP38G64K beeper emulation - -FILES.C -- added new document type for HP38G64K - -IO.H -- added CARDCTL and LCR definitions - -KEYBOARD.C -- bugfix in function ScanKeyboard(), update keyboard status only on - timer running and keyboard interrupt only occur on the rising edge - of "logic or" of IR[8:0] and not on the rising edge of each line; - the IRX15 interrupt (ON key) is level sensitive - -MOPS.C -- added function MapData() to detect the memory controller handle - the given address, needed for function Npeek(), Nread() and - Nwrite() -- bugfix in function MapROM(), no difference between Clarke and - Yorke chip in DA19 bit behavior, depends on ROM size -- bugfix in function Map(), on a HP49 NCE3 may mapped to ROM -- changed function CpuReset(), reset WSM state of flash memory -- bugfix in function Npeek(), update card status register in I/O - register area before reading and simulate an open data bus -- bugfix in function Nread(), loaded wrong bank switcher FF value - for a HP49 -- bugfix in function Nwrite(), loaded wrong bank switcher FF value - when writing on slot2 enabled (GX only) -- changed function Nread() and Nwrite(), added Flash memory access - detection part -- bugfix in function ReadIO(), the CARDSTATUS (0x10F) register - return zero when card detection is disabled -- bugfix in function WriteIO(), on a HP49 force new memory mapping - on changing the LED bit in the LCR (0x11C) register - -RESOURCE.H -- added several definitions - -TYPES.H -- conditional compiling of cycle counter (32bit EXE/64bit DLL) -- use position of Port2_NBanks for flash memory WSM state variable - - -Service Pack 15 for Emu48 Version 1.0 - -DEBUGGER.C -- added emulation run flag -- added notify function for emulation stopped -- added color highlighting on changed registers -- added implementation of "Step Out" (exit function) -- bugfix in function ViewMemWnd(), use the Npeek() function for - reading memory data, so fixed some problems with reading invalid - data from the I/O register area -- changed function OnClearAll(), changed argument to dialog handle -- bugfix in function OnDblClick(), fixed swapped nibbles after enter - new data -- changed function OnKeyCodeWnd(), changed first argument to dialog - handle -- bugfix in function Debugger(), removed context menu resource leaks - and a call of GetDlgItem() with invalid arguments - -DEBUGGER.H -- extern declaration of global functions -- moved WM_UPDATE definition to DEBUGGER.C - -EMU48.C -- replaced __argc and __argv variables by process variables -- replaced INI file handling part -- changed address in GPL license string -- added HP38 stuff to function UpdateWindowStatus() and - SettingsProc() -- changed function SettingsProc(), replaced Port1_Writeable variable -- bugfix in function OnViewReset(), some registers wasn't reset, - call reset function now -- bugfix in function OnDestroy(), moved functions SwitchToState() - and WriteSettings() to main program, because emulation thread may - not run and settings aren't read so far when main window close -- removed function FlushMessages() and all references, because it's - useless and references made trouble at a WM_QUIT message -- removed several other resource leaks on error conditions -- made function MainWndProc() public - -EMU48.DSP -- renamed serial.h into io.h in header definition -- added settings.c sources - -EMU48.H -- extern declaration of global variable and functions - -EMU48.RC -- changed language definition of dialog IDD_BREAKEDIT -- added Menuitem Debug "Step Out" in debugger menu -- changed version and copyright - -ENGINE.C -- renamed header Serial.h into io.h -- renamed wShutdnWake to bShutdnWake in Chipset structure -- moved bRealSpeed variable and make it public -- solved bRealSpeed name conflict -- added DWORD casting from Chipset.cycles variable -- added part for debugger function "Step Out" -- changed notify function for update debugger window - -EXTERNAL.C -- some minor changes for the HP38 beeper emulation - -FILES.C -- added new document type for HP38G -- replaced __argc and __argv variables by process variables -- added function CrcRom() to get a fingerprint of the ROM -- changed function NewDocument(), deleted Port1_Writeable variable, - isn't used any more -- bugfix in function OpenDocument(), in restore situation add port2 - only at HP48 emulation -- changed function OpenDocument(), check fingerprint of ROM -- changed function SaveDocument(), update fingerprint of ROM -- changed function SaveBackup(), save window position as well -- bugfix in function RestoreBackup(), lost port2 of a HP48 - -KEYBOARD.C -- renamed wShutdnWake to bShutdnWake in Chipset structure -- added DWORD casting from Chipset.cycles variable - -KLM.C -- bugfix in function InitKML(), on a KML script syntax error only - continue with the Cancel button - -IO.H -- old SERIAL.H, added I/O definitions - -MOPS.C -- renamed header Serial.h into io.h -- renamed function CRC() to UpCRC() -- changed function UckBit(), removed unused variable -- changed function MapP1(), use cards_status instead of - Port1_Writeable variable -- bugfix in function RomSwitch(), lached address line A6 was always - zero -> no access to upper half of flash memory -- added function CpuReset() to set cpu registers after reset -- changed function Npeek(), return data from I/O register area as - well now (for debugger support) -- bugfix in function Nread(), reading from the timer2 MSB (0x13F) - register updates the CRC (0x104-0x107) register -- bugfix in function ReadIO(), update the USRQ bit in the SRQ1 - (0x118) register after reading the RBR (0x114,0x115) register -- bugfix in function ReadIO(), update the NINT2 and NINT bits in the - SRQ2 (0x119) register -- bugfix in function WriteIO(), update the USRQ bit in the SRQ1 - (0x118) register after writing the IOC (0x110) register or the - TBR (0x116,0x117) register - -OPCODES.C -- added DWORD casting from w.cycles variable -- checked all undocumented cpu cycles and removed remarks -- bugfix in function o08(), o09(), o0A(), o0B(), o3X(), o8086n(), - o8087n(), o808An(), o808Bn() and o8Ed4(), changed number of cpu - cycles - -RESOURCE.H -- added several definitions - -SERIAL.C -- renamed header Serial.h into io.h -- renamed wShutdnWake to bShutdnWake in Chipset structure -- moved initialize/remove of Critical Section handler from the - function CommOpen() and CommClose() to main program -- added function UpdateUSRQ(), implements USRQ bit handling -- bugfix in function CommTransmit(), added LPB bit emulation in the - TCS (0x112) register and USRQ bit emulation in the SRQ1 (0x118) - register -- bugfix in function CommReceive(), only reject reading if com port - is closed and not whole operation and added USRQ bit emulation in - the SRQ1 (0x118) register - -SERIAL.H -- renamed to IO.H - -SETTINGS.C -- new modul to handle the INI file - -TIMER.C -- removed timer I/O definitions, replaced by include file IO.H -- replaced INT define with INTR (conflict with C variable type INT) -- renamed wShutdnWake variable to bShutdnWake -- bugfix in function CheckT1() and CheckT2(), added TSRQ bit - emulation in the SRQ1 (0x118) register - -TYPES.H -- changed variable type of wPosX and wPosY, position data is signed -- use position of wShutdnWake for wRomCrc -- use position of dwKdnCycles for cycles variable -- use position of Port1_Writeable for MSB of cycles variable -- use position of Port2_Writeable for dwKdnCycles variable -- use old position of the cycles variable for bShutdnWake - - -Service Pack 14 for Emu48 Version 1.0 - -COLOR.H -- new header with color definitions - -DDESERV.C -- added different files headers for HP48/49 - -DEBUGGER.C -- new modul for debugger routines - -DEBUGGER.H -- header file for debugger part - -DISASM.C -- changed function append_r_addr() and append_pc_comment(), relative - jumps now can viewed with the target address instead of a relative - offset and target address in remark; implemented a local variable -- bugfix in function rn_port2(), calculated port2 mask was wrong -- added HP49 stuff to function rn_port2() - -EMU48.DSP -- added debugger.c sources - -EMU48.C -- added debugger menu entry -- added HP49 stuff to the disassembler -- added HP49 stuff to function SettingsProc() -- changed function OnViewSettings(), removed port2 open/close - handling, now done in the document handler -- deleted unused function OnSysClose() -- bugfix in function Disasm(), in entry IDC_DISASM_PORT2 the highest - useable address was always wrong - -EMU48.RC -- added Menuitem Tools "Debugger..." -- changed version and copyright - -EMU48.H -- extern declaration of global variable and functions - -ENGINE.C -- moved inline function FASTPTR() to OPS.H -- added debug part in main emulation loop - -EXTERNAL.C -- some minor changes for the HP49 beeper emulation - -FILES.C -- added new document type for HP49 -- change in function WriteStack(), accept HP49 binary files now -- the port2 open/close handling is now controlled by the document -- several changes in port2 handling, the HP49 use an internal 128KB - RAM card instead of the external RAM card of the HP48 -- changed function UnmapPort2(), added return value for unmap - success -- changed function PatchRom(), longer addresses than 5 nibbles can - be used now -- changed function OpenDocument(), restore HP49 ROM bank selection - after document load -- changed function InitKML(), removed initialization of MMU - -KEYBOARD.C -- changed function ScanKeyboard(), added a flag for wake up from - SHUTDN mode - -KML.C -- bugfix in function PressButton(), if button already pressed, do - nothing -> fixed a draw problem with KML button type 3 -- bugfix in function RefreshButtons(), KML type 3 buttons, must - complete redraw before refresh them - -MOPS.C -- added HP49 MMU parts -- bugfix in function ReadIO(), update the UCK bit in the BAU (0x10D) - register - -OPS.H -- moved inline function FASTPTR() from ENGINE.C to header file - -RESOURCE.H -- added several definitions - -RPL.C -- added HP49 memory pointers -- added HP49 flash pointer object (=DOFASHP) -- added HP49 precision integer object (=DOINT) -- added HP49 precision real object (=DOLNGREAL) -- added HP49 precision complex object (=DOLNGCMP) -- added HP49 symbolic matrix object (=DOMATRIX) -- added HP49 aplet object (=DOAPLET) -- added HP49 mini font object (=DOMINIFONT) - -SERIAL.C -- changed function SerialThread(), added a flag for wake up from - SHUTDN mode - -TIMER.C -- changed functions CheckT1() and CheckT2(), added a flag for wake - up from SHUTDN mode - -TYPES.H -- use position of the wUnused1 variable for SHUTDN wake up flag - - -Service Pack 13 for Emu48 Version 1.0 - -DISASM.C -- bugfix in function disasm_8(), the HS=0 n opcode was showed wrong - -EMU48.DSP -- added fetch.c and opcodes.c sources - -EMU48.C -- bugfix in function Disasm() and About(), handled messages must - return TRUE - -EMU48.H -- added function prototypes - -ENGINE.C -- moved several definitions to OPCODE.H -- made function AdjKeySpeed() public -- replaced opcode handling include files by a function call, decoder - now works with tables instead of case switching -- deleted unused code parts in modul - -FETCH.C -- new modul with opcode dispatcher - -FETCH.H -- file deleted, replaced by FETCH.C - -FILES.C -- bugfix in function PatchRom(), no correct handling of remarks, - interpreter failed on lower case hex digits in arguments - -OPCODES.C -- new modul with opcode implementation - -OPCODES.H -- file content changed, replaced by OPCODES.C - - -Service Pack 12 for Emu48 Version 1.0 - -DISPLAY.C -- minor change in function UpdateMainDisplay() -- deleted remarked global variables and unused code parts in - function WriteToMainDisplay() - -EMU48.C -- added auto event object for controlling the CPU thread - -EMU48.H -- removed extern declaration of variable -- extern declaration of global variable and functions - -ENGINE.C -- new function CheckDisp(), synchronize display update now with the - line update counter -- replaced all ResumeThread() with SetEvent() calls -- replaced all SuspendThread() with WaitForSingleObject() calls - -KEYBOARD.C -- replaced all ResumeThread() with SetEvent() calls -- deleted unused code parts in function ScanKeyboard() - -MOPS.C -- flag for updating display area is now global -- new function GetLineCounter() for getting the actual display - refresh line -- changed function WriteIO(), display isn't updated here any more -- use serial definitions from "serial.h" now -- deleted remarked functions Nread2(), Nwrite2(), Nread5() and - Nwrite5() - -SERIAL.C -- replaced all ResumeThread() with SetEvent() calls - -TIMER.C -- bugfix in function SetT1(), loading same timer value doesn't - restart timer period -- replaced all ResumeThread() with SetEvent() calls - - -Service Pack 11 for Emu48 Version 1.0 - -EMU48.C -- removed cards status definitions -- bugfix in function OnFileExit(), continuing the emulation failed - after pressing the "Cancel" button in save dialogbox -- removed function OnSysClose(), no difference to function - OnFileExit() -- changed message implementation WM_SYSCOMMAND/SC_CLOSE to function - OnFileExit() - -EMU48.DSP -- added preprocessor definition "STRICT" to project - -EMU48.H -- moved cards status definitions from EMU48.C to header file -- extern declaration of global function - -EMU48.RC -- changed version and copyright - -ENGINE.C -- bugfix in function WorkerThread(), after changing the port2 card - status the memory mapping must be updated -- update HP48 time now in function WorkerThread() and not in - function StartTimers() - -FILES.C -- changed function MapPort2(), dwPort2Mask now shows the valid - address lines of the bank switcher FF - -MOPS.C -- bugfix in function MapP1() and MapP2(), clear mapping area if port - is configured but not plugged -- bugfix in function MapP2(), odd bank switch values loaded the - wrong page of port2 and bank switcher must be disabled on S(X) - versions -- changed function Nread(), simulate an open data bus now (fix - value for even and odd address) -- bugfix in function Nread(), don't change bank switcher value if - RAM or CE2 is on the same address, because these modules have - higher access priority -- bugfix in function Nwrite(), bank switching now works with the - 'datx=r fsd' command - -TIMER.C -- renamed function SetAccesstime() to SetHP48Time() and made - function public -- removed update of HP48 time in function StartTimers() - - -Service Pack 10 for Emu48 Version 1.0 - -DISPLAY.C -- use only one pattern field for all display resolutions -- added new display contrast scheme -- bugfix in function WriteToMainDisplay(), calculated source memory - address was illegal memory pointer - -EMU48.C -- bugfix in functions OnFileExit() and OnSysClose(), stop emulation - thread before saving emulation data -- changed function Disasm(), changed list box from single to multi - selectable items, added button to copy selected items to - clipboard -- moved function DragAcceptFiles() to WM_CREATE handler -- added function DragAcceptFiles() to WM_DESTROY handler -- allow second command line parameter as port2 filename -- added Critical Section initialization - -EMU48.H -- removed extern declaration of global function -- extern declaration of global variable and functions - -EMU48.RC -- added button in dialog IDD_DISASM -- reinsert button IDC_UPDATE in dialog IDD_CHOOSEKML -- changed version and copyright - -ENGINE.C -- functions CheckSerial() and AdjustSpeed() are inline coded now -- new function UpdateKdnBit() for updating the KDN bit by the 1ms - keyboard interrupt handler - -FILES.C -- added new function CrcPort2() to get a fingerprint of port2 -- changed function OpenDocument(), check fingerprint of port2 -- changed function SaveDocument(), update fingerprint of port2 - -KEYBOARD.C -- changed function Keyboard_GetIR() to static -- bugfix in function ScanKeyboard(), added fixes for the KDN bit - implementation and update keyboard interrupt pending flag when - 1ms keyboard handler is disabled - -KML.C -- bugfix in function ParseLine(), caused memory leaks when an error - occured -- bugfix in function ParseLines(), fixed a windows program abort on - some KML script or line include errors -- bugfix in function ParseBlock(), abort parsing on KML script - errors -- bugfix in function ParseBlocks(), fixed a windows program abort on - block include errors -- bugfix in function FreeLines(), caused memory leaks when different - argument types are used in a line - -MOPS.C -- added new function IOBit() -- bugfix in function ReadIO(), update the KDN bit in the SRQ2 - (0x119) register before reading - -OPCODES.H -- bugfix in A=IN and C=IN command, update KDN bit in the SRQ - register -- bugfix in all r=r+CON fs,n and r=r-CON fs,n opcodes, they always - work in HEX mode -- changes in INTON, INTOFF and RTI for KDN bit implementation -- changed RTI command, execute pending key interrupt only if enabled -- changed RSI command, set key interrupt pending flag also when 1ms - keyboard handler is disabled -- bugfix in INTON command, execute interrupt if key interrupt is - pending - -OPS.H -- added new inline functions Ninc16() and Ndec16() - -RESOURCE.H -- added/changed definitions -- removed ID_HELP_REGISTER - -TYPES.H -- use position of the uUnused1 variable for fingerprint of port2 -- use position of the Port2_Size variable for cpu cycles at start of - 1ms key interrupt handler - - -Service Pack 9 for Emu48 Version 1.0 - -DISASM.C -- changed output of HP Mnemonic P=n - -DISPLAY.C -- bugfix in function UpdateMainDisplay(), with off display and Zoom - > 1 only a part of the display was cleared -- changed function UpdateMenuDisplay(), use a common pointer offset - calculation and display output part now - -EMU48.C -- changed function OnViewCopy(), changed screen clipboard format - from CF_BITMAP to CF_DIB -- bugfix in function OnViewReset(), must unconfig MMU on reset too -- changed function OnAbout(), don't stop emulation while viewing - About box -- moved initialize/remove of the Critical Section part from message - handler to main program - -EMU48.H -- removed extern declaration of global variables and functions - -EMU48.RC -- changed design of IDD_ABOUT -- changed version and copyright - -ENGINE.C -- bugfix in function FASTPTR(), code execution is possible in IO - register area as well - -FETCH.H -- removed jump to extension opcode 81B0 - -FILES.C -- removed global variable - -MOPS.C -- bugfix in function MapP0(), MapP1(), MapP2(), MapBS(), mapping - area may have holes -- bugfix in function MapBS(), no read from ROM at mapped bank - switch control area -- bugfix in function MapP2(), if G(X) ROM select port2 only if - DA19=0 and BEN=1, now the saved bank switch control information is - used -- bugfix in function MapROM(), if G(X) ROM and DA19=0 (ROM disabled) - then mirror lower ROM at #80000 (AR18=0) -- bugfix in function Nread(), bank switching now works with every - 'r=datx fsd' command in the complete mapped bank switch control - area, an unconfigured bank switch area is now disabled and the - GX bank switch information (content of Flipflop) is saved now -- bugfix in function Nwrite(), at some conditions no update of the - display area and IO area couldn't be unconfigured -- removed functions Nread2(), Nwrite2(), Nread5() and Nwrite5() -- bugfix in function ReadIO(), several minor fixes in the LINECOUNT - (0x128,0x129) register emulation -- bugfix in function ReadIO(), the TIMER1CTRL and TIMER2CTRL - (0x12E,0x12F) register must be updated before reading -- bugfix in function WriteIO(), don't clear the XTRA bit in the - TIMER1CTRL (0x12E) register while setting -- bugfix in function WriteIO(), after setting new TIMER1CTRL and - TIMER2CTRL (0x12E,0x12F) register values the control bit - condition must be checked -- bugfix in function WriteIO(), handle start/stop of the LINECOUNT - register when the DON bit in the DISPIO (0x100) register has - changed -- bugfix in function WriteIO(), force new ROM mapping if DA19 in - the MSB LINECOUNT (0x129) register has changed on a G(X) ROM - -OPCODES.H -- Nwrite2() replaced by Nwrite() -- Nwrite5() replaced by Nwrite() -- Nread2() replaced by Nread() for the BS 'r=datx fsd' bugfix -- Nread5() replaced by Nread() for the BS 'r=datx fsd' bugfix -- bugfix in RTI command, generate interrupt if ON key is pressed -- bugfix in RSI command, don't set key interrupt pending flag if - INTOFF command is active -- removed extension opcode 81B0 - -TIMER.C -- removed assertions in function CheckT1() and CheckT2() that the - timers must run -- moved initialize/remove of Critical Section handler from the - function StartTimers() and StopTimers() to main program for bugfix - the problems with the Critical Section area of the function - ReadT1() and ReadT2() when the timers are stopped -- bugfix in function ReadT2(), timer2 was always running - -TYPES.H -- use Port2_Bank variable to save state of GX port2 Flip-Flop - - -Service Pack 8 for Emu48 Version 1.0 - -DISASM.C -- changed function read_nibble() to disassemble modules -- added new mapping functions for function read_nibble() -- bugfix in function append_imm_nibble(), HP Mnemonic hex number - was showed as decimal number - -EMU48.C -- changed variable types of function WinMain() -- added "drag and drop" implementation for HP objects -- added some features to function Disasm() -- removed all parts handled with the global variables bAccurateTimer - and uT1Period -- bugfix in function Disasm(), button "Next Address" caused a - windows program abort if the given address was outside of the - cpu address area -- bugfix in function UpdateWindowStatus(), Menuitem Tools - "Disassembler..." must be disabled when document file is closed -- bugfix in function OnStackPaste(), fixed problem when HP is off -- bugfix in function OnObjectLoad(), solve problem when calculator - is off and bugfixed method to switch emulator into sleep state -- bugfix in function OnObjectSave(), bugfixed method to switch - emulator into sleep state - -EMU48.DSP -- added library shell32.lib - -EMU48.H -- bugfix of variable hApp, used wrong type -- extern declaration of global variables -- removed extern declaration of global variables -- added some disassembler defines - -EMU48.RC -- added my name to dialog IDD_ABOUT -- added some radio buttons to dialog IDD_DISASM -- removed Timers part from dialog IDD_SETTINGS -- changed version and copyright - -ENGINE.C -- added global variable -- removed global variable -- bugfix in function AdjKeySpeed(), slow down whole emulation now, - when a key is pressed - -KEYBOARD.C -- changed key event signal in function KeyboardEvent() - -MOPS.C -- bugfix in function Uncnfg(), I/O mapped address area begin and end - on a 64 nibble boundary, Chipset.IOBase must be saved for the C=ID - command -- bugfix in function C_Eq_Id(), don't shift Chipset.IOBase for ID -- changed function Nread(), Nwrite(), Nread2(), Nwrite2(), Nread5() - and Nwrite5(), test Chipset.IOCfig as well for mapping - -OPCODES.H -- removed InfoMessage in BUSCB, BUSCC and BUSCD opcode, emulate as - NOP -- bugfix in RTI command, don't return from interrupt at timer1/2 - interrupt condition -- bugfix in SHUTDN command, don't shut down at timer1/2 wake up - condition -- bugfix in RSI command, detection of interrupt is in service was - wrong - -PCH.H -- added include shellapi.h - -RESOURCE.H -- added several definitions -- removed IDC_BROWSEDIR, IDC_REFRESH, IDC_USEMMTIMER, IDC_T1PERIOD, - IDC_T1DEFAULT - -TIMER.C -- removed global variables bAccurateTimer and uT1Period, replaced by - a static variable and a constant -- changed function CheckT1() and function CheckT2(), use function - parameter for the timer value now -- changed function ReadT1() and function ReadT2(), update timer - control bits after reading -- bugfix in function RescheduleT2(), execute timer2 event when MSB - of timer changed to update timer2 control register -- bugfix in function TimeProc(), waiting for timer2 overrun prevents - access to the timer2 value from the cpu emulation thread and reset - of variable uT2TimerId was outside synchronized area -- bugfix in function CheckT1() and function CheckT2(), fixed SRQ bit - handling -- bugfix in function SetT1() and function SetT2(), update timer - control bits and check for interrupts after setting -- bugfix in function StopTimers() and function SetT2(), killing - timer1 or timer2 in a Critical Section part may cause a dead lock - with the timer callback function (function timeKillEvent() waits - for the finish of the corresponding callback function, but the - callback function is locked by the Critical Section handler) - - -Service Pack 7 for Emu48 Version 1.0 - -DISASM.C -- new modul with disassembler - -DISPLAY.C -- bugfixes in function UpdateDisplayPointers(), next line offset was - sometimes wrong and the addresses of the main display area were - wrong when next line offset was negative -- new implementation of function WriteToMainDisplay(), fixed several - bugs (no output when next line offset was negative, sometimes - problems with left margin values > 4 and garbage on display) -- bugfix in function WriteToMenuDisplay(), menu wasn't updated - when next line offset was negative - -EMU48.C -- added global variable -- added semaphore handling for key scan -- added disassembler dialog box and menu entry -- bugfix in function OnViewCopy(), the clipboard wasn't closed when - EmptyClipboard() failed -- bugfix in function OnKeyDown(), suppress autorepeat feature of - keyboard - -EMU48.DSP -- added disasm.c source - -EMU48.H -- extern declaration of global variables -- added function prototypes - -EMU48.RC -- added Menuitem Tools "Disassembler..." -- changed version and copyright - -ENGINE.C -- added global variable -- bugfix in function AdjKeySpeed(), exit delay loop when a key - event has occured and use Chipset.Keyboard_Row[] instead of - Chipset.in to detect a pressed key - -FILES.C -- function LoadBitmapFile() save old hWindowDC palette now -- bugfix in function SaveDocumentAs(), previous opened file wasn't - closed - -KEYBOARD.C -- bugfix in function ScanKeyboard(), code part must be synchronized - and an interrupt was only generated when all input lines has been - low (no keys pressed) -- added parameter to function ScanKeyboard(), parameter indicates if - the Chipset.in interrupt register should be reset -- added key event signal in function KeyboardEvent() -- workaround in function KeyboardEvent(), hold key state for a - definite time - -KML.C -- bugfix in function ParseLines() and ParseBlocks(), allocated - memory for string parameter of include token wasn't freed -- bugfix in function KillKML(), palette resource couldn't freed, - when hWindowDC was open - -MOPS.C -- bugfix in function WriteIO(), the Chipset.start1 variable only - was updated when five nibbles at the DISPADDR (0x120) register - has been written -- bugfix in function WriteIO(), the Chipset.loffset variable only - was updated when three nibbles at the LINEOFFS (0x125) register - has been written -- bugfix in function WriteIO(), the Chipset.lcounter variable only - was updated when the MSB of the LINECOUNT (0x129) register has - been written -- bugfix in function WriteIO(), the Chipset.start2 variable only - was updated when five nibbles at the MENUADDR (0x130) register - has been written -- bugfix in function ReadIO(), the LINECOUNT (0x128-0x129) register - is a down counter - -OPCODES.H -- changed RSI command for thread synchronize - -RESOURCE.H -- added several definitions - -TIMER.C -- bugfix in function SetAccesstime(), sync time values must always - save in port0 and not at the mapped address -- bugfix in function RescheduleT2(), used wrong event time when - reference point for timer2 value wasn't saved - - -Service Pack 6 for Emu48 Version 1.0 - -DDESERV.C -- bugfix in XTYP_POKE part, fixed problem when HP is off - -DISPLAY.C -- added X4 display size parts - -EMU48.C -- changed function OnViewCopy() for X4 display size -- init lFreq variable for high performance counter here now - -EMU48.H -- changed type and name of bLcdDoubled to nLcdDoubled -- extern declaration of global variables - -EMU48.RC -- changed version and copyright - -EXTERNAL.C -- changed high limit of frequency, use SX specification -- added high limit of beep duration, use SX specification -- estimate cpu cycles for beep time -- adjust some cpu flags and registers modified by the original code - -KML.C -- changed TOK_ZOOM implementation in function InitLcd() - -MOPS.C -- changed implementation of registers 0x128-0x12D in function - ReadIO() - -OPCODES.H -- update field select table in "EXTENSION opcode o81B1" - -TIMER.C -- moved static lFreq variable to modul EMU48.C - - -Service Pack 5a for Emu48 Version 1.0 - -EMU48.C -- bugfix in OnPaint(), must redraw annunciators - - -Service Pack 5 for Emu48 Version 1.0 - -DDESERV.C -- return DDE error if emulator state couldn't change to sleep state - -EMU48.C -- added Copy/Paste Clipboard data from/to stack (strings only) - -EMU48.H -- extern declaration of global variables -- added function prototypes - -EMU48.RC -- added Menuitem Edit "Copy String" and "Paste String" -- fixed multiple use of accelerator keys -- changed version and copyright - -ENGINE.C -- added function WaitForSleepState(), wait for the SHUTDN command - -> stack isn't in use (when the clock is displayed, a time string - was sometimes on stack instead of the loaded item), then switch to - state 3 (Sleep state) -- added function AdjKeySpeed(), slow down key repetition - -FILES.C -- save mapping size of port2 in global variable -- optimized calculation of bank switch mask in MapPort2() - -MOPS.C -- bugfix in MapP0(), data offset was wrong -- bugfix in MapP1(), data offset was wrong -- bugfix in MapP2(), data offset was wrong and real size of modul - was zero -- bugfix in MapBS(), wrong pointer in mirrored data page -- bugfix in MapROM(), wrong pointer in mirrored data page -- bugfix in MapP0(), MapP1(), MapP2(), MapBS(), Config(), Uncnfg(), - mapped address area begin and end on a mapping size boundary -- bugfix in Map(), the access priority of CE1 and CE2 was wrong - (SX: port1<->port2, GX: port1<->bank select) -- bugfix in Uncnfg(), the unconfig priority of CE1 and CE2 was wrong - (SX: port1<->port2, GX: port1<->bank select) -- Map(), size optimized implementation -- Config(), size optimized implementation -- Uncnfg(), size optimized implementation -- C_Eq_Id(), size optimized implementation - -OPCODES.H -- insert key slow down in A=IN and C=IN - -RESOURCE.H -- added ID_STACK_COPY and ID_STACK_PASTE - - -Service Pack 4 for Emu48 Version 1.0 - -EMU48.C -- added code for port1 disable -- changed the default box setting of "Accurate Timer" in checked - -EMU48.RC -- added item "Port 1 is Plugged" -- changed version and copyright - -KEYBOARD.C -- bugfixes in 1 ms keyboard interrupt handler, keyboard interrupts - are generated at one of the following conditions: pressing the ON - key (non maskable), pressing a key detected by the 1 ms keyboard - scan when enabled (maskable), detect a key after an OUT command - or after the RSI command when a bit in the IN register is set - -MOPS.C -- bugfix in WriteIO(), TIMER1 was loaded with the current value - -OPCODES.H -- bugfix in INTON and INTOFF command, they aren't able to generate a - keyboard interrupt -- bugfix in RSI command, call interrupt routine or set interrupt - pending flag if a bit of the IN register is high -- RTI command changed, doesn't handle ON key here -- added InfoMessage for BUSCB command - -RESOURCE.H -- added IDC_PORT1EN - -SERIAL.C -- bugfix, synchronize threads for receive char - -TIMER.C -- changed function CheckT1(), quite similar to V1.0 with minor fixes -- changed function CheckT2(), minor fixes -- bugfix in function SetT1(), decrement value after full period, - don't check for interrupts after setting -- bugfix in function SetT2(), don't check for interrupts after - setting - - -Service Pack 3 for Emu48 Version 1.0 - -DDESERV.C -- new modul for DDE communication - -EMU48.C -- init DDE callback function and name service -- added section [Serial] in INI-File -- added combobox update in dialog box handler - -EMU48.DSP -- new makefile for MSVC 5.0 - -EMU48.H -- extern declaration of global variables -- added function prototypes - -EMU48.RC -- added block "Serial" -- changed version and copyright - -ENGINE.C -- bugfix in SetSpeed(), may enable "realspeed" with illegal - reference counts -- bugfix in SwitchToState(), switching from "Invalid" or "Sleep" - state into another, ResumeThread() may called before - SuspendThread() (unsynchronized threads) -- added code for serial device - -FILES.C -- separated stack writing code from LoadObject() to WriteStack() - -MOPS.C -- added global variables -- changed code in ReadIO() for BAUD, IO CONTROL, RCS, TCS, RBR, - SREQ?, IR CONTROL for serial support -- changed code in WriteIO() for BAUD, IOC, TBR, IRC for serial - support - -RESOURCE.H -- added IDC_WIRE and IDC_IR - -SERIAL.C -- new modul for serial support - -SERIAL.H -- new header with serial definitions - - -Service Pack 2 for Emu48 Version 1.0 - -DISPLAY.C -- bugfix in UpdateMainDisplay(), update display even if it's off - -EMU48.C -- added section [Emulator] in INI-File -- added checkbox update in dialog box handler - -EMU48.H -- extern declaration of variables - -EMU48.RC -- added item "Authentic Calculator Speed" -- changed version and copyright - -ENGINE.C -- added code to slow down emulation - -RESOURCE.H -- added IDC_REALSPEED - - -Service Pack 1 for Emu48 Version 1.0 - -DISPLAY.C -- red and blue has been changed in SetLcdColor() -- use display contrast value from chipset and not the default - value in CreateLcdBitmap() -- use semaphores to avoid GDI trouble with NT in - UpdateMainDisplay(), UpdateMenuDisplay(), WriteToMainDisplay() - and WriteToMenuDisplay() -- execute ResizeWindow() only if window exist -- bugfix in draw part of WriteToMainDisplay() - -EMU48.C -- version changed -- added global variable -- added semaphore handling to avoid GDI trouble with NT that prevent - graphic update sometimes -- added message for right mouse key -- bugfix of a parameter of GetPrivateProfileString() -- removed SwitchToState() and KillKML() at end of program -- eliminated memory leak caused by SetWindowTitle() -- function OnPaint() may returned without calling EndPaint() -- execute UpdateWindowStatus() only if window exist - -EMU48.H -- extern declaration of global variable -- added VOID as parameter in function prototypes - -EMU48.RC -- added/changed version and copyright - -EXTERNAL.C -- bugfix, check if beeper enabled -- changed beeper emulation, more realistic with Windows NT - -FILES.C -- avoid an open handle and adjust file attributes in - LoadBitmapFile() -- the WORD to int conversion used in function SetWindowPos() - failed; windows with negative position data wouldn't pop up with - NT (NT GDI is 32 bit coded, Windows 95 mostly 16 bit -> the - failed conversion doesn't matter with Windows 95) -- bugfix in close file handling of function OpenDocument() -- InitKML() need chipset for contrast setting in RestoreBackup() - -KML.C -- added global variables -- use semaphores to avoid GDI trouble with NT in DrawButton() and - DrawAnnunciator() -- added function ReleaseAllButtons() -- changed mouse handling for pressing more than one key - -OPCODES.H -- added S(X) oscillator cycles for each command -- bugfix in A=IN and C=IN command to emulate a saturn bug, on real - machines the assembler commands only work on an even address -- bugfix in all r=r+CON fs,n and r=r-CON fs,n opcodes to emulate a - saturn bug, on real machines commands with a single field selector - cause an overrun to other fields of the register -- NFdbl() replaced by NFadd() -- Ndbl() replaced by Nadd() - -OPS.H -- NFinc() definition changed -- NFdec() definition changed -- NFdbl() definition removed -- Ndbl() function removed -- changed implementation of Ninc(), added offset variable -- changed implementation of Ndec(), added offset variable -- optimized implementation of Nadd() -- optimized implementation of Nsub() -- optimized implementation of Nrsub() -- optimized implementation of Nnot() -- optimized implementation of Nneg() - -TIMER.C -- added global variables, defines and constants -- added function SetAccesstime() for setting the correct time -- bugfix in AbortT2() which prevent updating the clock sometime -- changed implementation of CheckT1() to correct blink frequency - of input cursor -- changed implementation of ReadT2() using a high resolution - timer to minimize skipping timer2 values -- bugfix in SetT2(), always check timer2 control register -- solved a problem with timer2 counts greater than 16.67 min. -- bugfix of wrong timer1/2 values (unsynchronized threads) - -TYPES.H -- use position of the t2_ticks variable for oscillator cycles - - -(c) by Christoph Gießelink +- added support for Apple hardware diff --git a/source/DDESERV.C b/source/DDESERV.C index 84c40ad..3d219b4 100644 --- a/source/DDESERV.C +++ b/source/DDESERV.C @@ -11,8 +11,8 @@ #include "io.h" HDDEDATA CALLBACK DdeCallback(UINT iType,UINT iFmt,HCONV hConv, - HSZ hsz1,HSZ hsz2,HDDEDATA hData, - DWORD dwData1,DWORD dwData2) + HSZ hsz1,HSZ hsz2,HDDEDATA hData, + DWORD dwData1,DWORD dwData2) { TCHAR *psz,szBuffer[32]; HDDEDATA hReturn; diff --git a/source/DEBUGGER.C b/source/DEBUGGER.C index bb50e5f..5701e5c 100644 --- a/source/DEBUGGER.C +++ b/source/DEBUGGER.C @@ -156,6 +156,50 @@ static VOID DisableMenuKeys(HWND hDlg) return; } +// +// read edit control and decode content as hex number or if enabled as symbol name +// +static BOOL GetAddr(HWND hDlg,INT nID,DWORD *pdwAddr,DWORD dwMaxAddr,BOOL bSymbEnable) +{ + TCHAR szBuffer[48]; + INT i; + BOOL bSucc = TRUE; + + HWND hWnd = GetDlgItem(hDlg,nID); + + GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer)); + + if (*szBuffer != 0) + { + // if address is not a symbol name decode number + if ( !bSymbEnable || szBuffer[0] != _T('=') + || RplGetAddr(&szBuffer[1],pdwAddr)) + { + // test if valid hex address + for (i = 0; bSucc && i < (LONG) lstrlen(szBuffer); ++i) + { + bSucc = (_istxdigit(szBuffer[i]) != 0); + } + + if (bSucc) // valid characters + { + // convert string to number + *pdwAddr = _tcstoul(szBuffer,NULL,16); + } + } + + // inside address range? + bSucc = bSucc && (*pdwAddr <= dwMaxAddr); + + if (!bSucc) // invalid address + { + SendMessage(hWnd,EM_SETSEL,0,-1); + SetFocus(hWnd); // focus to edit control + } + } + return bSucc; +} + // // set mapping menu // @@ -212,50 +256,6 @@ static VOID SetMappingMenu(HWND hDlg,UINT uID) return; }; -// -// read edit control and decode content as hex number or if enabled as symbol name -// -static BOOL GetAddr(HWND hDlg,INT nID,DWORD *pdwAddr,DWORD dwMaxAddr,BOOL bSymbEnable) -{ - TCHAR szBuffer[48]; - INT i; - BOOL bSucc = TRUE; - - HWND hWnd = GetDlgItem(hDlg,nID); - - GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer)); - - if (*szBuffer != 0) - { - // if address is not a symbol name decode number - if ( !bSymbEnable || szBuffer[0] != _T('=') - || RplGetAddr(&szBuffer[1],pdwAddr)) - { - // test if valid hex address - for (i = 0; bSucc && i < (LONG) lstrlen(szBuffer); ++i) - { - bSucc = (_istxdigit(szBuffer[i]) != 0); - } - - if (bSucc) // valid characters - { - // convert string to number - *pdwAddr = _tcstoul(szBuffer,NULL,16); - } - } - - // inside address range? - bSucc = bSucc && (*pdwAddr <= dwMaxAddr); - - if (!bSucc) // invalid address - { - SendMessage(hWnd,EM_SETSEL,0,-1); - SetFocus(hWnd); // focus to edit control - } - } - return bSucc; -} - // // get address of cursor in memory window // @@ -1143,7 +1143,7 @@ static BOOL OnClearAll(HWND hDlg) // static BOOL OnToggleMenuItem(HWND hDlg,UINT uIDCheckItem,BOOL *bCheck) { - *bCheck = !*bCheck; // toggle flag + *bCheck = !*bCheck; // toggle flag CheckMenuItem(GetMenu(hDlg),uIDCheckItem,*bCheck ? MF_CHECKED : MF_UNCHECKED); return 0; } @@ -1263,7 +1263,7 @@ static BOOL OnLButtonUp(HWND hDlg, LPARAM lParam) // handle of selected window hWnd = ChildWindowFromPointEx(hDlg,pt,CWP_SKIPDISABLED); - nId = GetDlgCtrlID(hWnd); // control ID of window + nId = GetDlgCtrlID(hWnd); // control ID of window GetWindowText(hWnd,szBuffer,ARRAYSIZEOF(szBuffer)); switch (nId) @@ -1423,7 +1423,6 @@ static BOOL OnDblClick(HWND hWnd, WORD wId) ViewMemWnd(hDlg,dwAdrMem); // update memory window SendMessage(hWnd,LB_SETCURSEL,i,0); return FALSE; - return FALSE; } // @@ -1445,7 +1444,7 @@ static VOID OnContextMenu(HWND hDlg, LPARAM lParam, WPARAM wParam) pt.y = rc.top + 5; } - nId = GetDlgCtrlID((HWND) wParam); // control ID of window + nId = GetDlgCtrlID((HWND) wParam); // control ID of window switch(nId) { @@ -1500,7 +1499,7 @@ static __inline BOOL OnKeyRightLeft(HWND hWnd, WPARAM wParam) WORD wX; INT nId; - nId = GetDlgCtrlID(hWnd); // control ID of window + nId = GetDlgCtrlID(hWnd); // control ID of window for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's if (nCol[wX] == nId) // found ID @@ -1523,10 +1522,10 @@ static __inline BOOL OnKeyRightLeft(HWND hWnd, WPARAM wParam) // static __inline BOOL OnKeyUpDown(HWND hWnd, WPARAM wParam) { - INT wX, wY; - INT nId; + INT wX, wY; + INT nId; - nId = GetDlgCtrlID(hWnd); // control ID of window + nId = GetDlgCtrlID(hWnd); // control ID of window for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's if (nCol[wX] == nId) // found ID @@ -1578,10 +1577,10 @@ static __inline BOOL OnKeyUpDown(HWND hWnd, WPARAM wParam) // static __inline BOOL OnKeyPlusMinus(HWND hWnd, WPARAM wParam) { - INT wX, wY; - INT nId; + INT wX, wY; + INT nId; - nId = GetDlgCtrlID(hWnd); // control ID of window + nId = GetDlgCtrlID(hWnd); // control ID of window for (wX = 0; wX < MEMWNDMAX; ++wX) // scan all Id's if (nCol[wX] == nId) // found ID @@ -1874,7 +1873,6 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM // add Settings item to sysmenu _ASSERT((IDM_DEBUG_SETTINGS & 0xFFF0) == IDM_DEBUG_SETTINGS); _ASSERT(IDM_DEBUG_SETTINGS < 0xF000); - if ((hSysMenu = GetSystemMenu(hDlg,FALSE)) != NULL) { VERIFY(AppendMenu(hSysMenu,MF_SEPARATOR,0,NULL)); @@ -2061,10 +2059,10 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM { case VK_F2: return OnKeyF2(hDlg); // toggle breakpoint case VK_F5: return OnKeyF5(hDlg); // key run - case VK_F6: return OnKeyF6(hDlg); // key step cursor + case VK_F6: return OnKeyF6(hDlg); // key step cursor case VK_F7: return OnKeyF7(hDlg); // key step into case VK_F8: return OnKeyF8(hDlg); // key step over - case VK_F9: return OnKeyF9(hDlg); // key step out + case VK_F9: return OnKeyF9(hDlg); // key step out case VK_F11: return OnKeyF11(hDlg); // key break } @@ -2122,7 +2120,7 @@ static INT_PTR CALLBACK Debugger(HWND hDlg, UINT message, WPARAM wParam, LPARAM case WM_NOTIFY: // tooltip for toolbar - if(((LPNMHDR) lParam)->code == TTN_GETDISPINFO) + if (((LPNMHDR) lParam)->code == TTN_GETDISPINFO) { ((LPTOOLTIPTEXT) lParam)->hinst = hApp; ((LPTOOLTIPTEXT) lParam)->lpszText = MAKEINTRESOURCE(((LPTOOLTIPTEXT) lParam)->hdr.idFrom); @@ -2983,8 +2981,8 @@ static BOOL ToggleBreakpointItem(HWND hWnd, INT nItem) // static VOID DrawBreakpoint(HWND hWnd, INT i) { - TCHAR *szText,szBuffer[32]; - LPARAM nItem; + TCHAR *szText,szBuffer[32]; + INT nItem; switch(sBreakpoint[i].nType) { @@ -3020,11 +3018,11 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L { TEXTMETRIC tm; - HWND hWnd; - HDC hDC; - HFONT hFont; - BP_T sBp; - INT i,nItem; + HWND hWnd; + HDC hDC; + HFONT hFont; + BP_T sBp; + INT i,nItem; switch (message) { @@ -3150,7 +3148,7 @@ static INT_PTR CALLBACK EditBreakpoint(HWND hDlg, UINT message, WPARAM wParam, L } case WM_VKEYTOITEM: - if(LOWORD(wParam) == VK_SPACE) + if (LOWORD(wParam) == VK_SPACE) { hWnd = GetDlgItem(hDlg,IDC_BREAKEDIT_WND); for (nItem = 0; nItem < wBreakpointCount; ++nItem) diff --git a/source/DEBUGGER.H b/source/DEBUGGER.H index 78224f5..1a9b694 100644 --- a/source/DEBUGGER.H +++ b/source/DEBUGGER.H @@ -11,7 +11,7 @@ #define BP_EXEC 0x01 // code breakpoint #define BP_READ 0x02 // read memory breakpoint #define BP_WRITE 0x04 // write memory breakpoint -#define BP_RPL 0x08 // RPL breakpoint +#define BP_RPL 0x08 // RPL breakpoint #define BP_ACCESS (BP_READ|BP_WRITE) // read/write memory breakpoint // breakpoint notify definitions @@ -24,8 +24,8 @@ #define DBG_OFF 0 #define DBG_RUN 1 #define DBG_STEPINTO 2 -#define DBG_STEPOVER 3 -#define DBG_STEPOUT 4 +#define DBG_STEPOVER 3 +#define DBG_STEPOUT 4 // debugger.c extern VOID UpdateDbgCycleCounter(VOID); diff --git a/source/DISASM.C b/source/DISASM.C index 99ebc1c..71078e0 100644 --- a/source/DISASM.C +++ b/source/DISASM.C @@ -765,7 +765,7 @@ static LPTSTR disasm_8 (DWORD *addr, LPTSTR out) { case HP_MNEMONICS: wsprintf (buf, _T("%cBIT=%d"), (fn & 8) ? _T('C') : _T('A'), - (fn & 1) ? 1 : 0); + (fn & 1) ? 1 : 0); p = append_str (out, buf); p = append_tab (out); p = append_imm_nibble (p, addr, 1); @@ -839,7 +839,7 @@ static LPTSTR disasm_8 (DWORD *addr, LPTSTR out) { case HP_MNEMONICS: wsprintf (buf, (n == 0xf) ? _T("%c%cEX") : _T("%c=%c"), - (n == 0xd) ? _T('P') : _T('C'), (n == 0xd) ? _T('C') : _T('P')); + (n == 0xd) ? _T('P') : _T('C'), (n == 0xd) ? _T('C') : _T('P')); p = append_str (out, buf); p = append_tab (out); wsprintf (buf, _T("%d"), fn); @@ -849,7 +849,7 @@ static LPTSTR disasm_8 (DWORD *addr, LPTSTR out) p = append_str (out, (n == 0xf) ? _T("exg.1") : _T("move.1")); p = append_tab (out); wsprintf (buf, (n == 0xd) ? _T("p, c.%d") : _T("c.%d, p"), fn); - p = append_str (p, buf); + p = append_str (p, buf); break; default: p = append_str (out, _T("Unknown disassembler mode")); @@ -918,9 +918,9 @@ static LPTSTR disasm_8 (DWORD *addr, LPTSTR out) { case HP_MNEMONICS: wsprintf (buf, _T("%s=%s%cCON"), - op_str_81[(n & 3) + 4 * disassembler_mode], - op_str_81[(n & 3) + 4 * disassembler_mode], - (n < 8) ? _T('+') : _T('-')); + op_str_81[(n & 3) + 4 * disassembler_mode], + op_str_81[(n & 3) + 4 * disassembler_mode], + (n < 8) ? _T('+') : _T('-')); p = append_str (out, buf); p = append_tab (out); p = append_field (p, fn); @@ -983,18 +983,18 @@ static LPTSTR disasm_8 (DWORD *addr, LPTSTR out) if (n == 2) { wsprintf (buf, _T("%cR%dEX.F"), ((int) c < 8) ? _T('A') : _T('C'), - (int) c & 7); + (int) c & 7); } else if (n == 1) { wsprintf (buf, _T("%c=R%d.F"), ((int) c < 8) ? _T('A') : _T('C'), - (int) c & 7); + (int) c & 7); } else { wsprintf (buf, _T("R%d=%c.F"), (int) c & 7, - ((int) c < 8) ? _T('A') : _T('C')); + ((int) c < 8) ? _T('A') : _T('C')); } p = append_str (out, buf); p = append_tab (out); @@ -1325,7 +1325,7 @@ DWORD disassemble (DWORD addr, LPTSTR out) { case HP_MNEMONICS: wsprintf (buf, op_str_0[(n & 7) + 8 * HP_MNEMONICS], - (n < 8) ? _T('&') : _T('!')); + (n < 8) ? _T('&') : _T('!')); p = append_str (out, buf); p = append_tab (out); p = append_field (p, fn); @@ -1539,10 +1539,10 @@ DWORD disassemble (DWORD addr, LPTSTR out) case HP_MNEMONICS: if ((c == 0) && (n >= 8)) wsprintf (buf, op_str_9[(n & 3) + 8 * HP_MNEMONICS + 4], - in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]); + in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]); else wsprintf (buf, op_str_9[(n & 3) + 8 * HP_MNEMONICS], - in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]); + in_str_9[((n >> 2) & 3) + 4 * c + 8 * HP_MNEMONICS]); p = append_str (out, buf); p = append_tab (out); p = append_field (p, fn); diff --git a/source/DISMEM.C b/source/DISMEM.C index dc793f8..6cda3e6 100644 --- a/source/DISMEM.C +++ b/source/DISMEM.C @@ -39,7 +39,7 @@ static CONST MODEL_MAP_T MemMap[] = { '6', // HP38G (64K) &pbyRom, &dwRomSize, // ROM - &Port0, &Chipset.Port0Size, // RAM + &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL // nc. @@ -47,7 +47,7 @@ static CONST MODEL_MAP_T MemMap[] = { 'A', // HP38G &pbyRom, &dwRomSize, // ROM - &Port0, &Chipset.Port0Size, // RAM + &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL, // nc. &pbyNoMEM, NULL // nc. @@ -58,21 +58,21 @@ static CONST MODEL_MAP_T MemMap[] = &Port0, &Chipset.Port0Size, // RAM part 1 &pbyNoMEM, NULL, // BS &pbyNoMEM, NULL, // nc. - &Port2, &Chipset.Port2Size // RAM part 2 + &Port2, &Chipset.Port2Size // RAM part 2 }, { 'G', // HP48GX &pbyRom, &dwRomSize, // ROM &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // BS - &Port1, &Chipset.Port1Size, // Card slot 1 + &Port1, &Chipset.Port1Size, // Card slot 1 &pbyPort2, &dwPort2Size // Card slot 2 }, { 'S', // HP48SX &pbyRom, &dwRomSize, // ROM &Port0, &Chipset.Port0Size, // RAM - &Port1, &Chipset.Port1Size, // Card slot 1 + &Port1, &Chipset.Port1Size, // Card slot 1 &pbyPort2, &dwPort2Size, // Card slot 2 &pbyNoMEM, NULL // nc. }, @@ -85,7 +85,7 @@ static CONST MODEL_MAP_T MemMap[] = &Port2, &Chipset.Port2Size // Port 1 part 2 }, { // CdB for HP: add Q type - 'Q', // HP49G+ + 'Q', // HP49g+ &pbyRom, &dwRomSize, // Flash &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // BS @@ -93,7 +93,7 @@ static CONST MODEL_MAP_T MemMap[] = &Port2, &Chipset.Port2Size // Port 1 part 2 }, { // CdB for HP: add 2 type - '2', // HP48Gii + '2', // HP48gII &pbyRom, &dwRomSize, // ROM &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // BS @@ -101,7 +101,7 @@ static CONST MODEL_MAP_T MemMap[] = &pbyNoMEM, NULL, // Port 1 part 2 }, { // CdB for HP: add P type - 'P', // HP39G+ + 'P', // HP39g+/gs &pbyRom, &dwRomSize, // ROM &Port0, &Chipset.Port0Size, // RAM &pbyNoMEM, NULL, // BS diff --git a/source/DISPLAY.C b/source/DISPLAY.C index d8fe4cc..28ea8d4 100644 --- a/source/DISPLAY.C +++ b/source/DISPLAY.C @@ -15,8 +15,10 @@ // #define DEBUG_DISPLAY // switch for DISPLAY debug purpose -#define NOCOLORSGRAY 8 -#define NOCOLORSBW 2 +#define NOCOLORSGRAY 8 // no. of colors in gray scale mode +#define NOCOLORSBW 2 // no. of colors in black and white mode + +#define DISPLAY_FREQ 19 // display update 1/frequency (1/64) in ms (gray scale mode) #define B 0x00000000 // black #define W 0x00FFFFFF // white @@ -29,29 +31,50 @@ |((((c)-1)>>1)<<8) \ |((((c)-1)>>1))) -#define DIBPIXEL(d,p) *((DWORD*)(d)) = ((*((DWORD*)(d)) & dwGrayMask) << 1) | (p); *((LPBYTE*) &(d)) += 4 +#define DIBPIXEL4(d,p) *((DWORD*)(d)) = ((*((DWORD*)(d)) & dwGrayMask) << 1) | (p); \ + *((LPBYTE*) &(d)) += 4 -BOOL bGrayscale = FALSE; // Default is to not emulate grayscale -UINT nBackgroundX = 0; -UINT nBackgroundY = 0; -UINT nBackgroundW = 0; -UINT nBackgroundH = 0; -UINT nLcdX = 0; -UINT nLcdY = 0; -UINT nLcdZoom = 1; -HDC hLcdDC = NULL; -HDC hMainDC = NULL; +BOOL bGrayscale = FALSE; +UINT nBackgroundX = 0; +UINT nBackgroundY = 0; +UINT nBackgroundW = 0; +UINT nBackgroundH = 0; +UINT nLcdX = 0; +UINT nLcdY = 0; +UINT nLcdZoom = 1; // memory DC zoom +UINT nGdiXZoom = 1; // GDI x zoom +UINT nGdiYZoom = 1; // GDI y zoom +HDC hLcdDC = NULL; +HDC hMainDC = NULL; +HDC hAnnunDC = NULL; // annunciator DC -static LPBYTE pbyLcd; +BYTE (*GetLineCounter)(VOID) = NULL; +VOID (*StartDisplay)(BYTE byInitial) = NULL; +VOID (*StopDisplay)(VOID) = NULL; + +static BYTE GetLineCounterGray(VOID); +static BYTE GetLineCounterBW(VOID); +static VOID StartDisplayGray(BYTE byInitial); +static VOID StartDisplayBW(BYTE byInitial); +static VOID StopDisplayGray(VOID); +static VOID StopDisplayBW(VOID); + +static LPBYTE pbyLcd; static HBITMAP hLcdBitmap; static HBITMAP hMainBitmap; +static HBITMAP hAnnunBitmap; static DWORD Pattern[16]; static BYTE Buf[36]; static DWORD dwGrayMask; +static LARGE_INTEGER lLcdRef; // reference time for VBL counter +static UINT uLcdTimerId = 0; + +static BYTE byVblRef = 0; // VBL stop reference + static DWORD dwKMLColor[64] = // color table loaded by KML script { W,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B, @@ -63,7 +86,7 @@ static DWORD dwKMLColor[64] = // color table loaded by KML script static struct { BITMAPINFOHEADER Lcd_bmih; - RGBQUAD bmiColors[NOCOLORSGRAY]; + RGBQUAD bmiColors[NOCOLORSGRAY]; } bmiLcd = { {0x28,0/*x*/,0/*y*/,1,8,BI_RGB,0,0,0,NOCOLORSGRAY,0} @@ -116,9 +139,6 @@ VOID UpdateContrast(BYTE byContrast) // update palette information _ASSERT(hLcdDC); SetDIBColorTable(hLcdDC,0,ARRAYSIZEOF(bmiLcd.bmiColors),bmiLcd.bmiColors); - - // recalculate update mask for online gray <-> bw switching - dwGrayMask = bGrayscale ? GRAYMASK(NOCOLORSGRAY) : GRAYMASK(NOCOLORSBW); return; } @@ -128,22 +148,42 @@ VOID SetLcdColor(UINT nId, UINT nRed, UINT nGreen, UINT nBlue) return; } +VOID SetLcdMode(BOOL bMode) +{ + if ((bGrayscale = bMode)) + { + // set pixel update mask + dwGrayMask = GRAYMASK(NOCOLORSGRAY); + GetLineCounter = GetLineCounterGray; + StartDisplay = StartDisplayGray; + StopDisplay = StopDisplayGray; + } + else + { + // set pixel update mask + dwGrayMask = GRAYMASK(NOCOLORSBW); + GetLineCounter = GetLineCounterBW; + StartDisplay = StartDisplayBW; + StopDisplay = StopDisplayBW; + } + UpdateContrast(Chipset.contrast); + return; +} + VOID CreateLcdBitmap(VOID) { // create LCD bitmap bmiLcd.Lcd_bmih.biWidth = LCD_ROW; - bmiLcd.Lcd_bmih.biHeight = -SCREENHEIGHT; // CdB for HP: add 64/80 ligne display for apples + bmiLcd.Lcd_bmih.biHeight = -SCREENHEIGHT; // CdB for HP: add 64/80 line display for apples _ASSERT(hLcdDC == NULL); - hLcdDC = CreateCompatibleDC(hWindowDC); - _ASSERT(hLcdDC != NULL); - hLcdBitmap = CreateDIBSection(hWindowDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0); + VERIFY(hLcdDC = CreateCompatibleDC(hWindowDC)); + VERIFY(hLcdBitmap = CreateDIBSection(hWindowDC,(BITMAPINFO*)&bmiLcd,DIB_RGB_COLORS,(VOID **)&pbyLcd,NULL,0)); hLcdBitmap = (HBITMAP) SelectObject(hLcdDC,hLcdBitmap); _ASSERT(hPalette != NULL); SelectPalette(hLcdDC,hPalette,FALSE); // set palette for LCD DC RealizePalette(hLcdDC); // realize palette BuildPattern(); // build Nibble -> DIB mask pattern - dwGrayMask = bGrayscale ? GRAYMASK(NOCOLORSGRAY) : GRAYMASK(NOCOLORSBW); - UpdateContrast(Chipset.contrast); + SetLcdMode(bGrayscale); // init display update function pointer return; } @@ -151,8 +191,12 @@ VOID DestroyLcdBitmap(VOID) { // set contrast palette to startup colors WORD i = 0; dwKMLColor[i++] = W; - while(i < 32) dwKMLColor[i++] = B; - while(i < 64) dwKMLColor[i++] = I; + while (i < 32) dwKMLColor[i++] = B; + while (i < 64) dwKMLColor[i++] = I; + + GetLineCounter = NULL; + StartDisplay = NULL; + StopDisplay = NULL; if (hLcdDC != NULL) { @@ -167,11 +211,8 @@ VOID DestroyLcdBitmap(VOID) BOOL CreateMainBitmap(LPCTSTR szFilename) { - HPALETTE hAssertPalette; - _ASSERT(hWindowDC != NULL); - hMainDC = CreateCompatibleDC(hWindowDC); - _ASSERT(hMainDC != NULL); + VERIFY(hMainDC = CreateCompatibleDC(hWindowDC)); if (hMainDC == NULL) return FALSE; // quit if failed hMainBitmap = LoadBitmapFile(szFilename); if (hMainBitmap == NULL) @@ -182,8 +223,7 @@ BOOL CreateMainBitmap(LPCTSTR szFilename) } hMainBitmap = (HBITMAP) SelectObject(hMainDC,hMainBitmap); _ASSERT(hPalette != NULL); - hAssertPalette = SelectPalette(hMainDC,hPalette,FALSE); - _ASSERT(hAssertPalette != NULL); + VERIFY(SelectPalette(hMainDC,hPalette,FALSE)); RealizePalette(hMainDC); return TRUE; } @@ -201,6 +241,40 @@ VOID DestroyMainBitmap(VOID) return; } +// +// load annunciator bitmap +// +BOOL CreateAnnunBitmap(LPCTSTR szFilename) +{ + _ASSERT(hWindowDC != NULL); + VERIFY(hAnnunDC = CreateCompatibleDC(hWindowDC)); + if (hAnnunDC == NULL) return FALSE; // quit if failed + hAnnunBitmap = LoadBitmapFile(szFilename); + if (hAnnunBitmap == NULL) + { + DeleteDC(hAnnunDC); + hAnnunDC = NULL; + return FALSE; + } + hAnnunBitmap = (HBITMAP) SelectObject(hAnnunDC,hAnnunBitmap); + return TRUE; +} + +// +// destroy annunciator bitmap +// +VOID DestroyAnnunBitmap(VOID) +{ + if (hAnnunDC != NULL) + { + VERIFY(DeleteObject(SelectObject(hAnnunDC,hAnnunBitmap))); + DeleteDC(hAnnunDC); + hAnnunDC = NULL; + hAnnunBitmap = NULL; + } + return; +} + //**************** //* //* LCD functions @@ -242,8 +316,8 @@ VOID UpdateDisplayPointers(VOID) VOID UpdateMainDisplay(VOID) { UINT x, y; + BYTE *p = pbyLcd+(Chipset.d0size*LCD_ROW); // CdB for HP: add 64/80 line display for apples DWORD d = Chipset.start1; - BYTE *p = pbyLcd+(Chipset.d0size*LCD_ROW); // CdB for HP: add 64/80 ligne display for apples #if defined DEBUG_DISPLAY { @@ -264,7 +338,7 @@ VOID UpdateMainDisplay(VOID) Npeek(Buf,d,36); for (x=0; x<36; ++x) // every 4 pixel { - DIBPIXEL(p,Pattern[Buf[x]]); + DIBPIXEL4(p,Pattern[Buf[x]]); // check for display buffer overflow _ASSERT(p <= pbyLcd + LCD_ROW * SCREENHEIGHT); } @@ -273,14 +347,9 @@ VOID UpdateMainDisplay(VOID) } EnterCriticalSection(&csGDILock); // solving NT GDI problems { - // CdB for HP: add 64/80 ligne display for apples - StretchBlt(hWindowDC, - nLcdX, nLcdY+Chipset.d0size*nLcdZoom, - 131*nLcdZoom, MAINSCREENHEIGHT*nLcdZoom, - hLcdDC, - Chipset.boffset, Chipset.d0size, - 131, MAINSCREENHEIGHT, - SRCCOPY); + // CdB for HP: add 64/80 line display for apples + StretchBlt(hWindowDC, nLcdX, nLcdY+Chipset.d0size*nLcdZoom, 131*nLcdZoom, MAINSCREENHEIGHT*nLcdZoom, + hLcdDC, Chipset.boffset, Chipset.d0size, 131, MAINSCREENHEIGHT, SRCCOPY); GdiFlush(); } LeaveCriticalSection(&csGDILock); @@ -289,8 +358,8 @@ VOID UpdateMainDisplay(VOID) VOID UpdateMenuDisplay(VOID) { - UINT x, y; - BYTE *p; + UINT x, y; + BYTE *p; DWORD d = Chipset.start2; #if defined DEBUG_DISPLAY @@ -305,13 +374,13 @@ VOID UpdateMenuDisplay(VOID) if (MENUHEIGHT==0) return; // menu disabled // calculate bitmap offset - p = pbyLcd + ((Chipset.d0size+MAINSCREENHEIGHT)*LCD_ROW); // CdB for HP: add 64/80 ligne display for apples + p = pbyLcd + ((Chipset.d0size+MAINSCREENHEIGHT)*LCD_ROW); // CdB for HP: add 64/80 line display for apples for (y = 0; y < MENUHEIGHT; ++y) { Npeek(Buf,d,34); // 34 nibbles are viewed for (x=0; x<34; ++x) // every 4 pixel { - DIBPIXEL(p,Pattern[Buf[x]]); + DIBPIXEL4(p,Pattern[Buf[x]]); // check for display buffer overflow _ASSERT(p <= pbyLcd + LCD_ROW * SCREENHEIGHT); } @@ -321,11 +390,11 @@ VOID UpdateMenuDisplay(VOID) } EnterCriticalSection(&csGDILock); // solving NT GDI problems { - // CdB for HP: add 64/80 ligne display for apples - StretchBlt(hWindowDC, + // CdB for HP: add 64/80 line display for apples + StretchBlt(hWindowDC, nLcdX, nLcdY+(MAINSCREENHEIGHT+Chipset.d0size)*nLcdZoom, - 131*nLcdZoom, MENUHEIGHT*nLcdZoom, - hLcdDC, + 131*nLcdZoom, MENUHEIGHT*nLcdZoom, + hLcdDC, 0, (MAINSCREENHEIGHT+Chipset.d0size), 131, MENUHEIGHT, SRCCOPY); @@ -359,19 +428,15 @@ VOID RefreshDisp0() memcpy(Buf,d,34); // 34 nibbles are viewed for (x=0; x<36; ++x) // every 4 pixel { - DIBPIXEL(p,Pattern[Buf[x]]); + DIBPIXEL4(p,Pattern[Buf[x]]); } d+=34; } EnterCriticalSection(&csGDILock); // solving NT GDI problems { - StretchBlt(hWindowDC, - nLcdX, nLcdY, - 131*nLcdZoom, Chipset.d0size*nLcdZoom, - hLcdDC, - Chipset.d0offset, 0, - 131, Chipset.d0size, - SRCCOPY); + StretchBlt(hWindowDC, nLcdX, nLcdY, + 131*nLcdZoom*nGdiXZoom, Chipset.d0size*nLcdZoom*nGdiYZoom, + hLcdDC, Chipset.d0offset, 0, 131, Chipset.d0size, SRCCOPY); GdiFlush(); } LeaveCriticalSection(&csGDILock); @@ -386,10 +451,7 @@ VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s) INT lWidth = abs(Chipset.width); // display width - if (bGrayscale) - { - return; - } + if (bGrayscale) return; // no direct writing in grayscale mode #if defined DEBUG_DISPLAY { @@ -399,7 +461,9 @@ VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s) } #endif - if (!(Chipset.IORam[BITOFFSET]&DON)) return; // display off + if (!(Chipset.IORam[BITOFFSET]&DON)) // display off + return; // no drawing + if (MAINSCREENHEIGHT == 0) return; // menu disabled d -= Chipset.start1; // nibble offset to DISPADDR (start of display) @@ -417,27 +481,25 @@ VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s) { *p = Pattern[*a]; } - a++; // next value to write - x++; // next x position + ++a; // next value to write + ++x; // next x position if (((INT) x==lWidth)&&s) // end of display line { x = 0; // first coloumn - y++; // next row + ++y; // next row if (y == (INT) MAINSCREENHEIGHT+Chipset.d0size) break; // recalculate bitmap memory position of new line - p = (DWORD*) (pbyLcd+y*LCD_ROW); // CdB for HP: add 64/80 ligne display for apples - } else p++; + p = (DWORD*) (pbyLcd+y*LCD_ROW); // CdB for HP: add 64/80 line display for apples + } + else + p++; } if (y==y0) y++; EnterCriticalSection(&csGDILock); // solving NT GDI problems { - StretchBlt(hWindowDC, - nLcdX, nLcdY+y0*nLcdZoom, + StretchBlt(hWindowDC, nLcdX, nLcdY+y0*nLcdZoom, 131*nLcdZoom, (y-y0)*nLcdZoom, - hLcdDC, - Chipset.boffset, y0, - 131, y-y0, - SRCCOPY); // CdB for HP: add 64/80 ligne display for apples + hLcdDC, Chipset.boffset, y0, 131, y-y0, SRCCOPY); // CdB for HP: add 64/80 line display for apples GdiFlush(); } LeaveCriticalSection(&csGDILock); @@ -450,10 +512,7 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) UINT y0, y; DWORD *p; - if (bGrayscale) - { - return; - } + if (bGrayscale) return; // no direct writing in grayscale mode #if defined DEBUG_DISPLAY { @@ -463,12 +522,12 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) } #endif - if (!(Chipset.IORam[BITOFFSET]&DON)) return; // display off + if (!(Chipset.IORam[BITOFFSET]&DON)) return; if (MENUHEIGHT == 0) return; // menu disabled - d -= Chipset.start2; // nibble offset to DISPADDR (start of display) + d -= Chipset.start2; y0 = y = (d / 34) + MAINSCREENHEIGHT+Chipset.d0size; // bitmap row - x0 = x = d % 34; // bitmap coloumn + x0 = x = d % 34; p = (DWORD*)(pbyLcd + y0*LCD_ROW + x0*sizeof(*p)); // outside menu display area @@ -493,15 +552,11 @@ VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s) } else p++; } if (y==y0) y++; - EnterCriticalSection(&csGDILock); // solving NT GDI problems + EnterCriticalSection(&csGDILock); // solving NT GDI problems { - StretchBlt(hWindowDC, - nLcdX, nLcdY+y0*nLcdZoom, - 131*nLcdZoom, (y-y0)*nLcdZoom, - hLcdDC, - 0, y0, - 131, y-y0, - SRCCOPY); // CdB for HP: add 64/80 ligne display for apples + StretchBlt(hWindowDC, nLcdX, nLcdY+y0*nLcdZoom, + 131*nLcdZoom, (y-y0)*nLcdZoom, + hLcdDC, 0, y0, 131, y-y0, SRCCOPY); // CdB for HP: add 64/80 line display for apples GdiFlush(); } LeaveCriticalSection(&csGDILock); @@ -557,33 +612,25 @@ VOID ResizeWindow(VOID) SWP_NOMOVE | SWP_NOZORDER); } - _ASSERT(hWindowDC); // move destination window - SetWindowOrgEx(hWindowDC, nBackgroundX, nBackgroundY, NULL); + EnterCriticalSection(&csGDILock); // solving NT GDI problems + { + _ASSERT(hWindowDC); // move origin of destination window + VERIFY(SetWindowOrgEx(hWindowDC, nBackgroundX, nBackgroundY, NULL)); + GdiFlush(); + } + LeaveCriticalSection(&csGDILock); InvalidateRect(hWnd,NULL,TRUE); } return; } +//################ +//# +//# functions for gray scale implementation +//# +//################ -#define DISPLAY_FREQ 19 // display update 1/frequency (1/64) in ms - -static LARGE_INTEGER lLcdRef; // reference time for VBL counter - -static UINT uLcdTimerId = 0; - -static BYTE byVblRef = 0; // VBL stop reference - -// LCD line counter calculation -static BYTE F4096Hz(VOID) // get a 6 bit 4096Hz down counter value -{ - LARGE_INTEGER lLC; - - QueryPerformanceCounter(&lLC); // get counter value - - // calculate 4096 Hz frequency down counter value - return -(BYTE)(((lLC.QuadPart - lAppStart.QuadPart) << 12) / lFreq.QuadPart) & 0x3F; -} - +// main display update routine static VOID CALLBACK LcdProc(UINT uEventId, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { EnterCriticalSection(&csLcdLock); @@ -605,17 +652,11 @@ static VOID CALLBACK LcdProc(UINT uEventId, UINT uMsg, DWORD dwUser, DWORD dw1, } // LCD line counter calculation -BYTE GetLineCounter(VOID) +static BYTE GetLineCounterGray(VOID) { LARGE_INTEGER lLC; BYTE byTime; - if (!bGrayscale) - { - _ASSERT(byVblRef < 0x40); - return (0x40 + F4096Hz() - byVblRef) & 0x3F; - } - if (uLcdTimerId == 0) // display off return ((Chipset.IORam[LINECOUNT+1] & (LC5|LC4)) << 4) | Chipset.IORam[LINECOUNT]; @@ -629,15 +670,8 @@ BYTE GetLineCounter(VOID) return 0x3F - byTime; // update display between VBL counter 0x3F-0x3E } -VOID StartDisplay(BYTE byInitial) +static VOID StartDisplayGray(BYTE byInitial) { - if (!bGrayscale) - { - // get positive VBL difference between now and stop time - byVblRef = (0x40 + F4096Hz() - byInitial) & 0x3F; - return; - } - if (uLcdTimerId) // LCD update timer running return; // -> quit @@ -649,20 +683,16 @@ VOID StartDisplay(BYTE byInitial) _ASSERT(byInitial <= 0x3F); // line counter value 0 - 63 lLcdRef.QuadPart -= ((LONGLONG) (0x3F - byInitial) * lFreq.QuadPart) >> 12; - uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC); - _ASSERT(uLcdTimerId); // test if display update timer started + VERIFY(uLcdTimerId = timeSetEvent(DISPLAY_FREQ,0,(LPTIMECALLBACK)&LcdProc,0,TIME_PERIODIC)); } return; } -VOID StopDisplay(VOID) +static VOID StopDisplayGray(VOID) { BYTE a[2]; ReadIO(a,LINECOUNT,2,TRUE); // update VBL at display off time - if (!bGrayscale) - return; - if (uLcdTimerId == 0) // timer stopped return; // -> quit @@ -678,3 +708,39 @@ VOID StopDisplay(VOID) LeaveCriticalSection(&csLcdLock); return; } +//################ +//# +//# functions for black and white implementation +//# +//################ + +// LCD line counter calculation in BW mode +static BYTE F4096Hz(VOID) // get a 6 bit 4096Hz down counter value +{ + LARGE_INTEGER lLC; + + QueryPerformanceCounter(&lLC); // get counter value + + // calculate 4096 Hz frequency down counter value + return -(BYTE)(((lLC.QuadPart - lAppStart.QuadPart) << 12) / lFreq.QuadPart) & 0x3F; +} + +static BYTE GetLineCounterBW(VOID) // get line counter value +{ + _ASSERT(byVblRef < 0x40); + return (0x40 + F4096Hz() - byVblRef) & 0x3F; +} + +static VOID StartDisplayBW(BYTE byInitial) +{ + // get positive VBL difference between now and stop time + byVblRef = (0x40 + F4096Hz() - byInitial) & 0x3F; + return; +} + +static VOID StopDisplayBW(VOID) +{ + BYTE a[2]; + ReadIO(a,LINECOUNT,2,TRUE); // update VBL at display off time + return; +} \ No newline at end of file diff --git a/source/EMU48.C b/source/EMU48.C index fb7159c..c8e46e2 100644 --- a/source/EMU48.C +++ b/source/EMU48.C @@ -13,7 +13,7 @@ #include "kml.h" #include "debugger.h" -#define VERSION "1.56+" +#define VERSION "1.57+" #ifdef _DEBUG LPCTSTR szNoTitle = _T("Emu48 ")_T(VERSION)_T(" Debug"); @@ -318,35 +318,6 @@ static BOOL IsFileWriteable(LPCTSTR szFilename) return bWriteable; } -// set listfield for sound device combo box -static VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID) -{ - WAVEOUTCAPS woc; - UINT uSelectDevice,uDevID,uDevNo; - - SendMessage(hWnd,CB_RESETCONTENT,0,0); - - // preset selector - uSelectDevice = (UINT) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) _T("Standard Audio")); - SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,WAVE_MAPPER); - - uDevNo = waveOutGetNumDevs(); - for (uDevID = 0; uDevID < uDevNo; ++uDevID) - { - if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR - && (woc.dwFormats & WAVE_FORMAT_4M08) != 0) - { - // copy product name to combo box - LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) woc.szPname); - SendMessage(hWnd,CB_SETITEMDATA,i,uDevID); - - if (uDevID == uDeviceID) uSelectDevice = i; - } - } - SendMessage(hWnd,CB_SETCURSEL,uSelectDevice,0L); - return; -} - // set listfield for serial combo boxes static VOID SetCommList(HWND hDlg,LPCTSTR szWireSetting,LPCTSTR szIrSetting) { @@ -394,7 +365,7 @@ static VOID SetCommList(HWND hDlg,LPCTSTR szWireSetting,LPCTSTR szIrSetting) // test if COM port is valid hComm = CreateFile(szBuffer,GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL); - if(hComm != INVALID_HANDLE_VALUE) + if (hComm != INVALID_HANDLE_VALUE) { VERIFY(CloseHandle(hComm)); bAddWire = bAddIr = TRUE; @@ -472,8 +443,7 @@ static INT_PTR CALLBACK SettingsGeneralProc(HWND hDlg, UINT uMsg, WPARAM wParam, if (bGrayscale != (BOOL) IsDlgButtonChecked(hDlg,IDC_GRAYSCALE)) { UINT nOldState = SwitchToState(SM_INVALID); - bGrayscale = !bGrayscale; // set new grayscale mode - UpdateContrast(Chipset.contrast); // update LCD color table for new mode + SetLcdMode(!bGrayscale); // set new display mode SwitchToState(nOldState); } @@ -534,7 +504,7 @@ static INT_PTR CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, WPARAM wParam, EnableWindow(GetDlgItem(hDlg,IDC_PORT1WR),FALSE); } } - else // HP38G/HP39G/HP40G/HP49G/HP39G+/HP48Gii/HP49G+ // CdB for HP: add apples + else // HP38G/HP39G/HP40G/HP49G { EnableWindow(GetDlgItem(hDlg,IDC_PORT1EN),FALSE); EnableWindow(GetDlgItem(hDlg,IDC_PORT1WR),FALSE); @@ -594,9 +564,9 @@ static INT_PTR CALLBACK SettingsMemoryProc(HWND hDlg, UINT uMsg, WPARAM wParam, && (Chipset.IORam[CARDCTL] & ECDT) != 0 && (Chipset.IORam[TIMER2_CTRL] & RUN) != 0 ) { - Chipset.HST |= MP; // set Module Pulled - IOBit(SRQ2,NINT,FALSE); // set NINT to low - Chipset.SoftInt = TRUE; // set interrupt + Chipset.HST |= MP; // set Module Pulled + IOBit(SRQ2,NINT,FALSE); // set NINT to low + Chipset.SoftInt = TRUE; // set interrupt bInterrupt = TRUE; } SwitchToState(nOldState); @@ -716,7 +686,7 @@ static INT_PTR CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, WPARAM wPar EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); } - if (cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') // HP49G/HP48GII/HP49G+ // CdB for HP: add Apples + if (cCurrentRomType=='X') // HP49G { SendDlgItemMessage(hDlg,IDC_IR,CB_RESETCONTENT,0,0); EnableWindow(GetDlgItem(hDlg,IDC_IR),FALSE); @@ -751,8 +721,7 @@ static INT_PTR CALLBACK SettingsPeripheralProc(HWND hDlg, UINT uMsg, WPARAM wPar ResetUdp(); // invalidate saved UDP address // set combobox parameter GetDlgItemText(hDlg,IDC_WIRE,szSerialWire,ARRAYSIZEOF(szSerialWire)); - // HP49G, 48GII, 49G+ Ir port is not connected - if (cCurrentRomType!='X' && cCurrentRomType!='2' && cCurrentRomType!='Q') // HP49G/HP48GII/HP49G+ // CdB for HP: add Apples + if (cCurrentRomType!='X') // HP49G Ir port is not connected GetDlgItemText(hDlg,IDC_IR,szSerialIr,ARRAYSIZEOF(szSerialIr)); return TRUE; } @@ -912,20 +881,25 @@ static LRESULT OnPaint(HWND hWindow) BitBlt(hPaintDC, Paint.rcPaint.left, Paint.rcPaint.top, Paint.rcPaint.right-Paint.rcPaint.left, Paint.rcPaint.bottom-Paint.rcPaint.top, hMainDC, rcMainPaint.left, rcMainPaint.top, SRCCOPY); + // CdB for HP: add apples display stuff SetWindowOrgEx(hPaintDC, nBackgroundX, nBackgroundY, NULL); + // redraw header display area StretchBlt(hPaintDC, nLcdX, nLcdY, - 131*nLcdZoom, Chipset.d0size*nLcdZoom, - hLcdDC, Chipset.d0offset, 0, 131, Chipset.d0size, SRCCOPY); + 131*nLcdZoom*nGdiXZoom, Chipset.d0size*nLcdZoom*nGdiYZoom, + hLcdDC, Chipset.d0offset, 0, 131, Chipset.d0size, SRCCOPY); + // redraw main display area - StretchBlt(hPaintDC, nLcdX, nLcdY+Chipset.d0size*nLcdZoom, - 131*nLcdZoom, nLines*nLcdZoom, - hLcdDC, Chipset.boffset, Chipset.d0size, 131, MAINSCREENHEIGHT, SRCCOPY); + StretchBlt(hPaintDC, nLcdX, nLcdY+Chipset.d0size*nLcdZoom*nGdiYZoom, + 131*nLcdZoom*nGdiXZoom, nLines*nLcdZoom*nGdiYZoom, + hLcdDC, Chipset.boffset, Chipset.d0size, + 131, MAINSCREENHEIGHT, SRCCOPY); // redraw menu display area - StretchBlt(hPaintDC, nLcdX, nLcdY+(MAINSCREENHEIGHT+Chipset.d0size)*nLcdZoom, - 131*nLcdZoom, MENUHEIGHT*nLcdZoom, - hLcdDC, 0, (MAINSCREENHEIGHT+Chipset.d0size), 131, MENUHEIGHT, SRCCOPY); + StretchBlt(hPaintDC, nLcdX, nLcdY+(MAINSCREENHEIGHT+Chipset.d0size)*nLcdZoom*nGdiYZoom, + 131*nLcdZoom*nGdiXZoom, MENUHEIGHT*nLcdZoom*nGdiYZoom, + hLcdDC, 0, (MAINSCREENHEIGHT+Chipset.d0size), + 131, MENUHEIGHT, SRCCOPY); GdiFlush(); } LeaveCriticalSection(&csGDILock); @@ -969,7 +943,7 @@ static LRESULT OnInitMenu(HMENU hMenu) EnableMenuItem(hMenu,ID_TOOL_MACRO_RECORD,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_PLAY,(bRun && nMacroState == MACRO_OFF) ? MF_ENABLED : MF_GRAYED); EnableMenuItem(hMenu,ID_TOOL_MACRO_STOP,(bRun && nMacroState != MACRO_OFF) ? MF_ENABLED : MF_GRAYED); - + MruUpdateMenu(hMenu); // update MRU list return 0; } @@ -981,7 +955,7 @@ static LRESULT OnDropFiles(HDROP hFilesInfo) { TCHAR szFileName[MAX_PATH]; WORD wNumFiles,wIndex; - BOOL bSuccess; + BOOL bSuccess = FALSE; // get number of files dropped wNumFiles = DragQueryFile (hFilesInfo,(UINT)-1,NULL,0); @@ -1030,7 +1004,7 @@ static LRESULT OnDropFiles(HDROP hFilesInfo) Sleep(dwWakeupDelay); KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode - while(Chipset.Shutdn == FALSE) Sleep(0); + while (Chipset.Shutdn == FALSE) Sleep(0); cancel: bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control @@ -1491,7 +1465,7 @@ static LRESULT OnObjectLoad(VOID) KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode - while(Chipset.Shutdn == FALSE) Sleep(0); + while (Chipset.Shutdn == FALSE) Sleep(0); } if (nState != SM_RUN) @@ -1546,7 +1520,7 @@ static LRESULT OnObjectLoad(VOID) KeyboardEvent(TRUE,0,0x8000); Sleep(dwWakeupDelay); KeyboardEvent(FALSE,0,0x8000); - while(Chipset.Shutdn == FALSE) Sleep(0); + while (Chipset.Shutdn == FALSE) Sleep(0); cancel: bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control @@ -1737,15 +1711,21 @@ static LRESULT OnToolDisasm(VOID) // disasm dialogbox call { if (pbyRom) SwitchToState(SM_SLEEP); if (DialogBox(hApp, MAKEINTRESOURCE(IDD_DISASM), hWnd, (DLGPROC)Disasm) == -1) - AbortMessage(_T("Disassembler Dialog Box Creation Error !")); + AbortMessage(_T("Disassembler Dialog Box Creation Error!")); if (pbyRom) SwitchToState(SM_RUN); return 0; } +static LRESULT OnTopics(VOID) +{ + ShellExecute(hWnd,_T("open"),_T("Emu48.htm"),NULL,szEmuDirectory,SW_SHOWNORMAL); + return 0; +} + static LRESULT OnAbout(VOID) { if (DialogBox(hApp, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)About) == -1) - AbortMessage(_T("About Dialog Box Creation Error !")); + AbortMessage(_T("About Dialog Box Creation Error!")); return 0; } @@ -1979,6 +1959,7 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar case ID_TOOL_MACRO_PLAY: return OnToolMacroPlay(); case ID_TOOL_MACRO_STOP: return OnToolMacroStop(); case ID_TOOL_MACRO_SETTINGS: return OnToolMacroSettings(); + case ID_HELP_TOPICS: return OnTopics(); case ID_ABOUT: return OnAbout(); } // check if command ID belongs to MRU file area @@ -2004,8 +1985,8 @@ LRESULT CALLBACK MainWndProc(HWND hWindow, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_LBUTTONUP: return OnLButtonUp((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); case WM_MOUSEMOVE: return OnMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); case WM_NCMOUSEMOVE: return OnNcMouseMove((UINT) wParam, LOWORD(lParam), HIWORD(lParam)); - case WM_KEYUP: return OnKeyUp((int)wParam, lParam); - case WM_KEYDOWN: return OnKeyDown((int)wParam, lParam); + case WM_KEYUP: return OnKeyUp((int) wParam, lParam); + case WM_KEYDOWN: return OnKeyDown((int) wParam, lParam); #if !defined _USRDLL // not in DLL version case WM_COPYDATA: return OnCopyData((PCOPYDATASTRUCT) lParam); #endif @@ -2125,10 +2106,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC rectWindow.top = 0; rectWindow.right = 256; rectWindow.bottom = 0; - AdjustWindowRect(&rectWindow, WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, TRUE); + AdjustWindowRect(&rectWindow, STYLE_TITLE, TRUE); hWnd = CreateWindow(MAKEINTATOM(classAtom),_T("Emu48"), - WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED, + STYLE_TITLE, CW_USEDEFAULT, CW_USEDEFAULT, rectWindow.right - rectWindow.left, rectWindow.bottom - rectWindow.top, @@ -2242,11 +2223,11 @@ start: while (GetMessage(&msg, NULL, 0, 0)) { - if( !TranslateAccelerator(hWnd, hAccel, &msg) - && (hDlgDebug == NULL || !IsDialogMessage(hDlgDebug, &msg)) - && (hDlgFind == NULL || !IsDialogMessage(hDlgFind, &msg)) - && (hDlgProfile == NULL || !IsDialogMessage(hDlgProfile, &msg)) - && (hDlgRplObjView == NULL || !IsDialogMessage(hDlgRplObjView, &msg))) + if ( !TranslateAccelerator(hWnd, hAccel, &msg) + && (hDlgDebug == NULL || !IsDialogMessage(hDlgDebug, &msg)) + && (hDlgFind == NULL || !IsDialogMessage(hDlgFind, &msg)) + && (hDlgProfile == NULL || !IsDialogMessage(hDlgProfile, &msg)) + && (hDlgRplObjView == NULL || !IsDialogMessage(hDlgRplObjView, &msg))) { TranslateMessage(&msg); DispatchMessage(&msg); diff --git a/source/Emu48.dsp b/source/EMU48.DSP similarity index 85% rename from source/Emu48.dsp rename to source/EMU48.DSP index aad0d55..5c6354e 100644 --- a/source/Emu48.dsp +++ b/source/EMU48.DSP @@ -4,26 +4,26 @@ # TARGTYPE "Win32 (x86) Application" 0x0101 -CFG=Emu48 - Win32 DebugRegDebug4x +CFG=Emu48 - Win32 Release !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "Emu48.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Emu48.mak" CFG="Emu48 - Win32 DebugRegDebug4x" -!MESSAGE +!MESSAGE +!MESSAGE NMAKE /f "Emu48.mak" CFG="Emu48 - Win32 Release" +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "Emu48 - Win32 Release" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Release Unicode" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 Debug Unicode" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 DebugRegDebug4x" (based on "Win32 (x86) Application") !MESSAGE "Emu48 - Win32 ReleaseRegDebug4x" (based on "Win32 (x86) Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -50,8 +50,8 @@ RSC=rc.exe # ADD CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /Yu"pch.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /d "NDEBUG" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -76,8 +76,8 @@ LINK32=link.exe # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /FR /Yu"pch.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /d "_DEBUG" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -100,11 +100,11 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c -# ADD CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /D "_UNICODE" /D "UNICODE" /Yu"pch.h" /FD /c +# ADD CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /Yu"pch.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "NDEBUG" -# ADD RSC /l 0x40c /d "NDEBUG" +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -127,11 +127,12 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /D "_UNICODE" /D "UNICODE" /FR /Yu"pch.h" /FD /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "STRICT" /D "REGISTRY" /FR /Yu"pch.h" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x40c /d "_DEBUG" -# ADD RSC /l 0x40c /d "_DEBUG" +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +# SUBTRACT RSC /x BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -143,14 +144,14 @@ LINK32=link.exe # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "DebugRegDebug4x" -# PROP BASE Intermediate_Dir "DebugRegDebug4x" +# PROP BASE Output_Dir "Emu48___Win32_DebugRegDebug4x" +# PROP BASE Intermediate_Dir "Emu48___Win32_DebugRegDebug4x" # PROP BASE Ignore_Export_Lib 0 # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "DebugRegDebug4x" -# PROP Intermediate_Dir "DebugRegDebug4x" +# PROP Output_Dir ".\DebugRegDebug4x" +# PROP Intermediate_Dir ".\DebugRegDebug4x" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /FR /Yu"pch.h" /FD /c @@ -170,14 +171,14 @@ LINK32=link.exe # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ReleaseRegDebug4x" -# PROP BASE Intermediate_Dir "ReleaseRegDebug4x" +# PROP BASE Output_Dir "Emu48___Win32_ReleaseRegDebug4x" +# PROP BASE Intermediate_Dir "Emu48___Win32_ReleaseRegDebug4x" # PROP BASE Ignore_Export_Lib 0 # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "ReleaseRegDebug4x" -# PROP Intermediate_Dir "ReleaseRegDebug4x" +# PROP Output_Dir ".\ReleaseRegDebug4x" +# PROP Intermediate_Dir ".\ReleaseRegDebug4x" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /Gr /MT /W3 /GX /O2 /Ob2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "STRICT" /Yu"pch.h" /FD /c @@ -193,7 +194,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib winmm.lib comctl32.lib advapi32.lib ws2_32.lib /nologo /subsystem:windows /machine:I386 -!ENDIF +!ENDIF # Begin Target @@ -280,6 +281,10 @@ SOURCE=.\kml.c # End Source File # Begin Source File +SOURCE=.\lowbat.c +# End Source File +# Begin Source File + SOURCE=.\mops.c # End Source File # Begin Source File @@ -313,6 +318,10 @@ SOURCE=.\settings.c # End Source File # Begin Source File +SOURCE=.\sndenum.c +# End Source File +# Begin Source File + SOURCE=.\sound.c # End Source File # Begin Source File @@ -381,6 +390,10 @@ SOURCE=.\pch.h # End Source File # Begin Source File +SOURCE=.\snddef.h +# End Source File +# Begin Source File + SOURCE=.\types.h # End Source File # End Group @@ -400,5 +413,9 @@ SOURCE=.\DBGTOOL.BMP SOURCE=.\Emu48.ico # End Source File # End Group +# Begin Source File + +SOURCE=.\EMU48.XML +# End Source File # End Target # End Project diff --git a/source/Emu48.dsw b/source/EMU48.DSW similarity index 85% rename from source/Emu48.dsw rename to source/EMU48.DSW index dbd3607..7cdd7d3 100644 --- a/source/Emu48.dsw +++ b/source/EMU48.DSW @@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00 ############################################################################### -Project: "Emu48"=".\Emu48.dsp" - Package Owner=<4> +Project: "Emu48"=.\Emu48.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/source/EMU48.H b/source/EMU48.H index d8d9d17..46a6f51 100644 --- a/source/EMU48.H +++ b/source/EMU48.H @@ -20,8 +20,8 @@ #define PORT2_PRESENT ((cCurrentRomType=='S')?P2C:P1C) #define PORT2_WRITE ((cCurrentRomType=='S')?P2W:P1W) -#define BINARYHEADER48 "HPHP48-W" -#define BINARYHEADER49 "HPHP49-W" +#define BINARYHEADER48 "HPHP48-W" +#define BINARYHEADER49 "HPHP49-W" #define BIN_FILTER "Port Data File (*.BIN)\0*.BIN\0All Files (*.*)\0*.*\0" #define HP_FILTER "HP Binary Object (*.HP;*.LIB)\0*.HP;*.LIB\0All Files (*.*)\0*.*\0" @@ -36,14 +36,14 @@ #define SM_RETURN 2 #define SM_SLEEP 3 -#define S_ERR_NO 0 // stack errorcodes +#define S_ERR_NO 0 // stack errorcodes #define S_ERR_OBJECT 1 -#define S_ERR_BINARY 2 -#define S_ERR_ASCII 3 +#define S_ERR_BINARY 2 +#define S_ERR_ASCII 3 #define BAD_OB (0xFFFFFFFF) // bad object -#define NO_SERIAL "disabled" // port not open +#define NO_SERIAL "disabled" // port not open #define HP_MNEMONICS FALSE // disassembler mnenomics mode #define CLASS_MNEMONICS TRUE @@ -61,7 +61,7 @@ // window styles #define STYLE_TITLE (WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_OVERLAPPED) -#define STYLE_NOTITLE (WS_POPUP|WS_CLIPSIBLINGS) +#define STYLE_NOTITLE (WS_POPUP|WS_SYSMENU|WS_MINIMIZEBOX|WS_CLIPSIBLINGS) // WM_COPYDATA identifier #define CDID_FILENAME 1 // send file name @@ -154,32 +154,39 @@ extern VOID WriteSettingsInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, INT nValue) extern VOID DelSettingsKey(LPCTSTR lpszSection, LPCTSTR lpszEntry); // Display.c -extern UINT nBackgroundX; -extern UINT nBackgroundY; -extern UINT nBackgroundW; -extern UINT nBackgroundH; -extern UINT nLcdX; -extern UINT nLcdY; -extern UINT nLcdZoom; -extern HDC hLcdDC; -extern HDC hMainDC; -extern VOID UpdateContrast(BYTE byContrast); -extern VOID SetLcdColor(UINT nId, UINT nRed, UINT nGreen, UINT nBlue); -extern VOID CreateLcdBitmap(VOID); -extern VOID DestroyLcdBitmap(VOID); -extern BOOL CreateMainBitmap(LPCTSTR szFilename); -extern VOID DestroyMainBitmap(VOID); -extern VOID UpdateDisplayPointers(VOID); -extern VOID UpdateMainDisplay(VOID); -extern VOID UpdateMenuDisplay(VOID); -extern VOID RefreshDisp0(); // CdB for HP: add apples display management -extern VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s); -extern VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s); -extern VOID UpdateAnnunciators(VOID); -extern VOID ResizeWindow(VOID); -extern BYTE GetLineCounter(VOID); -extern VOID StartDisplay(BYTE byInitial); -extern VOID StopDisplay(VOID); +extern BOOL bGrayscale; +extern UINT nBackgroundX; +extern UINT nBackgroundY; +extern UINT nBackgroundW; +extern UINT nBackgroundH; +extern UINT nLcdX; +extern UINT nLcdY; +extern UINT nLcdZoom; +extern UINT nGdiXZoom; +extern UINT nGdiYZoom; +extern HDC hLcdDC; +extern HDC hMainDC; +extern HDC hAnnunDC; +extern BYTE (*GetLineCounter)(VOID); +extern VOID (*StartDisplay)(BYTE byInitial); +extern VOID (*StopDisplay)(VOID); +extern VOID UpdateContrast(BYTE byContrast); +extern VOID SetLcdColor(UINT nId, UINT nRed, UINT nGreen, UINT nBlue); +extern VOID SetLcdMode(BOOL bMode); +extern VOID CreateLcdBitmap(VOID); +extern VOID DestroyLcdBitmap(VOID); +extern BOOL CreateMainBitmap(LPCTSTR szFilename); +extern VOID DestroyMainBitmap(VOID); +extern BOOL CreateAnnunBitmap(LPCTSTR szFilename); +extern VOID DestroyAnnunBitmap(VOID); +extern VOID UpdateDisplayPointers(VOID); +extern VOID UpdateMainDisplay(VOID); +extern VOID UpdateMenuDisplay(VOID); +extern VOID RefreshDisp0(); // CdB for HP: add apples display management +extern VOID WriteToMainDisplay(LPBYTE a, DWORD d, UINT s); +extern VOID WriteToMenuDisplay(LPBYTE a, DWORD d, UINT s); +extern VOID UpdateAnnunciators(VOID); +extern VOID ResizeWindow(VOID); // Engine.c extern BOOL bInterrupt; @@ -191,7 +198,6 @@ extern BOOL bKeySlow; extern BOOL bSoundSlow; extern UINT nOpcSlow; extern BOOL bCommInit; -extern BOOL bGrayscale; extern CHIPSET Chipset; extern TCHAR szSerialWire[16]; extern TCHAR szSerialIr[16]; @@ -283,6 +289,8 @@ extern BOOL GetSaveObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt); extern WORD WriteStack(UINT nStkLevel,LPBYTE lpBuf,DWORD dwSize); extern BOOL LoadObject(LPCTSTR szFilename); extern BOOL SaveObject(LPCTSTR szFilename); +extern BOOL LoadIconFromFile(LPCTSTR szFilename); +extern VOID LoadIconDefault(VOID); extern HBITMAP LoadBitmapFile(LPCTSTR szFilename); extern HRGN CreateRgnFromBitmap(HBITMAP hBmp,COLORREF color,DWORD dwTol); @@ -320,10 +328,16 @@ extern VOID IOBit(DWORD d, BYTE b, BOOL s); extern VOID ReadIO(BYTE *a, DWORD b, DWORD s, BOOL bUpdate); extern VOID WriteIO(BYTE *a, DWORD b, DWORD s); +// Lowbat.c +extern BOOL bLowBatDisable; +extern VOID StartBatMeasure(VOID); +extern VOID StopBatMeasure(VOID); +extern VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI); + // Keyboard.c extern DWORD dwKeyMinDelay; -extern VOID ScanKeyboard(BOOL bActive, BOOL bReset); -extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in); +extern VOID ScanKeyboard(BOOL bActive, BOOL bReset); +extern VOID KeyboardEvent(BOOL bPress, UINT out, UINT in); // Keymacro.c extern INT nMacroState; @@ -336,10 +350,10 @@ extern LRESULT OnToolMacroPlay(VOID); extern LRESULT OnToolMacroStop(VOID); extern LRESULT OnToolMacroSettings(VOID); -// Redeye.c +// Redeye.c extern VOID IrPrinter(BYTE c); -// Udp.c +// Udp.c extern TCHAR szUdpServer[1024]; extern WORD wUdpPort; extern VOID ResetUdp(VOID); @@ -361,8 +375,11 @@ extern VOID RPL_Replace(DWORD n); extern VOID RPL_Push(UINT l,DWORD n); // External.c -extern VOID External(CHIPSET* w); -extern VOID RCKBp(CHIPSET* w); +extern VOID External(CHIPSET* w); +extern VOID RCKBp(CHIPSET* w); + +// SndEnum.c +extern VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID); // Sound.c extern DWORD dwWaveVol; diff --git a/source/EMU48.RC b/source/EMU48.RC index 6bafc8d..aee5e04 100644 --- a/source/EMU48.RC +++ b/source/EMU48.RC @@ -106,7 +106,6 @@ BEGIN VERTGUIDE, 14 VERTGUIDE, 147 VERTGUIDE, 154 - VERTGUIDE, 161 VERTGUIDE, 237 TOPMARGIN, 7 BOTTOMMARGIN, 127 @@ -115,7 +114,7 @@ BEGIN IDD_CHOOSEKML, DIALOG BEGIN LEFTMARGIN, 7 - RIGHTMARGIN, 188 + RIGHTMARGIN, 208 TOPMARGIN, 7 BOTTOMMARGIN, 59 END @@ -242,7 +241,7 @@ BEGIN LTEXT "Find &what:",IDC_STATIC,7,9,34,8 COMBOBOX IDC_FIND_DATA,46,7,88,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - CONTROL "Find &ASCII",IDC_FIND_ASCII,"Button",BS_AUTOCHECKBOX | + CONTROL "Find &ASCII",IDC_FIND_ASCII,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,141,9,49,10 PUSHBUTTON "&Previous",IDC_FIND_PREV,6,26,50,14 DEFPUSHBUTTON "&Next",IDC_FIND_NEXT,74,26,50,14 @@ -296,7 +295,7 @@ FONT 8, "MS Sans Serif" BEGIN ICON IDI_EMU48,IDC_STATIC,7,6,20,20,SS_REALSIZEIMAGE LTEXT "",IDC_VERSION,29,6,151,8,NOT WS_GROUP - LTEXT "Copyright © 2015 Christoph Gießelink && Sébastien Carlier", + LTEXT "Copyright © 2017 Christoph Gießelink && Sébastien Carlier", IDC_STATIC,29,18,181,8 DEFPUSHBUTTON "OK",IDOK,215,12,39,14 EDITTEXT IDC_LICENSE,7,33,247,112,ES_MULTILINE | ES_AUTOHSCROLL | @@ -384,18 +383,18 @@ BEGIN GROUPBOX "Serial Ports",IDC_STATIC,161,64,83,50 END -IDD_CHOOSEKML DIALOG DISCARDABLE 0, 0, 195, 66 +IDD_CHOOSEKML DIALOG DISCARDABLE 0, 0, 215, 66 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Choose Your KML Script" FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "OK",IDOK,138,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,138,27,50,14 - COMBOBOX IDC_KMLSCRIPT,7,47,181,120,CBS_DROPDOWNLIST | + DEFPUSHBUTTON "OK",IDOK,158,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,158,27,50,14 + COMBOBOX IDC_KMLSCRIPT,7,47,201,120,CBS_DROPDOWNLIST | CBS_OEMCONVERT | CBS_SORT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EMUDIR,7,17,106,14,ES_AUTOHSCROLL - PUSHBUTTON "...",IDC_EMUDIRSEL,113,17,10,14 - PUSHBUTTON "V",IDC_UPDATE,123,17,10,14 + EDITTEXT IDC_EMUDIR,7,17,126,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_EMUDIRSEL,133,17,10,14 + PUSHBUTTON "V",IDC_UPDATE,143,17,10,14 LTEXT "Emu48 Directory :",IDC_STATIC,7,7,115,8 LTEXT "Current KML Script :",IDC_STATIC,7,37,115,8 END @@ -411,9 +410,9 @@ BEGIN IDC_ALWAYSDISPLOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 7,146,139,14 GROUPBOX "",IDC_STATIC,7,7,287,36 - CTEXT "Title of the Script",IDC_TITLE,71,14,158,8 - CTEXT "by",IDC_STATIC,71,22,158,8 - CTEXT "The Author",IDC_AUTHOR,71,30,158,8,NOT WS_GROUP + CTEXT "Title of the Script",IDC_TITLE,7,14,287,8 + CTEXT "by",IDC_STATIC,7,22,287,8 + CTEXT "The Author",IDC_AUTHOR,7,30,287,8,NOT WS_GROUP EDITTEXT IDC_KMLLOG,7,48,287,92,ES_MULTILINE | ES_AUTOHSCROLL | ES_OEMCONVERT | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP @@ -692,8 +691,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,6,0 - PRODUCTVERSION 1,5,6,0 + FILEVERSION 1,5,7,0 + PRODUCTVERSION 1,5,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -709,13 +708,13 @@ BEGIN BLOCK "04090000" BEGIN VALUE "CompanyName", "Christoph Gießelink & Sebastien Carlier\0" - VALUE "FileDescription", "HP38/39/40/48/49 Emulator\0" - VALUE "FileVersion", "1, 5, 6, 0\0" + VALUE "FileDescription", "HP38/39/40/48/49/50 Emulator\0" + VALUE "FileVersion", "1, 5, 7, 0\0" VALUE "InternalName", "Emu48\0" - VALUE "LegalCopyright", "Copyright © 2015\0" + VALUE "LegalCopyright", "Copyright © 2017\0" VALUE "OriginalFilename", "Emu48.exe\0" VALUE "ProductName", "Emu48\0" - VALUE "ProductVersion", "1, 5, 6, 0\0" + VALUE "ProductVersion", "1, 5, 7, 0\0" END END BLOCK "VarFileInfo" @@ -797,6 +796,8 @@ BEGIN END POPUP "&Help" BEGIN + MENUITEM "&Help Topics", ID_HELP_TOPICS + MENUITEM SEPARATOR MENUITEM "&About Emu48...", ID_ABOUT END END @@ -862,6 +863,8 @@ BEGIN END POPUP "&Help" BEGIN + MENUITEM "&Help Topics", ID_HELP_TOPICS + MENUITEM SEPARATOR MENUITEM "&About Emu48...", ID_ABOUT END END diff --git a/source/EMU48DLL.DSP b/source/EMU48DLL.DSP index 006ac00..0e4911d 100644 --- a/source/EMU48DLL.DSP +++ b/source/EMU48DLL.DSP @@ -120,6 +120,10 @@ SOURCE=.\display.c # End Source File # Begin Source File +SOURCE=.\disrpl.c +# End Source File +# Begin Source File + SOURCE=.\Emu48.c # End Source File # Begin Source File @@ -164,6 +168,10 @@ SOURCE=.\kml.c # End Source File # Begin Source File +SOURCE=.\lowbat.c +# End Source File +# Begin Source File + SOURCE=.\mops.c # End Source File # Begin Source File @@ -197,6 +205,10 @@ SOURCE=.\settings.c # End Source File # Begin Source File +SOURCE=.\sndenum.c +# End Source File +# Begin Source File + SOURCE=.\sound.c # End Source File # Begin Source File @@ -229,6 +241,10 @@ SOURCE=.\debugger.h # End Source File # Begin Source File +SOURCE=.\disrpl.h +# End Source File +# Begin Source File + SOURCE=.\Emu48.h # End Source File # Begin Source File @@ -261,6 +277,10 @@ SOURCE=.\pch.h # End Source File # Begin Source File +SOURCE=.\snddef.h +# End Source File +# Begin Source File + SOURCE=.\types.h # End Source File # End Group @@ -269,6 +289,14 @@ SOURCE=.\types.h # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" # Begin Source File +SOURCE=.\CHECKBOX.BMP +# End Source File +# Begin Source File + +SOURCE=.\DBGTOOL.BMP +# End Source File +# Begin Source File + SOURCE=.\Emu48.ico # End Source File # End Group diff --git a/source/ENGINE.C b/source/ENGINE.C index aa73503..6123270 100644 --- a/source/ENGINE.C +++ b/source/ENGINE.C @@ -31,8 +31,8 @@ TCHAR szSerialIr[16]; // devicename for IR port DWORD dwSXCycles = 82; // SX cpu cycles in interval DWORD dwGXCycles = 123; // GX cpu cycles in interval -DWORD dwGPCycles = 123*3; // G+ cpu cycles in interval // CdB for HP: add apples display management -DWORD dwG2Cycles = 123*2; // Gii cpu cycles in interval // CdB for HP: add apples display management +DWORD dwGPCycles = 123*3; // g+ cpu cycles in interval // CdB for HP: add apples display management +DWORD dwG2Cycles = 123*2; // gII cpu cycles in interval // CdB for HP: add apples display management // variables for debugger engine HANDLE hEventDebug; // event handle to stop cpu thread @@ -571,9 +571,10 @@ loop: QueryPerformanceCounter(&lDummyInt); dwSpeedRef = lDummyInt.LowPart; SetHP48Time(); // update HP48 time & date - StartTimers(); // start display counter/update engine StartDisplay((BYTE)(((Chipset.IORam[LINECOUNT+1]<<4)|Chipset.IORam[LINECOUNT])&0x3F)); + StartBatMeasure(); // start battery measurement + StartTimers(); } PCHANGED; while (!bInterrupt) @@ -631,6 +632,7 @@ loop: _ASSERT(nNextState != SM_RUN); StopDisplay(); // stop display counter/update + StopBatMeasure(); // stop battery measurement StopTimers(); while (nNextState == SM_SLEEP) // go into sleep state diff --git a/source/EXTERNAL.C b/source/EXTERNAL.C index a4b8ec8..9193d19 100644 --- a/source/EXTERNAL.C +++ b/source/EXTERNAL.C @@ -4,14 +4,13 @@ * This file is part of Emu48 * * Copyright (C) 1995 Sebastien Carlier + * Copyright (C) 2005 Christoph Gießelink * */ #include "pch.h" #include "Emu48.h" #include "ops.h" -#define SAMPLES_PER_SEC 44100 // sound sampling rate - //| 38G | 39G | 40G | 48SX | 48GX | 49G | Name //#F0E4F #80F0F #80F0F #706D2 #80850 #80F0F =SFLAG53_56 @@ -21,7 +20,7 @@ ? 0xE0E4F \ : ( (cCurrentRomType=='A') \ ? 0xF0E4F \ - : ( (cCurrentRomType!='E' && cCurrentRomType!='X' && cCurrentRomType!='P' && cCurrentRomType!='2' && cCurrentRomType!='Q') \ + : ( (cCurrentRomType!='E' && cCurrentRomType!='X' && cCurrentRomType!='P' && cCurrentRomType!='2' && cCurrentRomType!='Q') \ ? ( (cCurrentRomType=='S') \ ? 0x706D2 \ : 0x80850 \ @@ -67,9 +66,9 @@ VOID RCKBp(CHIPSET* w) // ROM Check Beep patch f = w->C[1]; // f = freq ctl d = w->C[0]; // d = duration ctl - + if (cCurrentRomType == 'S') // Clarke chip with 48S ROM - { + { // CPU strobe frequency @ RATE 14 = 1.97MHz dwCpuFreq = ((14 + 1) * 524288) >> 2; @@ -92,7 +91,7 @@ VOID RCKBp(CHIPSET* w) // ROM Check Beep patch SoundBeep(freq,dur); // beeping // estimate cpu cycles for beeping time (2MHz / 4MHz) - w->cycles += dur * ((cCurrentRomType=='S') ? 2000 : 4000); + w->cycles += dur * ((cCurrentRomType=='S') ? 2000 : 4000); w->P = 0; // P=0 w->carry = FALSE; // RTNCC diff --git a/source/FILES.C b/source/FILES.C index ca03d00..b79fa09 100644 --- a/source/FILES.C +++ b/source/FILES.C @@ -225,7 +225,7 @@ static TREENODE *nodePatch = NULL; static BOOL PatchNibble(DWORD dwAddress, BYTE byPatch) { - TREENODE *p; + PTREENODE p; _ASSERT(pbyRom); // ROM defined if ((p = (PTREENODE) malloc(sizeof(TREENODE))) == NULL) @@ -675,7 +675,7 @@ BOOL MapPort2(LPCTSTR szFilename) dwFileSizeLo = GetFileSize(hPort2File, &dwFileSizeHi); // size not 32, 128, 256, 512, 1024, 2048 or 4096 KB - if ( dwFileSizeHi != 0 + if ( dwFileSizeHi != 0 || dwFileSizeLo == 0 || (dwFileSizeLo & (dwFileSizeLo - 1)) != 0 || (dwFileSizeLo & 0xFF02FFFF) != 0) @@ -830,7 +830,7 @@ BOOL NewDocument(VOID) // use 2nd command line argument if defined MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); } - if (Chipset.type == 'X' || Chipset.type == '2' || Chipset.type == 'Q') // HP49G/HP48Gii/HP49G+ // CdB for HP: add apples + if (Chipset.type == 'X' || Chipset.type == '2' || Chipset.type == 'Q') // HP49G/HP48gII/HP49g+/50g // CdB for HP: add apples { Chipset.Port0Size = 256; Chipset.Port1Size = 128; @@ -841,11 +841,11 @@ BOOL NewDocument(VOID) FlashInit(); // init flash structure } - if (Chipset.type == 'Q') // HP49G+ // CdB for HP: add apples + + if (Chipset.type == 'Q') // HP49g+/50g // CdB for HP: add apples { Chipset.d0size = 16; } - Chipset.IORam[LPE] = RST; // set ReSeT bit at power on reset // allocate port memory @@ -861,7 +861,7 @@ BOOL NewDocument(VOID) } if (Chipset.Port2Size) { - Port2 = (LPBYTE) calloc(Chipset.Port2Size*2048,sizeof(*Port2)); + Port2 = (LPBYTE) calloc(Chipset.Port2Size*2048,sizeof(*Port1)); _ASSERT(Port2 != NULL); } LoadBreakpointList(NULL); // clear debugger breakpoint list @@ -873,14 +873,13 @@ restore: ResetBackup(); // HP48SX/GX - if(Chipset.type == 'S' || Chipset.type == 'G') + if (Chipset.type == 'S' || Chipset.type == 'G') { // use 2nd command line argument if defined MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); } if (pbyRom) { - SetWindowLocation(hWnd,Chipset.nPosX,Chipset.nPosY); Map(0x00,0xFF); } return FALSE; @@ -1060,7 +1059,7 @@ BOOL OpenDocument(LPCTSTR szFilename) } // HP48SX/GX - if(cCurrentRomType=='S' || cCurrentRomType=='G') + if (cCurrentRomType=='S' || cCurrentRomType=='G') { MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); // port2 changed and card detection enabled @@ -1097,7 +1096,7 @@ BOOL OpenDocument(LPCTSTR szFilename) RomSwitch(Chipset.Bank_FF); // reload ROM view of HP49G and map memory - if (Chipset.wRomCrc != wRomCrc) // ROM changed + if (Chipset.wRomCrc != wRomCrc) // ROM changed { CpuReset(); Chipset.Shutdn = FALSE; // automatic restart @@ -1128,7 +1127,7 @@ restore: ResetBackup(); // HP48SX/GX - if(cCurrentRomType=='S' || cCurrentRomType=='G') + if (cCurrentRomType=='S' || cCurrentRomType=='G') { // use 2nd command line argument if defined MapPort2((nArgc < 3) ? szPort2Filename : ppArgv[2]); @@ -1400,12 +1399,12 @@ BOOL GetSaveAsFilename(VOID) ofn.lpstrDefExt = _T("e38"); ofn.nFilterIndex = 1; } - if (cCurrentRomType=='E' || cCurrentRomType=='P') // HP39/40G/hp439G+ // CdB for HP: add apples + if (cCurrentRomType=='E' || cCurrentRomType=='P') // HP39/40 // CdB for HP: add apples { ofn.lpstrDefExt = _T("e39"); ofn.nFilterIndex = 2; } - if (cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') // HP49G/HP48Gii/HP49G+ // CdB for HP: add apples + if (cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') // HP49G/HP48gII/HP49g+/HP50g // CdB for HP: add apples { ofn.lpstrDefExt = _T("e49"); ofn.nFilterIndex = 4; @@ -1446,7 +1445,7 @@ BOOL GetSaveObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt) InitializeOFN(&ofn); ofn.lpstrFilter = lpstrFilter; - ofn.lpstrDefExt = lpstrDefExt; + ofn.lpstrDefExt = NULL; ofn.nFilterIndex = 1; ofn.lpstrFile = szBuffer; ofn.lpstrFile[0] = 0; @@ -1455,6 +1454,19 @@ BOOL GetSaveObjectFilename(LPCTSTR lpstrFilter,LPCTSTR lpstrDefExt) if (GetSaveFileName(&ofn) == FALSE) return FALSE; _ASSERT(ARRAYSIZEOF(szBufferFilename) == ofn.nMaxFile); lstrcpy(szBufferFilename, ofn.lpstrFile); + if (ofn.nFileExtension == 0) // given filename has no extension + { + // actual name length + UINT nLength = lstrlen(szBufferFilename); + + // destination buffer has room for the default extension + if (nLength + 1 + lstrlen(lpstrDefExt) < ARRAYSIZEOF(szBufferFilename)) + { + // add default extension + szBufferFilename[nLength++] = _T('.'); + lstrcpy(&szBufferFilename[nLength], lpstrDefExt); + } + } return TRUE; } @@ -1472,12 +1484,12 @@ WORD WriteStack(UINT nStkLevel,LPBYTE lpBuf,DWORD dwSize) // separated from Load DWORD dwAddress, i; bBinary = ((lpBuf[dwSize+0]=='H') - && (lpBuf[dwSize+1]=='P') - && (lpBuf[dwSize+2]=='H') - && (lpBuf[dwSize+3]=='P') - && (lpBuf[dwSize+4]=='4') + && (lpBuf[dwSize+1]=='P') + && (lpBuf[dwSize+2]=='H') + && (lpBuf[dwSize+3]=='P') + && (lpBuf[dwSize+4]=='4') && (lpBuf[dwSize+5]==((cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='Q') ? '9' : '8')) // CdB for HP: add apples - && (lpBuf[dwSize+6]=='-')); + && (lpBuf[dwSize+6]=='-')); for (dwAddress = 0, i = 0; i < dwSize; i++) { @@ -1581,7 +1593,7 @@ BOOL SaveObject(LPCTSTR szFilename) // separated stack reading part ? (LPBYTE) BINARYHEADER49 : (LPBYTE) BINARYHEADER48; - WriteFile(hFile, pbyHeader, 8, &lBytesWritten, NULL); + WriteFile(hFile, pbyHeader, 8, &lBytesWritten, NULL); while (dwLength--) { @@ -1595,6 +1607,39 @@ BOOL SaveObject(LPCTSTR szFilename) // separated stack reading part +//################ +//# +//# Load Icon +//# +//################ + +BOOL LoadIconFromFile(LPCTSTR szFilename) +{ + HANDLE hIcon; + + SetCurrentDirectory(szEmuDirectory); + // not necessary to destroy because icon is shared + hIcon = LoadImage(NULL, szFilename, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE|LR_LOADFROMFILE|LR_SHARED); + SetCurrentDirectory(szCurrentDirectory); + + if (hIcon) + { + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) hIcon); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) hIcon); + } + return hIcon != NULL; +} + +VOID LoadIconDefault(VOID) +{ + // use window class icon + SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM) NULL); + SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM) NULL); + return; +} + + + //################ //# //# Load Bitmap @@ -1732,7 +1777,7 @@ static HBITMAP DecodeBmp(LPBMPFILE pBmp) else { dwFileSize += WIDTHBYTES(pBmi->bmiHeader.biWidth * pBmi->bmiHeader.biBitCount) - * labs(pBmi->bmiHeader.biHeight); + * labs(pBmi->bmiHeader.biHeight); } if (pBmp->dwFileSize < dwFileSize) return NULL; @@ -2325,7 +2370,7 @@ HBITMAP LoadBitmapFile(LPCTSTR szFilename) if ( Bmp.dwFileSize >= 6 && (memcmp(Bmp.pbyFile,"GIF87a",6) == 0 || memcmp(Bmp.pbyFile,"GIF89a",6) == 0)) { - hBitmap = DecodeGif(&Bmp,NULL); + hBitmap = DecodeGif(&Bmp,&dwTColor); break; } diff --git a/source/I28F160.H b/source/I28F160.H index b95535b..a164678 100644 --- a/source/I28F160.H +++ b/source/I28F160.H @@ -14,14 +14,14 @@ typedef struct { BYTE byType[4]; // "WSM" UINT uSize; // size of this structure - BYTE byVersion; // WSM version + BYTE byVersion; // WSM version - BOOL bRomArray; // copy of bFlashRomArray - DWORD dwLockCnfg; // block lock table (32 entries) + BOOL bRomArray; // copy of bFlashRomArray + DWORD dwLockCnfg; // block lock table (32 entries) UINT uWrState; // state of write function WSM UINT uRdState; // state of read function WSM - BYTE byStatusReg; // status register - BYTE byExStatusReg; // extended status register + BYTE byStatusReg; // status register + BYTE byExStatusReg; // extended status register BYTE byWrite1No; // no. of written data in write buffer1 BYTE byWrite1Size; // no. of valid data in write buffer1 DWORD dwWrite1Addr; // destination address of buffer1 diff --git a/source/IO.H b/source/IO.H index c622adf..b5a4bda 100644 --- a/source/IO.H +++ b/source/IO.H @@ -129,7 +129,7 @@ // 0x1d Led Buffer Register [0 0 0 LBO] (bits 1-3 read zero) #define LBO 0x01 -// 0x28 Display Line Counter LSB [LC3 LC2 LC1 LC0] +// 0x28 Display Line Counter LSB [LC3 LC2 LC1 LC0] #define LC3 0x08 // LC3 - Line Counter Bit3 #define LC2 0x04 // LC2 - Line Counter Bit2 #define LC1 0x02 // LC1 - Line Counter Bit1 diff --git a/source/KML.C b/source/KML.C index a21c1d4..5297d9e 100644 --- a/source/KML.C +++ b/source/KML.C @@ -76,15 +76,18 @@ static CONST KmlToken pLexToken[] = {TOK_VIRTUAL, 000000, 7,_T("Virtual")}, {TOK_INCLUDE, 000002, 7,_T("Include")}, {TOK_NOTFLAG, 000001, 7,_T("NotFlag")}, + {TOK_MENUBAR, 000001, 7,_T("Menubar")}, // for PPC compatibility reasons {TOK_GLOBAL, 000000, 6,_T("Global")}, {TOK_AUTHOR, 000002, 6,_T("Author")}, {TOK_BITMAP, 000002, 6,_T("Bitmap")}, {TOK_OFFSET, 000011, 6,_T("Offset")}, + {TOK_ZOOMXY, 000011, 6,_T("Zoomxy")}, {TOK_BUTTON, 000001, 6,_T("Button")}, {TOK_IFFLAG, 000001, 6,_T("IfFlag")}, {TOK_ONDOWN, 000000, 6,_T("OnDown")}, {TOK_NOHOLD, 000000, 6,_T("NoHold")}, {TOK_LOCALE, 000001, 6,_T("Locale")}, + {TOK_TOPBAR, 000001, 6,_T("Topbar")}, // for PPC compatibility reasons {TOK_TITLE, 000002, 5,_T("Title")}, {TOK_OUTIN, 000011, 5,_T("OutIn")}, {TOK_PATCH, 000002, 5,_T("Patch")}, @@ -95,14 +98,17 @@ static CONST KmlToken pLexToken[] = {TOK_CLASS, 000001, 5,_T("Class")}, {TOK_PRESS, 000001, 5,_T("Press")}, {TOK_IFMEM, 000111, 5,_T("IfMem")}, + {TOK_SCALE, 000011, 5,_T("Scale")}, {TOK_TYPE, 000001, 4,_T("Type")}, {TOK_SIZE, 000011, 4,_T("Size")}, {TOK_ZOOM, 000001, 4,_T("Zoom")}, {TOK_DOWN, 000011, 4,_T("Down")}, {TOK_ELSE, 000000, 4,_T("Else")}, {TOK_ONUP, 000000, 4,_T("OnUp")}, + {TOK_ICON, 000002, 4,_T("Icon")}, {TOK_MAP, 000011, 3,_T("Map")}, {TOK_ROM, 000002, 3,_T("Rom")}, + {TOK_VGA, 000001, 3,_T("Vga")}, // for PPC compatibility reasons {TOK_LCD, 000000, 3,_T("Lcd")}, {TOK_END, 000000, 3,_T("End")}, {TOK_NONE, 000000, 0,_T("")} @@ -134,6 +140,9 @@ static UINT uButtonClicked = 0; static BOOL bKeyPressed = FALSE; // no key pressed static UINT uLastKeyPressed = 0; // var for last pressed key +static INT nScaleMul = 0; // no scaling +static INT nScaleDiv = 0; + //################ //# //# Compilation Result @@ -1239,6 +1248,14 @@ static VOID InitGlobal(KmlBlock* pBlock) nCurrentClass = (UINT) pLine->nParam[0]; PrintfToLog(_T("Calculator Class : %u"), nCurrentClass); break; + case TOK_ICON: + if (!LoadIconFromFile((LPTSTR) pLine->nParam[0])) + { + PrintfToLog(_T("Cannot load Icon %s."), (LPTSTR)pLine->nParam[0]); + break; + } + PrintfToLog(_T("Icon %s loaded."), (LPTSTR)pLine->nParam[0]); + break; case TOK_DEBUG: bDebug = (BOOL) pLine->nParam[0]&1; PrintfToLog(_T("Debug %s"), bDebug?_T("On"):_T("Off")); @@ -1287,6 +1304,10 @@ static VOID InitGlobal(KmlBlock* pBlock) dwTColorTol = (DWORD) pLine->nParam[0]; dwTColor = RGB((BYTE) pLine->nParam[1],(BYTE) pLine->nParam[2],(BYTE) pLine->nParam[3]); break; + case TOK_SCALE: + nScaleMul = (INT) pLine->nParam[0]; + nScaleDiv = (INT) pLine->nParam[1]; + break; default: PrintfToLog(_T("Command %s Ignored in Block %s"), GetStringOf(pLine->eCommand), GetStringOf(pBlock->eType)); } @@ -1332,13 +1353,45 @@ static KmlLine* InitLcd(KmlBlock* pBlock) nLcdY = (UINT) pLine->nParam[1]; break; case TOK_ZOOM: - if ((nLcdZoom = (UINT) pLine->nParam[0]) == 0) - nLcdZoom = 1; + if ((nGdiXZoom = (UINT) pLine->nParam[0]) == 0) + nGdiXZoom = 1; // default zoom + + // search for memory DC zoom (1-4) + for (nLcdZoom = 4; (nGdiXZoom % nLcdZoom) != 0; --nLcdZoom) { }; + _ASSERT(nLcdZoom > 0); // because (nGdiXZoom % 1) == 0 + nGdiXZoom /= nLcdZoom; // remainder is GDI zoom + nGdiYZoom = nGdiXZoom; + break; + case TOK_ZOOMXY: + if ((nGdiXZoom = (UINT) pLine->nParam[0]) == 0) + nGdiXZoom = 1; // default zoom + if ((nGdiYZoom = (UINT) pLine->nParam[1]) == 0) + nGdiYZoom = 1; // default zoom + + // search for memory DC zoom (1-4) + for (nLcdZoom = 4; ((nGdiXZoom % nLcdZoom) | (nGdiYZoom % nLcdZoom)) != 0 ; --nLcdZoom) { }; + _ASSERT(nLcdZoom > 0); // because (nGdiYZoom % 1) == 0 && (nGdiYZoom % 1) == 0 + nGdiXZoom /= nLcdZoom; // remainder is GDI zoom + nGdiYZoom /= nLcdZoom; break; case TOK_COLOR: SetLcdColor((UINT) pLine->nParam[0],(UINT) pLine->nParam[1], (UINT) pLine->nParam[2],(UINT) pLine->nParam[3]); break; + case TOK_BITMAP: + if (hAnnunDC != NULL) + { + PrintfToLog(_T("Bitmap %s ignored."), (LPCTSTR)pLine->nParam[0]); + AddToLog(_T("Please put only one Bitmap command in the Lcd block.")); + break; + } + if (!CreateAnnunBitmap((LPCTSTR)pLine->nParam[0])) + { + PrintfToLog(_T("Cannot load Annunciator Bitmap %s."), (LPCTSTR)pLine->nParam[0]); + break; + } + PrintfToLog(_T("Annunciator Bitmap %s loaded."), (LPCTSTR)pLine->nParam[0]); + break; case TOK_END: return pLine; default: @@ -1628,6 +1681,7 @@ VOID KillKML(VOID) } UnmapRom(); DestroyLcdBitmap(); + DestroyAnnunBitmap(); DestroyMainBitmap(); if (hPalette) { @@ -1649,6 +1703,7 @@ VOID KillKML(VOID) } hRgn = NULL; } + LoadIconDefault(); bClicking = FALSE; uButtonClicked = 0; FreeBlocks(pKml); @@ -1670,8 +1725,12 @@ VOID KillKML(VOID) nBackgroundW = 256; nBackgroundH = 0; nLcdZoom = 1; + nGdiXZoom = 1; + nGdiYZoom = 1; dwTColor = (DWORD) -1; dwTColorTol = 0; + nScaleMul = 0; + nScaleDiv = 0; cCurrentRomType = 0; nCurrentClass = 0; ResizeWindow(); @@ -2065,17 +2124,22 @@ VOID RefreshButtons(RECT *rc) VOID DrawAnnunciator(UINT nId, BOOL bOn) { + HDC hDC; UINT nSx,nSy; --nId; // zero based ID if (nId >= ARRAYSIZEOF(pAnnunciator)) return; if (bOn) { + hDC = hAnnunDC != NULL ? hAnnunDC : hMainDC; + nSx = pAnnunciator[nId].nDx; // position of annunciator nSy = pAnnunciator[nId].nDy; } else { + hDC = hMainDC; + nSx = pAnnunciator[nId].nOx; // position of background nSy = pAnnunciator[nId].nOy; } @@ -2084,7 +2148,7 @@ VOID DrawAnnunciator(UINT nId, BOOL bOn) BitBlt(hWindowDC, pAnnunciator[nId].nOx, pAnnunciator[nId].nOy, pAnnunciator[nId].nCx, pAnnunciator[nId].nCy, - hMainDC, + hDC, nSx, nSy, SRCCOPY); GdiFlush(); @@ -2280,6 +2344,105 @@ VOID PlayKey(UINT nOut, UINT nIn, BOOL bPressed) //# //################ +static VOID ResizeMainBitmap(INT nMul, INT nDiv) +{ + if (nMul * nDiv > 0) // resize main picture + { + BITMAP Bitmap; + int nMode; + INT nWidth,nHeight; + UINT i; + + // update graphic + nBackgroundX = MulDiv(nBackgroundX,nMul,nDiv); + nBackgroundY = MulDiv(nBackgroundY,nMul,nDiv); + nBackgroundW = MulDiv(nBackgroundW,nMul,nDiv); + nBackgroundH = MulDiv(nBackgroundH,nMul,nDiv); + nLcdX = MulDiv(nLcdX,nMul,nDiv); + nLcdY = MulDiv(nLcdY,nMul,nDiv); + nGdiXZoom = MulDiv(nGdiXZoom * nLcdZoom,nMul,nDiv); + nGdiYZoom = MulDiv(nGdiYZoom * nLcdZoom,nMul,nDiv); + + // search for memory DC zoom (1-4) + for (nLcdZoom = 4; ((nGdiXZoom % nLcdZoom) | (nGdiYZoom % nLcdZoom)) != 0 ; --nLcdZoom) { }; + _ASSERT(nLcdZoom > 0); // because (nGdiYZoom % 1) == 0 && (nGdiYZoom % 1) == 0 + nGdiXZoom /= nLcdZoom; // remainder is GDI zoom + nGdiYZoom /= nLcdZoom; + + // update script coordinates (buttons) + for (i = 0; i < nButtons; ++i) + { + pButton[i].nOx = (UINT) (pButton[i].nOx * nMul / nDiv); + pButton[i].nOy = (UINT) (pButton[i].nOy * nMul / nDiv); + pButton[i].nDx = (UINT) (pButton[i].nDx * nMul / nDiv); + pButton[i].nDy = (UINT) (pButton[i].nDy * nMul / nDiv); + pButton[i].nCx = (UINT) (pButton[i].nCx * nMul / nDiv); + pButton[i].nCy = (UINT) (pButton[i].nCy * nMul / nDiv); + } + + // update script coordinates (annunciators) + for (i = 0; i < ARRAYSIZEOF(pAnnunciator); ++i) + { + // translate offset + pAnnunciator[i].nOx = (UINT) (pAnnunciator[i].nOx * nMul / nDiv); + pAnnunciator[i].nOy = (UINT) (pAnnunciator[i].nOy * nMul / nDiv); + + if (hAnnunDC == NULL) // no external annunciator bitmap + { + // translate down (with rounding) + pAnnunciator[i].nDx = (UINT) MulDiv(pAnnunciator[i].nDx,nMul,nDiv); + pAnnunciator[i].nDy = (UINT) MulDiv(pAnnunciator[i].nDy,nMul,nDiv); + // translate size (with rounding) + pAnnunciator[i].nCx = (UINT) MulDiv(pAnnunciator[i].nCx,nMul,nDiv); + pAnnunciator[i].nCy = (UINT) MulDiv(pAnnunciator[i].nCy,nMul,nDiv); + } + } + + EnterCriticalSection(&csGDILock); // solving NT GDI problems + { + // get bitmap size + GetObject(GetCurrentObject(hMainDC,OBJ_BITMAP),sizeof(Bitmap),&Bitmap); + + // resulting bitmap size + nWidth = MulDiv(Bitmap.bmWidth,nMul,nDiv); + nHeight = MulDiv(Bitmap.bmHeight,nMul,nDiv); + + VERIFY(nMode = SetStretchBltMode(hMainDC,HALFTONE)); + + if (nMul <= nDiv) // shrinking bitmap + { + VERIFY(StretchBlt( + hMainDC,0,0,nWidth,nHeight, + hMainDC,0,0,Bitmap.bmWidth,Bitmap.bmHeight, + SRCCOPY)); + } + else // expanding bitmap + { + // bitmap with new size + HDC hMemDC = CreateCompatibleDC(hMainDC); + HBITMAP hMainBitMap = CreateCompatibleBitmap(hMainDC,nWidth,nHeight); + HBITMAP hMemBitMap = (HBITMAP) SelectObject(hMemDC,SelectObject(hMainDC,hMainBitMap)); + + VERIFY(StretchBlt( + hMainDC,0,0,nWidth,nHeight, + hMemDC,0,0,Bitmap.bmWidth,Bitmap.bmHeight, + SRCCOPY)); + + // delete original bitmap + VERIFY(DeleteObject(SelectObject(hMemDC,hMemBitMap))); + DeleteDC(hMemDC); + } + + VERIFY(SetStretchBltMode(hMainDC,nMode)); + + GdiFlush(); + } + LeaveCriticalSection(&csGDILock); + ResizeWindow(); + } + return; +} + static KmlBlock* LoadKMLGlobal(LPCTSTR szFilename) { HANDLE hFile; @@ -2418,6 +2581,7 @@ BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog) goto quit; } + ResizeMainBitmap(nScaleMul,nScaleDiv); // resize main picture CreateLcdBitmap(); PrintfToLog(_T("%i Buttons Defined"), nButtons); @@ -2430,7 +2594,7 @@ BOOL InitKML(LPCTSTR szFilename, BOOL bNoLog) quit: if (bOk) { - // HP38G/HP39G(+)/HP40G have no object loading, ignore // CdB for HP: add apples + // HP38G/HP39G(+|s)/HP40G(s) have no object loading, ignore // CdB for HP: add apples DragAcceptFiles(hWnd,cCurrentRomType != '6' && cCurrentRomType != 'A' && cCurrentRomType != 'E' && cCurrentRomType != 'P'); if (!bNoLog) diff --git a/source/KML.H b/source/KML.H index 62ef378..ced8be5 100644 --- a/source/KML.H +++ b/source/KML.H @@ -32,35 +32,39 @@ typedef enum eTokenId TOK_GLOBAL, //16 TOK_AUTHOR, //17 TOK_BITMAP, //18 - TOK_OFFSET, //19 - TOK_BUTTON, //20 - TOK_IFFLAG, //21 - TOK_ONDOWN, //22 - TOK_NOHOLD, //23 - TOK_LOCALE, //24 - TOK_TOPBAR, //25 - TOK_TITLE, //26 - TOK_OUTIN, //27 - TOK_PATCH, //28 - TOK_PRINT, //29 - TOK_DEBUG, //30 - TOK_COLOR, //31 - TOK_MODEL, //32 - TOK_CLASS, //33 - TOK_PRESS, //34 - TOK_IFMEM, //35 - TOK_TYPE, //36 - TOK_SIZE, //37 - TOK_DOWN, //38 - TOK_ZOOM, //39 - TOK_ELSE, //40 - TOK_ONUP, //41 - TOK_EOL, //42 - TOK_MAP, //43 - TOK_ROM, //44 - TOK_VGA, //45 - TOK_LCD, //46 - TOK_END //47 + TOK_ZOOMXY, //19 + TOK_OFFSET, //20 + TOK_BUTTON, //21 + TOK_IFFLAG, //22 + TOK_ONDOWN, //23 + TOK_NOHOLD, //24 + TOK_LOCALE, //25 + TOK_TOPBAR, //26 + TOK_MENUBAR, //27 + TOK_TITLE, //28 + TOK_OUTIN, //29 + TOK_PATCH, //30 + TOK_PRINT, //31 + TOK_DEBUG, //32 + TOK_COLOR, //33 + TOK_MODEL, //34 + TOK_CLASS, //35 + TOK_PRESS, //36 + TOK_IFMEM, //37 + TOK_SCALE, //38 + TOK_TYPE, //39 + TOK_SIZE, //40 + TOK_DOWN, //41 + TOK_ZOOM, //42 + TOK_ELSE, //43 + TOK_ONUP, //44 + TOK_ICON, //45 + TOK_EOL, //46 + TOK_MAP, //47 + TOK_ROM, //48 + TOK_VGA, //49 + TOK_LCD, //50 + TOK_END //51 } TokenId; #define TYPE_NONE 00 diff --git a/source/LOWBAT.C b/source/LOWBAT.C new file mode 100644 index 0000000..adfc75d --- /dev/null +++ b/source/LOWBAT.C @@ -0,0 +1,122 @@ +/* + * lowbat.c + * + * This file is part of Emu48 + * + * Copyright (C) 2006 Christoph Gießelink + * + */ +#include "pch.h" +#include "Emu48.h" +#include "io.h" // I/O definitions + +// #define BAT_SIMULATION // switch low bat simulation + +#define BAT_FREQ (60*1000) // bat update time in ms (real machine = 60us, HP28C = 60s) + +BOOL bLowBatDisable = FALSE; + +static HANDLE hCThreadBat = NULL; +static HANDLE hEventBat; + +static DWORD WINAPI LowBatThread(LPVOID pParam) +{ + BOOL bLBI,bVLBI; + + do + { + GetBatteryState(&bLBI,&bVLBI); // get battery state + + // very low bat detection + bVLBI = bVLBI && (Chipset.IORam[LPE] & EVLBI) != 0; + + IOBit(LPD,VLBI,bVLBI); // set VLBI + IOBit(SRQ1,VSRQ,bVLBI); // and service bit + + if (bVLBI) // VLBI detected + { + Chipset.SoftInt = TRUE; + bInterrupt = TRUE; + + if (Chipset.Shutdn) // CPU shut down + { + Chipset.bShutdnWake = TRUE; // wake up from SHUTDN mode + SetEvent(hEventShutdn); // wake up emulation thread + } + } + } + while (WaitForSingleObject(hEventBat,BAT_FREQ) == WAIT_TIMEOUT); + + return 0; + UNREFERENCED_PARAMETER(pParam); +} + +VOID StartBatMeasure(VOID) +{ + DWORD dwThreadId; + + if (hCThreadBat) // Bat measuring thread running + return; // -> quit + + // event to cancel Bat refresh loop + hEventBat = CreateEvent(NULL,FALSE,FALSE,NULL); + + VERIFY(hCThreadBat = CreateThread(NULL,0,&LowBatThread,NULL,0,&dwThreadId)); + return; +} + +VOID StopBatMeasure(VOID) +{ + if (hCThreadBat == NULL) // thread stopped + return; // -> quit + + SetEvent(hEventBat); // leave Bat update thread + WaitForSingleObject(hCThreadBat,INFINITE); + CloseHandle(hCThreadBat); + hCThreadBat = NULL; // set flag Bat update stopped + CloseHandle(hEventBat); // close Bat event + return; +} + +VOID GetBatteryState(BOOL *pbLBI, BOOL *pbVLBI) +{ +#if defined BAT_SIMULATION + switch (GetPrivateProfileInt(_T("LowBat"),_T("Level"),2,_T(".\\Lowbat.ini"))) + { + case 0: // empty + *pbLBI = TRUE; + *pbVLBI = TRUE; + break; + case 1: // low + *pbLBI = TRUE; + *pbVLBI = FALSE; + break; + default: // full + *pbLBI = FALSE; + *pbVLBI = FALSE; + break; + } +#else + SYSTEM_POWER_STATUS sSps; + + *pbLBI = FALSE; // no battery warning + *pbVLBI = FALSE; + + VERIFY(GetSystemPowerStatus(&sSps)); + + // low bat emulation enabled and battery powered + if (!bLowBatDisable && sSps.ACLineStatus == AC_LINE_OFFLINE) + { + // on critical battery state make sure that lowbat flag is also set + if ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0) + sSps.BatteryFlag |= BATTERY_FLAG_LOW; + + // low bat detection + *pbLBI = ((sSps.BatteryFlag & BATTERY_FLAG_LOW) != 0); + + // very low bat detection + *pbVLBI = ((sSps.BatteryFlag & BATTERY_FLAG_CRITICAL) != 0); + } +#endif + return; +} diff --git a/source/MOPS.C b/source/MOPS.C index b8e71ec..4cf0aee 100644 --- a/source/MOPS.C +++ b/source/MOPS.C @@ -326,7 +326,7 @@ static VOID MapROM(BYTE a, BYTE b) UINT i; DWORD p, m; - // HP39(+)/40G, HP49G(+) HP48Gii // CdB for HP: add apples memory + // HP39(+)/40G, HP49G/g+ HP48gII // CdB for HP: add apples memory if (cCurrentRomType == 'E' || cCurrentRomType == 'X' || cCurrentRomType == 'P' || cCurrentRomType == '2' || cCurrentRomType == 'Q') { if (bFlashRomArray) // view flash ROM data @@ -396,8 +396,8 @@ VOID Map(BYTE a, BYTE b) // maps 2KB pages with priority if (Chipset.P1Cfig) MapP1(a,b); // CE2, port1 (higher priority than CE1) } if (Chipset.P0Cfig) MapP0(a,b); // RAM, highest priority (execpt HDW) - // CdB for HP: add apples header -// @todo cg, bug if display header area is mapped to addr 0 + // CdB for HP: add apples header + // @todo cg, bug if display header area is mapped to addr 0 if (Chipset.d0address!=0) { RMap[Chipset.d0address]=&(Chipset.d0memory[0]); RMap[Chipset.d0address+1]=&(Chipset.d0memory[2048*2]); @@ -760,8 +760,9 @@ VOID Npeek(BYTE *a, DWORD d, UINT s) } } } - if (s-=c) {a+=c; d=(d+c)&0xFFFFF;} - } while (s); + a+=c; + d=(d+c)&0xFFFFF; + } while (s-=c); return; } @@ -850,8 +851,9 @@ VOID Nread(BYTE *a, DWORD d, UINT s) for (u=0; u> 4)&0xF; break; case 0x06: *a = (Chipset.crc>> 8)&0xF; break; case 0x07: *a = (Chipset.crc>>12)&0xF; break; - case 0x08: *a = 0; break; + case 0x08: // LPD + // LB2 and LB1 not emulated, must be 0 + _ASSERT((Chipset.IORam[LPD] & (LB2 | LB1)) == 0); + + GetBatteryState(&bLBI,&bVLBI); // get battery state + + // check if battery states enabled + bLBI = bLBI && ((Chipset.IORam[LPE] & ELBI) != 0); + bVLBI = bVLBI && ((Chipset.IORam[LPE] & EVLBI) != 0); + + // set IO bits + IOBit(LPD,LB0,bLBI); + IOBit(LPD,VLBI,bVLBI); + IOBit(SRQ1,VSRQ,bVLBI); + *a = Chipset.IORam[d]; + break; case 0x09: // LPE *a = Chipset.IORam[d]; if (bUpdate) @@ -1072,7 +1088,8 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) else { *a = Chipset.IORam[d] & 0x7; - #if defined DEBUG_SERIAL // return BAUD value + #if defined DEBUG_SERIAL // return BAUD value + if (bUpdate) { TCHAR buffer[256]; wsprintf(buffer,_T("%.5lx: BAUD Read: %x\n"),Chipset.pc,*a); @@ -1099,14 +1116,15 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) } else { - // on a HP39/40G and HP49G Chipset.cards_status bust always be 0xF -// _ASSERT((cCurrentRomType!='E' && cCurrentRomType!='X' && cCurrentRomType!='2' && cCurrentRomType!='P' && cCurrentRomType!='Q') || Chipset.cards_status == 0xF); // CdB for HP: add apples + // on a HP30/40G and HP49G Chipset.cards_status bust always be 0xF + _ASSERT((cCurrentRomType!='E' && cCurrentRomType!='X' && cCurrentRomType!='2' && cCurrentRomType!='P' && cCurrentRomType!='Q') || Chipset.cards_status == 0xF); // CdB for HP: add apples *a = Chipset.cards_status; } break; case 0x10: // IO CONTROL *a = Chipset.IORam[d]; // return IO CONTROL value #if defined DEBUG_SERIAL + if (bUpdate) { TCHAR buffer[256]; wsprintf(buffer,_T("%.5lx: IOC Read: %x\n"),Chipset.pc,*a); @@ -1117,6 +1135,7 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) case 0x11: // RCS *a = Chipset.IORam[d] | RX; // return RCS value #if defined DEBUG_SERIAL + if (bUpdate) { TCHAR buffer[256]; wsprintf(buffer,_T("%.5lx: RCS Read: %x\n"),Chipset.pc,*a); @@ -1127,6 +1146,7 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) case 0x12: // TCS *a = Chipset.IORam[d]; // return TCS value #if defined DEBUG_SERIAL + if (bUpdate) { TCHAR buffer[256]; wsprintf(buffer,_T("%.5lx: TCS Read: %x\n"),Chipset.pc,*a); @@ -1179,6 +1199,7 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) case 0x18: // SREQ? LSB *a = Chipset.IORam[d]; // return SREQ value #if defined DEBUG_SERIAL + if (bUpdate) { TCHAR buffer[256]; wsprintf(buffer,_T("%.5lx: SEQ %s Read: %x\n"),Chipset.pc,(d==0x18) ? "LSB" : "MSB",*a); @@ -1190,7 +1211,7 @@ VOID ReadIO(BYTE *a, DWORD d, DWORD s, BOOL bUpdate) if (cCurrentRomType=='E') // HP39/40G { Chipset.IORam[d] = (nCurrentClass != 40) - ? (Chipset.IORam[d] & ~IRI) // HP39G + ? (Chipset.IORam[d] & ~IRI) // HP39G : (Chipset.IORam[d] | IRI); // HP40G } *a = Chipset.IORam[d]; // return IR CONTROL value @@ -1421,8 +1442,7 @@ VOID WriteIO(BYTE *a, DWORD d, DWORD s) } else // Clarke / Yorke chip { - // bit 3 is read-only - Chipset.IORam[d] = (Chipset.IORam[d]&8)|(c&7); + Chipset.IORam[d]=(Chipset.IORam[d]&8)|(c&7); // bit 3 is read-only } CommSetBaud(); // set baudrate #if defined DEBUG_SERIAL diff --git a/source/OPCODES.C b/source/OPCODES.C index 90df305..c6959d1 100644 --- a/source/OPCODES.C +++ b/source/OPCODES.C @@ -12,7 +12,6 @@ #include "Opcodes.h" #include "apple.h" #include "io.h" // I/O register definitions -#include "i28f160.h" #define w Chipset #define GOYES3 {if(w.carry) o_goyes3(I);else{w.pc+=2;return;}} @@ -1046,7 +1045,7 @@ VOID o807(LPBYTE I) // SHUTDN // emulation of BS reset circuit in deep sleep // HP39/40G, HP48GX, HP49G, display off, card control off or in slow mode if ( (cCurrentRomType=='E' || cCurrentRomType=='G' || cCurrentRomType=='X' || cCurrentRomType=='2' || cCurrentRomType=='P' || cCurrentRomType=='Q') // CdB for HP: add apples - && (w.IORam[BITOFFSET]&DON) == 0 + && (w.IORam[BITOFFSET]&DON) == 0 && ((w.IORam[CARDCTL]&(ECDT|RCDT)) != (ECDT|RCDT))) { // on HP48GX ROM must be selected (DA19=1) and @@ -2153,7 +2152,7 @@ VOID o8Fd5(LPBYTE I) // GOSBVL #ddddd return; } - // ?r=s f + // ?r=s f VOID o9a0(LPBYTE I) { w.cycles+=6+F_l[I[1]]; w.pc+=3; TFe(w.A, w.B, I[1]); GOYES3; } VOID o9a1(LPBYTE I) { w.cycles+=6+F_l[I[1]]; w.pc+=3; TFe(w.B, w.C, I[1]); GOYES3; } VOID o9a2(LPBYTE I) { w.cycles+=6+F_l[I[1]]; w.pc+=3; TFe(w.C, w.A, I[1]); GOYES3; } @@ -2445,7 +2444,7 @@ VOID o_goyes5(LPBYTE I) } //////// EXTENSIONS //////// -VOID o81B1(LPBYTE I) +VOID o81B1(LPBYTE I) // beep patch { if (cCurrentRomType=='Q' || cCurrentRomType=='2' || cCurrentRomType=='P') { diff --git a/source/PCH.H b/source/PCH.H index 9175827..31cb02a 100644 --- a/source/PCH.H +++ b/source/PCH.H @@ -1,55 +1,55 @@ -// -// PCH.H -// - -#define _WIN32_IE 0x0200 -#define _CRT_SECURE_NO_DEPRECATE -#define _CRTDBG_MAP_ALLOC -#define _WINSOCK_DEPRECATED_NO_WARNINGS - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined VERIFY -#if defined _DEBUG -#define VERIFY(f) _ASSERT(f) -#else // _DEBUG -#define VERIFY(f) ((VOID)(f)) -#endif // _DEBUG -#endif // _VERIFY - -#if !defined INVALID_SET_FILE_POINTER -#define INVALID_SET_FILE_POINTER ((DWORD)-1) -#endif - -#if !defined INVALID_FILE_ATTRIBUTES -#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) -#endif +// +// PCH.H +// -#if !defined GWLP_USERDATA -#define GWLP_USERDATA GWL_USERDATA -#endif +#define _WIN32_IE 0x0200 +#define _CRT_SECURE_NO_DEPRECATE +#define _CRTDBG_MAP_ALLOC +#define _WINSOCK_DEPRECATED_NO_WARNINGS + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined VERIFY +#if defined _DEBUG +#define VERIFY(f) _ASSERT(f) +#else // _DEBUG +#define VERIFY(f) ((VOID)(f)) +#endif // _DEBUG +#endif // _VERIFY + +#if !defined INVALID_SET_FILE_POINTER +#define INVALID_SET_FILE_POINTER ((DWORD)-1) +#endif + +#if !defined INVALID_FILE_ATTRIBUTES +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + +#if !defined GWLP_USERDATA +#define GWLP_USERDATA GWL_USERDATA +#endif #if !defined GCLP_HCURSOR #define GCLP_HCURSOR GCL_HCURSOR #endif - -#if !defined IDC_HAND // Win2k specific definition -#define IDC_HAND MAKEINTRESOURCE(32649) -#endif - + +#if !defined IDC_HAND // Win2k specific definition +#define IDC_HAND MAKEINTRESOURCE(32649) +#endif + #if _MSC_VER <= 1200 // missing type definition in the MSVC6.0 SDK and earlier #define SetWindowLongPtr SetWindowLong #define GetWindowLongPtr GetWindowLong @@ -58,36 +58,36 @@ typedef SIZE_T DWORD_PTR, *PDWORD_PTR; typedef ULONG ULONG_PTR, *PULONG_PTR; typedef LONG LONG_PTR, *PLONG_PTR; -#endif - -#if _MSC_VER >= 1400 // valid for VS2005 and later -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\" \ - type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' processorArchitecture='x86' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\" \ - type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' processorArchitecture='ia64' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\" \ - type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' processorArchitecture='amd64' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\" \ - type='win32' \ - name='Microsoft.Windows.Common-Controls' \ - version='6.0.0.0' processorArchitecture='*' \ - publicKeyToken='6595b64144ccf1df' \ - language='*'\"") -#endif -#endif +#endif + +#if _MSC_VER >= 1400 // valid for VS2005 and later +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\" \ + type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' processorArchitecture='x86' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"") +#elif defined _M_IA64 +#pragma comment(linker,"/manifestdependency:\" \ + type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' processorArchitecture='ia64' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\" \ + type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' processorArchitecture='amd64' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\" \ + type='win32' \ + name='Microsoft.Windows.Common-Controls' \ + version='6.0.0.0' processorArchitecture='*' \ + publicKeyToken='6595b64144ccf1df' \ + language='*'\"") +#endif +#endif diff --git a/source/REDEYE.C b/source/REDEYE.C index 17713dc..2c47163 100644 --- a/source/REDEYE.C +++ b/source/REDEYE.C @@ -12,7 +12,7 @@ #define ERR_CHAR 127 // character for transfer error -#define H1 0x78 +#define H1 0x78 #define H2 0xE6 #define H3 0xD5 #define H4 0x8B diff --git a/source/RESOURCE.H b/source/RESOURCE.H index d28ed34..474771f 100644 --- a/source/RESOURCE.H +++ b/source/RESOURCE.H @@ -180,6 +180,7 @@ #define ID_OBJECT_LOAD 40009 #define ID_OBJECT_SAVE 40010 #define ID_ABOUT 40011 +#define ID_HELP_TOPICS 40012 #define ID_FILE_CLOSE 40013 #define ID_BACKUP_SAVE 40014 #define ID_BACKUP_RESTORE 40015 @@ -241,12 +242,12 @@ #define ID_FILE_MRU_FILE1 40100 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 130 #define _APS_NEXT_COMMAND_VALUE 40072 #define _APS_NEXT_CONTROL_VALUE 1136 -#define _APS_NEXT_SYMED_VALUE 108 +#define _APS_NEXT_SYMED_VALUE 109 #endif #endif diff --git a/source/RPL.C b/source/RPL.C index f9cb17c..2f90efe 100644 --- a/source/RPL.C +++ b/source/RPL.C @@ -68,7 +68,7 @@ #define DOROMP 0x02E92 // XLIB Name #define SEMI 0x0312B // ; -#define GARBAGECOL 0x0613E // =GARBAGECOL entry for HP48S/G/GII and HP49G(+) +#define GARBAGECOL 0x0613E // =GARBAGECOL entry for HP48S/G and HP49G // check for Metakernel version #define METAKERNEL Metakernel() @@ -90,7 +90,7 @@ static BOOL Metakernel(VOID) { // get version number WORD wVersion = ((Port1[30] * 10) + Port1[34]) * 10 - + Port1[36]; + + Port1[36]; // version newer then V2.30, then compatible with HP OS bMkDetect = (wVersion <= 230); @@ -105,7 +105,7 @@ static DWORD RPL_GarbageCol(VOID) // RPL variables must be in system RAM CHIPSET OrgChipset; DWORD dwAVMEM; - // only for HP48SX, HP48GX, HP49G, HP48GII and HP49G+ + // only for HP48SX, HP48GX, HP49G, HP48gII and HP49g+ _ASSERT( cCurrentRomType == 'S' || cCurrentRomType == 'G' || cCurrentRomType == 'X' || cCurrentRomType == '2' || cCurrentRomType == 'Q'); @@ -210,8 +210,8 @@ DWORD RPL_SkipOb(DWORD d) case DOGROB: // Graphic case DOLIB: // Library case DOBAK: // Backup - case DOEXT0: // Library Data - case DOEXT1: // Reserved 1 + case DOEXT0: // Library Data + case DOEXT1: // Reserved 1 if (n == DOEXT1 && cCurrentRomType != 'S') { // on HP48G series and later interpreted as DOACPTR @@ -226,7 +226,7 @@ DWORD RPL_SkipOb(DWORD d) break; case DOLNGREAL: // Precision Real (HP49G) l = 5; - if (cCurrentRomType=='X' && cCurrentRomType!='2' && cCurrentRomType!='Q') // CdB for HP: add apples + if (cCurrentRomType=='X') { l += Read5(d+l); l += Read5(d+l); @@ -234,7 +234,7 @@ DWORD RPL_SkipOb(DWORD d) break; case DOLNGCMP: // Precision Complex (HP49G) l = 5; - if (cCurrentRomType=='X' && cCurrentRomType!='2' && cCurrentRomType!='Q') // CdB for HP: add apples + if (cCurrentRomType=='X') { l += Read5(d+l); l += Read5(d+l); @@ -332,7 +332,7 @@ DWORD RPL_ObjectSize(BYTE *o,DWORD s) case DOLIB: // Library case DOBAK: // Backup case DOEXT0: // Library Data - case DOEXT1: // Reserved 1 + case DOEXT1: // Reserved 1 if (n == DOEXT1 && cCurrentRomType != 'S') { // on HP48G series and later interpreted as DOACPTR @@ -401,7 +401,7 @@ DWORD RPL_CreateTemp(DWORD l,BOOL bGarbageCol) Nwrite(p,a+l,b-a); free(p); Write5(a+l-5,l); // set object length field - return a+1; // return base address of new object + return (a+1); // return base address of new object } UINT RPL_Depth(VOID) @@ -446,7 +446,7 @@ VOID RPL_Push(UINT l,DWORD n) if (METAKERNEL) ++l; // Metakernel, save MK object on stack level 1 stkp = Read5(DSKTOP) - 5; // get pointer of new stack level 1 - Write5(DSKTOP,stkp); // save it + Write5(DSKTOP,stkp); // save it for (i = 1; i < l; ++i) // move down stack level entries before insert pos { diff --git a/source/SERIAL.C b/source/SERIAL.C index 05a0233..ecdde4a 100644 --- a/source/SERIAL.C +++ b/source/SERIAL.C @@ -113,14 +113,14 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort) _tcscat(szDevice,strPort); // device name hComm = CreateFile(szDevice, - GENERIC_READ | GENERIC_WRITE, + GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL); - if(hComm != INVALID_HANDLE_VALUE) + if (hComm != INVALID_HANDLE_VALUE) { DWORD dwThreadId; @@ -140,7 +140,7 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort) hCThreadTxd = CreateThread(NULL,0,&TransmitThread,NULL,CREATE_SUSPENDED,&dwThreadId); _ASSERT(hCThreadTxd); SetThreadPriority(hCThreadTxd,THREAD_PRIORITY_ABOVE_NORMAL); - ResumeThread(hCThreadTxd); // start thread + ResumeThread(hCThreadTxd); // start thread // create Comm event handler bReading = FALSE; @@ -148,7 +148,7 @@ BOOL CommOpen(LPTSTR strWirePort,LPTSTR strIrPort) hCThreadEv = CreateThread(NULL,0,&EventThread,NULL,CREATE_SUSPENDED,&dwThreadId); _ASSERT(hCThreadEv); SetThreadPriority(hCThreadEv,THREAD_PRIORITY_ABOVE_NORMAL); - ResumeThread(hCThreadEv); // start thread + ResumeThread(hCThreadEv); // start thread while (!bReading) Sleep(0); // wait for SerialThread started } else @@ -204,7 +204,7 @@ VOID CommSetBaud(VOID) const DWORD dwBaudrates[] = { 1200, 1920, 2400, 3840, 4800, 7680, 9600, 15360, 14400, 19200, 38400, 57600, 115200, 115200, 115200, 115200 }; - DCB dcb; + DCB dcb; UINT uBaudIndex; uBaudIndex = isModelApple(cCurrentRomType) @@ -353,13 +353,13 @@ VOID CommReceive(VOID) // reject reading if com port is closed and not whole operation if (hComm && dwBytesRead == 0L) // com port open and buffer empty { - if(ReadFile(hComm,&cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE) + if (ReadFile(hComm,&cBuffer,sizeof(cBuffer),&dwBytesRead,&os) == FALSE) dwBytesRead = 0L; else // bytes received nRp = 0; // reset read pointer } - if(dwBytesRead == 0L) // receive buffer empty + if (dwBytesRead == 0L) // receive buffer empty break; #if defined DEBUG_SERIAL @@ -379,10 +379,10 @@ VOID CommReceive(VOID) --dwBytesRead; Chipset.IORam[RCS] |= RBF; // receive buffer full - if(UpdateUSRQ()) // update USRQ bit + if (UpdateUSRQ()) // update USRQ bit INTERRUPT; } - while(0); + while (FALSE); LeaveCriticalSection(&csRecvLock); return; } diff --git a/source/SETTINGS.C b/source/SETTINGS.C index e0d11c4..6d5d539 100644 --- a/source/SETTINGS.C +++ b/source/SETTINGS.C @@ -67,7 +67,7 @@ static VOID ReadReg(LPCTSTR lpSubKey, LPCTSTR lpValueName, LPBYTE lpData, DWORD 0, KEY_QUERY_VALUE, &hKey); - if (retCode == ERROR_SUCCESS) + if (retCode == ERROR_SUCCESS) { retCode = RegQueryValueEx(hKey,lpValueName,NULL,&dwType,lpData,pdwSize); RegCloseKey(hKey); @@ -117,7 +117,7 @@ static BOOL DelReg(LPCTSTR lpSubKey, LPCTSTR lpValueName) 0, KEY_SET_VALUE, &hKey); - if (retCode == ERROR_SUCCESS) + if (retCode == ERROR_SUCCESS) { retCode = RegDeleteValue(hKey,lpValueName); RegCloseKey(hKey); @@ -199,6 +199,8 @@ VOID ReadSettings(VOID) uWaveDevId = ReadInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId); dwWaveVol = ReadInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol); dwWaveTime = ReadInt(_T("Emulator"),_T("WaveTime"),dwWaveTime); + // LowBat + bLowBatDisable = ReadInt(_T("LowBat"),_T("Disable"),bLowBatDisable); // Macro bMacroRealSpeed = ReadInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); nMacroTimeout = ReadInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout); @@ -252,6 +254,8 @@ VOID WriteSettings(VOID) WriteInt(_T("Emulator"),_T("WaveDeviceId"),uWaveDevId); WriteInt(_T("Emulator"),_T("WaveVolume"),dwWaveVol); WriteInt(_T("Emulator"),_T("WaveTime"),dwWaveTime); + // LowBat + WriteInt(_T("LowBat"),_T("Disable"),bLowBatDisable); // Macro WriteInt(_T("Macro"),_T("RealSpeed"),bMacroRealSpeed); WriteInt(_T("Macro"),_T("ReplayTimeout"),nMacroTimeout); diff --git a/source/SNDDEF.H b/source/SNDDEF.H new file mode 100644 index 0000000..500232d --- /dev/null +++ b/source/SNDDEF.H @@ -0,0 +1,102 @@ +/* + * snddef.h + * + * This file is part of Emu48 + * + * Copyright (C) 2015 Christoph Gießelink + * + */ + +#include + +#if _MSC_VER >= 1600 // valid for VS2010 and later + +#include +#include + +#else // create the necessary definitions manually + +// +// IKsPropertySet +// + +#ifndef _IKsPropertySet_ +#define _IKsPropertySet_ + +#ifdef __cplusplus +struct IKsPropertySet; +#endif // __cplusplus + +typedef struct IKsPropertySet *LPKSPROPERTYSET; + +DEFINE_GUID(IID_IKsPropertySet, 0x31efac30, 0x515c, 0x11d0, 0xa9, 0xaa, 0x00, 0xaa, 0x00, 0x61, 0xbe, 0x93); + +#undef INTERFACE +#define INTERFACE IKsPropertySet + +DECLARE_INTERFACE_(IKsPropertySet, IUnknown) +{ + // IUnknown methods + STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID*) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + // IKsPropertySet methods + STDMETHOD(Get) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength, PULONG pulBytesReturned) PURE; + STDMETHOD(Set) (THIS_ REFGUID rguidPropSet, ULONG ulId, LPVOID pInstanceData, ULONG ulInstanceLength, + LPVOID pPropertyData, ULONG ulDataLength) PURE; + STDMETHOD(QuerySupport) (THIS_ REFGUID rguidPropSet, ULONG ulId, PULONG pulTypeSupport) PURE; +}; + +#endif // _IKsPropertySet_ + +// DirectSound Configuration Component GUID {11AB3EC0-25EC-11d1-A4D8-00C04FC28ACA} +DEFINE_GUID(CLSID_DirectSoundPrivate, 0x11ab3ec0, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +// DirectSound Device Properties {84624F82-25EC-11d1-A4D8-00C04FC28ACA} +DEFINE_GUID(DSPROPSETID_DirectSoundDevice, 0x84624f82, 0x25ec, 0x11d1, 0xa4, 0xd8, 0x0, 0xc0, 0x4f, 0xc2, 0x8a, 0xca); + +typedef enum +{ + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A = 1, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 = 2, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 = 3, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W = 4, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A = 5, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W = 6, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A = 7, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W = 8, +} DSPROPERTY_DIRECTSOUNDDEVICE; + +#ifdef UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W +#else // UNICODE +#define DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A +#endif // UNICODE + +typedef enum +{ + DIRECTSOUNDDEVICE_TYPE_EMULATED, + DIRECTSOUNDDEVICE_TYPE_VXD, + DIRECTSOUNDDEVICE_TYPE_WDM +} DIRECTSOUNDDEVICE_TYPE; + +typedef enum +{ + DIRECTSOUNDDEVICE_DATAFLOW_RENDER, + DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE +} DIRECTSOUNDDEVICE_DATAFLOW; + +typedef struct _DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA +{ + DIRECTSOUNDDEVICE_TYPE Type; // Device type + DIRECTSOUNDDEVICE_DATAFLOW DataFlow; // Device dataflow + GUID DeviceId; // DirectSound device id + LPTSTR Description; // Device description + LPTSTR Module; // Device driver module + LPTSTR Interface; // Device interface + ULONG WaveDeviceId; // Wave device id +} DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA, *PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA; + +#endif diff --git a/source/SNDENUM.C b/source/SNDENUM.C new file mode 100644 index 0000000..eb9adda --- /dev/null +++ b/source/SNDENUM.C @@ -0,0 +1,256 @@ +/* + * SndEnum.c + * + * This file is part of Emu48 + * + * Copyright (C) 2015 Christoph Gießelink + * + */ +#include "pch.h" +#include "Emu48.h" +#include "snddef.h" + +typedef HRESULT (WINAPI *LPFNDLLGETCLASSOBJECT)(REFCLSID,REFIID,LPVOID *); +static LPFNDLLGETCLASSOBJECT pfnDllGetClassObject = NULL; + +// +// create a IKsPropertySet interface +// +static __inline HRESULT DirectSoundPrivateCreate(LPKSPROPERTYSET *ppKsPropertySet) +{ + LPCLASSFACTORY pClassFactory = NULL; + HRESULT hr; + + // create a class factory object + #if defined __cplusplus + hr = pfnDllGetClassObject(CLSID_DirectSoundPrivate,IID_IClassFactory,(LPVOID *) &pClassFactory); + #else + hr = pfnDllGetClassObject(&CLSID_DirectSoundPrivate,&IID_IClassFactory,(LPVOID *) &pClassFactory); + #endif + + // create the DirectSoundPrivate object and query for an IKsPropertySet interface + if (SUCCEEDED(hr)) + { + #if defined __cplusplus + hr = pClassFactory->CreateInstance(NULL,IID_IKsPropertySet,(LPVOID *) ppKsPropertySet); + #else + hr = pClassFactory->lpVtbl->CreateInstance(pClassFactory,NULL,&IID_IKsPropertySet,(LPVOID *) ppKsPropertySet); + #endif + } + + if (pClassFactory) // release the class factory object + { + #if defined __cplusplus + pClassFactory->Release(); + #else + pClassFactory->lpVtbl->Release(pClassFactory); + #endif + } + + if (FAILED(hr) && *ppKsPropertySet) // handle failure + { + #if defined __cplusplus + (*ppKsPropertySet)->Release(); + #else + (*ppKsPropertySet)->lpVtbl->Release(*ppKsPropertySet); + #endif + } + return hr; +} + +// +// get the device information about a DirectSound GUID. +// +static BOOL GetInfoFromDSoundGUID(CONST GUID *lpGUID, UINT *puWaveDeviceID) +{ + LPKSPROPERTYSET pKsPropertySet = NULL; + HRESULT hr; + BOOL bSuccess = FALSE; + + hr = DirectSoundPrivateCreate(&pKsPropertySet); + if (SUCCEEDED(hr)) + { + ULONG ulBytesReturned = 0; + + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA sDirectSoundDeviceDescription; + + ZeroMemory(&sDirectSoundDeviceDescription,sizeof(sDirectSoundDeviceDescription)); + sDirectSoundDeviceDescription.DeviceId = *lpGUID; + + // get the size of the direct sound device description + #if defined __cplusplus + hr = pKsPropertySet->Get( + DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, + NULL, + 0, + &sDirectSoundDeviceDescription, + sizeof(sDirectSoundDeviceDescription), + &ulBytesReturned + ); + #else + hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet, + &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, + NULL, + 0, + &sDirectSoundDeviceDescription, + sizeof(sDirectSoundDeviceDescription), + &ulBytesReturned + ); + #endif + + if (SUCCEEDED(hr) && ulBytesReturned) + { + PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA psDirectSoundDeviceDescription = NULL; + + // fetch the direct sound device description + psDirectSoundDeviceDescription = (PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA) malloc(ulBytesReturned); + if (psDirectSoundDeviceDescription != NULL) + { + // init structure with data from length request + *psDirectSoundDeviceDescription = sDirectSoundDeviceDescription; + + #if defined __cplusplus + hr = pKsPropertySet->Get( + DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, + NULL, + 0, + psDirectSoundDeviceDescription, + ulBytesReturned, + &ulBytesReturned + ); + #else + hr = pKsPropertySet->lpVtbl->Get(pKsPropertySet, + &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, + NULL, + 0, + psDirectSoundDeviceDescription, + ulBytesReturned, + &ulBytesReturned + ); + #endif + + if ((bSuccess = SUCCEEDED(hr))) + { + // the requested device ID + *puWaveDeviceID = psDirectSoundDeviceDescription->WaveDeviceId; + } + free(psDirectSoundDeviceDescription); + } + } + + #if defined __cplusplus + pKsPropertySet->Release(); + #else + pKsPropertySet->lpVtbl->Release(pKsPropertySet); + #endif + } + return bSuccess; +} + +// +// callback function for DirectSoundEnumerate() +// +static BOOL CALLBACK DSEnumProc(LPGUID lpGUID,LPCTSTR lpszDesc,LPCTSTR lpszDrvName,LPVOID lpContext) +{ + HWND hWnd = (HWND) lpContext; // window handle of the combo box + + if (lpGUID != NULL) // NULL only for "Primary Sound Driver" + { + UINT uDevID; + + if (GetInfoFromDSoundGUID(lpGUID,&uDevID)) + { + WAVEOUTCAPS woc; + + // has device the necessary capabilities? + if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR + && (woc.dwFormats & WAVE_FORMAT_4M08) != 0) + { + // copy product name and wave device ID to combo box + LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) lpszDesc); + SendMessage(hWnd,CB_SETITEMDATA,i,uDevID); + } + } + } + return TRUE; + UNREFERENCED_PARAMETER(lpszDrvName); +} + +// set listfield for sound device combo box +VOID SetSoundDeviceList(HWND hWnd,UINT uDeviceID) +{ + typedef BOOL (CALLBACK *LPDSENUMCALLBACK)(LPGUID, LPCTSTR, LPCTSTR, LPVOID); + typedef HRESULT (WINAPI *LPFN_SDE)(LPDSENUMCALLBACK lpDSEnumCallback,LPVOID lpContext); + LPFN_SDE pfnDirectSoundEnumerate = NULL; + + UINT uSelectDevice,uDevID,uDevNo; + + HMODULE hDSound = LoadLibrary(_T("dsound.dll")); + + if (hDSound != NULL) // direct sound dll found + { + #if defined _UNICODE + pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateW"); + #else + pfnDirectSoundEnumerate = (LPFN_SDE) GetProcAddress(hDSound,"DirectSoundEnumerateA"); + #endif + pfnDllGetClassObject = (LPFNDLLGETCLASSOBJECT) GetProcAddress(hDSound,"DllGetClassObject"); + } + + SendMessage(hWnd,CB_RESETCONTENT,0,0); + + // preset selector + uSelectDevice = (UINT) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) _T("Standard Audio")); + SendMessage(hWnd,CB_SETITEMDATA,uSelectDevice,WAVE_MAPPER); + + // check for direct sound interface functions + if (pfnDirectSoundEnumerate != NULL && pfnDllGetClassObject != NULL) + { + // copy product name and wave device ID to combo box + if (SUCCEEDED(pfnDirectSoundEnumerate((LPDSENUMCALLBACK) DSEnumProc,hWnd))) + { + UINT i; + + uDevNo = (UINT) SendMessage(hWnd,CB_GETCOUNT,0,0); + for (i = 0; i < uDevNo; ++i) + { + // translate device ID to combo box position + uDevID = (UINT) SendMessage(hWnd,CB_GETITEMDATA,i,0); + + if (uDevID == uDeviceID) uSelectDevice = i; + } + } + } + else // direct sound not available, detect over wave capabilities + { + WAVEOUTCAPS woc; + + uDevNo = waveOutGetNumDevs(); + for (uDevID = 0; uDevID < uDevNo; ++uDevID) + { + if ( waveOutGetDevCaps(uDevID,&woc,sizeof(woc)) == MMSYSERR_NOERROR + && (woc.dwFormats & WAVE_FORMAT_4M08) != 0) + { + // copy product name and wave device ID to combo box + LONG i = (LONG) SendMessage(hWnd,CB_ADDSTRING,0,(LPARAM) woc.szPname); + SendMessage(hWnd,CB_SETITEMDATA,i,uDevID); + + if (uDevID == uDeviceID) uSelectDevice = i; + } + } + } + + // activate last selected combo box item + SendMessage(hWnd,CB_SETCURSEL,uSelectDevice,0L); + + if (hDSound != NULL) // direct sound dll loaded + { + pfnDllGetClassObject = NULL; + VERIFY(FreeLibrary(hDSound)); + } + return; +} diff --git a/source/STACK.C b/source/STACK.C index 0170729..570dcbc 100644 --- a/source/STACK.C +++ b/source/STACK.C @@ -7,7 +7,6 @@ * */ #include "pch.h" -#include "resource.h" #include "Emu48.h" #include "io.h" @@ -113,7 +112,7 @@ static __inline INT SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize) } // nStrLen = no. of digits without sign - if (nStrLen >= nSize) // destination buffer too small + if (nStrLen >= nSize) // destination buffer too small return 0; nNumSize = nStrLen + 1; // no. of written data @@ -126,7 +125,7 @@ static __inline INT SetZInt(LPCTSTR cp,LPBYTE pbyNum,INT nSize) if (!((c >= _T('0')) || (c <= _T('9')))) return 0; - c -= _T('0'); + c -= _T('0'); *pbyNum++ = (BYTE) c; } *pbyNum = bySign; // add sign @@ -296,7 +295,7 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec, byNum[j] = byNum[j + i]; } - if(byNum[1] == 0) // number is 0 + if (byNum[1] == 0) // number is 0 { ZeroMemory(pbyNum,nMantLen + nExpLen + 1); return nMantLen + nExpLen + 1; @@ -326,7 +325,7 @@ static __inline INT SetBcd(LPCTSTR cp,INT nMantLen,INT nExpLen,CONST TCHAR cDec, while (*cp >= _T('0') && *cp <= _T('9')) lExp = lExp * 10 + *cp++ - _T('0'); - if(i) lExp = -lExp; + if (i) lExp = -lExp; } if (*cp != 0) return 0; @@ -692,9 +691,9 @@ LRESULT OnStackPaste(VOID) // paste data to stack { if (bDetectClpObject) // autodetect clipboard object enabled { - // HP49G or HP49G+ in exact mode - if ( (cCurrentRomType == 'X' || cCurrentRomType == 'Q') - && !RPL_GetSystemFlag(fnApprox)) + // HP49G or HP49G+ in exact mode + if ( (cCurrentRomType == 'X' || cCurrentRomType == 'Q') + && !RPL_GetSystemFlag(fnApprox)) { // try to convert string to HP49 precision integer s = RPL_SetZInt(lpstrClipdata,byNumber,sizeof(byNumber)); @@ -805,7 +804,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack } } } - while(FALSE); + while (FALSE); GlobalUnlock(hClipObj); } @@ -825,7 +824,7 @@ LRESULT OnStackPaste(VOID) // paste data to stack KeyboardEvent(FALSE,0,0x8000); // wait for sleep mode - while(Chipset.Shutdn == FALSE) Sleep(0); + while (Chipset.Shutdn == FALSE) Sleep(0); cancel: bDbgAutoStateCtrl = TRUE; // enable automatic debugger state control diff --git a/source/TYPES.H b/source/TYPES.H index 1017b06..031687f 100644 --- a/source/TYPES.H +++ b/source/TYPES.H @@ -16,6 +16,7 @@ #define SWORD SHORT // signed 16 Bit variable #define QWORD ULONGLONG // unsigned 64 Bit variable +#define CHIPSET Chipset_t typedef struct { SWORD nPosX; // position of window @@ -25,38 +26,38 @@ typedef struct DWORD Port0Size; // real size of module in KB DWORD Port1Size; // real size of module in KB DWORD Port2Size; // real size of module in KB (HP49G only) - DWORD dwUnused0; // not used, was memory pointer Port0 - DWORD dwUnused1; // not used, was memory pointer Port1 - DWORD dwUnused2; // not used, was memory pointer Port2 + DWORD dwUnused0; // not used, was memory pointer Port0 + DWORD dwUnused1; // not used, was memory pointer Port1 + DWORD dwUnused2; // not used, was memory pointer Port2 - DWORD pc; + DWORD pc; DWORD d0; DWORD d1; DWORD rstkp; DWORD rstk[8]; - BYTE A[16]; - BYTE B[16]; - BYTE C[16]; - BYTE D[16]; - BYTE R0[16]; - BYTE R1[16]; - BYTE R2[16]; - BYTE R3[16]; - BYTE R4[16]; - BYTE ST[4]; - BYTE HST; - BYTE P; - WORD out; + BYTE A[16]; + BYTE B[16]; + BYTE C[16]; + BYTE D[16]; + BYTE R0[16]; + BYTE R1[16]; + BYTE R2[16]; + BYTE R3[16]; + BYTE R4[16]; + BYTE ST[4]; + BYTE HST; + BYTE P; + WORD out; WORD in; BOOL SoftInt; BOOL Shutdn; - BOOL mode_dec; + BOOL mode_dec; BOOL inte; // interrupt status flag (FALSE = int in service) BOOL intk; // 1 ms keyboard scan flag (TRUE = enable) BOOL intd; // keyboard interrupt pending (TRUE = int pending) BOOL carry; - WORD crc; + WORD crc; WORD wPort2Crc; // fingerprint of port2 WORD wRomCrc; // fingerprint of ROM #if defined _USRDLL // DLL version @@ -67,38 +68,38 @@ typedef struct #endif DWORD dwKdnCycles; // cpu cycles at start of 1ms key handler - UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF - UINT FlashRomState; // WSM state of flash memory (unused) - BYTE cards_status; - BYTE IORam[64]; // I/O hardware register - UINT IOBase; // address of I/O modules page - BOOL IOCfig; // I/O module configuration flag - BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page - BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB - BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page - BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag - BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag + UINT Bank_FF; // save state of HP48GX port2 or state of HP49G ROM FF + UINT FlashRomState; // WSM state of flash memory (unused) + BYTE cards_status; + BYTE IORam[64]; // I/O hardware register + UINT IOBase; // address of I/O modules page + BOOL IOCfig; // I/O module configuration flag + BYTE P0Base, BSBase, P1Base, P2Base; // address of modules first 2KB page + BYTE P0Size, BSSize, P1Size, P2Size; // mapped size of module in 2KB + BYTE P0End, BSEnd, P1End, P2End; // address of modules last 2KB page + BOOL P0Cfig, BSCfig, P1Cfig, P2Cfig; // module address configuration flag + BOOL P0Cfg2, BSCfg2, P1Cfg2, P2Cfg2; // module size configuration flag - BYTE t1; - DWORD t2; + BYTE t1; + DWORD t2; - BOOL bShutdnWake; // flag for wake up from SHUTDN mode + BOOL bShutdnWake; // flag for wake up from SHUTDN mode - BYTE Keyboard_Row[9]; - WORD IR15X; - UINT Keyboard_State; // not used + BYTE Keyboard_Row[9]; + WORD IR15X; + UINT Keyboard_State; // not used signed short loffset; signed int width; - UINT boffset; - UINT lcounter; - UINT sync; // not used - BYTE contrast; - BOOL dispon; // not used - DWORD start1; - DWORD start12; - DWORD end1; - DWORD start2, end2; + UINT boffset; + UINT lcounter; + UINT sync; // not used + BYTE contrast; + BOOL dispon; // not used + DWORD start1; + DWORD start12; + DWORD end1; + DWORD start2, end2; // CdB for HP: add apples header DWORD d0size; // no. of header display lines @@ -106,7 +107,7 @@ typedef struct DWORD d0offset; // offset inside the header display for the content DWORD d0address; // address in saturn addr area for d0memory (2 pages) // BOOL d0Cfig; // modul configured -} CHIPSET; +} Chipset_t; // additional Saturnator registers and Apple hardware typedef struct diff --git a/source/gpl.txt b/source/gpl.txt deleted file mode 100644 index 45645b4..0000000 --- a/source/gpl.txt +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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 2 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, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License.