mirror of
https://github.com/markpmlim/AppleIIModula2Interpreter.git
synced 2024-12-26 18:29:48 +00:00
Add files via upload
This commit is contained in:
parent
4c9a46bd4c
commit
52da8af78d
242
Equates.S
Normal file
242
Equates.S
Normal file
@ -0,0 +1,242 @@
|
||||
;Name : EQUATES.S
|
||||
;End of file : 5,936
|
||||
|
||||
********************************
|
||||
* Disassembler: TFBD (Phoenix)
|
||||
* References:
|
||||
* Lilith MCode Interpreter
|
||||
* Medos-2: A Modula-2 Oriented Operating System
|
||||
* for the Personal Computer Lilith
|
||||
* The Personal Computer Lilith
|
||||
* Modula2 Handbook
|
||||
********************************
|
||||
; Some ASCII codes used by the Modula2 Interpreter
|
||||
;
|
||||
CTRLC EQU $03
|
||||
BELL EQU $07
|
||||
BS EQU $08
|
||||
LF EQU $0A
|
||||
FF EQU $0C
|
||||
CR EQU $0D
|
||||
CTRLS EQU $13
|
||||
SPACE EQU $20
|
||||
DEL EQU $7F
|
||||
;
|
||||
; Apple II ZPage locations
|
||||
;
|
||||
WNDLFT EQU $20
|
||||
WNDWDTH EQU $21
|
||||
WNDTOP EQU $22
|
||||
WNDBTM EQU $23
|
||||
CH EQU $24
|
||||
CV EQU $25
|
||||
BASL EQU $28
|
||||
BAS2L EQU $2A
|
||||
INVFLG EQU $32
|
||||
YSAV1 EQU $35
|
||||
CSWL EQU $36
|
||||
CSWH EQU $37
|
||||
Z44 EQU $44
|
||||
Z45 EQU $45
|
||||
RNDL EQU $4E
|
||||
RNDH EQU $4F
|
||||
KBD EQU $C000
|
||||
;
|
||||
; Apple Hardware locations
|
||||
;
|
||||
KBSTRB EQU $C010
|
||||
SPKR EQU $C030
|
||||
BasicInt EQU $C300
|
||||
BasicIn EQU $C305
|
||||
BasicOut EQU $C307
|
||||
XC30B EQU $C30B ;GENERIC SIGNATURE BYTE
|
||||
XC30C EQU $C30C ;DEVICE SIGNATURE BYTE
|
||||
PInit EQU $C30D
|
||||
PRead EQU $C30E
|
||||
PWrite EQU $C30F
|
||||
PStat EQU $C310
|
||||
ClrROM EQU $CFFF
|
||||
; Offsets into Command Control Block
|
||||
;
|
||||
; Dummy Section of zpage locations
|
||||
; used for the various registers
|
||||
;
|
||||
DSECT
|
||||
ORG $80
|
||||
PC DS 2 ;Interpreter's Program Counter
|
||||
IReg DS 2 ;instruction register
|
||||
Z84 DS 2 ;General purpose locations
|
||||
Z86 DS 2
|
||||
Z88 DS 2
|
||||
Z8A DS 2
|
||||
Z8C DS 2
|
||||
Z8E DS 2
|
||||
;
|
||||
; Ref: page 18 MeDOS-2 manual
|
||||
; 4 regs point to the stack frame of the currently
|
||||
; executed process
|
||||
; P - points to the process descriptor at the
|
||||
; beginning of the stack frame
|
||||
; L - points to the activation rec on top of stack frame
|
||||
; S - points to 1st free location in the stack frame
|
||||
; H - points to the end of stack (H for high limit)
|
||||
; addr of stack limit
|
||||
;
|
||||
; F - points to the base addr of the code frame
|
||||
; G - points to the base addr of the data frame
|
||||
; The first word of the data frame gives the
|
||||
; reference to the corresponding code frame
|
||||
;
|
||||
FReg DS 2 ;Code frame base address
|
||||
GReg DS 2 ;Corr Data frame base address
|
||||
HReg DS 2 ;Stack limit address (himem)
|
||||
LReg DS 2 ;Local segment base address
|
||||
SReg DS 2 ;Procedure Stack ptr (TOS)
|
||||
PReg DS 2 ;Process base address
|
||||
MReg DS 2 ;Process interrupt mask
|
||||
ExprStkP DS 2 ;Save area for index into ExprStack
|
||||
ExprStack DS 32 ;Expression Stack ($A0-$BF) 16 words
|
||||
ZTemp DS 1
|
||||
FPTemp DS 4 ;work area for temp FP
|
||||
Acc1 DS 6
|
||||
Acc2 DS 6
|
||||
DEND
|
||||
********************************
|
||||
* Ref: Appendix C of interpreter docs Fixed addr section
|
||||
*
|
||||
X0800 EQU $0800 ;F-register of module 0 (SYSTEM)
|
||||
;
|
||||
; The data frame table holds addrs of the
|
||||
; data frames of loaded modules. All modules
|
||||
; are accessed through this table. The index
|
||||
; to an entry in this table is called the
|
||||
; module number.
|
||||
; MeDOS-2 ref pg 15, Appendix C of interp doc
|
||||
;
|
||||
DFTab EQU $0840 ;data frame table
|
||||
********************************
|
||||
* Trap Error Numbers
|
||||
* Ref Lilith mcode interpreter manual
|
||||
*
|
||||
end EQU 0
|
||||
instrChk EQU 1 ;illegal instruction
|
||||
prioChk EQU 2 ;priority error
|
||||
storageChk EQU 3 ;storage overflow
|
||||
rangeChk EQU 4 ;range violation
|
||||
addrChk EQU 5 ;NIL access/invalid computed addr
|
||||
realOvfl EQU 6 ;floating point overflow
|
||||
cardOvfl EQU 7 ;cardinal overflow
|
||||
intOvfl EQU 8 ;integer overflow
|
||||
funcErr EQU 9 ;function return error
|
||||
halt EQU 10 ;halt called
|
||||
assertErr EQU 11 ;assertion error
|
||||
stopped EQU 13
|
||||
;
|
||||
; Offsets into an unpacked floating point number
|
||||
;
|
||||
FMant0 EQU 0 ;Mantissa
|
||||
FMant1 EQU 1
|
||||
FMant2 EQU 2
|
||||
FMant3 EQU 3
|
||||
FSign EQU 4 ;Sign
|
||||
FExp EQU 5 ;Exponent
|
||||
;
|
||||
false EQU 0
|
||||
true EQU 1
|
||||
;
|
||||
; Data Structure of File is given below:
|
||||
; File = RECORD
|
||||
; id : CARDINAL;
|
||||
; eof : BOOLEAN;
|
||||
; res : Response;
|
||||
; tmp : BOOLEAN;
|
||||
; name : ARRAY[0..29] OF CHAR;
|
||||
; data : ARRAY [0..127] OF CARDINAL;
|
||||
; ts : ARRAY [0..127] OF CARDINAL;
|
||||
; wrk : ARRAY [0..22] OF CARDINAL;
|
||||
; END;
|
||||
;
|
||||
DSECT
|
||||
f.id DS 2 ;file ref #
|
||||
f.eof DS 2 ;Indicate if DOS call was successful
|
||||
f.res DS 2 ;error code
|
||||
f.tmp DS 2
|
||||
f.name DS 30 ;FileName
|
||||
f.data DS 256
|
||||
f.st DS 256 ;sector
|
||||
f.wrk DS 46 ;Use as a DOS FCB/DCB
|
||||
DEND
|
||||
********************************
|
||||
* Apple DOS 3.3 page 3 vectors
|
||||
*
|
||||
CallFM EQU $03D6 ;DOS File Manager ($AAFD)
|
||||
X03DC EQU $03DC ;Subrtn to locate input parm list for File Manager ($B5BB)
|
||||
X03E3 EQU $03E3 ;Subrtn to locate input parm list for RWTS ($B7E8)
|
||||
SOFTEV EQU $03F2
|
||||
;
|
||||
; DOS 3.3 equates
|
||||
;
|
||||
DOSENT EQU $AB06 ;File Mgr Main entry
|
||||
DCBSUP EQU $ABDC ;Init File Mgr work area
|
||||
RDVTOC EQU $AFF7 ;Read/Write VTOC buffer
|
||||
RDVDIR EQU $B011 ;Read a dir sector
|
||||
VDINC EQU $B230 ;Advance index into next dir entry
|
||||
TEMP1 EQU $B39C ;Dir index
|
||||
TEMP2 EQU $B39D
|
||||
CVTAB EQU $B3A4 ;Decimal conversion table
|
||||
FTTAB EQU $B3A7 ;file type table
|
||||
VSECAL EQU $B3F3 ;sector allocation (bitmap)
|
||||
VDFILE EQU $B4C6 ;1st dir entry & track of T/S list
|
||||
CCBREQ EQU $B5BB ;USER REQUEST BYTE (opcode)
|
||||
CCBDRV EQU $B5C0 ;drive
|
||||
CCBSLT EQU $B5C1 ;slot
|
||||
CCBFCB EQU $B5C7 ;FCB PTR (Addr of File Mgr WA)
|
||||
FCBDCB EQU $B5D1 ;FILE DATA CONTROL BLOCK
|
||||
DCBSLT EQU $B5F7 ;slot # x 16
|
||||
DCBDRV EQU $B5F8 ;drive #
|
||||
DCBVOL EQU $B5F9 ;vol # (complemented)
|
||||
;
|
||||
; Command Control Block request codes (lifted fr DOS source)
|
||||
;
|
||||
CRQNUL EQU 0 ; 0-NO REQUEST
|
||||
CRQOPN EQU 1 ; 1-OPEN FILE
|
||||
CRQCLS EQU 2 ; 2-CLOSE FILE
|
||||
CRQRD EQU 3 ; 3-READ DATA
|
||||
CRQWR EQU 4 ; WRITE DATA
|
||||
CRQDEL EQU 5 ; 5-DELETE FILE
|
||||
CRQDIR EQU 6 ; 6-READ DIRECTORY
|
||||
CRQLCK EQU 7 ; 7-LOCK FILE
|
||||
CRQUNL EQU 8 ; 8-UNLOCK FILE
|
||||
CRQRNM EQU 9 ; 9-RENAME
|
||||
CRQPOS EQU 10 ; 10-POSITION FILE
|
||||
CRQFMT EQU 11 ; 11-FORMAT
|
||||
CRQVAR EQU 12 ; 12 - VERIFY
|
||||
CRQMAX EQU 13
|
||||
oCCBREQ EQU 0
|
||||
oCCBRQM EQU 1 ;Request Modifier Byte
|
||||
CRMNBT EQU 1 ; R/W NEXT BYTE
|
||||
CRMNBL EQU 2 ; R/W NEXT BLOCK
|
||||
oCCBRLN EQU 2
|
||||
oCCBFN2 EQU 2
|
||||
oCCBVOL EQU 4
|
||||
;
|
||||
oCCBDRV EQU 5
|
||||
oCCBBLN EQU 6
|
||||
oCCBSLT EQU 6
|
||||
oCCBFUC EQU 7
|
||||
oCCBDAT EQU 8
|
||||
oCCBBBA EQU 8
|
||||
oCCBFN1 EQU 8 ;Ptr to filename
|
||||
;
|
||||
oCCBSTA EQU 10 ;Result Status
|
||||
CREFNF EQU 6 ; FILE NOT FOUND
|
||||
CRENSA EQU 9
|
||||
;
|
||||
oCCBFCB EQU 12 ;File Control Block ptr
|
||||
oCCBDBP EQU 14 ;Ptr to Dir Buf
|
||||
oCCBSBP EQU 16 ;Ptr to SECTOR BUF
|
||||
oDCBCRR EQU 25 ;current relative record
|
||||
oDCBCRB EQU 27 ;current relative byte
|
||||
; Offsets into I/O Block
|
||||
oIBSLOT EQU 1
|
||||
oIBPDRV EQU 16
|
89
LoadInterP.S
Normal file
89
LoadInterP.S
Normal file
@ -0,0 +1,89 @@
|
||||
;Name : LOADINTERP.S
|
||||
;End of file : 1,370
|
||||
|
||||
LST OFF
|
||||
;---------------------------------------------------------;
|
||||
; Disassembled with The Flaming Bird Disassembler ;
|
||||
; (c) Phoenix corp. 1992,93 - All rights reserved ;
|
||||
;---------------------------------------------------------;
|
||||
; TFBD generated equates
|
||||
; (c) PHC 1992,93
|
||||
;
|
||||
CTRLD EQU $84
|
||||
ROMIN2 EQU $C081
|
||||
LCBANK2 EQU $C083
|
||||
MeDOSEnt EQU $D000
|
||||
HOME EQU $FC58
|
||||
CROUT EQU $FD8E
|
||||
COUT EQU $FDED
|
||||
RESETV EQU $FFFC
|
||||
;
|
||||
ORG $3000
|
||||
JSR HOME
|
||||
LDA ROMIN2 ;Enable Apple II ROM
|
||||
LDA ROMIN2
|
||||
JSR CROUT
|
||||
;
|
||||
; Load Modula-2 Interpreter
|
||||
;
|
||||
LDA #CTRLD
|
||||
JSR COUT
|
||||
LDY #0
|
||||
LoadLup1 LDA LOADINTERP,Y
|
||||
BEQ IntLoaded
|
||||
JSR COUT
|
||||
INY
|
||||
BNE LoadLup1
|
||||
;
|
||||
; Load SEK.ABS file
|
||||
; SEK - Sequential Executive Kernel
|
||||
;
|
||||
IntLoaded JSR CROUT
|
||||
JSR CROUT
|
||||
LDA #CTRLD
|
||||
JSR COUT
|
||||
LDY #0
|
||||
LoadLup2 LDA LOADSEK,Y
|
||||
BEQ SekLoaded
|
||||
JSR COUT
|
||||
INY
|
||||
BNE LoadLup2
|
||||
;
|
||||
SekLoaded JSR CROUT
|
||||
LDA LCBANK2 ;Switch in LC bank2
|
||||
LDA LCBANK2
|
||||
LDA #0
|
||||
STA RESETV
|
||||
LDA #0
|
||||
STA RESETV+1
|
||||
;
|
||||
; Patch LOCATIONS $00-$0A with the instructions
|
||||
; 0000: LDA $C081
|
||||
; 0003: LDA $C081
|
||||
;
|
||||
LDA #$AD ;Abs load instruction
|
||||
STA $00
|
||||
STA $03
|
||||
LDA #$81
|
||||
STA $00+1
|
||||
STA $03+1
|
||||
LDA #$C0
|
||||
STA $00+2
|
||||
STA $03+2
|
||||
;
|
||||
; 0008: JMP $FAA6 - Return zero
|
||||
;
|
||||
LDA #$4C
|
||||
STA $06
|
||||
LDA #$A6
|
||||
STA $06+1
|
||||
LDA #$FA
|
||||
STA $06+2
|
||||
JMP MeDOSEnt ;XFER CONTROL TO MeDOS
|
||||
;
|
||||
MSB ON
|
||||
LOADINTERP ASC "BLOAD INTERP,A$D000"
|
||||
DB 0
|
||||
LOADSEK ASC "BLOAD SEK.ABS"
|
||||
DB 0
|
||||
MSB OFF
|
BIN
Modula2_Src.2mg
Normal file
BIN
Modula2_Src.2mg
Normal file
Binary file not shown.
8
Readme.md
Normal file
8
Readme.md
Normal file
@ -0,0 +1,8 @@
|
||||
The disassembly of the Modula2 Interpreter for DOS3.3 was done with The Flaming Bird Disassembler (TFBD) downloadable from BrutalDeluxe's website (http://www.brutaldeluxe.fr).
|
||||
|
||||
Acknowledgements: The disassembly of the interpreter would not be possible without help from Willie Kusche.
|
||||
|
||||
Tools required:
|
||||
1) ProDOS version of EdAsm
|
||||
2) HexEditor e.g HxD (Windows) Hex Fiend(macOS)
|
||||
|
Loading…
Reference in New Issue
Block a user