3D13 without retro-abortion-ignore - how?

ZXNet echo conference «code.zx»

From Dratov Denis To lvd 24 September 2005

lvd> Please tell me where to go (which URL) or say so. =) Maybe there are certain articles on this matter But back in 1994, I sorted out this issue on my own when I tried to do Dsk menu for PSM. First, you need to intercept calls to BASIC functions through variable substitution address #5cc2 (in which #c9 = ret). Trace the stack. Through it various functions, such as cleaning the screen, scanning the keyboard, outputting a character. Replace these functions, collect the lines that go to output, ignore all sorts of cleaning, scanning for break, etc. Something like this :) P.S.: It would be interesting to read a more “scientific” one on this matter material or even look at the developments, since the mechanism is universal.

From lvd To All 24 September 2005

How to make a subject? I would like it to be 1 - it doesn’t show a stupid inscription retri-abortion-ignore and others like them, 2 - so that I can find out what was or wasn’t error. There is no need to know the type of error. Please tell me where to go (what URL) or say so. =) -- -+- "For now, I intend to fight the new arrivals." (c) CityAceE

From Robus To Robus 25 September 2005

Rob> It's easy: Rob> the only thing is, if there is a reading error, it will try to read forever =) I made a mistake, it will read several times, depending on the variables, but oh Was there a mistake, you need to read the descriptions of the 3D13 procedures... -- By Rob F. / Entire Group ...

From Robus To lvd 25 September 2005

lvd> How to make a subject? I would like it to be 1 - the stupid inscription would not be displayed lvd> retro-abortion-ignore and others like them, 2 - so that I can find out that it was not lvd> there was an error. There is no need to know the type of error. Please tell me where to go (by lvd> which URL) or say so. =) It's simple: D.I. LD A,63 LD I,A XOR A LD (23613),A LD HL,51697 LD (23746),HL IM 1 EI Of course, VASIKA variables must be set... =) After neither the break nor the ignore lines will work in the above-mentioned ACM lines, The only thing is that if there is a reading error, it will try to read forever =) -- By Rob F. / Entire Group ...

From Dratov Denis To Pawel 25 September 2005

Paw> See the article "Handling TR-DOS disk errors" on our website. Well, in general, this is approximately what I was talking about, but this is not entirely complete except RIA/ReadOnly there are still errors such as a crooked format, or lack of it, which You can already _clarify_ through the status port.

From Pavel Kislyak To Robus 25 September 2005

See the article "Handling TR-DOS disk errors" on our website [http://realsoft.nm.ru/download.htm].

From Ilya Razyev To lvd 26 September 2005

Hello lvd! I am responding to your letter dated September 24, 2005, then I wrote lvd to All, and then it was 22:44:14 on the clock. l> How to make a subject? I would like it to be 1 - the stupid inscription is not displayed l> retro-abortion-ignore and others like them, 2 - so that I can find out that it was not l> there was an error. There is no need to know the type of error. l> Please tell me where to go (which URL) or say so. =) zx.pk.ru programming!!! All the best, Ilya. BoundlessJack KetchDiLife ScreenBeepGirl\n Taimyr 2.00 (c) Evgeny Varnavsky

From Kirill Frolov To lvd 30 September 2005

Press RESET immediately, lvd! On Sat, 24 Sep 05 21:44:14 +0400, lvd wrote: l> How to make a subject? I would like it to be 1 - the stupid inscription is not displayed l> retro-abortion-ignore and others like them, 2 - so that I can find out that it was not l> there was an error. There is no need to know the type of error. In the registers everything is the same as when calling #3D13. External variables: int_mode -- interrupt mode: 0, 1, 2. in_trdos -- not equal to 0 when calling tr-dos functions. At the output: flag C is set if an error occurred (was caught), otherwise, the C flag is cleared. The error type is not returned, but In my opinion, there aren’t very many options: read/write error, recording protection. You can look at the TR-DOS variables. Yes, of course #3D13 functions themselves can return an error sign without a stupid inscription and you still need to check (file search, for example), for read-write sectors is not relevant of course. EXPORT global trdos ; call 0x3d13 in safe way ; CF=1 fatality sign trdos: ex af, af' exx ldhl,0x5cc2 ld a, (hl) push af ld (hl), 0xc3 ld hl, (0x5cc3) push hl ld hl, trdos_catch ld (0x5cc3), hl ld hl, (0x5c3d) push hl ld hl, trdos_fail push hl ldhl,0 ld (0x5d0f), hl add hl, sp ld (trdos_sp), hl ld (0x5c3d), hl ld hl, in_trdos ld (hl), 1 ; for im 2 ; DOES NOT WORK! im 1 ld hl, 0x2758 ld iy, 0x5c3a exa exx call 0x3d13 exa xor a ld (in_trdos), a ld a, (int_mode) cp 2 jr c,trdos_im0 im 2 trdos_im0: exx pop hl pop hl ld (0x5c3d), hl pop hl ld (0x5cc3), hl pop af ld (0x5cc2), a ld hl, 0x2758 exx exa or a ret trdos_catch: ex (sp), hl push af push de push hl ld a, l or 0x05 ld l, a ld de, 0-0x0d6f ; 0d6e, 0d6b adc hl, de jr z, trdos_fail0 pop hl pop de pop af ex (sp), hl ret trdos_fail0: ld sp, 0 trdos_sp equ $-2 ret trdos_fail: xor a ld (in_trdos), a ld a, (int_mode) cp 2 jr c,trdos_im1 im 2 trdos_im1: pop hl ld (0x5c3d), hl pop hl ld (0x5cc3), hl pop af ld (0x5cc2), a scf ret ENDEXP

From Kirill Frolov To Ilya Razyev 30 September 2005

Press RESET immediately, Ilya Razyev! On Mon, 26 Sep 05 08:42:10 +0400, Ilya Razyev wrote: l>> Please tell me where to go (which URL) or say so. =) IR> zx.pk.ru programming!!! zxnet://code.zx

From Kirill Frolov To Dratov Denis 30 September 2005

Press RESET immediately, Dratov Denis! On Sun, 25 Sep 05 17:41:08 +0400, Dratov Denis wrote: Paw>> See the article "Handling TR-DOS disk errors" on our website. DD> Well, this is basically what I was talking about, but it’s not entirely complete DD> in addition to RIA/ReadOnly, there are also errors such as a crooked format, or absence DD> it, which can already be _clarified_ through the status port. From a crooked (for example MS-DOS) format, TR-DOS may even die. And there's nothing to be done about it.

From Kirill Frolov To All 30 September 2005

Press RESET immediately, Kirill Frolov! On Fri, 30 Sep 2005 18:12:02 +0000 (UTC), Kirill Frolov wrote: l>> How to make a subject? I would like it to be 1 - the stupid inscription is not displayed l>> retro-abortion-ignore and others like them, 2 - so that I can find out that it was not l>> there was an error. There is no need to know the type of error. KF> In the registers everything is the same as when calling #3D13. External variables: KF> int_mode -- interrupt mode: 0, 1, 2. In pursuit. If you write *loader*, then try not to commit a number of typical mistakes: 1. gluing the depacker to each packed section - quite One copy is enough; 2. gluing sections “sector by sector” from code blocks is, strictly speaking not an error, but the size of the program increases without any need; 3. incorrect interrupt vector (to the bus in the confirmation cycle it is set regardless of the actual mode and slows down memory performance) may cause the drive controller to malfunction on too "proprietary" models - install I or in ROM, and if you use IM2 - to the fast memory bank (2nd) (address: #8000..#bfff); 4. mixed basic/asm loader with loading of other sectionsvia #3D13 sector by sector - firstly, an average of 128 bytes are lost to the unused “tail” of the BASIC program (see point 2), but the most scary thing - your program can only be loaded on the system equipped with DOS TR-DOS (and even then not always). When the need for this is often there is none, for example, like for a typical DEMO. IF YOUR PROGRAM TAKES LESS THAN 40 KB AND DOES NOT WORK WITH THE DISK, EXCEPT AT THE MOMENT OF LOADING *USE BASIC MONO BLOCK*. This type of bootloader runs on any ZX-Spectrum model compatible computer, with any disk system (except, perhaps, ZX-Spectrum 16K ;-) How does this type of bootloader work? In short: the whole program fits in the REM line and is installed/unpacked after startup to the right place in memory. Because /download address/ BASIC programs different in different systems, the start address is determined by *two operators* *PEEK*, and not hard-wired into the program (which is why I claim that bootloaders from point 4 can be launched on systems with Interface-1 -- use PEEK). The initial code of the program that ensures correct allocation of memory by the CLEAR operator and launch of the depacker, naturally position-independent. Below is an example of my “loader”. He may have some shortcomings and generally not fully completed. But it eliminates a number of describedabove problems. Yes, the most important thing is that the depacker is not screwed to it. would be glad if someone used dehrust for this (actually, the problem is that there is no packer available for IBM-PC from the command line and available for ZX-Spectrum directly from ZASM). Newsgroups: fido7.zx.spectrum From: Kirill Frolov Subject: Re: ZX ASM Date: Tue, 18 Nov 2003 06:32:32 +0300 Press RESET immediately, Maxim Petrankov! On Tue, 18 Nov 03 00:49:36 +0300, Maxim Petrankov wrote: MP> The question is... How to translate a compiled program in ASMA into .B? MP> Well, so that you can run directly from disk via R+Enter... For ZXASM the source is below. The entire program, if it fits in less than, approximately, 40Kb, is written in a single BASIC block AND MAYBE THEN LOADED INTO ANY OS FOR SPECTRUM (compatible with BASIC). AND IN TR-DOS, AND FROM A TAPE PLAYER, AND WITH MB02, AND WITH +3DOS... There are also disadvantages: the program is recorded unpacked. Theoretically, you can use the HRUST packer. Usage example: orgsomethere ent $ jp SAVE_BASIC include "save_bas.asm" ; 123456789 _name_ db "FileNameB" _clear_equ 0x6000-1 org 0x6000 _start_equ $ Your program text here... start Entry point of your program _end_ File save_bas.asm: ;---- save basic program to disk -----; compile and execute this file to save ; executable basic file of loader ; ;arguments (defined as labels): ; _name_ ; db "8 chars" name of executable file (w/o ext.) ; _start_ ; start address of code block ; _end_ ; end address of code block ; start ; execution entry point of code ; _clear_ ; CLEAR argument (optional) ; (defalt is _start_-1) ORG 0xfe00 basic_end: ENT SAVE_BASIC SAVE_BASIC: ld de, basic_end-1 ; copy end of basic stub ld hl, basic_stub_end-1 ld bc, basic_stub_end-basic_stub_space lddr ; move code block to end of workspace ld hl, _end_-1 ld bc, _end_-_start_ lddr ; copy basic stub before code block ld hl, basic_stub_space-1 ld bc, basic_stub_space-basic_stub_start lddr inc de push de ; basic_start ; save name.C ld hl, _name_ ld de, 0x5cdd ld bc, 8 ldir ld a, "C" ld (de), a pop de ; basic_start ld hl, basic_end xor a sbc hl, de ex de, hl ld c, 0x0b call 0x3d13 ; .C -> .B, save FCB, fileno ld a, "B" ld (0x5ce5), a ld a, (0x5d1e) push af ; fileno ld hl, -16 add hl, sp ld sp, hl ex de, hl ld hl, 0x5cdd ld bc, 16 ldir ; delete name.B ld a, 9 ld (0x5d06), a ld c, 0x12 call 0x3d13 ; restore fileno, FCB, rename .C .B ld hl, 0 add hl, sp ld de, 0x5cdd ld bc, 16 ldir ld sp, hl pop af ld hl, (0x5ce8) ld de, -4 ; minus autostart record length add hl, de ld (0x5ce6), hl ; basic length ld (0x5ce8), hl ; basic+var length ld c, 0x09 call 0x3d13 ret ;----------------------------------- ; this is short BASIC stub BASNUM: MACRO db "0" db 0x0e dw 0 dw =1 db 0 ENDM basic_stub_start: db 0x3d, 0x13 dw bs_line_end-bs_line_start+_end_-_start_ bs_line_start: ; RAND USR (n+(PEEK 23635)+256*PEEK 23636) : REM code... db 0xf9, 0xc0, "(" BASNUM bs_entry-basic_stub_start db "+", "(", 0xbe BASNUM 0x5c53: db ")" db "+": BASNUM 256: db "*" db 0xbe: BASNUM 0x5c54 db ")", ":", 0xea bs_entry: ; clear ld bc, _end_+0x100 ; FIXME! call 0x1eb7 ; move code block to its execution address ld hl, (0x5c53) ld de, basic_stub_space-basic_stub_start+_end_-_start_-1 add hl, de ld de, _end_-1 ld bc, _end_-_start_ lddr ; CLEAR below res 4, (iy+1) ld hl, (0x5c53) ld (0x5c4b), hl ld (hl), 0x80 inc hl ld (0x5c59), hl ld (hl), 0x0d inc hl ld (hl), 0x80 inc hl ld (0x5c61), hl ld (0x5c63), hl ld (0x5c65), hl ld hl, start ; jump to code entry push hl ld bc, _clear_ jp 0x1eb7 basic_stub_space: ; basic end of REM line db 0x0d bs_line_end: db 0x80 db 0xaa ; autostart record dw 0x3d13 basic_stub_end: if basic_stub_end&0xc000 else error endif IFNDEF _clear_ _clear_ equ _start_-1 ENDIF Тоже самое для ZAS ассемблера: [...поскипано, ибо никто ZAS'ом не пользуется :-( ...]