home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 3
/
PDCD_3.iso
/
games
/
mzx
/
!MZXiface
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1995-02-18
|
6KB
|
259 lines
MZXiface version 0.01 by Andrew Clover
Well dang my poons, it's a BASIC program!
Haven't done one of these for ages!
0,"Fatal error: "+
$+" (internal code "+
+")."
Xerror_noaddress$="Oh dear, you appear to have forgotten to type an address to poke."
berror_badaddress$="That address cannot be right - Spectrum RAM only goes from 16384 to 65535."
aerror_novalue$="Erk! You appear to have forgotten to type an value to poke the address with."
Yerror_badvalue$="That value is surely wrong - byte values must be between 0 and 255."
Lerror_notask$="I can hardly hack MZX when you haven't loaded it, can I?"
Nerror_novar$="Sorry, I can't hack this version of MZX, only release 1.10."
icon_action=4
icon_address=5
icon_value=7
indirlen=512
scratchlen=512
taskbuflen=1024
mzxfind$="z80mem%="
mzxtask$="MZX"
taskname$="MZXiface"
pollflags=%1100000110001
message_quit=0
iconflag_selected=21
key_return=73
poll 256, indir indirlen, scratch scratchlen, taskbuf taskbuflen
"Wimp_Initialise",200,&4B534154,taskname$
wimpver,tfootle
"Wimp_OpenTemplate",,"<Obey$Dir>.Templates"
$poll="MZXiface"
"Wimp_LoadTemplate",,scratch,indir,indir+indirlen,-1,poll,0
"Wimp_CloseTemplate"
"Wimp_CreateWindow",,scratch
wfootle
!scratch=wfootle
"Wimp_GetWindowState",,scratch
scratch!28=-1
"Wimp_OpenWindow",,scratch
mequit=
error(
$+" (internal code "+
)+").",
"Wimp_Poll",pollflags,poll
reason
reason
0'
redraw_window_request(!poll)
2$
open_window_request(poll)
4%
close_window_request(poll)
mouse_click(poll)
key_pressed(poll)
17,18:
user_message(poll)
mequit
"Wimp_CloseDown"
error(a,b$,c)
errornumber, error$, providequit, result, errorflags, errortitle$, extrabuttons$
errornumber=a
error$=b$
providequit=c
!scratch=errornumber
$(scratch+4)=error$+
providequit
errortitle$=taskname$
M+ errortitle$="Warning from "+taskname$
wimpver<322
providequit
R errorflags=%000000000011
T errorflags=%000000010001
"Wimp_ReportError",scratch,errorflags,errortitle$
,result
providequit
Y errorflags=%011100000001
Z]
"Wimp_ReportError",scratch,errorflags,errortitle$,"!"+taskname$,1,"Quit"
,result
\ errorflags=%010100010001
]X
"Wimp_ReportError",scratch,errorflags,errortitle$,"!"+taskname$,1,0
,result
!scratch=wfootle
scratch!4=icon_action
scratch!8=0
d#scratch!12=1<<iconflag_selected
"Wimp_SetIconState",,scratch
=(result>1)
redraw_window_request(a)
footle, more
footle=a
!scratch=footle
"Wimp_RedrawWindow",,scratch
more
more
"Wimp_GetRectangle",,scratch
more
open_window_request(a)
block
block=a
"Wimp_OpenWindow",,block
close_window_request(a)
block, footle
block=a
footle=!block
"Wimp_CloseWindow",,block
mequit=(footle=wfootle)
mouse_click(a)
block, buttons, window, icon
block=a
buttons=block!8
window=block!12
icon=block!16
window
wfootle:
icon
icon_action:
!
(buttons
2))
pokeloke
key_pressed(a)
block, key, window
block=a
key=block!24
window=!block
window=wfootle
key=13
simulatepokepress
"Wimp_ProcessKey",key
user_message(a)
block, message
block=a
message=block!16
message
message_quit: mequit=
simulatepokepress
keypressed
!scratch=wfootle
scratch!4=icon_action
"scratch!8=1<<iconflag_selected
#scratch!12=1<<iconflag_selected
"Wimp_SetIconState",,scratch
pokeloke
"OS_Byte",121,key_return
&80
,keypressed
(keypressed<>&FF
(0)=13)
!scratch=wfootle
scratch!4=icon_action
scratch!8=0
#scratch!12=1<<iconflag_selected
"Wimp_SetIconState",,scratch
pokeloke
icon$, address, value, taskloop, last, ptr, poked
!scratch=wfootle
scratch!4=icon_address
"Wimp_GetIconState",,scratch
icon$=
getzero(scratch!28)
icon$=""
* address=
error(0,error_noaddress$,
address=
(icon$)
address<16384
address>65535
+ address=
error(0,error_badaddress$,
!scratch=wfootle
scratch!4=icon_value
"Wimp_GetIconState",,scratch
icon$=
getzero(scratch!28)
icon$=""
& value=
error(0,error_novalue$,
value=
(icon$)
value<0
value>255
' value=
error(0,error_badvalue$,
taskloop=0
poked=
"TaskManager_EnumerateTasks",taskloop,scratch,scratchlen
taskloop,last
last>scratch
ptr=scratch
&
getzero(ptr!4)=mzxtask$
ptr!8>0
+
poketask(!ptr,address,value)
poked=
ptr+=16
ptr>=last
taskloop=-1
taskloop<0
poked
% poked=
error(0,error_notask$,
getzero(a)
address, result$
address=a
result$=""
?address>32
result$+=
(?address)
address+=1
=result$
poketask(a,b,c)
mzxtask, address, value, mzxbase, loop
mzxtask=a
address=b
value=c
loop=0
mzxbase=0
"Wimp_TransferBlock",mzxtask,&8F00,tfootle,taskbuf,1024
mzxbase=0
loop<=1024-
(mzxfind$)-10
getlen(taskbuf+loop,
(mzxfind$))=mzxfind$
D
"OS_ReadUnsigned",10,taskbuf+loop+
(mzxfind$)
,,mzxbase
loop+=1
mzxbase=0
& mzxbase=
error(0,error_novar$,
?taskbuf=value
"Wimp_TransferBlock",tfootle,taskbuf,mzxtask,mzxbase+address,1
getlen(a,b)
address, length, result$
address=a
length=b
result$=""
?address>32
length>0
result$+=
(?address)
address+=1
length-=1
=result$