SERial line reset
SERial line reset
Hi All,
I have a plain QL setup that is, JS ROM, 8049 and TK2.
I use SER2 to transfer data, SER1 as mouse port, and seldom SER1 to printer output. I sometimes experience problems with serial line, after exchanging data with PC, while reseting the BAUD will not help, and I need to reboot the machine to be able to use printer or mouse again.
I was trying to flush any serial data queued, e.g. by COPY SER TO SCR, then brake, but it also did not bring the right syncing with mouse or printer back to normal.
Is there a way to reset SER line along with 8049 chip to its initial state by a program without need of rebooting?
Many thanks in advance.
Tom
I have a plain QL setup that is, JS ROM, 8049 and TK2.
I use SER2 to transfer data, SER1 as mouse port, and seldom SER1 to printer output. I sometimes experience problems with serial line, after exchanging data with PC, while reseting the BAUD will not help, and I need to reboot the machine to be able to use printer or mouse again.
I was trying to flush any serial data queued, e.g. by COPY SER TO SCR, then brake, but it also did not bring the right syncing with mouse or printer back to normal.
Is there a way to reset SER line along with 8049 chip to its initial state by a program without need of rebooting?
Many thanks in advance.
Tom
Re: SERial line reset
Not to my knowledge.
You can press <CTRL><ALT>7 , that will reset the 8049. But also resets (and thus, confuses) all comms with the IPC, so it's not really useful because it will also kill your keyboard normally.
If all channels to the serial ports are closed and it still doesn't work, I'm afraid you'll need a full reset.
Tobias
You can press <CTRL><ALT>7 , that will reset the 8049. But also resets (and thus, confuses) all comms with the IPC, so it's not really useful because it will also kill your keyboard normally.
If all channels to the serial ports are closed and it still doesn't work, I'm afraid you'll need a full reset.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: SERial line reset
Tobias,
Many thanks, I was not aware of "<CTRL><ALT>7" - key combination, I will certainly try. I am just curious, where this trick is documented.
Also, can I somehow achieve <CTRL><ALT>7 by a program?
Many thanks
Tom
Many thanks, I was not aware of "<CTRL><ALT>7" - key combination, I will certainly try. I am just curious, where this trick is documented.
Also, can I somehow achieve <CTRL><ALT>7 by a program?
Many thanks
Tom
Re: SERial line reset
I scanned an article by Alan Turnbull about implementing a Warm Reset using the CTRL-ALT-7 key combinations. I hope they'll show up below - it should be possible to click on the pages to magnify them, my OCR program couldn't handle the grey boxes, so I just scanned as a graphic.tcat wrote:Tobias,
Many thanks, I was not aware of "<CTRL><ALT>7" - key combination, I will certainly try. I am just curious, where this trick is documented.
Also, can I somehow achieve <CTRL><ALT>7 by a program?
Many thanks
Tom
This key combination was used to invoke and external monitor/debugger during QL development, Some code remained in Sinclair ROMs, the nett effect is usually just to lock up the QL. Here is what Andrew Pennell said about it in QDOS Companion book:
Code: Select all
Level 7 is usually ignored but may be redfined with RAM vector $1C. Level 7 interrupts can normally only be triggered by additional hardware. However, an early debugging tool has been left in the hardware so that pressing CTRL ALT 1, 5 or 7 invokes the equivalent interrupt. A level 7 interrupt will usually cause the machine to lock up as it destroys the communication process between 68008 and 8049 IPC.
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
-
- Font of All Knowledge
- Posts: 3957
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: SERial line reset
Hi,
Was there not a bug in the 8049 ALT 7 code, which Hermes cured...
Was there not a bug in the 8049 ALT 7 code, which Hermes cured...
Regards,
Derek
Derek
Re: SERial line reset
Hermes converts CTL-ALT-7 into CTL-ALT-ESC-7 which is probably just so that it is harder to press by mistake (extra key). I think on a Hermes system that it actually resets the QL as opposed to just locking up on a QL without Hermes.Derek_Stewart wrote:Hi,
Was there not a bug in the 8049 ALT 7 code, which Hermes cured...
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
Re: SERial line reset
Maybe I didn't make myself clear enough:
<CTRL><ALT>7 does re-set the IPC. But as the communication between IPC and "main" QL is in no way secured and breaks as soon as one of the two partners is not compliant with it (which happens if the IPC stops to transmit in the middle of a transfer because it has just been re-set, and we're always in the middle of a transfer in that situation, because after all: you've just pressed a key).......
This key combination is thus entirely useless and normally just locks up the QL.
Tobias
<CTRL><ALT>7 does re-set the IPC. But as the communication between IPC and "main" QL is in no way secured and breaks as soon as one of the two partners is not compliant with it (which happens if the IPC stops to transmit in the middle of a transfer because it has just been re-set, and we're always in the middle of a transfer in that situation, because after all: you've just pressed a key).......
This key combination is thus entirely useless and normally just locks up the QL.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: SERial line reset
Dear All,
I have hand coded the assembly, compiled and run the binary. Pressing <CTL> <ALT> <7>, resets the machine, goes to the initial screen, but does not clear the RAM, but does reset system variables.
I cannot quite make out from the scan, these addresses, so I hope I got them right.
WARM_RESTART_AH EQU $01CA Warm retstart for 'AH' ROM (QDOS v1.02)
WARM_RESTART_JM EQU $01CA Warm retstart for 'JM' ROM (QDOS v1.03)
WARM_RESTART_JS EQU $01CC Warm retstart for 'JS' ROM (QDOS v1.10)
WARM_RESTART_JSU EQU $01CE Warm retstart for 'JSU' ROM (QDOS v1U10)
WARM_RESTART_MG EQU $01CC Warm retstart for 'MG' ROM (QDOS v1.13)
Code follows, please compile with GST MAC as the assembly uses long labels, older GST Assemblers can cope only with short labels up to 8 char in length.
You may need, to change this line to correspond to your system ROM version.
MOVE.L #WARM_RESTART_JS,A0
It seems that SuperBASIC listing in the article does not have the right codes in DATA statement, at least they do not correspond to the assembly listing.
I have added DATA statements with correct codes, corrected SuperBASIC listing follows below, it is for JS ROM QL.
Cheers
Tom
I have hand coded the assembly, compiled and run the binary. Pressing <CTL> <ALT> <7>, resets the machine, goes to the initial screen, but does not clear the RAM, but does reset system variables.
I cannot quite make out from the scan, these addresses, so I hope I got them right.
WARM_RESTART_AH EQU $01CA Warm retstart for 'AH' ROM (QDOS v1.02)
WARM_RESTART_JM EQU $01CA Warm retstart for 'JM' ROM (QDOS v1.03)
WARM_RESTART_JS EQU $01CC Warm retstart for 'JS' ROM (QDOS v1.10)
WARM_RESTART_JSU EQU $01CE Warm retstart for 'JSU' ROM (QDOS v1U10)
WARM_RESTART_MG EQU $01CC Warm retstart for 'MG' ROM (QDOS v1.13)
Code follows, please compile with GST MAC as the assembly uses long labels, older GST Assemblers can cope only with short labels up to 8 char in length.
Code: Select all
* Motorola MC68008 program to provide 'warm reset'
* facility by re-defining the <CTRL>, <ALT>, '7' effect.
* Also, vector chich normally cause the QL to 'crash' are
* re-defined to cause a warm system restart instead.
*
* Assemble, save to Microdrive, reserve memory with
* something like LET a=RESPR(256), load code into memory
* with something like 'LBYTES mdv1_code,a' and activate
* with 'CALL a'.
*
* Alternatively, run program in Listing 2.
*
* COPYRIGHT (c) August 1985, Alan Turnbull, B.Sc.
BASIC_JOB EQU $00 SuperBASIC job ID
MT_TRAPV EQU $07 TRAP #1 key for TRAP re-direction
WARM_RESTART_AH EQU $01CA Warm retstart for 'AH' ROM (QDOS v1.02)
WARM_RESTART_JM EQU $01CA Warm retstart for 'JM' ROM (QDOS v1.03)
WARM_RESTART_JS EQU $01CC Warm retstart for 'JS' ROM (QDOS v1.10)
WARM_RESTART_JSU EQU $01CE Warm retstart for 'JSU' ROM (QDOS v1U10)
WARM_RESTART_MG EQU $01CC Warm retstart for 'MG' ROM (QDOS v1.13)
NEW_DIV_BY_ZERO EQU $005E
NEW_CHK_INSTR EQU $005E
NEW_TRAPV_INSTR EQU $005E
NEW_TRACE_EXCEPT EQU $005E
NEW_TRAP_05 EQU $005E
NEW_TRAP_06 EQU $005E
NEW_TRAP_07 EQU $005E
NEW_TRAP_08 EQU $005E Address of 'RTE' in all ROMs
NEW_TRAP_09 EQU $005E
NEW_TRAP_0A EQU $005E
NEW_TRAP_0B EQU $005E
NEW_TRAP_0C EQU $005E
NEW_TRAP_0D EQU $005E
NEW_TRAP_0E EQU $005E
NEW_TRAP_0F EQU $005E
VIDEO_RAM EQU $20000 Start of video RAM
SV_RAMT EQU $28020 System variable that holds RAM top + 1
SV_STACT EQU $28480 End of fixed system variables
SECTION NMI7
LEA TRAP_TABLE,A1 Point to new TRAP vector table
LEA NEW_ADDR_ERROR,A0
MOVE.L A0,ADDRESS_ERROR-TRAP_TABLE(A1)
LEA NEW_ILL_INSTR,A0
MOVE.L A0,ILLEGAL_INSTR-TRAP_TABLE(A1) Load new vectors
LEA NEW_PRIV_VIOL,A0
MOVE.L A0,PRIVILEGE_VIOL-TRAP_TABLE(A1)
LEA NEW_INT_LEV_7,A0
MOVE.L A0,INT_LEV_7-TRAP_TABLE(A1)
MOVEQ #BASIC_JOB,D1 Signal SuperBASIC job
MOVEQ #MT_TRAPV,D0 Re-define trap table
TRAP #1 Return to SuperBASIC
RTS
TRAP_TABLE
ADDRESS_ERROR DS.L 1
ILLEGAL_INSTR DS.L 1
DC.L NEW_DIV_BY_ZERO
DC.L NEW_CHK_INSTR
DC.L NEW_TRAPV_INSTR
PRIVILEGE_VIOL DS.L 1
DC.L NEW_TRACE_EXCEPT
INT_LEV_7 DS.L 1
DC.L NEW_TRAP_05
DC.L NEW_TRAP_06
DC.L NEW_TRAP_07
DC.L NEW_TRAP_08
DC.L NEW_TRAP_09
DC.L NEW_TRAP_0A
DC.L NEW_TRAP_0B
DC.L NEW_TRAP_0C
DC.L NEW_TRAP_0D
DC.L NEW_TRAP_0E
DC.L NEW_TRAP_0F
* [Effectively the same is as the corresponding routine in ROM]
NEW_ADDR_ERROR ADDQ.L #8,A7 Skip over extra words on stack
RTE Return from this exception
NEW_ILL_INSTR
NEW_PRIV_VIOL
NEW_INT_LEV_7 MOVE.W #$2700,SR Set 'supervisor' mode, mask-out interrupts 1-6 and clear 'user' flags
MOVEA.L SV_RAMT,A5 Signal value for top of RAM needed by warm restart
LEA VIDEO_RAM,A0
MOVE.L #SV_STACT-VIDEO_RAM-1,D0 Number of bytes to top of fixed system variable
AGAIN CLR.B (A0)+ Clear a byte (also provides a delay to stop other lev. 7 interrupts)
DBF D0,AGAIN Repeat until counter exhausted
MOVE.L #WARM_RESTART_JS,A0 Point to warm restart routine in 'JS' ROM
JSR (A0) Do it!
END
MOVE.L #WARM_RESTART_JS,A0
It seems that SuperBASIC listing in the article does not have the right codes in DATA statement, at least they do not correspond to the assembly listing.
I have added DATA statements with correct codes, corrected SuperBASIC listing follows below, it is for JS ROM QL.
Code: Select all
100 REMark SuperBASIC program to implement MC68008 program in Listing 1
110 REMark COPYRIGHT (c) April 1985, Alan Turnbull, B.Sc.
120 :
130 LET reserved_address=RESPR(160)
140 RESTORE
150 LET address=reserved_address
160 REPeat read_and_store_data
170 IF EOF THEN EXIT read_and_store_data
180 READ data_item
190 POKE_W address,data_item
200 LET address=address+2
210 END REPeat read_and_store_data
220 CALL reserved_address
230 STOP
240 :
250 DATA 17402, 42, 16890, 114, 9032, 0, 16890, 110
260 DATA 9032, 4, 16890, 102, 9032, 20, 16890, 94
270 DATA 9032, 28, 29184, 28679, 20033, 20085, 0, 0
280 DATA 0, 0, 0, 94, 0, 94, 0, 94
290 DATA 0, 0, 0, 94, 0, 0, 0, 94
300 DATA 0, 94, 0, 94, 0, 94, 0, 94
310 DATA 0, 94, 0, 94, 0, 94, 0, 94
320 DATA 0, 94, 0, 94, 20623, 20083, 18172, 9984
330 DATA 10873, 2, -32736, 16889, 2, 0, 8252, 0
340 DATA -31617, 16920, 20936, -4, 8316, 0, 460, 20112
Tom
Last edited by tcat on Sun Nov 15, 2015 4:11 pm, edited 1 time in total.
-
- Font of All Knowledge
- Posts: 3957
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: SERial line reset
Hi Tom,
Looks like the original code assumed that the System Variables and Screen Base address stay in the same place.
MT.INF (or DO.SMSQ) should been used to find the System Variables address. The Screen Base address is found in the Channel Block.
If Minerva with the second screen enabled, the code will fail.
Looks like the original code assumed that the System Variables and Screen Base address stay in the same place.
MT.INF (or DO.SMSQ) should been used to find the System Variables address. The Screen Base address is found in the Channel Block.
If Minerva with the second screen enabled, the code will fail.
Regards,
Derek
Derek
Re: SERial line reset
Derek,
I will try to improve the code further, I am just wondering if it would be also possible to somehow restore system variables after restart.
Tom
I will try to improve the code further, I am just wondering if it would be also possible to somehow restore system variables after restart.
Tom