Tag: Macros
APW-ORCA/M Framework for MacOSX
by sowhat on May.29, 2009, under Programming
While dealing with editing my code in TextMate and uploading that to the GS emulator, certain things just begged for automation. Nothing too fancy, just some helpful utilities I have bundled into a framework of sorts. I call it the APW-ORCA/M Framework for MacOSX. It creates and manages projects written in ORCA/M assembly tailored for the AppleIIgs on MacOSX.
Download it: (AWPFrameWork1.1.tar.gz).
I have apw_projects designated as my Apple IIgs assembly language folder so I would put APWFrameWork1.1.tar.gz in that folder, then change directory to that folder and issue a “tar -xzf APWFrameWork1.1.tar.gz”. This will install the framework. You can then delete the tar file “rm APWFrameWork1.1.tar.gz” to save space.
You’re ready to go, first thing is to read the _README file. That will show you how to use the framework properly.
Additionally __LIBRARY/APW-ORCA:M.tmbundle is provided, Click to install this assembly language environment bundle to TextMate. It provides color coded syntax which makes editing APW sourcecode much easier.
Suggested TextMate settings:
Choose “Sunset” theme.
Set TAB SIZE = 15
Set Preferences/Advanced:LineEndings to CR (Mac OS Classic).
The macro generator in the framework is especially handy for generating the macro files and way easier to use than the MACGEN method provided in APW. The libraries are as up to date as possible, including macros for Marinetti. Included as well are some program templates that make the most basic desktop application. Additional tricky or painful templates for popular functions will be included in future releases.
This framework is written in Perl because I am old school and I have been writing in Perl for more than 15 years. I could have made it in PHP or Ruby but I’m better and quicker writing Perl… the results all wind up the same no matter which high level language you use. By the way… The underlying same-ness of languages is best viewed and understood from the assembly side of things.
I use this framework exclusively for all my IIgs programming projects and have found no bugs, but I’m sure someone out there will find some, it always happens.
As a final thought… If you have been reading along in these postings so far and don’t have APW or ORCA/M, squeeze out a couple bucks and get it here: (https://store.syndicomm.com/) I’m sure “Sheppy” will be thrilled to send you a copy. You can get all the manuals there as well.
Slight interruption…
by sowhat on Apr.21, 2009, under Programming
I know we’re talking assembly language here and something has come to light and needs to be disseminated to the Apple IIgs user base post haste. Back in 1990 when So What Software closed it’s doors, we were unaware of GS/OS version 6 because it was not out yet. It appears to make our flagship software product “Call Box” crash!!! After a bit of digging, disassembling and help from key old timers such as Dave Lyons I have found the problem, which in reality is a big one, but fixable. It all has to do with Memory Manager master pointer records and tools and the way I abuse them in that software. I quickly made a patch which will allow Call Box version 2.0 to operate under GS/OS version 6.xx.
Seeing that this is a discourse on assembly language and toolbox programming I have posted the sourcecode and macros for the patch so that you can get some APW time right off the bat with pre-debugged source. Just some simple copying, pasting, assembling and linking.
I realize that you can count the number of 65816 programmers on one hand these days so I have included the compiled patch as well. This image also includes the file BASIC.LAUNCHER which Apple cleverly removed from the 6.0.X release of the System Disk. This file is necessary for launching Call Box BASIC programs from the Call Box Launching Shell.
Sourcecode:
GEN ON
LIST ON
SYMBOL ON
ABSADDR ON
MCOPY fixcb.mac
KEEP fixcb
ORG $2000
;------------------------------------------------
; This patch is for Call Box Version 2.0 only!!!!
;
; This patch fixes the Master Pointer Block Bug
; found when operating CB 2.0 under GS/OS V6.XX
;
; This patch is quite fragile and is intended as
; a temporary fix until the new version 3.0 is
; released later in 2009.
;
; By William Stephens 04.10.2009
;------------------------------------------------
PatchLocation gequ $84 ;V2.0 specific
PatchValue gequ $CC ;New value, original is 0600
PatchValue1 gequ $13 ;VERY HARDWIRED *** DANGER ***
FileLength gequ $602A ;V2.0 specific
OpenBuf gequ $1C00 ;4 page DOS buffer
HexOut gequ $FDDA ;Print a hex byte
C gequ $43 ;ASCII "C"
B gequ $42 ;ASCII "B"
Indexer gequ $F8 ;Zero page indexer
Begin START
OBJ $2000
sec
xce
sep #$30
longa off
longi off
;-- Make the full pathname ----------------------
_P8:Get_Prefix GetPrefixPrm
tax
lda #0
bcs errnxt
lda #PathBuf
sta Indexer
lda #>Pathbuf
sta Indexer+1
ldy PathLen
lda #C
sta (Indexer),y
iny
lda #B
sta (Indexer),y
iny
sty PathLen
;-- Fix the file access bits --------------------
_P8:Get_File_Info FilePrm
tax
lda #1
bcs error
lda #35 ;Set to __BWR
sta FileAccess
lda #7
sta FilePrm
_P8:Set_File_Info FilePrm
tax
lda #2
errnxt bcs error
;-- Open the file -------------------------------
_P8:Open OpenPrm
tax
lda #3
bcs error
;-- Pass the reference number -------------------
lda Orefnum
sta Crefnum
sta Rrefnum
sta SMrefnum
;-- Read the file into the buffer ---------------
_P8:Read ReadPrm
tax
lda #4
bcs error
;-- Do the patch --------------------------------
lda #Image
sta Indexer
lda #>Image
sta Indexer+1
ldy #PatchLocation
lda #PatchValue
sta (Indexer),y
iny
lda #PatchValue1
sta (Indexer),y
;-- Reposition to the start of file -------------
_P8:Set_Mark SetMarkPrm
txa
lda #5
bcs error
;-- Write the file back to itself ---------------
_P8:Write ReadPrm
tax
lda #6
bcs error
;-- Close the file ------------------------------
_P8:Close ClosePrm
;-- Fix the file access bits --------------------
lda #33 ;Set to __B_R
sta FileAccess
_P8:Set_File_Info FilePrm
tax
lda #7
bcs error
;-- Patching finished ---------------------------
rts
;-- Error handler -------------------------------
error jsr HexOut ;Display command#/error#
txa
jsr HexOut
rts
;-- Parameter tables and data -------------------
SetMarkPrm dc i1'2'
SMrefnum dc i1'0'
dc i3'0'
FilePrm dc i1'10'
dc i'PathLen'
FileAccess dc i1'0'
dc i1'0'
dc i'0'
dc i1'0'
dc i'0'
dc i'0'
dc i'0'
dc i'0'
dc i'0'
OpenPrm dc i1'3'
dc i'PathLen'
dc i'OpenBuf'
Orefnum dc i1'0'
ClosePrm dc i1'1'
Crefnum dc i1'0'
GetPrefixPrm dc i1'1'
dc i'PathLen'
ReadPrm dc i1'4'
Rrefnum dc i1'0'
dc i'Image'
dc i'FileLength'
dc i'0'
PathLen dc i1'0'
PathBuf ds 63
Image ds FileLength
END
Macros:
MACRO
&lab _P8:Get_Prefix ¶ms
&lab jsr $BF00
dc i1"$C7"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Get_File_Info ¶ms
&lab jsr $BF00
dc i1"$C4"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Set_File_Info ¶ms
&lab jsr $BF00
dc i1"$C3"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Open ¶ms
&lab jsr $BF00
dc i1"$C8"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Read ¶ms
&lab jsr $BF00
dc i1"$CA"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Set_Mark ¶ms
&lab jsr $BF00
dc i1"$CE"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Write ¶ms
&lab jsr $BF00
dc i1"$CB"
dc i2"¶ms"
MEND
MACRO
&lab _P8:Close ¶ms
&lab jsr $BF00
dc i1"$CC"
dc i2"¶ms"
MEND
Once you have this assembled and linked as a P8 binary file named “FIXCB”, put it in the directory with the file CB (the Call Box BASIC engine) and type BRUN FIXCB. Also, put the file BASIC.LAUNCHER in you root directory.
That should fix up your Call Box installation for now.
Call Box version 2.0 is freely downloadable from this site, simply visit The Call Box TPS page. There you will find the 2.0 installation set, Programmers association disks and the all important manual.
–William Stephens
Chapter 3 will be posted soon…
