Jump to content
IGNORED

AAC (ASCII ATASCII Converter)


fujidude

Recommended Posts

Recently I coded up a program to allow converting ASCII and ATASCII files. The program is command line driven and intended for use under SpartaDOS X (earlier versions may also work). I posted this program in the Sparta DOS 4.47 topic, but am moving it here to its own. I am hoping for testing and feedback. When the program is finally done to the level of performance I am happy with, hopefully it can be made part of the SDX Toolkit. But if not, anyone will be free to add it to their own tools collection as they see fit.

 

So, download it and give it a try if you like. Keep the following program usage in mind because right now, very little user entry validation is performed. It is therefore important that you spell out your device:filename entries.

 

AAC (ASCII ATASCII Converter) is designed to copy a source text file to a destination text file, doing a text translation in the process. Only the output format is specified. It will be assumed the input file will be the opposing type. For example, if an ASCII, (either DOS/Win or Unix) output translation is used, then the input file is assumed to be in ATASCII form.

Usage:

   AAC <source> <dest> /[T|A|U|H]
   /T = convert to ATASCII
   /A = convert to ASCII (DOS/Win)
   /U = convert to ASCII (Unix)
   /H = this help summary

Eg:

  X AAC.EXE D1:COOLINFO.ASC D2:COOLINFO.TXT /T

If using COMEXE you can get by with this:

  AAC D1:COOLINFO.ASC D2:COOLINFO.TXT /T


Download the program.

Edited by fujidude
Link to comment
Share on other sites

Keep in mind this version is ignoring tabs. I am already incorporating that change in the next version. I'll post the next version to test in the next day or so.

 

Also keep in mind that for now, if you are using real hardware, and your source and destination file reside on the same physical floppy disk, the going will be slow and give your floppy drive one hell of a workout. I suggest source and dest be on different disks/drives if working from one real floppy.

 

I hope to add in a buffering system later which will take away any such concern, but most people these days are using SIO2PC type stuff, emulators, or have multiple real floppies anyway.

Edited by fujidude
Link to comment
Share on other sites

New test version out! Now the SD "crunch" routine is used so if you don't specify a drive letter the current one gets put on. Also, keep in mind that in SDX D:myfile is the same as D4:myfile. If the current drive is B: (or D2:), and you simply enter myfile, it becomes D2:myfile.

 

Also in this version... Tabs are now translated. Also, drawing characters that are common to both ATASCII and ASCII are now included in conversions. This includes that single line box drawing. The angle stuff of ATASCII and the double line box drawing of ASCII are discarded as each has no equivalent in the other.

 

Again, use AAC /H for help.

 

 

Edited by fujidude
  • Like 1
Link to comment
Share on other sites

Hi everyone! AAC is almost ready for it's 1.0 release but I am having a problem with the last thing I needed to put in: an error handler. My error handler is meant to simply display the error, and then jump to DOS via DOSVEC. All other ways I exit the program also use a jump to DOSVEC and work fine. But, if I cause an error, say like 170, the message prints and the program hangs somewhere in la la land. I don't know why and thus how to correct.

 

This program is written in action. I am going to supply all the source code and a symbol list to make ML monitor checking easier. I would appreciate any of you who can help, and if you know someone else in this community who would be good to have look at it, pleas invite them to do so.

 

Thanks a bunch!

 

FujiDude

 

Edited by fujidude
Link to comment
Share on other sites

Thanks to Phaeron for finding the issue (or at least enough of it to get a correction working). I have made version 1.0. I believe it works reasonably well. It loads in at $2600 and is around 5KB or so. Should work with most configs of Sparta. It is possible this program could even work with DOS-XL, but I have a check in it that looks for SpartaDOS and aborts if Sparta is not being used. Given the availability of SpartaDOS X and it's rich feature set, I doubt making the effort to see if DOS-XL worked or changing the DOS check code would be worth it. If I'm wrong, and there are a secret society of DOS-XL die-hards who want this, please speak up.

 

It's late, and I want to put it together in a package before I post it. Look for it tomorrow (err, later today).

Edited by fujidude
Link to comment
Share on other sites

Okay, if anyone cares here is version 1.0 of AAC!

 

AAC (ASCII ATASCII Converter) is a command line driven program for SpartaDOS designed to copy a source text file to a destination text file, doing a text translation in the process. Only the output format is specified. It will be assumed the input file will be the opposing type. For example, if an ASCII, (either DOS/Win or Unix) output translation is used, then the input file is assumed to be in ATASCII form.

What is translated:

  • Upper and lower case alphabetic characters
  • Numeric digits
  • Tabs
  • Common punctuation symbols
  • Single line box drawing characters, excepting angled ones
  • Inverse ATASCII (treated the same as non inverse)

I'll attach a DD disk image of the program.

 

 

 

 

Link to comment
Share on other sites

This is a very useful tool. I'm sure I will put it on my Incognito system when I get it set up again. I had been writing quick and dirty programs to accomplish this very task when I needed to. I usually forgot to save them.

 

example:

 

10 open#1,4,0,"D:infile.txt"

20 open#2,8,0,"D:outfile.txt"

30 trap 100

40 get #1,a

50 if a=13 then 70

50 put#1,a

60 goto 40

70 a=155:put#1,a

80 get#1,a:rem throw away line feed

90 goto 40

100 close #1:close #2

 

slow, and a pain in the ass.

Edited by Kyle22
Link to comment
Share on other sites

As about the "known bugs": the behaviour is also fixed when one starts the program with the following command:

 

X /C AAC

 

The /C parameter clears out the memory from MEMLO to MEMTOP. So it seems that the problem is related to the contents of the memory as left after a program is used. Of course, Sparta Commander, when loaded, occupies about 12k over the MEMLO, so it leaves a lot of "random" (from the point of view of the AAC) values in the area the AAC is loaded to. Therefore it is easily visible that the AAC has a problem running after the Sparta Commander was used.

 

But in fact, this symptom means that there is an uninitialized variable inside the AAC binary, which gets a proper initial value when the program is loaded to an area of zeroed RAM. This may be a bug in the program itself, or in a library, or in the compiler. It certainly can be traced down with a debugger, and the case looks pretty simple: even AAC /H does not work, so the problem is probably related to the command line parser.

Link to comment
Share on other sites

I have been looking over the program (and library) code quite a bit and have not yet been able to find any variables used for anything that were not 1st set to an appropriate value, either by declaration initialization or as part of the program.

 

Nevermind the /h option, the first thing that is called that outputs to the screen is title() @ $3363. I also noticed, for whatever it's worth, that the enter BASIC, gr.0, dos, then AAC trick does not work with Altirra BASIC 1.45 as it does with Atari BASIC rev. c.

 

I was thinking the issue (whether with my program or outside of it) was related to something with the screen or editor devices, but after trying an experiment I'm less suspicious of it. The experiment I tried was to run and exit SC, then run AAC with actual valid arguments to give it some real work to do. The idea was to see if it did the job but just fail to display information on screen. Sadly, the job was not done.

Link to comment
Share on other sites

As about the "known bugs": the behaviour is also fixed when one starts the program with the following command:

 

X /C AAC

 

The /C parameter clears out the memory from MEMLO to MEMTOP. So it seems that the problem is related to the contents of the memory as left after a program is used. Of course, Sparta Commander, when loaded, occupies about 12k over the MEMLO, so it leaves a lot of "random" (from the point of view of the AAC) values in the area the AAC is loaded to. Therefore it is easily visible that the AAC has a problem running after the Sparta Commander was used.

 

But in fact, this symptom means that there is an uninitialized variable inside the AAC binary, which gets a proper initial value when the program is loaded to an area of zeroed RAM. This may be a bug in the program itself, or in a library, or in the compiler. It certainly can be traced down with a debugger, and the case looks pretty simple: even AAC /H does not work, so the problem is probably related to the command line parser.

 

I haven't found a garbage in variable situation yet. I did run this through Altirra's debugger though (after loading symbol names).

 

Here is the 1st run that works:

(1210:  0,  0) C=FF00 X=00 Y=00 S=EF P=B0 (N     )  00:B937: AD FC 02          LDA CH       [$00:02FC] = $FF
Altirra> yr aac.sym
118 symbol(s) loaded.
Altirra> bp main
Breakpoint 0 set at $370A.
Altirra> g
Breakpoint 0 hit
(1424:193,109) C=FF00 X=03 Y=00 S=F2 P=B3 (N   ZC)  00:370A: 4C 0D 37  main    JMP $370D    [$00:370D] = $20
(1424:193,110) C=FF00 X=03 Y=00 S=F2 P=B3 (N   ZC)  00:370D: 20 63 33          JSR title    [$00:3363] = $4C
(1424:193,110) C=FF00 X=03 Y=00 S=F0 P=B3 (N   ZC)  00:3363: 4C 66 33  title   JMP $3366    [$00:3366] = $20
(1424:193,110) C=FF00 X=03 Y=00 S=F0 P=B3 (N   ZC)  00:3366: 20 AF 28          JSR PutE     [$00:28AF] = $A9
(1424:203, 22) C=FF9B X=00 Y=01 S=F0 P=31 (     C)  00:3369: 4C 86 33          JMP $3386    [$00:3386] = $A2
(1424:203, 23) C=FF9B X=00 Y=01 S=F0 P=31 (     C)  00:3386: A2 33             LDX #$33
(1424:203, 23) C=FF9B X=33 Y=01 S=F0 P=31 (     C)  00:3388: A9 6C             LDA #$6C
(1424:203, 23) C=FF6C X=33 Y=01 S=F0 P=31 (     C)  00:338A: 20 3B 28          JSR PrintE   [$00:283B] = $86
(1425: 34, 82) C=FF65 X=00 Y=01 S=F0 P=31 (     C)  00:338D: 60                RTS
(1425: 34, 82) C=FF65 X=00 Y=01 S=F2 P=31 (     C)  00:3710: 20 D8 30          JSR sdxLibIn [$00:30D8] = $4C
(1425: 34, 90) C=FF01 X=00 Y=00 S=F2 P=30 (      )  00:3713: A5 A0             LDA $A0      [$00:00A0] = $01
(1425: 34, 90) C=FF01 X=00 Y=00 S=F2 P=30 (      )  00:3715: F0 03             BEQ $371A
(1425: 34, 90) C=FF01 X=00 Y=00 S=F2 P=30 (      )  00:3717: 4C 52 37          JMP $3752    [$00:3752] = $A9
(1425: 34, 90) C=FF01 X=00 Y=00 S=F2 P=30 (      )  00:3752: A9 01             LDA #$01
(1425: 34, 90) C=FF01 X=00 Y=00 S=F2 P=30 (      )  00:3754: 20 48 28          JSR Close    [$00:2848] = $20
(1425: 40,  1) C=FF00 X=10 Y=01 S=F2 P=31 (     C)  00:3757: A9 02             LDA #$02
(1425: 40,  1) C=FF02 X=10 Y=01 S=F2 P=31 (     C)  00:3759: 20 48 28          JSR Close    [$00:2848] = $20
(1425: 45, 25) C=FF00 X=20 Y=01 S=F2 P=31 (     C)  00:375C: A0 00             LDY #$00
(1425: 45, 25) C=FF00 X=20 Y=00 S=F2 P=33 (    ZC)  00:375E: 8C 09 37          STY $3709    [$00:3709]
(1425: 45, 26) C=FF00 X=20 Y=00 S=F2 P=33 (    ZC)  00:3761: AD 94 26          LDA $2694    [$00:2694] = $26
(1425: 45, 26) C=FF26 X=20 Y=00 S=F2 P=31 (     C)  00:3764: 8D 16 31          STA $3116    [$00:3116]
(1425: 45, 26) C=FF26 X=20 Y=00 S=F2 P=31 (     C)  00:3767: AD 93 26          LDA $2693    [$00:2693] = $95
(1425: 45, 27) C=FF95 X=20 Y=00 S=F2 P=B1 (N    C)  00:376A: 8D 15 31          STA tE       [$00:3115]
(1425: 45, 27) C=FF95 X=20 Y=00 S=F2 P=B1 (N    C)  00:376D: AD 47 36          LDA $3647    [$00:3647] = $36
(1425: 45, 27) C=FF36 X=20 Y=00 S=F2 P=31 (     C)  00:3770: 8D 94 26          STA $2694    [$00:2694]
(1425: 45, 28) C=FF36 X=20 Y=00 S=F2 P=31 (     C)  00:3773: AD 46 36          LDA $3646    [$00:3646] = $48
(1425: 45, 28) C=FF48 X=20 Y=00 S=F2 P=31 (     C)  00:3776: 8D 93 26          STA $2693    [$00:2693]
(1425: 45, 28) C=FF48 X=20 Y=00 S=F2 P=31 (     C)  00:3779: 20 CD 2D          JSR nParms   [$00:2DCD] = $4C
(1425: 46, 19) C=FF00 X=20 Y=00 S=F2 P=33 (    ZC)  00:377C: A5 A0             LDA $A0      [$00:00A0] = $00
(1425: 46, 20) C=FF00 X=20 Y=00 S=F2 P=33 (    ZC)  00:377E: F0 03             BEQ $3783
(1425: 46, 20) C=FF00 X=20 Y=00 S=F2 P=33 (    ZC)  00:3783: 20 8E 33  L3783   JSR info     [$00:338E] = $4C
(1432:105, 94) C=FFFF X=FF Y=01 S=FF P=B1 (N    C)  00:A1D9: E8                INX
(1432:105, 96) C=FFFF X=00 Y=01 S=FF P=33 (    ZC)  00:A1DA: 8E 0E D4          STX NMIEN    [$00:D40E]
(1432:105,100) C=FFFF X=00 Y=01 S=FF P=33 (    ZC)  00:A1DD: 78                SEI
(1432:105,102) C=FFFF X=00 Y=01 S=FF P=37 (   IZC)  00:A1DE: AD 01 D3          LDA PORTB    [$00:D301] = $FF
(1432:105,106) C=FFFF X=00 Y=01 S=FF P=B5 (N  I C)  00:A1E1: 48                PHA
(1432:105,108) C=FFFF X=00 Y=01 S=FE P=B5 (N  I C)  00:A1E2: 29 FE             AND #$FE
(1432:105,111) C=FFFE X=00 Y=01 S=FE P=B5 (N  I C)  00:A1E4: 8D 01 D3          STA PORTB    [$00:D301]
(1432:106,  1) C=FFFE X=00 Y=01 S=FE P=B5 (N  I C)  00:A1E7: A9 DB             LDA #$DB
(1432:106,  3) C=FFDB X=00 Y=01 S=FE P=B5 (N  I C)  00:A1E9: 8D FA FF          STA $FFFA    [$00:FFFA]
(1432:106,  6) C=FFDB X=00 Y=01 S=FE P=B5 (N  I C)  00:A1EC: A9 09             LDA #$09
(1432:106,  9) C=FF09 X=00 Y=01 S=FE P=35 (   I C)  00:A1EE: 8D FB FF          STA $FFFB    [$00:FFFB]
(1432:106, 12) C=FF09 X=00 Y=01 S=FE P=35 (   I C)  00:A1F1: A9 DD             LDA #$DD
(1432:106, 15) C=FFDD X=00 Y=01 S=FE P=B5 (N  I C)  00:A1F3: 8D FE FF          STA $FFFE    [$00:FFFE]
(1432:106, 18) C=FFDD X=00 Y=01 S=FE P=B5 (N  I C)  00:A1F6: A9 09             LDA #$09
(1432:106, 21) C=FF09 X=00 Y=01 S=FE P=35 (   I C)  00:A1F8: 8D FF FF          STA $FFFF    [$00:FFFF]
(1432:106, 24) C=FF09 X=00 Y=01 S=FE P=35 (   I C)  00:A1FB: 68                PLA
(1432:106, 31) C=FFFF X=00 Y=01 S=FF P=B5 (N  I C)  00:A1FC: 8D 01 D3          STA PORTB    [$00:D301]
(1432:106, 36) C=FFFF X=00 Y=01 S=FF P=B5 (N  I C)  00:A1FF: 58        LA1FF   CLI
(1432:106, 39) C=FFFF X=00 Y=01 S=FF P=B1 (N    C)  00:A200: A9 40             LDA #$40
(1432:106, 41) C=FF40 X=00 Y=01 S=FF P=31 (     C)  00:A202: 8D 0E D4          STA NMIEN    [$00:D40E]
(1432:106, 47) C=FF40 X=00 Y=01 S=FF P=31 (     C)  00:A205: 8E 1D 0D          STX $0D1D    [$00:0D1D]
(1432:106, 51) C=FF40 X=00 Y=01 S=FF P=31 (     C)  00:A208: 86 0E             STX APPMHI   [$00:000E]
(1432:106, 55) C=FF40 X=00 Y=01 S=FF P=31 (     C)  00:A20A: 86 0F             STX APPMHI+1 [$00:000F]
(1432:106, 59) C=FF40 X=00 Y=01 S=FF P=31 (     C)  00:A20C: E8                INX
(1432:106, 62) C=FF40 X=01 Y=01 S=FF P=31 (     C)  00:A20D: 8E E5 0C          STX $0CE5    [$00:0CE5]
(1432:106, 65) C=FF40 X=01 Y=01 S=FF P=31 (     C)  00:A210: 20 C5 A2          JSR $A2C5    [$00:A2C5] = $20
(1432:109, 60) C=FF12 X=12 Y=01 S=FF P=30 (      )  00:A213: CE E5 0C          DEC $0CE5    [$00:0CE5] = $01
(1432:109, 65) C=FF12 X=12 Y=01 S=FF P=32 (    Z )  00:A216: 20 27 A2          JSR $A227    [$00:A227] = $A2
(1432:110, 29) C=FF01 X=FF Y=01 S=FF P=B0 (N     )  00:A219: 20 BD A1          JSR $A1BD    [$00:A1BD] = $A9
(1432:110, 52) C=FF00 X=FF Y=01 S=FF P=32 (    Z )  00:A21C: 20 AE AD          JSR $ADAE    [$00:ADAE] = $20
(1432:153, 53) C=FF31 X=00 Y=FF S=FF P=F1 (NV   C)  00:A21F: A9 02             LDA #$02
(1432:153, 56) C=FF02 X=00 Y=FF S=FF P=71 ( V   C)  00:A221: 20 4F A2          JSR $A24F    [$00:A24F] = $8D

And here is a run after using SC that doesn't work. Notice it never makes it back from the title routine:

(646:  0,  0) C=FF00 X=00 Y=00 S=EF P=B0 (N     )  00:B935: F0 19             BEQ $B950
Altirra> yr aac.sym
118 symbol(s) loaded.
Altirra> bp main
Breakpoint 0 set at $370A.
Altirra> g
Breakpoint 0 hit
(1231:193,109) C=FF00 X=03 Y=00 S=F2 P=B3 (N   ZC)  00:370A: 4C 0D 37  main    JMP $370D    [$00:370D] = $20
(1231:193,110) C=FF00 X=03 Y=00 S=F2 P=B3 (N   ZC)  00:370D: 20 63 33          JSR title    [$00:3363] = $4C
(1231:193,110) C=FF00 X=03 Y=00 S=F0 P=B3 (N   ZC)  00:3363: 4C 66 33  title   JMP $3366    [$00:3366] = $20
(1231:193,110) C=FF00 X=03 Y=00 S=F0 P=B3 (N   ZC)  00:3366: 20 AF 28          JSR PutE     [$00:28AF] = $A9
(1231:199,  3) C=FFFF X=FF Y=87 S=FF P=B1 (N    C)  00:A1D9: E8                INX
(1231:199,  5) C=FFFF X=00 Y=87 S=FF P=33 (    ZC)  00:A1DA: 8E 0E D4          STX NMIEN    [$00:D40E]
(1231:199,  9) C=FFFF X=00 Y=87 S=FF P=33 (    ZC)  00:A1DD: 78                SEI
(1231:199, 11) C=FFFF X=00 Y=87 S=FF P=37 (   IZC)  00:A1DE: AD 01 D3          LDA PORTB    [$00:D301] = $FF
(1231:199, 15) C=FFFF X=00 Y=87 S=FF P=B5 (N  I C)  00:A1E1: 48        LA1E1   PHA
(1231:199, 17) C=FFFF X=00 Y=87 S=FE P=B5 (N  I C)  00:A1E2: 29 FE             AND #$FE
(1231:199, 20) C=FFFE X=00 Y=87 S=FE P=B5 (N  I C)  00:A1E4: 8D 01 D3          STA PORTB    [$00:D301]
(1231:199, 24) C=FFFE X=00 Y=87 S=FE P=B5 (N  I C)  00:A1E7: A9 DB             LDA #$DB
(1231:199, 27) C=FFDB X=00 Y=87 S=FE P=B5 (N  I C)  00:A1E9: 8D FA FF          STA $FFFA    [$00:FFFA]
(1231:199, 31) C=FFDB X=00 Y=87 S=FE P=B5 (N  I C)  00:A1EC: A9 09             LDA #$09
(1231:199, 35) C=FF09 X=00 Y=87 S=FE P=35 (   I C)  00:A1EE: 8D FB FF          STA $FFFB    [$00:FFFB]
(1231:199, 39) C=FF09 X=00 Y=87 S=FE P=35 (   I C)  00:A1F1: A9 DD             LDA #$DD
(1231:199, 43) C=FFDD X=00 Y=87 S=FE P=B5 (N  I C)  00:A1F3: 8D FE FF          STA $FFFE    [$00:FFFE]
(1231:199, 47) C=FFDD X=00 Y=87 S=FE P=B5 (N  I C)  00:A1F6: A9 09             LDA #$09
(1231:199, 51) C=FF09 X=00 Y=87 S=FE P=35 (   I C)  00:A1F8: 8D FF FF          STA $FFFF    [$00:FFFF]
(1231:199, 55) C=FF09 X=00 Y=87 S=FE P=35 (   I C)  00:A1FB: 68                PLA
(1231:199, 60) C=FFFF X=00 Y=87 S=FF P=B5 (N  I C)  00:A1FC: 8D 01 D3          STA PORTB    [$00:D301]
(1231:199, 64) C=FFFF X=00 Y=87 S=FF P=B5 (N  I C)  00:A1FF: 58        LA1FF   CLI
(1231:199, 66) C=FFFF X=00 Y=87 S=FF P=B1 (N    C)  00:A200: A9 40             LDA #$40
(1231:199, 68) C=FF40 X=00 Y=87 S=FF P=31 (     C)  00:A202: 8D 0E D4          STA NMIEN    [$00:D40E]
(1231:199, 72) C=FF40 X=00 Y=87 S=FF P=31 (     C)  00:A205: 8E 1D 0D          STX $0D1D    [$00:0D1D]
(1231:199, 75) C=FF40 X=00 Y=87 S=FF P=31 (     C)  00:A208: 86 0E             STX APPMHI   [$00:000E]
(1231:199, 78) C=FF40 X=00 Y=87 S=FF P=31 (     C)  00:A20A: 86 0F             STX APPMHI+1 [$00:000F]
(1231:199, 81) C=FF40 X=00 Y=87 S=FF P=31 (     C)  00:A20C: E8                INX
(1231:199, 84) C=FF40 X=01 Y=87 S=FF P=31 (     C)  00:A20D: 8E E5 0C          STX $0CE5    [$00:0CE5]
(1231:199, 87) C=FF40 X=01 Y=87 S=FF P=31 (     C)  00:A210: 20 C5 A2          JSR $A2C5    [$00:A2C5] = $20
(1231:202, 88) C=FF12 X=12 Y=01 S=FF P=30 (      )  00:A213: CE E5 0C          DEC $0CE5    [$00:0CE5] = $01
(1231:202, 93) C=FF12 X=12 Y=01 S=FF P=32 (    Z )  00:A216: 20 27 A2          JSR $A227    [$00:A227] = $A2
(1231:203, 64) C=FF01 X=FF Y=01 S=FF P=B0 (N     )  00:A219: 20 BD A1          JSR $A1BD    [$00:A1BD] = $A9
(1231:203, 84) C=FF00 X=FF Y=01 S=FF P=32 (    Z )  00:A21C: 20 AE AD          JSR $ADAE    [$00:ADAE] = $20
(1231:246, 67) C=FF31 X=00 Y=FF S=FF P=F1 (NV   C)  00:A21F: A9 02             LDA #$02
(1231:246, 69) C=FF02 X=00 Y=FF S=FF P=71 ( V   C)  00:A221: 20 4F A2          JSR $A24F    [$00:A24F] = $8D

Link to comment
Share on other sites

It looks like the issue might be inside the PutE routine. Suddenly the program counter is in the $A000 ranges when it should be in the $3000 ranges. PutE is actually part of the run time by ACS and is a code block, so it might be tough for me to find a garbage in variable issue.

Link to comment
Share on other sites

The code "in the $A000 ranges" in both situations is a part of SpartaDOS X procedure _DOS, which gets entered when jmp ($0a) is called. The weird part is that its first two instructions are skipped. These two missing instructions are LDX #$FF / TXS, exactly 3 bytes.

 

Please take a look at the code again, especially at these parts which are doing any pointer arithmetics then do system calls using these resulting pointers.

Edited by drac030
Link to comment
Share on other sites

Update: I sat and traced the program to see what happens. It turns out that my first guess was right: the issue is caused by an uninitialized variable. It is located at address $B7. POKE $B7,$00 typed at the SDX command prompt "fixes" the issue instantly.

 

The function at fault seems to be PutE(). It uses $B7 as the I/O channel number to use. When the $B7 location contains garbage, the program tries to put characters to a closed IOCB, gets error 135 from the OS, and terminates.

  • Like 4
Link to comment
Share on other sites

Drac030, thank you for confirming it is inside the PutE routine. I will see what I can do to deal with that, though as I mentioned it is part of the run-time from OSS/ACS. Perhaps one of the other 3rd party run times would work better, or maybe I can just do the poke to memory inside my program prior to PutE being used.

 

Thanks again!

 

*** Edit:

 

Jut realized, if I do put in some code to set the memory location in question, then it will change where everything is and probably not be the correct location. There are ways to deal with that, but I think the best solution is to somehow fix the PutE routine. That will make it easiest for updating the program as well as making other programs.

Edited by fujidude
Link to comment
Share on other sites

Here is the new version of AAC, with the bug fixed. Special thanks for drac030 for pinpointing the variable at $B7 as the culprit. Thanks draco030!

 

Action! uses that location to store which channel is used for routines like PutE. Action! normally uses channel 0 here which it has opened up to E:. Although there are versions of the routines where the programmer specifies the channel, such as PutDE, the idea is that a programmer can simply change the value at $B7 to easily redirect output somewhere else. The problem was that the run time "SYS.ACT", provided by OSS/ACS had no mechanism to initialize that location, so if it got changed to something other than 0, the output is attempted to be sent to another channel. That other channel is likely closed, or worse, open to somewhere that is not supposed to get that kind of output.

 

Anyway, here is the new download:

Edited by fujidude
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...