From ecf69cfdba5e9a4c5bd70cc1028cfcd464ee522b Mon Sep 17 00:00:00 2001 From: Curle Date: Wed, 3 Apr 2024 01:18:41 +0100 Subject: [PATCH] Fix formatting issue; reshape window to better suit the size of the text. --- Acepm.Designer.vb | 92 ++++++++++++++++---------- Acepm.vb | 165 +++++++++++++++++++++++++++------------------- 2 files changed, 154 insertions(+), 103 deletions(-) diff --git a/Acepm.Designer.vb b/Acepm.Designer.vb index 5219bb6..7e7555f 100644 --- a/Acepm.Designer.vb +++ b/Acepm.Designer.vb @@ -61,6 +61,7 @@ Partial Class Acepm Label4 = New Label() CardNumber = New TextBox() PunchNumber = New TextBox() + Output = New Label() Frame1.SuspendLayout() SuspendLayout() ' @@ -84,7 +85,7 @@ Partial Class Acepm ' ' InA ' - InA.Location = New Point(625, 25) + InA.Location = New Point(484, 23) InA.Name = "InA" InA.Size = New Size(25, 25) InA.TabIndex = 2 @@ -93,14 +94,14 @@ Partial Class Acepm ' ' InText ' - InText.Location = New Point(656, 25) + InText.Location = New Point(515, 23) InText.Name = "InText" InText.Size = New Size(200, 23) InText.TabIndex = 3 ' ' InB ' - InB.Location = New Point(625, 50) + InB.Location = New Point(484, 48) InB.Name = "InB" InB.Size = New Size(25, 25) InB.TabIndex = 4 @@ -109,7 +110,7 @@ Partial Class Acepm ' ' TS ' - TS.Location = New Point(656, 50) + TS.Location = New Point(515, 48) TS.Name = "TS" TS.Size = New Size(55, 25) TS.TabIndex = 5 @@ -118,7 +119,7 @@ Partial Class Acepm ' ' InputText ' - InputText.Location = New Point(717, 50) + InputText.Location = New Point(576, 48) InputText.Name = "InputText" InputText.Size = New Size(55, 25) InputText.TabIndex = 6 @@ -127,7 +128,7 @@ Partial Class Acepm ' ' InstrText ' - InstrText.Location = New Point(778, 50) + InstrText.Location = New Point(637, 48) InstrText.Name = "InstrText" InstrText.Size = New Size(55, 25) InstrText.TabIndex = 7 @@ -136,7 +137,7 @@ Partial Class Acepm ' ' Up ' - Up.Location = New Point(656, 137) + Up.Location = New Point(515, 135) Up.Name = "Up" Up.Size = New Size(50, 25) Up.TabIndex = 8 @@ -145,7 +146,7 @@ Partial Class Acepm ' ' Down ' - Down.Location = New Point(712, 137) + Down.Location = New Point(571, 135) Down.Name = "Down" Down.Size = New Size(50, 25) Down.TabIndex = 9 @@ -154,7 +155,7 @@ Partial Class Acepm ' ' Button6 ' - Button6.Location = New Point(768, 137) + Button6.Location = New Point(627, 135) Button6.Name = "Button6" Button6.Size = New Size(50, 25) Button6.TabIndex = 10 @@ -163,7 +164,7 @@ Partial Class Acepm ' ' Writer ' - Writer.Location = New Point(625, 300) + Writer.Location = New Point(484, 298) Writer.Name = "Writer" Writer.Size = New Size(50, 25) Writer.TabIndex = 11 @@ -172,7 +173,7 @@ Partial Class Acepm ' ' Reader ' - Reader.Location = New Point(681, 300) + Reader.Location = New Point(540, 298) Reader.Name = "Reader" Reader.Size = New Size(50, 25) Reader.TabIndex = 12 @@ -181,7 +182,7 @@ Partial Class Acepm ' ' Enter ' - Enter.Location = New Point(625, 350) + Enter.Location = New Point(484, 348) Enter.Name = "Enter" Enter.Size = New Size(50, 25) Enter.TabIndex = 13 @@ -190,7 +191,7 @@ Partial Class Acepm ' ' Run ' - Run.Location = New Point(710, 350) + Run.Location = New Point(569, 348) Run.Name = "Run" Run.Size = New Size(50, 25) Run.TabIndex = 14 @@ -199,7 +200,7 @@ Partial Class Acepm ' ' Oneshot ' - Oneshot.Location = New Point(765, 350) + Oneshot.Location = New Point(624, 348) Oneshot.Name = "Oneshot" Oneshot.Size = New Size(50, 25) Oneshot.TabIndex = 15 @@ -208,7 +209,7 @@ Partial Class Acepm ' ' InitCards ' - InitCards.Location = New Point(625, 400) + InitCards.Location = New Point(484, 398) InitCards.Name = "InitCards" InitCards.Size = New Size(100, 25) InitCards.TabIndex = 16 @@ -217,7 +218,7 @@ Partial Class Acepm ' ' Exitt ' - Exitt.Location = New Point(625, 450) + Exitt.Location = New Point(484, 446) Exitt.Name = "Exitt" Exitt.Size = New Size(50, 25) Exitt.TabIndex = 17 @@ -226,7 +227,7 @@ Partial Class Acepm ' ' Button14 ' - Button14.Location = New Point(700, 450) + Button14.Location = New Point(601, 446) Button14.Name = "Button14" Button14.Size = New Size(50, 25) Button14.TabIndex = 18 @@ -238,7 +239,7 @@ Partial Class Acepm Frame1.Controls.Add(Instruction) Frame1.Controls.Add(Hexadecimal) Frame1.Controls.Add(Dec) - Frame1.Location = New Point(625, 81) + Frame1.Location = New Point(484, 79) Frame1.Name = "Frame1" Frame1.Size = New Size(250, 50) Frame1.TabIndex = 19 @@ -277,15 +278,16 @@ Partial Class Acepm ' ' MCV ' - MCV.Location = New Point(625, 137) + MCV.Location = New Point(484, 135) MCV.Name = "MCV" MCV.Size = New Size(25, 23) MCV.TabIndex = 20 + MCV.Text = "0" ' ' Label1 ' Label1.AutoSize = True - Label1.Location = New Point(625, 176) + Label1.Location = New Point(484, 174) Label1.Name = "Label1" Label1.Size = New Size(172, 15) Label1.TabIndex = 21 @@ -293,35 +295,39 @@ Partial Class Acepm ' ' TCAText ' - TCAText.Location = New Point(624, 194) + TCAText.Location = New Point(483, 192) TCAText.Name = "TCAText" TCAText.Size = New Size(25, 23) TCAText.TabIndex = 22 + TCAText.Text = "Off" ' ' TCBText ' - TCBText.Location = New Point(655, 194) + TCBText.Location = New Point(514, 192) TCBText.Name = "TCBText" TCBText.Size = New Size(25, 23) TCBText.TabIndex = 23 + TCBText.Text = "Off" ' ' mcText ' - mcText.Location = New Point(686, 194) + mcText.Location = New Point(545, 192) mcText.Name = "mcText" mcText.Size = New Size(25, 23) mcText.TabIndex = 23 + mcText.Text = "0" ' ' TotalText ' - TotalText.Location = New Point(717, 194) + TotalText.Location = New Point(576, 192) TotalText.Name = "TotalText" TotalText.Size = New Size(100, 23) TotalText.TabIndex = 23 + TotalText.Text = "0" ' ' OutText ' - OutText.Location = New Point(686, 237) + OutText.Location = New Point(545, 235) OutText.Name = "OutText" OutText.Size = New Size(100, 23) OutText.TabIndex = 23 @@ -329,7 +335,7 @@ Partial Class Acepm ' Label2 ' Label2.AutoSize = True - Label2.Location = New Point(625, 239) + Label2.Location = New Point(484, 237) Label2.Name = "Label2" Label2.Size = New Size(45, 15) Label2.TabIndex = 21 @@ -338,36 +344,39 @@ Partial Class Acepm ' Label3 ' Label3.AutoSize = True - Label3.Location = New Point(636, 272) + Label3.Location = New Point(491, 271) Label3.Name = "Label3" - Label3.Size = New Size(154, 15) + Label3.Size = New Size(160, 15) Label3.TabIndex = 21 - Label3.Text = "DRUM / CARDS Track DL" + Label3.Text = "DRUM / CARDS Track DL" ' ' Trackk ' - Trackk.Location = New Point(737, 300) + Trackk.Location = New Point(596, 298) Trackk.Name = "Trackk" Trackk.Size = New Size(25, 23) Trackk.TabIndex = 22 + Trackk.Text = "0" ' ' DL ' - DL.Location = New Point(768, 300) + DL.Location = New Point(627, 298) DL.Name = "DL" DL.Size = New Size(25, 23) DL.TabIndex = 22 + DL.Text = "1" ' ' EnterAt ' - EnterAt.Location = New Point(680, 350) + EnterAt.Location = New Point(539, 348) EnterAt.Name = "EnterAt" EnterAt.Size = New Size(25, 23) EnterAt.TabIndex = 22 + EnterAt.Text = "0" ' ' Label4 ' - Label4.Location = New Point(731, 400) + Label4.Location = New Point(590, 403) Label4.Name = "Label4" Label4.Size = New Size(61, 20) Label4.TabIndex = 24 @@ -375,23 +384,32 @@ Partial Class Acepm ' ' CardNumber ' - CardNumber.Location = New Point(798, 400) + CardNumber.Location = New Point(657, 398) CardNumber.Name = "CardNumber" CardNumber.Size = New Size(25, 23) CardNumber.TabIndex = 22 + CardNumber.Text = "128" ' ' PunchNumber ' - PunchNumber.Location = New Point(761, 452) + PunchNumber.Location = New Point(657, 448) PunchNumber.Name = "PunchNumber" PunchNumber.Size = New Size(25, 23) PunchNumber.TabIndex = 22 + PunchNumber.Text = "256" + ' + ' Output + ' + Output.Location = New Point(12, 53) + Output.Name = "Output" + Output.Size = New Size(442, 502) + Output.TabIndex = 25 ' ' Acepm ' AutoScaleDimensions = New SizeF(7.0F, 15.0F) AutoScaleMode = AutoScaleMode.Font - ClientSize = New Size(866, 492) + ClientSize = New Size(742, 558) Controls.Add(Label4) Controls.Add(OutText) Controls.Add(TotalText) @@ -427,6 +445,7 @@ Partial Class Acepm Controls.Add(InA) Controls.Add(DLBP) Controls.Add(DLAP) + Controls.Add(Output) Name = "Acepm" Text = "Acepm" Frame1.ResumeLayout(False) @@ -473,5 +492,6 @@ Partial Class Acepm Friend WithEvents Label4 As Label Friend WithEvents CardNumber As TextBox Friend WithEvents PunchNumber As TextBox + Friend WithEvents Output As Label End Class diff --git a/Acepm.vb b/Acepm.vb index aa996e9..bcfcba9 100644 --- a/Acepm.vb +++ b/Acepm.vb @@ -1,30 +1,33 @@  Public Class Acepm - Dim MemH(500) As Long, MemL(500) As Long - Dim N As Integer, S As Integer, D As Integer - Dim C As Integer, W As Integer, T As Integer, M As Long - Dim Go As Integer, TT As Long, ST As Integer, TE As Integer - Dim SWH As Long, SWL As Long - Dim TCA As Integer, TCB As Integer - Dim Disc As Integer, Buzzer As Integer - Dim DLA As Integer, DLB As Integer, MC As Integer - Dim ConvertedH As Long, ConvertedL As Long - Dim Carry As Long, Neg As Integer - Dim H As Long, L As Long - Dim I As Long, Buzz As Integer - Dim TempL As Long, TempH As Long - Dim A1 As Long, A2 As Long, A3 As Long, A4 As Long - Dim B1 As Long, B2 As Long, Prod As Long - Dim ROH As Long, ROL As Long, REH As Long, REL As Long + ' Integer -> Short, Long -> Integer. + ' Data sizes changed since DD implemented all this. + Dim MemH(500) As Integer, MemL(500) As Integer + Dim N As Short, S As Short, D As Short + Dim C As Short, W As Short, T As Short, M As Integer + Dim Go As Short, TT As Integer, ST As Short, TE As Short + Dim SWH As Integer, SWL As Integer + Dim TCA As Short, TCB As Short + Dim Disc As Short, Buzzer As Short + Dim DLA As Short, DLB As Short, MC As Short + Dim ConvertedH As Integer, ConvertedL As Integer + Dim Carry As Integer, Neg As Short + Dim H As Integer, L As Integer + Dim I As Integer, Buzz As Short + Dim TempL As Integer, TempH As Integer + Dim A1 As Integer, A2 As Integer, A3 As Integer, A4 As Integer + Dim B1 As Integer, B2 As Integer, Prod As Integer + Dim ROH As Integer, ROL As Integer, REH As Integer, REL As Integer Dim Res1 As Single, Res2 As Single 'FOR THE MULT TEST - Dim Running As Integer, StartMC As Integer, IMC As Integer - Dim HeadR As Integer, ShiftR As Integer, Track As Integer - Dim HeadW As Integer, ShiftW As Integer, TrackR As Integer, TrackW As Integer - Dim DLNo As Integer - Dim Row As Integer, CardReading As Integer, CardPunching As Integer - Dim PunchAnyCard As Integer, Initial As Integer - Dim NewCard As Integer + Dim Running As Short, StartMC As Short, IMC As Short + Dim HeadR As Short, ShiftR As Short, Track As Short + Dim HeadW As Short, ShiftW As Short, TrackR As Short, TrackW As Short + Dim DLNo As Short + Dim Row As Short, CardReading As Short, CardPunching As Short + Dim PunchAnyCard As Short, Initial As Short + Dim NewCard As Short + Dim TempText As String Sub Transfer() @@ -201,7 +204,7 @@ Public Class Acepm '(see Sub Transfer) and fnally the next instruction is 'into the instruction register, MemH(0) and MemH(0). - Dim X As Long + Dim X As Integer Disc = 0 Carry = 0 'PARSE THE INSTRUCTION @@ -316,7 +319,8 @@ Public Class Acepm End If 'SOUND THE BUZZER IF IT HAS BEEN STIMULATED If Buzz = 1 Then Beep() : - MsgBox("Buzzer is Sounding") : Buzz = 0 + 'MsgBox("Buzzer is Sounding") :' + Buzz = 0 'EFFECT MULT AND DRUM If D = 19 Then Mult() If D = 22 Then Drum() @@ -360,7 +364,7 @@ Public Class Acepm Display() End Sub - Sub Form_Load(sender As Object, e As EventArgs) + Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Sets default values for the DLs which are displayed and 'the Hexadecimal option for word display format. Opens the @@ -368,11 +372,22 @@ Public Class Acepm DLA = 1 DLB = 2 - Hexadecimal.Checked = False + Hexadecimal.Checked = True 'Fix the bug implemented by DD - default to hex mode so that we can run Display after opening the files - Microsoft.VisualBasic.FileSystem.FileOpen(1, "AceDrum", OpenMode.Binary) - Microsoft.VisualBasic.FileSystem.FileOpen(2, "AceCards", OpenMode.Binary) - Microsoft.VisualBasic.FileSystem.FileOpen(3, "AcePunch", OpenMode.Binary) + + ' Fix a bug implemented by DD, where you could only load data from a single path on the filesystem + Dim drumLoc = + IO.Path.Combine(IO.Directory.GetParent(Application.ExecutablePath).FullName, "Acedrum") + Dim cardsLoc = + IO.Path.Combine(IO.Directory.GetParent(Application.ExecutablePath).FullName, "Acecards") + Dim punchLoc = + IO.Path.Combine(IO.Directory.GetParent(Application.ExecutablePath).FullName, "Acepunch") + + FileOpen(1, drumLoc, OpenMode.Binary) + FileOpen(2, cardsLoc, OpenMode.Binary) + FileOpen(3, punchLoc, OpenMode.Binary) + + Display() End Sub Sub Hexadecimal_Click(sender As Object, e As EventArgs) Handles Hexadecimal.CheckedChanged @@ -462,7 +477,7 @@ Public Class Acepm 'from instruction format makes F=1 which gives a warning. 'The result is in Converted H and Converted L. - Dim X As Long, text As String, Symb As String, F As Integer + Dim X As Integer, text As String, Symb As String, F As Short Dim Textt As String F = 0 text = "" @@ -509,7 +524,7 @@ Public Class Acepm 'number. First spaces are removed. The result is 'in Converted H and Converted L. - Dim I As Integer, X As Long + Dim I As Short, X As Integer Dim text As String, Symb As String, Textt As String text = "" Textt = InText.Text @@ -539,81 +554,98 @@ Public Class Acepm 'are also shown. Sub PrintWord does the actual printing 'of the contents. - 'Form1.Cls + Output.Text = "" + Dim Line As String + If TCA = 0 Then TCAText.Text = "Off" Else TCAText.Text = "On" If TCB = 0 Then TCBText.Text = "Off" Else TCBText.Text = "On" mcText.Text = Str$(ST) TotalText.Text = Str$(TT - StartMC) -Print: Print(" DELAY LINE") - Print(Format$(DLA, " 00")) - Print(" DELAY LINE") - Print(Format$(DLB, " 00")) - Print(" INSTRUCTION (0)") - Print("") +Print: Line += ("DELAY LINE") + Line += (Format$(DLA, " 00")) + Line += (" DELAY LINE") + Line += (Format$(DLB, " 00")) + Line += (" INSTRUCTION (0)") + Output.Text += Line + Environment.NewLine + Line = "" For M = 0 To 31 - Print(" ") + Line += (" ") PrintWord(32 * DLA + M) - Print(TAB(23).ToString) - Print(Format$(M, " 00")) - Print(TAB(29).ToString) + Line += TempText + Line += Microsoft.VisualBasic.Strings.StrDup((23 - Line.Length), " ") + Line += (Format$(M, " 00")) + Line += Microsoft.VisualBasic.Strings.StrDup((29 - Line.Length), " ") PrintWord(32 * DLB + M) - Print(TAB(48).ToString) - If M = 0 Then Print(" " + Inststring(0)) - If M = 2 Then Print(" INPUT (1)") + Line += TempText + Line += Microsoft.VisualBasic.Strings.StrDup((48 - Line.Length), " ") + If M = 0 Then Line += (" " + Inststring(0)) + If M = 2 Then Line += (" INPUT (1)") If M = 4 Then - Print(" ") - Print(Format$(0, " ")) + Line += (" ") + Line += (Format$(0, " ")) PrintWord(1) + Line += TempText End If - If M = 6 Then Print(" DS") + If M = 6 Then Line += (" DS") If M = 8 Then - Print(Format$(12, " 00 ")) + Line += (Format$(12, " 00 ")) PrintWord(384) + Line += TempText End If If M = 9 Then - Print(Format$(12, " 00 ")) + Line += (Format$(12, " 00 ")) PrintWord(385) + Line += TempText End If If M = 12 Then - Print(Format$(14, " 00 ")) + Line += (Format$(14, " 00 ")) PrintWord(386) + Line += TempText End If If M = 13 Then - Print(Format$(14, " 00 ")) + Line += (Format$(14, " 00 ")) PrintWord(387) + Line += TempText End If If M = 15 Then - Print(" TS") + Line += (" TS") End If If M = 17 Then - Print(Format$(15, " 00 ")) + Line += (Format$(15, " 00 ")) PrintWord(388) + Line += TempText End If If M = 19 Then - Print(Format$(16, " 00 ")) + Line += (Format$(16, " 00 ")) PrintWord(389) + Line += TempText End If If M = 21 Then - Print(Format$(20, " 00 ")) + Line += (Format$(20, " 00 ")) PrintWord(390) + Line += TempText End If If M = 23 Then - Print(Format$(26, " 00 ")) + Line += (Format$(26, " 00 ")) PrintWord(391) + Line += TempText End If If M = 25 Then - Print(Format$(27, " 00 ")) + Line += (Format$(27, " 00 ")) PrintWord(392) + Line += TempText End If If M = 27 Then - Print(" OUTPUT") + Line += (" OUTPUT") End If If M = 29 Then - Print(Format$(28, " 00 ")) + Line += (Format$(28, " 00 ")) PrintWord(28) + Line += TempText End If - Print("") + Output.Text += Line + Environment.NewLine + Line = "" Next M End Sub @@ -665,7 +697,7 @@ Print: Print(" DELAY LINE") 'memory position of the TS or DS. For a DS, the even minor 'cycle is loaded and the even contents moved to the odd. - Dim X As Integer + Dim X As Short MC = Val(MCV.Text) Mod 32 MCV.Text = Str$(MC) X = 0 @@ -702,13 +734,13 @@ Beep: MsgBox("Not a TS, DS or Output Destination") 'Prints a word on the form in the chosen format If Instruction.Checked Then - Print(Inststring(X)) + TempText = (Inststring(X)) End If If Hexadecimal.Checked Then - Print(Hexstring(X)) + TempText = (Hexstring(X)) End If If Dec.Checked Then - Print(Decstring(X)) + TempText = (Decstring(X)) End If End Sub @@ -1223,5 +1255,4 @@ RunAgain: End Sub - End Class