home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_24_1988_Transactor_Publishing.d64
/
fred.doc
< prev
next >
Wrap
Text File
|
2023-02-26
|
7KB
|
260 lines
C$parmsize = $00fb
c$local = $002b
c$parms = $033c
acptr = $ffa5
chkin = $ffc6
chkout = $ffc9
chrin = $ffcf
chrout = $ffd2
ciout = $ffa8
cint = $ff81
clall = $ffe7
close = $ffc3
clrchn = $ffcc
getin = $ffe4
iobase = $fff3
ioinit = $ff84
listen = $ffb1
load = $ffd5
membot = $ff9c
memtop = $ff99
open = $ffc0
plot = $fff0
ramtas = $ff87
rdtim = $ffde
readst = $ffb7
restor = $ff8a
save = $ffd8
scnkey = $ff9f
screen = $ffed
second = $ff93
setlfs = $ffba
setmsg = $ff90
setnam = $ffbd
settim = $ffdb
settmo = $ffa2
stop = $ffe1
talk = $ffb4
tksa = $ff96
udtim = $ffea
unlsn = $ffae
untlk = $ffab
vector = $ff8d
.ref c$start
.ref c$105
.ref c$1102
.ref ..s$aa
.ref ..s$ab
.ref c$1139
.ref ..s$ac
.ref ..s$ad
.ref ..s$ae
.ref ..s$af
.ref ..s$ag
.ref ..s$ah
.ref ..s$ai
.ref ..s$aj
.ref ..s$ak
.ref ..s$al
.ref c$106
.ref c$0112
c$$start
jmp c$start
main
sta c$parmsize
lda #$04 ; 4 bytes of register locals
ldx #$00
ldy #$00
jsr c$105 ; save local storage
ldx #$1f ; a1 = 31
ldy #$00 ;
stx c$local ; ...
ldx #$0a ; a2 = 10
ldy #$00 ;
stx c$local+1 ; ...
ldx #$18 ; a3 = 24
ldy #$00 ;
stx c$local+2 ; ...
ldx #$32 ; a4 = 50
ldy #$00 ;
stx c$local+3 ; ...
lda #$00 ; push stack offset of zero for fred(1)
jsr c$1102 ; ...
lda #$00 ; push stack offset of zero for fred(2)
jsr c$1102 ; ...
ldx c$local ; a1 is
ldy #$00 ;
stx c$parms ; 1st arg for fred(2)
sty c$parms+1 ;
ldx #<..s$aa ; "jugo" is
ldy #>..s$aa ;
stx c$parms+2 ; 2nd arg for fred(2)
sty c$parms+3 ;
ldx #<..s$ab ; 75.5 is copied
ldy #>..s$ab ;
lda #$04 ; to arg offset 4
jsr c$1139 ; as 3rd arg (double) for fred(2)
ldx #$b3 ; 179 is
ldy #$00 ;
stx c$parms+9 ; 4th arg for fred(2)
sty c$parms+10 ;
lda #$0b ; use args from stacked offset(0) to 11 for fred(2)
jsr fred ; call fred(2); return is 1st arg in place for fred(1)
ldx #<..s$ac ; "garth" is
ldy #>..s$ac ;
stx c$parms+2 ; 2nd arg for fred(1)
sty c$parms+3 ;
ldx #<..s$ad ; 60.3 3rd arg for fred(1)
ldy #>..s$ad ;
lda #$04 ; still at offset 4
jsr c$1139 ;
lda #$09 ; NOW stack arg offset 9
jsr c$1102 ; for fred(3)
lda #$09 ; and
jsr c$1102 ; fred(4)
ldx c$local+1 ; a2 is
ldy #$00 ;
stx c$parms+9 ; 1st arg for fred(4)
sty c$parms+10 ;
ldx #<..s$ae ; "tylum" is
ldy #>..s$ae ;
stx c$parms+11 ; 2nd arg for fred(4)
sty c$parms+12 ;
ldx #<..s$af ; 90.6 3rd arg for fred(4)
ldy #>..s$af ;
lda #$0d ; at arg offset 4+9=13 ($b)
jsr c$1139 ; copy to arg at offset $b
ldx #$d2 ; 210 is
ldy #$00 ;
stx c$parms+18 ; 4th arg for fred(4)
sty c$parms+19 ;
lda #$14 ; fred(4)'s args go up to 20 ($14) = 9+11
jsr fred ; call fred(4); return value is in place for fred(3)
ldx #<..s$ag ; "glorp" is
ldy #>..s$ag ;
stx c$parms+11 ; 2nd arg for fred(3)
sty c$parms+12 ;
ldx #<..s$ah ; 30.4 3rd arg for fred(3)
ldy #>..s$ah ;
lda #$0d ; at arg offset 4+9=13 ($b)
jsr c$1139 ; copy double
lda #$12 ; push arg offset 9+9=18 ($12)
jsr c$1102 ; for fred(5)
ldx c$local+2 ; a3 is
ldy #$00 ;
stx c$parms+18 ; 1st arg for fred(5)
sty c$parms+19 ;
ldx #<..s$ai ; "ploom" is
ldy #>..s$ai ;
stx c$parms+20 ; 2nd arg for fred(5)
sty c$parms+21 ;
ldx #<..s$aj ; 80.2 3rd arg for fred(5)
ldy #>..s$aj ;
lda #$16 ; at arg offset 4+9+9=22 ($16)
jsr c$1139 ; copy double
lda #$1b ; push arg offset 9+9+9=27 ($1b)
jsr c$1102 ; for fred(6)
ldx c$local+3 ; a4 is
ldy #$00 ;
stx c$parms+27 ; 1st arg for fred(6)
sty c$parms+28 ;
ldx #<..s$ak ; "glim" is
ldy #>..s$ak ;
stx c$parms+29 ; 2nd arg for fred(6)
sty c$parms+30 ;
ldx #<..s$al ; 50.3 3rd arg for fred(6)
ldy #>..s$al ;
lda #$1f ; at arg offset 4+9+9+9=31 ($1f)
jsr c$1139 ; copy double
ldx #$7f ; 127
ldy #$00 ;
stx c$parms+36 ; is 4th arg for fred(6)
sty c$parms+37 ;
lda #$26 ; fred(6) args go up to 27+11=38 ($26)
jsr fred ; call fred(6)
lda #$1d ; fred(5) args go up to 18+11=29 ($1d)
jsr fred ; call fred(5)
lda #$14 ; fred(3) args go up to 9+11=20 ($14)
jsr fred ; call fred(3)
lda #$0b ; fred(1) args go up to 0+11 ($b)
jsr fred ; call fred(1) (finally!)
lda #$04 ; restore our used local "registers"
ldx #$00 ;
ldy #$00 ;
jmp c$106 ; by jumping to c$106 (to return)
fred
sta c$parmsize
lda #$02 ; two bytes, not one
ldx #$00
ldy #$00
jsr c$105 ; are saved for "age"
ldy #$00 ; this sort of code inline at the beginning of
lda ($16),Y ; each routine
tax ;
iny ; copies parameters from to
lda ($16),Y ; "registers"
tay ;
stx c$local
sty c$local+1
ldx c$local ; get age (counted as two bytes,
ldy c$local+1 ; even though declared char)
stx c$parms ; and put back well it was
sty c$parms+1 ;
lda #$02 ; oh well, useless routines are
ldx #$02 ; guaranteed to generate useless code
jsr c$0112
jmp fred+44 ; ???
lda #$02 ; restore 2 bytes of "registers"
ldx #$00
ldy #$00
jmp c$106 ; and return via c$106
..s$aa
.byte $4a , $55 , $47 , $4f , $00
..s$ab
;!!!Invalid opcode - switching to byte mode.
.byte $87 , $17 , $00 , $00 , $00
..s$ac
;!!!Invalid opcode - switching to byte mode.
.byte $47 , $41 , $52 , $54 , $48 , $00
..s$ad
.byte $86 , $71 , $33 , $33 , $33
..s$ae
;!!!Invalid opcode - switching to byte mode.
.byte $54 , $59 , $4c , $55 , $4d , $00
..s$af
;!!!Invalid opcode - switching to byte mode.
.byte $87 , $35 , $33 , $33 , $33
..s$ag
;!!!Invalid opcode - switching to byte mode.
.byte $47 , $4c , $4f , $52 , $50 , $00
..s$ah
.byte $85 , $73 , $33 , $33 , $33
..s$ai
.byte $50 , $4c , $4f , $4f , $4d , $00
..s$aj
;!!!Invalid opcode - switching to byte mode.
.byte $87 , $20 , $66 , $66 , $66
..s$ak
;!!!Invalid opcode - switching to byte mode.
.byte $47 , $4c , $49 , $4d , $00
..s$al
.byte $86 , $49 , $33 , $33 , $33