Jump to content

Vorticon

+AtariAge Subscriber
  • Posts

    5,876
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Vorticon

  1. So your suggestion above results in exactly the same results as what I implemented below. longint = record case boolean of true : (value : integer[4]); false : (intval : packed array[0..1] of integer); end; time(stime.intval[0], stime.intval[1]); {start time} repeat time(itime.intval[0], itime.intval[1]) {interval time} until (itime.value - stime.value) > 70; {40 second timeout limit} So I'm assuming that the longint variant record I created is valid, at least for integer[4].
  2. I was just reading last night about concurrency in UCSD Pascal and it's a really powerful feature, particularly for interfacing like you did. I have plans to wirelessly interface my Heathkit Hero Jr robot to the TI and control it with UCSD Pascal. I've already done that in XB but it's slow and clunky at best. I can do better with Pascal and concurrency. The manual says it is not implemented on the TI. How did you modify that?
  3. I suppose one could test a specific CRU bit on the 9901, for example bit 2 for the VDP vertical sync, and increment a value with every interrupt, but as you said not much else could be done while this is running. Probably useful for exact delays but not so much for timing functions.
  4. Great idea. I suppose an external keyboard and monitor could be attached for development purposes and subsequently disconnected for regular use.
  5. It is not realistically possible to disconnect completely and still lead a normal life short of retiring to a deserted island Crusoe style. I've been resigned to that for a long time now and do my best to keep my online life as protected as possible. Here's one example: I don't use a password manager, but rather an ancient Casio Digital Assistant from the early 90's which does not have any online connectivity and I store all my passwords in it and keep it in a fireproof safe. I manually update it periodically and it has a backup battery. Good luck hacking into it he he... An old Palm Pilot will work just as well by the way. I am also in the process of dumping Google Drive and setting up an NAS instead.
  6. Google bricked my old but perfectly functional Nexus tablet with one of its updates and I could not revive it even with root access. I'll be damned if I ever purchase anything dependent on a Google service again. Same goes for Apple and HP who follow similar policies (HP even bricks printers if non-OEM ink cartridges are used!). I'm starting to seriously consider using my old trusty (and internet isolated) TI for any task that can be performed on it. I mean what's wrong with TI Writer or Multiplan and my Panasonic KXP-1123 dot-matrix printer?
  7. I'm afraid interrupts are still very hazy topic for me. Say I want to set up my timer routine to run with VDP interrupts. What is the procedure to do so? There is a list of system interrupts in the UCSD assembler manual on pages 231-232 but it does not give any hints on how one works with them.
  8. I was just looking for a place to stash the timer routine. I thought high expansion memory was available. Any suggestions?
  9. Why I does .ORG 0A000h give me an out of bounds operand error? I should be able to locate an assembly routine in high memory, right?
  10. Well nuts... I had literally just finished writing an assembly timer routine based on @TheBF's suggestion... intvect .equ 83c4h .proc timer .org 0 .def htime, ltime inc @ltime jnc return inc @htime return b *r11 htime .word ltime .word .proc treset .ref htime, ltime clr @htime clr @ltime b *r11 .proc tinstall clr @intvect b *r11 .proc gettimer,2 .ref htime,ltime mov *r10+,r1 mov *r10+,r2 mov @htime,*r2 mov @ltime,*r1 b *r11 .end
  11. That was my thinking as well, but that's not the definition quoted in the manual where the index can be as high as 36! I like your interrupt driven timer although I'm not sure it will work on the p-system. Only way to find out is test it out. OC IF tests for overflow so as to know when to increment the high-word, correct? I need to find a safe place to stash that routine though.
  12. It looks like changing the long integer definition from integer[10] to integer[4] works. I'm not clear as to why though because that index value is supposed to indicate the number of decimals that long integer can represent. I would love an explanation if anybody has one. Here's the modified test code which measures a 40 second delay. program timetest; type longint = record case boolean of true : (value : integer[4]); false : (intval : packed array[0..1] of integer); end; var stime, etime : longint; stimestr, etimestr : string; begin page(output); writeln('starting now!'); (* start time *) time(stime.intval[0], stime.intval[1]); repeat (* end time *) time(etime.intval[0], etime.intval[1]) until (etime.value - stime.value) > 2400;; str(stime.value, stimestr); str(etime.value, etimestr); writeln('start time --- end time'); writeln(stimestr, '---', etimestr); end. That said, that is not a reliable timer and it appears that it's heavily affected by what goes on inside the timer loop as additional statements make the timer run much slower. Below is a snippet of real life code where a value of 70 represents 40 seconds instead of the expected 2400! time(stime.intval[0], stime.intval[1]); {start time} repeat getbyte(comcode, flag); {wait for remote nak code} time(itime.intval[0], itime.intval[1]); {interval time} if (itime.value - stime.value) > 70 then {40 second timeout limit} begin timeout := true; exit(sendfile); end; until comcode = 21; I should also point out that this is being tested out in emulation and I have the sneaky feeling that the results will be different on real hardware.
  13. I'm still looking for an excuse to use my SAMS card. Go for it!
  14. I'm trying to set up a timer function using the TIME intrinsic and I'm getting weird results. TIME returns the system's clock into a 32 bit integer split into a high integer and low integer. The 32bit integer represents 1/60th of second intervals. TIME(HIINT, LOWINT). program timetest; type longint = record case boolean of true : (value : integer[10]); false : (intval : packed array[0..1] of integer); end; var stime, etime : longint; stimestr, etimestr : string; begin (* start time *) time(stime.intval[0], stime.intval[1]); writeln; (* end time *) time(etime.intval[0], etime.intval[1]); str(stime.value, stimestr); str(etime.value, etimestr); writeln('start time --- end time'); writeln(stimestr, '---', etimestr); end. I'm getting ridiculously large differences in time which make no sense. Where am I going wrong here?
  15. As @apersson850 stated, this could get complicated very quickly. Skidding can be faked by rotating the back of the car a certain amount and translating the whole car in the direction of the original movement vector proportional to your angular velocity which already incorporates your speed and steering values. Yes it's not physics-accurate by any means, but it will generally look the part. Here's how I would try it. CAR TURNS CALCULATE ANGULAR VELOCITY IS THE ARBITRARY SKIDDING THRESHOLD EXCEEDED? NO --> NORMAL TURN YES --> - ROTATE CAR PROPORTIONAL TO DELTA ANGULAR VELOCITY ABOVE SKIDDING THRESHOLD - TRANSLATE WHOLE CAR IN DIRECTION OF ORIGINAL MOVEMENT VECTOR PROPORTIONAL TO THAT DELTA VALUE 4. RESUME LINEAR MOTION IN DIRECTION OF TURN
  16. OK so I had to finish Hexview, so here it is. It's just a block viewer which allows you to go forward, backward, to the first block and the last one. Simpler to use that PATCH which I'll reserve for more involved file manipulation. My OCD has been appeased...
  17. I would thing you will need to set a threshold for the angular velocity which when exceeded will cause the car to skid. You can play with the value until the desired balance between turning and skidding is achieved.
  18. I checked out the PATCH utility and it's pretty comprehensive. I really like the way they formatted the screen display. I think there is no point in me duplicating that work now that I know how to do it. In a sense I'm glad you pointed out PATCH after I started Hexview Now XMODEM is next... PS: this is turning into quite the rabbit hole. It all started with me wanting to transfer a binary file from the PC to the pcode system and here we are still not quite there yet. Quite fun I might add (NEERDS! * which movie is that from? 😜*).
  19. Ah! Well I did learn something from the exercise, so it's all good. I'm still going to finish it nonetheless because I'm weird that way 😁
  20. Thanks for the tips! It was a buffer issue. While it was declared as an array of bytes, it's still read as an integer, so each element is actually 2 bytes. This always gets me. There is no need however to invert the read order. Here's the functional version: (* hex file viewer *) program hexview; type byte = 0..255; byteword = record case boolean of true : (value : integer); false : (bytes : packed array[0..1] of byte); end; var infile : file; fname : string; cblock, blocksin : integer; buffer : array[0..255] of byteword; function dec2hex(n : integer) : char; begin if n >= 10 then n := n + 7; dec2hex := chr(n + 48); end; (* dec2hex *) function getkey : integer; external; procedure showblock; var i, x, y : integer; begin page(output); x := 1; y := 1; for i := 0 to 255 do begin gotoxy(x, y); write(dec2hex(buffer[i].bytes[0] div 16)); write(dec2hex(buffer[i].bytes[0] mod 16)); x := x + 3; gotoxy(x, y); write(dec2hex(buffer[i].bytes[1] div 16)); write(dec2hex(buffer[i].bytes[1] mod 16)); x := x + 3; if x > 71 then begin x := 1; y := succ(y); end; end; end; (* showblock *) begin page(output); writeln(chr(7),'file to view:'); readln(fname); reset(infile, fname); cblock := 0; blocksin := blockread(infile, buffer, 1, cblock); showblock; repeat until getkey <> 255; end. (* hexview *)
  21. Oops... I'm dividing by 256 instead of 16. write(dec2hex(buffer[i] div 16)); write(dec2hex(buffer[i] mod 16)); Also I forgot to subtract 10 from the A-F conversion if n >= 10 then dec2hex := chr(n + 65 - 10); Still not working though... What else am I missing???
  22. With all this business with file transfers, I found I had an acute need for a HEX file viewer to check the integrity of received files. There is no such built-in utility in UCSD Pascal so I figured I'll put a quick and dirty one together. Below is the bulk of it. It's not yet finished but this is enough to test the functionality. Here it's only reading the first block of a file and display it in hex. Or at least that's what is supposed to happen, and guess what, it's not working... (* hex file viewer *) program hexview; type byte = 0..255; var infile : file; fname : string; cblock, blocksin : integer; buffer : array[0..511] of byte; function dec2hex(n : integer) : char; begin if n < 10 then dec2hex := chr(n + 48) else if n >= 10 then dec2hex := chr(n + 65); end; (* dec2hex *) function getkey : integer; external; procedure showblock; var i, x, y : integer; begin page(output); x := 1; y := 1; for i := 0 to 511 do begin gotoxy(x, y); write(dec2hex(buffer[i] div 256)); write(dec2hex(buffer[i] mod 256)); x := x + 3; if x > 71 then begin x := 1; y := succ(y); end; end; end; (* showblock *) begin page(output); writeln(chr(7),'file to view:'); readln(fname); reset(infile, fname); cblock := 0; blocksin := blockread(infile, buffer, 1, cblock); showblock; repeat until getkey <> 255; end. (* hexview *) What it ends up displaying is non-Hex characters, which does not make sense since the buffer is supposed to fill up with 512 byte values. I'm sure I'm missing something basic here...
×
×
  • Create New...