robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
396 stars 48 forks source link

Tandy SCREEN 6 (640x200x4-color) GET gets 2x size expected #163

Closed JDoucette closed 2 years ago

JDoucette commented 2 years ago

Bug report

Problem GET() a sprite in SCREEN 6 in Tandy (640x200 x 4-colors) accepts a target 2x the expected size.

Steps

  1. Run in tandy mode:
    "C:\Program Files (x86)\PC-BASIC-1.2\pcbasic.exe" --preset=tandy --syntax=tandy --video=tandy --scaling=crisp --dimensions=1344,840
  2. Run this program:
    10 CLEAR,,,32768!:SCREEN 6
    20 DIM X(1000),Y(1000)
    30 LOCATE 1,1
    40 FOR I=1 TO 4:PRINT"ABCDEFGHIJ":NEXT I
    50 GET (0,0)-(7,7),X
    60 GET (0,0)-(15,15),Y
    70 PUT (320,100),X
    80 PUT (480,100),Y
  3. Note that I am GET() a 8x8 and 16x16 square. But what is PUT is 16x8 and 32x16

GET-PUT

Program Above.

Crash log None.

Notes PC-BASIC version: 1.2.14
Operating system version: Windows 10

robhagemans commented 2 years ago

Hi, you're using an old version of PC-BASIC, can you please check if v1.2.15 or v2.0.4 resolve your issue?

JDoucette commented 2 years ago

Running this program:

10 CLEAR,,,32768!:SCREEN 6
20 DIM X(1000),Y(1000)
30 LOCATE 1,1
40 FOR I=1 TO 4:PRINT"ABCDEFGHIJ":NEXT I
50 GET (0,0)-(7,7),X
60 GET (0,0)-(15,15),Y
70 PUT (320,100),X
80 PUT (480,100),Y

in PC-BASIC 2.0.4 produces:

PC-BASIC crash log
====================================================================================================
FATAL ERROR
version   2.0.4 [v2.0.4-1 c3a043b4 2021-11-08 20:17:17.513097]
python    3.7.9 [32bit WindowsPE] True
platform  Windows-10-10.0.19041
interface VideoSDL2, AudioSDL2
statement 70 PUT (320,100),X

interpreter.py:112, parse
statements.py:82, parse_statement
graphics.py:946, put_
framebuffer.py:189, unpack
error: required argument is not an integer

This is a bug in PC-BASIC.
Sorry about that. You can help improve PC-BASIC:

- Please file a bug report, including this message and the steps you took
  just before the crash. Go to:
    https://github.com/robhagemans/pcbasic/issues

- Please include the full crash log in your report.
  You can paste it from the clipboard or from the file at:
    C:\Users\jason\AppData\Roaming\pcbasic-2.0\crash-20211113-nvvoir6l.log
Traceback (most recent call last):
  File "C:\pc-basic\pcbasic\guard.py", line 51, in protect
  File "C:\pc-basic\pcbasic\main.py", line 119, in _run_session
  File "C:\pc-basic\pcbasic\basic\api.py", line 149, in interact
  File "C:\pc-basic\pcbasic\basic\implementation.py", line 315, in interact
  File "C:\pc-basic\pcbasic\basic\interpreter.py", line 122, in loop
  File "C:\pc-basic\pcbasic\basic\interpreter.py", line 112, in parse
  File "C:\pc-basic\pcbasic\basic\parser\statements.py", line 82, in parse_statement
  File "C:\pc-basic\pcbasic\basic\display\graphics.py", line 946, in put_
  File "C:\pc-basic\pcbasic\basic\display\framebuffer.py", line 189, in unpack
struct.error: required argument is not an integer

==== Screen Pages ==================================================================================
   +--------------------------------------------------------------------------------+
 0 |ABCDEFGHIJ                                                                      | 10
 1 |ABCDEFGHIJ                                                                      | 10
 2 |ABCDEFGHIJ                                                                      | 10
 3 |ABCDEFGHIJ                                                                      | 10
 4 |                                                                                |  0
 5 |                                                                                |  0
 6 |                                                                                |  0
 7 |                                                                                |  0
 8 |                                                                                |  0
 9 |                                                                                |  0
10 |                                                                                |  0
11 |                                                                                |  0
12 |                                                                                |  0
13 |                                                                                |  0
14 |                                                                                |  0
15 |                                                                                |  0
16 |                                                                                |  0
17 |                                                                                |  0
18 |                                                                                |  0
19 |                                                                                |  0
20 |                                                                                |  0
21 |                                                                                |  0
22 |                                                                                |  0
23 |                                                                                |  0
24 | 1LIST   2RUN   3LOAD"  4SAVE"  5CONT  6,"LPT1 7TRON  8TROFF 9KEY    0SCREEN| 80
   +--------------------------------------------------------------------------------+
==== Scalars =======================================================================================
b'I!': b'!'[b'00002083' 5.0]
==== Arrays ========================================================================================
b'X!'[1000]: b'080008000000000038fc38fc6c666c66c666c666fe7cfe7cc666c666c666c666c6fcc6fc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
b'Y!'[1000]: b'10001000000000000000000038fc3cf838fc3cf86c66666c6c66666cc666c066c666c066fe7cc066fe7cc066c666c066c666c066c666666cc666666cc6fc3cf8c6fc3cf8000000000000000038fc3cf838fc3cf86c66666c6c66666cc666c066c666c066fe7cc066fe7cc066c666c066c666c066c666666cc666666cc6fc3cf8c6fc3cf80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
==== Strings =======================================================================================

==== Program Buffer ================================================================================
b'00' b'bf13' (+018) b'0a00' [00010] b'922c2c2c1d000000903ac8201700d3131400862058281ce803292c59281ce8032900dd131e00ca20122c1200fd132800822049e71220cc20153a91224142434445464748494a223a8320490012143200fe892028112c1129ea28182c18292c580029143c00fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'd313' (+020) b'1400' [00020] b'862058281ce803292c59281ce8032900dd131e00ca20122c1200fd132800822049e71220cc20153a91224142434445464748494a223a8320490012143200fe892028112c1129ea28182c18292c580029143c00fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'dd13' (+010) b'1e00' [00030] b'ca20122c1200fd132800822049e71220cc20153a91224142434445464748494a223a8320490012143200fe892028112c1129ea28182c18292c580029143c00fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'fd13' (+032) b'2800' [00040] b'822049e71220cc20153a91224142434445464748494a223a8320490012143200fe892028112c1129ea28182c18292c580029143c00fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'1214' (+021) b'3200' [00050] b'fe892028112c1129ea28182c18292c580029143c00fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'2914' (+023) b'3c00' [00060] b'fe892028112c1129ea280f0f2c0f0f292c59003b144600fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'3b14' (+018) b'4600' [00070] b'fe8820281c40012c0f64292c58004d145000fe8820281ce0012c0f64292c59000000'
b'00' b'4d14' (+018) b'5000' [00080] b'fe8820281ce0012c0f64292c59000000'
b'00' b'0000' (ENDS) b'' b''
==== Program =======================================================================================
10 CLEAR,,,32768!:SCREEN 6
20 DIM X(1000),Y(1000)
30 LOCATE 1,1
40 FOR I=1 TO 4:PRINT"ABCDEFGHIJ":NEXT I
50 GET (0,0)-(7,7),X
60 GET (0,0)-(15,15),Y
70 PUT (320,100),X
80 PUT (480,100),Y
==== Options =======================================================================================
['--preset=tandy', '--syntax=tandy', '--video=tandy', '--scaling=crisp', '--dimensions=1344,840']
JDoucette commented 2 years ago

Attaching crash logs crash-20211113-nvvoir6l.log .

robhagemans commented 2 years ago

The crash is clearly a bug, which I'm looking into.

However, the fact that GET takes twice the width specified is correct in the sense that it replicates the behaviour of the original Tandy GW-BASIC, and is needed for Tandy programs to run correctly. It's documented at https://robhagemans.github.io/pcbasic/doc/2.0/#GET-graphics:

In PCjr/Tandy mode, in SCREEN 6, GET stores an area of twice the width of the specified rectangle.

robhagemans commented 2 years ago

The crash was fixed by commit ebf6812a; anomalous width behaviour is not a bug, per previous comment.

rbergen commented 2 years ago

While testing my changes in #188, I found that the new tandy/GET_PUT_in_SCREEN_6 test crashes on Python 2. It may be time to consider dropping support for Python 2 considering it was sunset 2.5 years ago, but I thought I'd still mention it.