Skip to content

Instantly share code, notes, and snippets.

@podstawek
podstawek / beep.pp
Created April 4, 2022 13:53
Pascal program to emit sound on Apple Lisa
PROGRAM sound;
USES HWINT;
BEGIN
Beep(3000, 5000);
END.
PROGRAM sound;
USES HWINT;
PROCEDURE Delay(milli: MilliSeconds);
VAR old: MilliSeconds;
BEGIN
old := Timer;
repeat
begin
@podstawek
podstawek / concurrency.pp
Created April 11, 2022 13:33
BEEP call in Apple Lisa's Pascal is non-blocking. Which is very different from e.g. ZX Spectrum implementation. This program illustrates how a loop can run while sound is playing.
PROGRAM sound;
USES HWINT;
var i:integer;
begin
SetVolume(2);
noise(3000);
for i:= 1 to 600 do
begin
;-----------------------------------------
; Adapted from the original Lisa ROM listing
; https://www.apple.asimov.net/documentation/applelisa/AppleLisa-BootROMListing.pdf
; D0 = desired frequency ($00 - $AA)
; D1 = duration (0 = .5 msec)
; D2 = volume (0,2,4,...,E)
; D3 = pulse train shape as a string of 8 bits
;-----------------------------------------
ORG $800
@podstawek
podstawek / compile.sh
Created February 12, 2023 12:46
Cross-compile assembly code on a Mac so that it is executable on an old PC XT
filename=$1
filename="${filename%.*}"
echo "Filename without extension is ${filename}"
echo -n "Compiling $1 with vasm... " &&\
vasmx86_std -m8086 $1 -Faout -o ${filename}.obj &&\
echo "done."
echo -n "Linking $1 with vlink... " &&\