01-16-2018, 12:16 PM
boriel Wrote:This looks like a compiler bug :!:No, it is different, the upper code (Full code below) of the earlier prigram produces this:
The code that produces it is the one posted above??
Code:
Traceback (most recent call last):
File "D:\Restliche Programme\zxbasic\zxb.py", line 339, in <module>
sys.exit(main()) # Exit
File "D:\Restliche Programme\zxbasic\zxb.py", line 287, in main
asm_output = optimize(asm_output) + '\n'
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 2326, in optimize
x.optimize()
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 1982, in optimize
regs.op(i1, o1)
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 693, in op
self.inc(o[0])
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 558, in inc
v_ = self.getv(self.mem.get(r_, None))
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 516, in getv
v = self.get(r)
File "D:\Restliche Programme\zxbasic\arch\zx48k\optimizer.py", line 498, in get
if r.lower() == '(sp)' and self.stack:
AttributeError: 'NoneType' object has no attribute 'lower'
Here it is:
Code:
dim control$,key$ as string
dim posx,posy,dir,drw,found as byte
dim shtx,shty,shard as Uinteger
poke uinteger 23675,@UDGs01
sub waitnokey()
while inkey$<>"":wend
end sub
sub Drawscreen()
dim x,y,byt as ubyte
dim adr as uinteger
dim a$ as string
adr=@Buffer
for y=0 to 21
a$=""
for x=0 to 31
byt=peek adr
if byt=0 then a$=a$+" ":else a$=a$+"\a":end If
adr=adr+1
next x
print at y,0;ink 4;a$;
next y
end sub
function Piece(x as Uinteger,y as Uinteger)
dim b as uinteger
dim a$ as string
b=@Buffer+(y<<5)+x
if peek b=0 then
a$=" "
elseif peek b=1 then
a$="\{i4}\a"
elseif peek b=2 then
a$="\{i5}\g"
elseif peek b=3 then
a$="\{i5}\h"
end if
print at y,x;a$;
end function
sub PlacePiece(x as uinteger,y as Uinteger,piece as ubyte)
poke @Buffer+(y<<5)+x,piece
end sub
function GetPiece(x as uinteger,y as Uinteger) as ubyte
return @Buffer+(y<<5)+x
end Function
sub PlaceShards(cnt as integer)
dim dir,dir1 as ubyte
dim xy as uinteger
while cnt>0
xy=int(rnd*704)
if peek(@Buffer+xy)=1 then
cnt=cnt-1
dir=int(rnd*1.99)
if dir=1 then
dir1=2
else
dir1=3
end If
poke @Buffer+xy,dir1
end If
wend
end sub
border 1:paper 0:bright 0:ink 7:Flash 0:Inverse 0:cls
print at 0,0;"\{b1}\{p1}Inu Yasha-Test by LCD";
print at 3,1;"1. Keyboard QAOPM";
print at 4,1;"2. Sinclair 67890";
control$=""
while control$=""
key$=inkey$
if key$="1" then control$="qaopm":end If
if key$="2" then control$="98670":end If
wend
randomize
cls
PlaceShards(32)
Drawscreen()
posx=10:posy=20
print at posy,posx;"\{i7}\j";
mainloop:
while key$<>control$(4)
key$=inkey$
if key$=control$(0) and posy>0 then Piece(posx,posy):posy=posy-1:print at posy,posx;"\{i7}\j";:waitnokey():end If
if key$=control$(1) and posy<21 then Piece(posx,posy):posy=posy+1:print at posy,posx;"\{i7}\j";:waitnokey():end If
if key$=control$(2) and posx>0 then Piece(posx,posy):posx=posx-1:print at posy,posx;"\{i7}\j";:waitnokey():end If
if key$=control$(3) and posx<31 then Piece(posx,posy):posx=posx+1:print at posy,posx;"\{i7}\j";:waitnokey():end If
wend
if key$=control$(4) then
print at 22,0;"\{p6}\{i2}\{b1}Select firing direction";
print at 23,0;"\{p6}\{i2}\{b1}SPC to purify and get Shard";
waitnokey()
dir=0
while dir=0
key$=inkey$
waitnokey()
if key$=control$(0) then dir=1:end if
if key$=control$(1) then dir=2:end if
if key$=control$(2) then dir=3:end if
if key$=control$(3) then dir=4:end if
if key$=" " then
found=0
if GetPiece(posx+1,posy)>1 then found=found+1:shard=shard+1:PlacePiece(posx+1,posy,1):end If
if GetPiece(posx-1,posy)>1 then found=found+1:shard=shard+1:PlacePiece(posx-1,posy,1):end If
if GetPiece(posx,posy-1)>1 then found=found+1:shard=shard+1:PlacePiece(posx,posy-1,1):end If
if GetPiece(posx,posy+1)>1 then found=found+1:shard=shard+1:PlacePiece(posx,posy+1,1):end If
if found=0 then border 2:pause 5:border 0:end if
dir=5
end if
wend
if dir=5 then dir=0:end if
print at 22,0;"\{p0}\{i7}\{b0} ";
print at 23,0;"\{p0}\{i7}\{b0} ";
shtx=posx
shty=posy
while dir>0
if dir=1 and shty>0 then shty=shty-1:end if
if dir=2 and shty<22 then shty=shty+1:end if
if dir=3 and shtx>0 then shtx=shtx-1:end if
if dir=4 and shtx<31 then shtx=shtx+1:end if
bg=peek(@Buffer+(shty<<5)+shtx)
if bg=2 then dir=peek(@Shoottable1+dir-1):end If
if bg=3 then dir=peek(@Shoottable2+dir-1):end if
if shtx=0 or shtx=31 or shty=0 or shty=22 then dir=0:end If
'if bg<99 then
if bg=0 then
drw=1
else
drw=0
end if
if drw then
print at shty,shtx;"*";
end if
wend
end if
goto mainloop
End
Shoottable1:
asm
defb 4,3,2,1 ;/
end asm
Shoottable2:
asm
defb 3,4,1,2 ;\
end asm
UDGs01:
asm
defb 24, 44, 94, 60, 24, 24, 60, 0 ;A Tree
defb 16, 56, 16, 16, 16, 16, 56, 40 ;B Arrow up
defb 0, 0, 0,194,127,194, 0, 0 ;C Arrow right
defb 40, 56, 16, 16, 16, 16, 56, 16 ;D Arrow down
defb 0, 0, 0, 67,254, 67, 0, 0 ;E Arrow left
defb 16, 42, 84, 40, 16, 8, 20, 0 ;F Tree Visited
defb 0, 2, 12, 28, 56, 48, 64, 0 ;G Shard /
defb 0, 64, 48, 56, 28, 12, 2, 0 ;H Shard \
defb 24, 24, 60, 60, 90, 24, 60, 36 ;I Youkai
DEFB 0, 24, 24, 60, 90, 24, 36, 36 ;J Figure
end asm
Buffer:
asm
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,1,1,1,1,1,1,1,1,0,0
DEFB 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0
DEFB 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0
DEFB 0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
DEFB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
end asm
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!