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

CLS ruins GET() sprites, and you can no longer PUT() them #162

Closed JDoucette closed 2 years ago

JDoucette commented 2 years ago
EXCEPTION                                                                       
90 PUT(100,0),X                                                                                                                                                 
graphics.py:634, put                                                            
    None                                                                        
backend.py:1381, put_rect                                                       
    None                                                                        
video_pygame.py:1357, put_rect                                                  
    None                                                                        
video_pygame.py:1340, <lambda>                                                  
    None                                                                        
ValueError: operands could not be broadcast together with shapes (16,8) (8,8) (16,8)                                                                            
                                                                                This is a bug in PC-BASIC.  

Bug report

Problem

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, with Tandy mode: Note this is running in Tandy mode SCREEN 6 = 640x200 x 4-colors

    10 SCREEN 0:CLS:CLEAR,,,32768!:SCREEN 6
    20 FOR I=1 TO 4:PRINT"ABCD":NEXT I
    30 DIM X(1000),Y(1000)
    40 GET(0,0)-(7,7),X
    50 GET(0,0)-(3,7),Y
    60 PUT(100,0),X
    70 PUT(150,0),Y
    80 CLS
    90 PUT(100,0),X
    100 PUT(150,0),Y

Remove this, and it works:

80 CLS

P.S. You may also notice the sprites grabbed with GET are 2x too wide, captured in this bug report: https://github.com/robhagemans/pcbasic/issues/163

Version 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 in PC-BASIC 2.0.4 results in:

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 60 PUT(100,0),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-zw6yb2gq.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 |ABCD                                                                            |  4
 1 |ABCD                                                                            |  4
 2 |ABCD                                                                            |  4
 3 |ABCD                                                                            |  4
 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'04000800000038386c6cc6c6fefec6c6c6c6c6c6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
==== Strings =======================================================================================

==== Program Buffer ================================================================================
b'00' b'c513' (+024) b'0a00' [00010] b'c820113ac03a922c2c2c1d000000903ac8201700df131400822049e71220cc20153a912241424344223a83204900f3131e00862058281ce803292c59281ce803290007142800fe8928112c1129ea28182c18292c58001b143200fe8928112c1129ea28142c18292c59002a143c00fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'df13' (+026) b'1400' [00020] b'822049e71220cc20153a912241424344223a83204900f3131e00862058281ce803292c59281ce803290007142800fe8928112c1129ea28182c18292c58001b143200fe8928112c1129ea28142c18292c59002a143c00fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'f313' (+020) b'1e00' [00030] b'862058281ce803292c59281ce803290007142800fe8928112c1129ea28182c18292c58001b143200fe8928112c1129ea28142c18292c59002a143c00fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'0714' (+020) b'2800' [00040] b'fe8928112c1129ea28182c18292c58001b143200fe8928112c1129ea28142c18292c59002a143c00fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'1b14' (+020) b'3200' [00050] b'fe8928112c1129ea28142c18292c59002a143c00fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'2a14' (+015) b'3c00' [00060] b'fe88280f642c11292c580039144600fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'3914' (+015) b'4600' [00070] b'fe88280f962c11292c59003f145000c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'3f14' (+006) b'5000' [00080] b'c0004e145a00fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'4e14' (+015) b'5a00' [00090] b'fe88280f642c11292c58005d146400fe88280f962c11292c59000000'
b'00' b'5d14' (+015) b'6400' [00100] b'fe88280f962c11292c59000000'
b'00' b'0000' (ENDS) b'' b''
==== Program =======================================================================================
10 SCREEN 0:CLS:CLEAR,,,32768!:SCREEN 6
20 FOR I=1 TO 4:PRINT"ABCD":NEXT I
30 DIM X(1000),Y(1000)
40 GET(0,0)-(7,7),X
50 GET(0,0)-(3,7),Y
60 PUT(100,0),X
70 PUT(150,0),Y
80 CLS
90 PUT(100,0),X
100 PUT(150,0),Y
==== Options =======================================================================================
['--preset=tandy', '--syntax=tandy', '--video=tandy', '--scaling=crisp', '--dimensions=1344,840']
JDoucette commented 2 years ago

Crash logs: crash-20211113-zw6yb2gq.log

robhagemans commented 2 years ago

The crash was fixed by commit ebf6812a.

robhagemans commented 2 years ago

With the crash fixed, this appears to work correctly in the develop branch for next 2.0.x release, hence the remaining issue affects the 1.2 branch only.