tw9667.pp 763 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. { %target=go32v2 }
  2. { compiled with smallest code option, control B does not work }
  3. { compiled with fastest code option, both controls work fine }
  4. { output with smallest code (note that control B output seems randomical)
  5. 1234567890
  6. A >5/53<
  7. B >M/77<
  8. }
  9. program tbug;
  10. uses
  11. crt;
  12. type
  13. TCharColor = record
  14. car : char;
  15. color : byte;
  16. end;
  17. TScreen = array[1..50,1..80] of TCharColor;
  18. var
  19. CGA : TScreen absolute $B800:0000;
  20. c : char;
  21. begin
  22. clrscr;
  23. write( '1234567890');
  24. { control A }
  25. gotoxy( 1, 2);
  26. write( 'A >', CGA[ 1, 5].car, '/', ord( CGA[ 1, 5].car), '<');
  27. { control B }
  28. gotoxy( 1, 3);
  29. c := CGA[ 1, 5].car;
  30. write( 'B >', c, '/', ord( c), '<');
  31. if (c<>'5') then
  32. halt(1);
  33. writeln;
  34. end.