ZX81 convert to VBA

Emulator and emulator development specific topics
Post Reply
oldhand
Posts: 13
Joined: Thu May 10, 2012 9:52 am

ZX81 convert to VBA

Post by oldhand »

How easy would it be to Convert a ZX81 game to Excel VBA Code?
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX81 convert to VBA

Post by XavSnap »

Hi Oldhand,
To run it, or edit the code ?
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
oldhand
Posts: 13
Joined: Thu May 10, 2012 9:52 am

Re: ZX81 convert to VBA

Post by oldhand »

to edit the code to run as VBA. Thank you for Answering
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX81 convert to VBA

Post by XavSnap »

Hi,
Use "P2Text.exe", "ZxTocken" or the SAVE"MYPRG.TXT" option in Vb81.
Rename it to "MyPrg.BAS".

INPUT = INPUTBOX()
PRINT = picture1.print "xxx"
DIM S$() = Dim S$() as string
PLOT = picture1.PSET()

Example;

Code: Select all

Private Sub Timer1_Timer()
Timer1.Enabled = False
Picture1.DrawMode = 4
'If (Rnd * 3) > 1 Then Univer (Rnd * 6) * IIf(Rnd * 1 > 0, 1, -1), (Rnd * 6) * IIf(Rnd * 1 > 0, 1, -1), (Rnd * 3) * IIf(Rnd * 1 > 0, 1, -1), (Rnd * 3) * IIf(Rnd * 1 > 0, 1, -1): Exit Sub

Me.AutoRedraw = False

Dim x1, y1, U, v, r, a, b, z, a2, B2
30     Dim m(255, 2)
40     For x1 = 1 To 128
50     Let m(x1, 2) = 255
60     Next x1
70     For y1 = 0 To 175 Step 5
80     For x1 = 1 To 128
90     If x1 = 65 Then GoTo 260
100    Let U = x1 - 64
110    Let v = y1 - 87
120    Let r = Sqr(U * U + v * v) / 4 + 0.01
130    Let z = (80 * Sin(r)) / r + 10
140    Let U = 0.707 * y1
150    Let a = (x1 + U)
160    Let b = (z + U + 16)
a2 = (a * 20) - 200 ' X Scale
B2 = (b * 10) + 150 ' Y Scale
180    If b <= m(a, 1) Then GoTo 220
190    Let m(a, 1) = b

Picture1.PSet (a2, B2), RGB(100, y1 + 50, x1 + 200)
220    If b >= m(a, 2) Then GoTo 260
230    Let m(a, 2) = b

Picture1.PSet (a2, B2), RGB(100, y1 + 50, x1 + 200)
260    Next x1
270    Next y1

End Sub

Have Fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
oldhand
Posts: 13
Joined: Thu May 10, 2012 9:52 am

Re: ZX81 convert to VBA

Post by oldhand »

I can get a Listing of the ZX81 code that is not a problem, but converting it to use as VBA Excel code is the Hard part, But zx91 code has lots of Gosubs in them and Returns also you can use W as well as W$ which are treated different in ZX81 Coding.
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: ZX81 convert to VBA

Post by XavSnap »

Code: Select all

Private Sub RUN_Click()
1 GoSub CLS
5 Let a$ = "Hello"
10 GoSub 100
15 Let a$ = " "
20 GoSub 100
30 Let a$ = "WORLD"
40 GoSub 100
50 Let a = 3.1416
60 GoSub NxtLine
70 GoSub 300

90 GoTo 1000
100 Text1.Text = Text1.Text + a$
200 Return
300 Text1.Text = Text1.Text + a
400 Return

CLS:
Text1.Text = ""
Return

NxtLine:
Text1.Text = Text1.Text + vbCrLf
Return

1000 Rem END

End Sub
Attachments
test.zip
(1.38 KiB) Downloaded 65 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply