jds wrote:
Since this is Pascal, and p-code, what you probably have is an implementation of Wirth's p-code interpreter. It is probably based on the code in the book Algorithms + Data Structures = Programs, a PDF is
available on Han's Ottens site. Page 334 onwards describes the P-code interpreter, and might give you some hints on your version. My guess is that it would be very similar to others of the time, and perhaps even quite similar to the p-code interpreter in Apple Pascal.
That opcode $06 could be the INT instruction, which allocates space for local variables by incrementing something called the t register. This happens to be the 6th instruction in the set of instructions in the source code.
Thanks for the link. I have that book, read it many trips around the sun ago and misplaced it.
The first thing I did when starting this project was to dig up documentation about the UCSD P-System and Apple Pascal. Very different from LUCIDATA.
This is the instruction dispatch table so far:
Code:
0100 01C1 00263 fdb L_01C1 ; $00 - Halt + something else having to do with case of
0102 01E6 00264 fdb L_01E6 ; $01 - Branch
00265
0104 01 ED 00266 fcb $01,$ED ; 0100
00267
0106 0658 00268 fdb L_0658 ; $03 - Some kind of call
0108 067E 00269 fdb L_067E ; $04 - Some kind of call
010A 06A2 00270 fdb L_06A2 ; $05 - Return
010C 06B3 00271 fdb L_06B3 ; $06 - Manage stack pointer
010E 06E9 00272 fdb L_06E9 ; $07 - Push constant
0110 078E 00273 fdb L_078E ; $08 - Determine array index
0112 0828 00274 fdb L_0828 ; $09
00275
0114 08 45 08 5A 00276 fcb $08,$45,$08,$5A ; 0110
00277
0118 0883 00278 fdb L_0883 ; $0C - Eoln
011A 089C 00279 fdb L_089C ; $0D - Eof
011C 08B0 00280 fdb L_08B0 ; $0E - Rewrite
011E 08C9 00281 fdb L_08C9 ; $0F - Reset
0120 08DF 00282 fdb L_08DF ; $10 - Compare bytes?
0122 08FB 00283 fdb L_08FB ; $11
00284
0124 09 01 09 01 00285 fcb $09,$01,$09,$01 ; 0120
0128 09 01 09 01 00286 fcb $09,$01,$09,$01 ; 0128
00287
012C 0904 00288 fdb L_0904 ; $16 - Push character
012E 0909 00289 fdb L_0909 ; $17 - Pop character
00290
0130 09 0E 09 1C 00291 fcb $09,$0E,$09,$1C ; 0130
00292
0134 0950 00293 fdb L_0950 ; $1A
00294
0136 09 79 00295 fcb $09,$79 ; 0130
00296
0138 09BD 00297 fdb L_09BD ; $1C - Writeln
013A 09C9 00298 fdb L_09C9 ; $1D - Readln
013C 0A03 00299 fdb L_0A03 ; $1E - Write string
013E 0A6D 00300 fdb L_0A6D ; $1F - Read
0140 0A84 00301 fdb L_0A84 ; $20 - Compare for =
0142 0AAC 00302 fdb L_0AAC ; $21 - Compare for <>
0144 0AB6 00303 fdb L_0AB6 ; $22 - Compare for <
0146 0AC2 00304 fdb L_0AC2 ; $23 - Compare for >
0148 0ACE 00305 fdb L_0ACE ; $24 - Compare for <=
014A 0ADA 00306 fdb L_0ADA ; $25 - Compare for >=
014C 0AE6 00307 fdb L_0AE6 ; $26 - Push integer
014E 0AEB 00308 fdb L_0AEB ; $27 - Pop integer
0150 0B05 00309 fdb L_0B05 ; $28 - Add integer
0152 0B0D 00310 fdb L_0B0D ; $29 - Subtract integer
0154 0B15 00311 fdb L_0B15 ; $2A - Multiply integer
0156 0B1D 00312 fdb L_0B1D ; $2B - Divide integer
00313
0158 0B 25 00314 fcb $0B,$25 ; 0158
00315
015A 0B2E 00316 fdb L_0B2E ; $2D - Odd?
015C 0B43 00317 fdb L_0B43 ; $2E - Write integer
00318
015E 0B FC 00319 fcb $0B,$FC ; 0158
00320
0160 0CE7 00321 fdb L_0CE7 ; $30 - Push set
0162 0CEC 00322 fdb L_0CEC ; $31 - Pop set
0164 0D00 00323 fdb L_0D00 ; $32 - Manipulate set
0166 0D34 00324 fdb L_0D34 ; $33 - Combine sets
00325
0168 0D 53 00326 fcb $0D,$53 ; 0168
00327
016A 0D7D 00328 fdb L_0D7D ; $35 - Compare sets
00329
016C 0D 9E 0D C6 00330 fcb $0D,$9E,$0D,$C6 ; 0168
0170 0D D4 0D E4 00331 fcb $0D,$D4,$0D,$E4,$0D,$F4,$0E,$04 ; 0170
0174 0D F4 0E 04
0178 0E 14 0E 19 00332 fcb $0E,$14,$0E,$19,$0E,$1E,$0E,$E8 ; 0178
017C 0E 1E 0E E8