home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_24_1988_Transactor_Publishing.d64 / fred.doc < prev    next >
Text File  |  2023-02-26  |  7KB  |  260 lines

  1. C$parmsize   = $00fb
  2. c$local      = $002b
  3. c$parms      = $033c
  4. acptr        = $ffa5
  5. chkin        = $ffc6
  6. chkout       = $ffc9
  7. chrin        = $ffcf
  8. chrout       = $ffd2
  9. ciout        = $ffa8
  10. cint         = $ff81
  11. clall        = $ffe7
  12. close        = $ffc3
  13. clrchn       = $ffcc
  14. getin        = $ffe4
  15. iobase       = $fff3
  16. ioinit       = $ff84
  17. listen       = $ffb1
  18. load         = $ffd5
  19. membot       = $ff9c
  20. memtop       = $ff99
  21. open         = $ffc0
  22. plot         = $fff0
  23. ramtas       = $ff87
  24. rdtim        = $ffde
  25. readst       = $ffb7
  26. restor       = $ff8a
  27. save         = $ffd8
  28. scnkey       = $ff9f
  29. screen       = $ffed
  30. second       = $ff93
  31. setlfs       = $ffba
  32. setmsg       = $ff90
  33. setnam       = $ffbd
  34. settim       = $ffdb
  35. settmo       = $ffa2
  36. stop         = $ffe1
  37. talk         = $ffb4
  38. tksa         = $ff96
  39. udtim        = $ffea
  40. unlsn        = $ffae
  41. untlk        = $ffab
  42. vector       = $ff8d
  43.  .ref c$start
  44.  .ref c$105
  45.  .ref c$1102
  46.  .ref ..s$aa
  47.  .ref ..s$ab
  48.  .ref c$1139
  49.  .ref ..s$ac
  50.  .ref ..s$ad
  51.  .ref ..s$ae
  52.  .ref ..s$af
  53.  .ref ..s$ag
  54.  .ref ..s$ah
  55.  .ref ..s$ai
  56.  .ref ..s$aj
  57.  .ref ..s$ak
  58.  .ref ..s$al
  59.  .ref c$106
  60.  .ref c$0112
  61.  
  62. c$$start
  63.  jmp c$start
  64.  
  65. main
  66.  sta c$parmsize
  67.  lda #$04      ; 4 bytes of register locals
  68.  ldx #$00
  69.  ldy #$00
  70.  jsr c$105     ; save local storage
  71.  ldx #$1f      ; a1 = 31
  72.  ldy #$00      ;
  73.  stx c$local   ;  ...
  74.  ldx #$0a      ; a2 = 10
  75.  ldy #$00      ;
  76.  stx c$local+1 ;  ... 
  77.  ldx #$18      ; a3 = 24
  78.  ldy #$00      ;
  79.  stx c$local+2 ;  ...
  80.  ldx #$32      ; a4 = 50
  81.  ldy #$00      ;
  82.  stx c$local+3 ;  ...
  83.  lda #$00      ; push stack offset of zero for fred(1)
  84.  jsr c$1102    ;  ...
  85.  lda #$00      ; push stack offset of zero for fred(2)
  86.  jsr c$1102    ;  ...
  87.  ldx c$local   ; a1 is
  88.  ldy #$00      ;
  89.  stx c$parms   ; 1st arg for fred(2) 
  90.  sty c$parms+1 ;
  91.  ldx #<..s$aa  ; "jugo" is
  92.  ldy #>..s$aa  ;
  93.  stx c$parms+2 ; 2nd arg for fred(2)
  94.  sty c$parms+3 ;
  95.  ldx #<..s$ab  ; 75.5 is copied
  96.  ldy #>..s$ab  ;
  97.  lda #$04      ; to arg offset 4
  98.  jsr c$1139    ; as 3rd arg (double) for fred(2)
  99.  ldx #$b3      ; 179 is
  100.  ldy #$00      ;
  101.  stx c$parms+9 ; 4th arg for fred(2)
  102.  sty c$parms+10 ;
  103.  lda #$0b       ; use args from stacked offset(0) to 11 for fred(2)
  104.  jsr fred       ; call fred(2); return is 1st arg in place for fred(1)
  105.  ldx #<..s$ac   ; "garth" is
  106.  ldy #>..s$ac   ;
  107.  stx c$parms+2  ; 2nd arg for fred(1)
  108.  sty c$parms+3  ;
  109.  ldx #<..s$ad   ; 60.3 3rd arg for fred(1)
  110.  ldy #>..s$ad   ;
  111.  lda #$04       ;  still at offset 4
  112.  jsr c$1139     ;
  113.  lda #$09       ; NOW stack arg offset 9
  114.  jsr c$1102     ;  for fred(3)
  115.  lda #$09       ; and
  116.  jsr c$1102     ;  fred(4)
  117.  ldx c$local+1  ; a2 is
  118.  ldy #$00       ;
  119.  stx c$parms+9  ;  1st arg for fred(4)
  120.  sty c$parms+10 ;
  121.  ldx #<..s$ae   ; "tylum" is
  122.  ldy #>..s$ae   ;
  123.  stx c$parms+11 ;   2nd arg for fred(4)
  124.  sty c$parms+12 ;
  125.  ldx #<..s$af   ; 90.6 3rd arg for fred(4)
  126.  ldy #>..s$af   ;
  127.  lda #$0d       ;  at arg offset 4+9=13 ($b)
  128.  jsr c$1139     ;  copy to arg at offset $b
  129.  ldx #$d2       ; 210 is
  130.  ldy #$00       ;
  131.  stx c$parms+18 ;  4th arg for fred(4)
  132.  sty c$parms+19 ;
  133.  lda #$14       ;  fred(4)'s args go up to 20 ($14) = 9+11
  134.  jsr fred       ; call fred(4); return value is in place for fred(3)
  135.  ldx #<..s$ag   ; "glorp" is
  136.  ldy #>..s$ag   ;
  137.  stx c$parms+11 ;  2nd arg for fred(3)
  138.  sty c$parms+12 ;
  139.  ldx #<..s$ah   ; 30.4 3rd arg for fred(3)
  140.  ldy #>..s$ah   ;
  141.  lda #$0d       ;  at arg offset 4+9=13 ($b) 
  142.  jsr c$1139     ;   copy double
  143.  lda #$12       ; push arg offset 9+9=18 ($12)
  144.  jsr c$1102     ;  for fred(5)
  145.  ldx c$local+2  ; a3 is
  146.  ldy #$00       ;
  147.  stx c$parms+18 ;  1st arg for fred(5)
  148.  sty c$parms+19 ;
  149.  ldx #<..s$ai   ; "ploom" is 
  150.  ldy #>..s$ai   ;
  151.  stx c$parms+20 ;  2nd arg for fred(5)
  152.  sty c$parms+21 ;
  153.  ldx #<..s$aj   ; 80.2 3rd arg for fred(5)
  154.  ldy #>..s$aj   ;
  155.  lda #$16       ;  at arg offset 4+9+9=22 ($16)
  156.  jsr c$1139     ;   copy double
  157.  lda #$1b       ; push arg offset 9+9+9=27 ($1b)
  158.  jsr c$1102     ;  for fred(6)
  159.  ldx c$local+3  ; a4 is
  160.  ldy #$00       ;
  161.  stx c$parms+27 ;  1st arg for fred(6)
  162.  sty c$parms+28 ;
  163.  ldx #<..s$ak   ; "glim" is
  164.  ldy #>..s$ak   ;
  165.  stx c$parms+29 ;  2nd arg for fred(6)
  166.  sty c$parms+30 ;
  167.  ldx #<..s$al   ; 50.3 3rd arg for fred(6)
  168.  ldy #>..s$al   ;
  169.  lda #$1f       ;  at arg offset 4+9+9+9=31 ($1f)
  170.  jsr c$1139     ;   copy double
  171.  ldx #$7f       ; 127
  172.  ldy #$00       ;
  173.  stx c$parms+36 ;  is 4th arg for fred(6)
  174.  sty c$parms+37 ;
  175.  lda #$26       ; fred(6) args go up to 27+11=38 ($26)
  176.  jsr fred       ;  call fred(6)
  177.  lda #$1d       ; fred(5) args go up to 18+11=29 ($1d)
  178.  jsr fred       ;  call fred(5)
  179.  lda #$14       ; fred(3) args go up to 9+11=20 ($14)
  180.  jsr fred       ;  call fred(3)
  181.  lda #$0b       ; fred(1) args go up to 0+11 ($b)
  182.  jsr fred       ;  call fred(1) (finally!)
  183.  lda #$04       ; restore our used local "registers"
  184.  ldx #$00       ;
  185.  ldy #$00       ;
  186.  jmp c$106      ;  by jumping to c$106 (to return)
  187.  
  188.  
  189. fred
  190.  sta c$parmsize
  191.  lda #$02       ; two bytes, not one
  192.  ldx #$00
  193.  ldy #$00
  194.  jsr c$105      ; are saved for "age"
  195.  ldy #$00       ; this sort of code inline at the beginning of
  196.  lda ($16),Y    ;  each routine
  197.  tax            ;
  198.  iny            ; copies parameters from to
  199.  lda ($16),Y    ;  "registers"
  200.  tay            ;
  201.  stx c$local    
  202.  sty c$local+1  
  203.  ldx c$local    ; get age (counted as two bytes,
  204.  ldy c$local+1  ;  even though declared char)
  205.  stx c$parms    ;  and put back well it was
  206.  sty c$parms+1  ;
  207.  lda #$02       ;  oh well, useless routines are
  208.  ldx #$02       ;   guaranteed to generate useless code
  209.  jsr c$0112
  210.  jmp fred+44    ;  ???
  211.  lda #$02       ;  restore 2 bytes  of "registers"
  212.  ldx #$00
  213.  ldy #$00       
  214.  jmp c$106      ; and return via c$106
  215.  
  216.  
  217. ..s$aa
  218.  .byte   $4a , $55 , $47 , $4f , $00 
  219. ..s$ab
  220.  
  221. ;!!!Invalid opcode - switching to byte mode.
  222.  .byte   $87 , $17 , $00 , $00 , $00 
  223. ..s$ac
  224.  
  225. ;!!!Invalid opcode - switching to byte mode.
  226.  .byte   $47 , $41 , $52 , $54 , $48 , $00 
  227. ..s$ad
  228.  
  229.  .byte   $86 , $71 , $33 , $33 , $33 
  230. ..s$ae
  231.  
  232. ;!!!Invalid opcode - switching to byte mode.
  233.  .byte   $54 , $59 , $4c , $55 , $4d , $00 
  234. ..s$af
  235.  
  236. ;!!!Invalid opcode - switching to byte mode.
  237.  .byte   $87 , $35 , $33 , $33 , $33 
  238. ..s$ag
  239.  
  240. ;!!!Invalid opcode - switching to byte mode.
  241.  .byte   $47 , $4c , $4f , $52 , $50 , $00 
  242. ..s$ah
  243.  
  244.  .byte   $85 , $73 , $33 , $33 , $33 
  245. ..s$ai
  246.  
  247.  .byte   $50 , $4c , $4f , $4f , $4d , $00 
  248. ..s$aj
  249.  
  250. ;!!!Invalid opcode - switching to byte mode.
  251.  .byte   $87 , $20 , $66 , $66 , $66 
  252. ..s$ak
  253.  
  254. ;!!!Invalid opcode - switching to byte mode.
  255.  .byte   $47 , $4c , $49 , $4d , $00 
  256. ..s$al
  257.  
  258.  .byte   $86 , $49 , $33 , $33 , $33 
  259.  
  260.