So What Software

Tag: CallBox

Slight interruption…

by 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.

Download: FIXCB.img

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 &params
&lab jsr $BF00
 dc i1"$C7"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Get_File_Info &params
&lab jsr $BF00
 dc i1"$C4"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Set_File_Info &params
&lab jsr $BF00
 dc i1"$C3"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Open &params
&lab jsr $BF00
 dc i1"$C8"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Read &params
&lab jsr $BF00
 dc i1"$CA"
 dc i2"&params"
 MEND
MACRO
&lab _P8:Set_Mark &params
&lab jsr $BF00
 dc i1"$CE"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Write &params
&lab jsr $BF00
 dc i1"$CB"
 dc i2"&params"
 MEND
 MACRO
&lab _P8:Close &params
&lab jsr $BF00
 dc i1"$CC"
 dc i2"&params"
 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…

Comments Off :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...