----------------------------------------------------------------------------- 680x0 Second Processor CiscOS v2.02 changelog (c) Eelco Huininga 2007-2015 ----------------------------------------------------------------------------- Thanks to Jonathan Harston and Dave (Hoglet) for their code reviews and additions v2.03 (20160320) - Changed: SWI_OS_Word_01ff: SUBQ #1, A0 to SUBQ.L #1, A0 - Changed: irq_transfer: LEA nmi_handler_table, A0 to MOVEA.L nmi_handler_table, A0 v2.02 (20150913) - Changed: SWI:IntOn and SWI:IntOff back to original statements (Dave) - Changed: Enabled interrupts on startup (Dave) - Changed: SWI &72: OS_ReadLine32: changed BEQ SWI_OS_ReadLine32_escape to BHS SWI_OS_ReadLine32_escape (Dave) - Changed: irq_transfer: changed MOVE.L A0, $00000074 to MOVE.L (A0), $00000074 (Dave) - Changed: MON calls to OS_ReadLine32 line lenghts in D1 are now .L (was .B) (Dave) - Changed: SWI &29 call &0A: return value of D0 is now $0A (JGH) v2.01 (20150731) - Changed bios_address to FFFF0000 for real hardware, and to 003F0000 for Easy68k emulator - Changed {/} in the help messages to (/), since {/} don`t display correctly in real hardware MODE 7 v2.00 (20150330) - First version that actually runs on real hardware! - Changed TUBE ULA address from $003E0000 to $FFFE0000 - Changed NMI handlers 0-3: read/writes now to r3data (was r2data) - Changed: INT1, INT3, INT4, INT6 and INT7 now point to _irqv, so it shows an 'Unknown Interrupt' error message - Updated: SWI &0E:OS_ReadLine: Optimized code - Changed SWI:IntOn and SWI:IntOff both did the opposite thing ; v1.99f (20150317) - Removed: Removed the `langrom` and `current` variables since they're not used in this OS. They both have been replaced by the `tubeaddress` variable - Removed: *S reference, since the same functionality is now available in *MON - Removed: *SR reference, since the same functionality is now available in *MON - Removed: get_hex_value: it is replaced by SWI &21:OS_ReadUnsigned - Fixed: No such SWI error message now displays correct orignating PC - Fixed: get_hex_value - replaced CLR D1 with CLR.L D1 - Fixed: hoaddr has now the correct value - Fixed: *GO handler - Fixed: *HELP handler now passes the command correctly to the host - Updated: _escapev handler to represent new escapeflag correctly and now uses escapev - Updated: SWI handler now correctly handles OS_WriteI calls, returns correct V values and generates correct errors - Updated: SWI &06:OS_Byte - OS_Byte $8E handler now jumps to correct routine - Updated: SWI &29:OS_FSControl extended to all &3A calls - Updated: *MON now uses : as prompt - Added: OSWORD &FA transfer and initialisation routine - Added: returncode (Sys$ReturnCode) and returncodelimit (Sys$RCLimit) - Added: callbackv, callback_wkspc_ptr, callback_buff, breakpointv, breakpoint_wkspc_ptr, breakpoint_buff, escapev, escape_wkspc_ptr, event_wkspc_ptr, exitv, exit_wkspc_ptr, unusedswiv, unusedswi_wkspc_ptr, upcallv, upcall_wkspc_ptr, - Added: get_ascii_value function - Return printable ASCII value of string at (A6) in D0 - Added: OS_ServiceCall &04 (Service_UKCommand) to the OS_CLI handler - Added: OS_ServiceCall &09 (Service_Help) to the *HELP handler - Added: OS_ServiceCall &27 (Service_Reset) to the main_loop - Added: SWI &11:OS_Exit: Pass control to the most recent exit handler - Added: SWI &15:OS_CallBack: Set up the CallBack handler - Added: SWI &18:OS_BreakCtrl - Set up the BreakPoint handler - Added: SWI &1C:OS_Mouse: Read a mouse state from the buffer - Added: SWI &21:OS_ReadUnsigned - Convert a string to an unsigned number - Added: SWI &28:OS_BinaryToDecimal - Convert a 32-bit integer to a string - Added: SWI &2F:OS_ReadPalette - Read the setting of a particular colour - Added: SWI &38:OS_SWINumberToString: Convert a SWI number to a SWI name string - Added: SWI &39:OS_SWINumberFromString: Convert a SWI name string to a SWI number - Added: SWI &40:OS_ChangeEnvironment - rewrote handler for smaller size and added handlers 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16 - Added: SWI &42:OS_ReadMonotonicTime: Return the number of centiseconds since the last hard reset - Added: SWI &48:OS_WriteEnv - Set the program environment command string and start time - Added: SWI &50:OS_ExitAndDie: Kill a module and pass control to the most recent exit handler - Added: SWI &55:OS_ReadDefaultHandler: Return the address of the default handler - Added: SWI &59:OS_Confirm - Get a yes or no response - Added: SWI &D5:OS_ConvertCardinal1 - convert a value into a unsigned string of decimal characters - Added: SWI &D6:OS_ConvertCardinal2 - convert a value into a unsigned string of decimal characters - Added: SWI &D7:OS_ConvertCardinal3 - convert a value into a unsigned string of decimal characters - Added: SWI &D8:OS_ConvertCardinal4 - convert a value into a unsigned string of decimal characters - Added: SWI &D9:OS_ConvertInteger1 - convert a value into a signed string of decimal characters - Added: SWI &DA:OS_ConvertInteger2 - convert a value into a signed string of decimal characters - Added: SWI &DB:OS_ConvertInteger3 - convert a value into a signed string of decimal characters - Added: SWI &DC:OS_ConvertInteger4 - convert a value into a signed string of decimal characters - Added: SWI &EA:OS_ConvertNetStation - Convert from an Econet station/network number pair to a string - Added: *XFER handler - now uses OSWORD &05 and &06 - Added: *MON - (B)yte search - Added: *MON - (D)isassemble - Added: *MON - (E)dit memory - Added: *MON - (F)ill memory - Added: *MON - (G)o - Added: *MON - (H)ex dump handler - Added: *MON - (M)ove memory handler - Added: *MON - (R) Set register - Added: *MON - (*) OS command handler - Added: *ERROR handler - Added: *QUIT handler - Checked the IRQ (Event, Escape, BRK and Transfer 0 through 7) handlers - Moved the SWI constants to a seperate INCLUDE file - Re-arranged the variables/constants before the start of the code to make it more efficient ; v1.99e (20150302) - Renamed the OS to CiscOS (in reference to RiscOS) - Updated: SWI &06: OS_Byte &8E handler (Enter language ROM) - program start time is now used - Updated: reset_entry: os start time is now used - Updated: reset_entry: interrupts are now disabled during boot time - Updated: Completely rewrote the OS_Word handler - Updated: *XFER handler is now working correctly - Updated: Startup message - Updated: *MON handler is now working correctly - Updated: *HELP handler is now working correctly - Updated: unknown_exception handler now shows extended information - Updated: SWI &01:OS_WriteC - now calls wrchv instead of wrchv calling OS_Writec. This ensures that all output can be redirected when intercepting wrchv - Updated: SWI &19:OS_UnusedSWI - Now preserves registers on exit - Updated: SWI &29:OS_FSControl - Control the filing system manager and the filing system itself - Updated: SWI &2B:OS_GenerateError - speed - Updated: SWI &40:OS_ChangeEnvitonment - speed - Updated: SWI &5D:OS_PrintChar - bugfixes - Updated: SWI &7D:bugfixes - Updated: Optimized the SWI handler and SWI table - Updated: Address error exception handler: now correctly displays the registers pushed to the stack - Updated: SWI_OS_ConvertHex to correctly handle nibbles in the A-F range - Updated: SWI table OS_Word description (was: OS_Byte) - Updated: not_supported used A5 as SWI register instead of A0 - Updated: reset_entry: Set the stack pointer temporary to $00000500 so we can safely jump to subroutines like checkramsize - Updated: checkramsize: changed the address from $00000000 to $00000008 to prevent hangup on reset when in the checkramsize function - Added: Integer divide by zero handler - Added: Illegal instruction handler - Added: osstarttime variable - Added: programstarttime variable - Added: error_pc variable - Added: SWI &10:OS_GetEnv: Read environment parameters - Added: SWI &12:OS_SetEnv: Set environment parameters - Added: SWI &32:OS_ReadPoint: Returns the colour and tint of a point - Added: SWI &34:OS_CallAVector: Call a vector directly - Added: SWI &36:OS_RemoveCursors: Remove the cursors from the screen (VDU 23,1,0;0;0;0;) - Added: SWI &37:OS_RestoreCursors: Restore the cursors from the screen (VDU 23,1,1;0;0;0;) - Added: SWI &3F:OS_CheckModeValid: Check if it is possible to change to a specified screen mode - Added: SWI &56:OS_SetECFOrigin: Set the origin of the ECF pattern (VDU23,17,6,x;y;0,0,0) v1.99d (20140806): - Changed: INT5 to INT2 (TUBE IRQ) for easy designing MC68008P circuits - Changed: INT7 to INT5 (TUBE NMI) for easy designing MC68008P circuits v1.99c (20140319): - Added: *HELP SWI handler (displays all supported SWI calls) - Added: *XFER - Added: NMI handler (JGH/EH) - Added: Privilege exception handler - Updated: *HELP message: *HELP now shows a short help message, and *HELP TUBE now shows the extended help message - Updated: Updated the low-level TUBE calls (JGH) and renamed them to make them more consistent (EH) - Updated: SWI &40: SWI_OS_ChangeEnvironment: now re-routed through changeenvironmentv vector - Updated: Replaced enter_language_rom with SWI_OS_Byte_8E - Updated: SWI &05: OS_CLI handlerit now uses a jump table - Updated: SWI &0C: OS_GBPB handler (JGH/EH) - Added: Escape flag - Added: SWI &13: OS_IntOn - Enable interrupts - Added: SWI &14: OS_IntOff - Disable interrupts - Added: SWI &2C: OS_ReadEscapeState: Check whether an escape contition has occurred - Added: SWI &5B: OS_CRC: Calculate 16-bit CRC value v1.99b (20140303): - Updated: Replaced dump_d0 routine with SWI &D4:OS_ConvertHex8 - Updated: Replaced dump_sr routine with SWI &E0:OS_ConvertBinary2 - Updated: findram procedure is now called checkramsize - Added: SWI &0F: OS_Control: Read or write address handlers - Added: SWI &16: OS_EnterOS - Switch to supervisor mode - Added: SWI &19: OS_UnusedSWI: Read or write handler for unused SWI`s - Added: SWI &29: OS_FSControl: Control the filing system manager and the filing system itself - Added: SWI &29: OS_FSControl $10: Set file system options - Added: SWI &29: OS_FSControl $16: Close all open files - Added: SWI &3A: OS_ValidateAddress: Check that a range of addresses are in logical RAM - Added: SWI &40: OS_ChangeEnvironment: Read or write address handlers (handler 6, 9, 10) - Added: SWI &45: OS_Plot: Perform a direct PLOT call using VDU - Added: SWI &46: OS_WriteN: Write the first D1 characters of the string pointed to by D0 - Added: SWI &5D: OS_PrintChar: Send character to the printer - Added: SWI &7C: OS_LeaveOS - Switch to user mode - Added: SWI &D0: OS_ConvertHex1 - Added: SWI &D1: OS_ConvertHex2 - Added: SWI &D2: OS_ConvertHex4 - Added: SWI &D3: OS_ConvertHex6 - Added: SWI &D4: OS_ConvertHex8 - Added: SWI &DD: OS_ConvertBinary1 - Added: SWI &DE: OS_ConvertBinary2 - Added: SWI &DF: OS_ConvertBinary3 - Added: SWI &E0: OS_ConvertBinary4 - Added: Added beeb (&07) to startup message :-) v1.99a (20140301): Major rewrite of the v0.99 code, abandoning the old 6502-style API calls and implementing ARM SWI-style API calls. - Replaced old 6502-style vectors with new SWI-style vectors D0-7=R0-7, A0=SWI, A1-2=R8-9, A4=R12 (Workspace pointer) - Replaced old 6502-style API calls and replaced them with new SWI-style API calls - RISC OS style SWI handler written for TRAP 12 (JGH/EH) - Removed jump table at $FFFFFF7C (you can use SWI calls from now on) - HIMEM, OSHWM and Stack Pointer are now set accordingly to size of RAM - Startup message now correctly displays CPU type and RAM size (JGH) - Error handler is now SWI &2B: OS_GenerateError - Error handler now routes errors through the ErrorV vector - SWI handler now uses jump table (JGH/EH) - SWI handler now routes known SWI`s with a Software Vector through it`s vector addresses - SWI Handler now routes unknown SWI`s through the UKSWIV vector - Exception handler now prints debug information - Subroutines grouped according to functionality (JGH) - Optimized SWI &06: OS_Byte (JGH) - Added: SWI &0E: OS_ReadLine: Read a line from the current input stream - Added: SWI &7D: OS_ReadLine32: Read a line from the current input stream - checkramsize now returns the RAM size in bytes in D0 - Renamed some messages and errors - Error numbers are now 32-bit - Added: Built-in application jump table (JGH) - Replaced OSWORD &00 calls with OS_ReadLine32 calls (also removed the OSWORD &00 parameterblock) - OSWORD &00 now uses hoaddr as high order address for buffer - Added IRQ handler (JGH) - Different error messages for unknown exceptions and interrupts - Various code optimizations (JGH/EH) - Added: changelog Todo / known issues: Finish *FLASH code so it runs in RAM and programs 28F256 Error handling (see also PRM 1-28): All SWI`s should setup an error block on exit if an error occurred. On exit, D0 should point to error block and V should be set. Write SWI &1E:OS_Module Write SWI &1F:OS_Claim and &20:OS_Release (Claim and release vector) related to &40:OS_ChangeEnvironment Write SWI &29:OS_FSControl other handlers Write SWI &30:OS_ServiceCall Write SWI &40:OS_ChangeEnvironment handlers: 2 (Prefetch abort), 3 (Data abort), 15 (Currently active object) Write SWI &EB:OS_ConvertFixedFileSize Write SWI &EC:OS_ConvertFileSize Write SWI &280:Cache_Control (and *CACHE handler) Write SWI &40380:Debugger_Disassemble Write all Spaced translators Write palettev Finish SWI &45:OS_Plot : Unknown plot codes (216-231,240-255) are sent to the unknown plot vector?, which by default does nothing. Finish SWI &7D write handler for flags in D4: rewrite code so it runs locally on the copro, not using the OSWORD &00 TUBE call but OS_ReadC instead Finish SWI &C0:SWI_OS_ConvertStandardDateAndTime and SWI &C1: SWI_OS_ConvertDateAndTime Finish _exitv Switch from/to supervisor/user-mode at appropiate locations in the code Efficiency: make generic set/clear overflow/carry flag and RTS exits for all SWI`s (BRA is 4 bytes vs. AND+RTS is 6 bytes) Known issue: SWI &06:OS_Byte $82, $83, $84 and $9D - don`t know if these give the correct value Known issue: SWI &07:OS_Word $00 handler doesn`t preserve the Carry flag returned by the OS_ReadLine32 routine Known issue: SWI &0C:OS_OSGBPB - reason &09-&0C are not supported by standard BBC B with DFS: find out if this is gonna be a problem Known issue: SWI &34:OS_CallAVector: pass Carry and oVerflow bits to vector Known issue: SWI &3F:OS_CheckModeValid returns error on checking a shadow mode (MODE 128-135) Known issue: SWI &59:OS_Confirm doesn`t change the mouse pointer Known issue: SWI &7C:OS_LeaveOS - supervisor and user stack are different so the RTS returns to a long stored on the user stack, but the addresses is actually stored on the supervisor stack Known issue: The error_pc variable is not updated every time an error is generated Known issue: Address exception handler: now probably only handles 68000/68008 stacks. Known issue: the IRQ handler will call the Event handler with event nr in D0.B and event parameters in D1=&0000yyxx. This is probably different from the way RiscOS handles Events (ex. Event 3: ADC conversion endedchannel is in R1) If an attempt is made to access protected memory from an insufficiently privileged mode, MEMC traps the exception and sends an abort signal to the ARM. Simplify/join the SWI`s OS_ConvertCardinal and OS_ConvertInteger (only the signed/unsigned branches differ) https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/Kernel/s/Arthur3?annotate=4.3.2.11 StringToInteger Enable/disable interrupts at appropiate locations in the code Differentiate between SSP and USP (System Stack Pointer & User Stack Pointer) Write *TZAP: Memory editor for TUBE Check for register consistency (also: compatibility with ARM SWI calls)