Skip to content

Commit

Permalink
Merge pull request #2 from Ripjetski6502/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Ripjetski6502 authored Mar 23, 2023
2 parents eac41fb + 9c35c6d commit eca191d
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 45 deletions.
Binary file modified bin/fullappdemo.xex
Binary file not shown.
2 changes: 1 addition & 1 deletion src/a8defines.pas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface

const
// Version
LIB_VERSION = '1.1.0';
LIB_VERSION = '1.1.1';

// Window Record and Memory Alloc
WRECSZ = 10;
Expand Down
2 changes: 1 addition & 1 deletion src/a8libgadg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function GList(bN, x, y, bE, bI, bV, bS: Byte; pS: TStringArray): Byte;
// Set drawing position
xp := 0;
yp := 0;
bEnd := Min(bStart + bV - 1, bS - 1);
bEnd := WMin(bStart + bV - 1, bS - 1);

for bL := 0 to bS - 1 do
begin
Expand Down
6 changes: 3 additions & 3 deletions src/a8libmisc.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface
// --------------------------------------------------
function IKC2ATA(bN: Byte): Byte;
function WaitKCX(bI: Byte): Word;
function Min(x, y: Byte): Byte;
function WMin(x, y: Byte): Byte;

implementation

Expand Down Expand Up @@ -140,9 +140,9 @@ function WaitKCX(bI: Byte): Word;
Poke(KEYPCH, KNONE);
end;

function Min(x, y: Byte): Byte;
function WMin(x, y: Byte): Byte;
(*
@description: Min returns the smallest value of X and Y.
@description: WMin returns the smallest value of X and Y.
*)
begin
Expand Down
38 changes: 2 additions & 36 deletions src/a8libstr.pas
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,7 @@ procedure StrAI(pS: PByte; bS: Byte);
// Process each element
for bL := 0 to bS - 1 do
begin
if (pS^ >= 0) and (pS^ <= 31) then
begin
pS^ := pS^ + 64;
end
else if (pS^ >= 32) and (pS^ <= 95) then
begin
pS^ := pS^ - 32;
end
else if (pS^ >= 128) and (pS^ <= 159) then
begin
pS^ := pS^ + 64;
end
else if (pS^ >= 160) and (pS^ <= 223) then
begin
pS^ := pS^ - 32;
end;

pS^ := byte(ata2int(char(pS^)));
// Increment pointer to next char
Inc(pS);
end;
Expand All @@ -96,25 +80,7 @@ procedure StrAI(pS: PByte; bS: Byte);
// ------------------------------------------------------------
function CharAI(bC: Byte): Byte;
begin
if (bC >= 0) and (bC <= 31) then
begin
Result := bC + 64;
end
else if (bC >= 32) and (bC <= 95) then
begin
Result := bC - 32;
end
else if (bC >= 128) and (bC <= 159) then
begin
Result := bC + 64;
end
else if (bC >= 160) and (bC <= 223) then
begin
Result := bC - 32;
end
else begin
Result := bC;
end;
Result := byte(ata2int(char(bC)));
end;


Expand Down
85 changes: 81 additions & 4 deletions src/fullappdemo.pas
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// Pull in include files
uses
Crt, a8defines, a8defwin, a8libmisc, a8libstr, a8libwin, a8libgadg, a8libmenu;
crt, sysutils, a8defines, a8defwin, a8libmisc, a8libstr, a8libwin, a8libgadg, a8libmenu;

// Variables
var
Expand Down Expand Up @@ -43,7 +43,7 @@ function FileInput: Boolean;
selected_list: Byte;
read_list: Byte;
bM: Byte;
tmp: Byte;
i, tmp: Byte;

begin
Result:= false;
Expand All @@ -56,7 +56,7 @@ function FileInput: Boolean;
FillChar(@selected_file[tmp + 1], FILE_SIZE - tmp, CHSPACE );

win_file:=WOpen(5, 4, 30, 16, WOFF);
WOrn(win_file, WPTOP, WPLFT, 'Choose file');
WOrn(win_file, WPTOP, WPLFT, 'Choose a file');


WPrint(win_file, 2, 2, WOFF, 'File:');
Expand All @@ -73,13 +73,35 @@ function FileInput: Boolean;

// file
read_file:= GInput(win_file, 8, 2, GFILE, 12, selected_file);
if (read_file <> XESC) then
begin
for i:=0 to Length(list_files) - 1 do
begin
if list_files[i] = Trim(selected_file) then
begin
selected_list:= i + 1;
GList(win_file, 2, 5, GDISP, selected_list, 8, Length(list_files), list_files);
end;
end;
end
else if (read_file = XESC) then
begin
bM:= XESC;
break;
end;

// Drives combo
read_drive:= GCombo(win_file, 21, 5, GEDIT, selected_drive, 8, list_drives);
if (read_drive <> XESC) then
begin
selected_drive := read_drive;
end
else if (read_drive = XESC) then
begin
bM:= XESC;
break;
end;

GCombo(win_file, 21, 5, GDISP, selected_drive, 8, list_drives);

// Files List
Expand All @@ -92,7 +114,13 @@ function FileInput: Boolean;
SetLength(selected_file, FILE_SIZE);
FillChar(@selected_file[tmp + 1], FILE_SIZE - tmp, CHSPACE );
WPrint(win_file, 8, 2, WOFF, selected_file);
end
else if (read_list = XESC) then
begin
bM:= XESC;
break;
end;

GList(win_file, 2, 5, GDISP, selected_list, 8, Length(list_files), list_files);

// Buttons to confirm
Expand Down Expand Up @@ -228,15 +256,39 @@ function FormInput: Boolean;

// Edit fields
bA := GInput(bW1, 8, 2, GNUMER, 27, cA);
if (bA = XESC) then
begin
bM:= XESC;
break;
end;
bB := GInput(bW1, 8, 3, GALPHA, 27, cB);
if (bB = XESC) then
begin
bM:= XESC;
break;
end;
bC := GInput(bW1, 8, 4, GALNUM, 27, cC);
if (bC = XESC) then
begin
bM:= XESC;
break;
end;
bD := GInput(bW1, 8, 5, GANY, 27, cD);

if (bD = XESC) then
begin
bM:= XESC;
break;
end;
// ----- Spinner Input -----
bV := GSpin(bW1, 8, 6, 0, 100, bVp, GEDIT);
if (bV <> XESC) then
begin
bVp := bV;
end
else if (bV = XESC) then
begin
bM:= XESC;
break;
end;

// ----- Display Radio Buttons - horizontal -----
Expand All @@ -250,6 +302,11 @@ function FormInput: Boolean;
if (bRA <> XESC) then
begin
bRAp := bRA;
end
else if (bRA = XESC) then
begin
bM:= XESC;
break;
end;

// Redisplay buttons
Expand All @@ -262,6 +319,11 @@ function FormInput: Boolean;
if (bRB <> XESC) then
begin
bRBp := bRB;
end
else if (bRB = XESC) then
begin
bM:= XESC;
break;
end;

// Redisplay buttons
Expand All @@ -280,6 +342,11 @@ function FormInput: Boolean;
if (bCha <> XESC) and (bCha <> XTAB) then
begin
bChap := bCha;
end
else if (bCha = XESC) then
begin
bM:= XESC;
break;
end;
// until (bCha = XESC) or (bCha = XTAB) or (bCha = XNONE);

Expand All @@ -292,6 +359,11 @@ function FormInput: Boolean;
if (bChb <> XESC) then
begin
bChbp := bChb;
end
else if (bChb = XESC) then
begin
bM:= XESC;
break;
end;
// until (bChb = XESC) or (bChb = XTAB) or (bCha = XNONE);

Expand All @@ -304,6 +376,11 @@ function FormInput: Boolean;
if (bChc <> XESC) then
begin
bChcp := bChc;
end
else if (bChc = XESC) then
begin
bM:= XESC;
break;
end;
// until (bChc = XESC) or (bChc = XTAB) or (bCha = XNONE);

Expand Down

0 comments on commit eca191d

Please sign in to comment.