Advertisement
Guest User

Untitled

a guest
Jun 24th, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Program Name: Memory Checker
  2. ; Author: David Gomes
  3. ; Version: 1.0
  4. ; Written for Doors CS 7.0 and higher
  5. .nolist
  6. #include "ti83plus.inc"
  7. #include "dcs7.inc"
  8. .list
  9.     .org progstart
  10.     .db $BB,$6D
  11. Init:
  12.   B_CALL (_ClrLCDFull)
  13.  
  14.   set textWrite,(IY + sGrFlags)
  15.   set fracDrawLFont,(IY + fontFlags)
  16.  
  17.   ld a,1
  18.   ld (penCol), a
  19.   ld (penRow), a
  20.   ld hl,Title
  21.   B_CALL (_VPutS)
  22.  
  23.   ld a,17
  24.   ld (penRow),a
  25.   ld a,1
  26.   ld (penCol),a
  27.   ld hl,RAMText
  28.   B_CALL (_VPutS)
  29.  
  30.   ld a,41
  31.   ld (penRow),a
  32.   ld a,1
  33.   ld (penCol),a
  34.   ld hl,ARCText
  35.   B_CALL (_VPutS)
  36.  
  37.   ld h,0
  38.   ld l,9
  39.   ld d,95
  40.   ld e,9
  41.   ld a,1
  42.   call fastline
  43.  
  44.   res fracDrawLFont,(IY + fontFlags)
  45.  
  46.   ld a,10
  47.   ld (penRow),a
  48.   ld a,20
  49.   ld (penCol),a
  50.   B_CALL (_memchk)
  51.   call VDispHL
  52.  
  53.   ld a,17
  54.   ld (penRow),a
  55.   ld a,20
  56.   ld (penCol),a
  57.   ld hl,OutOf
  58.   B_CALL (_VPutS)
  59.  
  60.   ld a,24
  61.   ld (penRow),a
  62.   ld a,20
  63.   ld (penCol),a
  64.   ld hl,24756
  65.   call VDispHL
  66.  
  67.   call GetFreeArc
  68.   ld a,35
  69.   ld (penRow),a
  70.   ld a,20
  71.   ld (penCol),a
  72.   B_CALL (_VPutS)
  73.  
  74.   ld a,41
  75.   ld (penRow),a
  76.   ld a,20
  77.   ld (penCol),a
  78.   ld hl,OutOf
  79.   B_CALL (_VPutS)
  80.  
  81.   call GetTotalArc
  82.   ld a,47
  83.   ld (penRow),a
  84.   ld a,20
  85.   ld (penCol),a
  86.   B_CALL (_VPutS)
  87.  
  88.   call iFastCopy
  89.   B_CALL (_GetKey)
  90.  
  91.   res textWrite,(IY + sGrFlags)
  92.  
  93.   ret
  94.  
  95. RAMText:
  96.   .db "RAM",0
  97.  
  98. ARCText:
  99.   .db "ARC",0
  100.  
  101. Title:
  102.   .db "Memory Checker",0
  103.  
  104. OutOf:
  105.   .db "out of",0
  106.  
  107. ;The following code was made by Runer112
  108. GetTotalArc:
  109. ;——————————————————————————————————————————————;
  110. ;—> Returns the total amount of user archive as a 7-character decimal string
  111. ;INPUTS:    none
  112. ;OUTPUTS:   hl=pointer to string (OP3)
  113. ;DESTROYS:  af  bc  de  ix
  114. ;——————————————————————————————————————————————;
  115.   B_CALL($80BA)
  116.   add   a,a
  117.   add   a,a
  118.   ld    d,0
  119.   ld    e,a
  120.   ld    hl,GetTotalArc_HWValues
  121.   add   hl,de
  122.   jr    ConvArc
  123. GetTotalArc_HWValues:
  124.   .db   (10*$4000)>>24&$FF,(10*$4000)>>16&$FF,(10*$4000)>>8&$FF,(10*$4000)&$FF
  125.   .db   (94*$4000)>>24&$FF,(94*$4000)>>16&$FF,(94*$4000)>>8&$FF,(94*$4000)&$FF
  126.   .db   (30*$4000)>>24&$FF,(30*$4000)>>16&$FF,(30*$4000)>>8&$FF,(30*$4000)&$FF
  127.   .db   (94*$4000)>>24&$FF,(94*$4000)>>16&$FF,(94*$4000)>>8&$FF,(94*$4000)&$FF
  128.  
  129. GetFreeArc:
  130. ;——————————————————————————————————————————————;
  131. ;—> Returns the amount of free archive as a 7-character decimal string
  132. ;INPUTS:    none
  133. ;OUTPUTS:   hl=pointer to string (OP3)
  134. ;DESTROYS:  af  bc  de  ix
  135. ;——————————————————————————————————————————————;
  136.   B_CALL($5014)     ;ArcChk
  137.   ex    de,hl
  138.   inc   hl
  139.  
  140.  
  141. ConvArc:
  142. ;——————————————————————————————————————————————;
  143. ;—> Converts a 32-bit integer into a 7-character decimal string
  144. ;INPUTS:    hl=pointer to 32-bit integer (big-endian)
  145. ;OUTPUTS:   hl=pointer to string (OP3)
  146. ;DESTROYS:  af  bc  de  ix
  147. ;——————————————————————————————————————————————;
  148.   rst   20h
  149.   ld    hl,OP3+7
  150.   ld    de,10
  151.   ld    (hl),d
  152.   ld    b,7
  153. ConvArc_Loop1:
  154.   push  bc
  155.   push  hl
  156.   B_CALL($80B1)     ;Div32By16
  157.   pop   hl
  158.   pop   bc
  159.   ld    a,(OP2+3)
  160.   add   a,'0'
  161.   dec   hl
  162.   ld    (hl),a
  163.   djnz  ConvArc_Loop1
  164.   ld    d,h
  165.   ld    e,l
  166.   ld    bc,6<<8+'0'
  167. ConvArc_Loop2:
  168.   ld    a,(de)
  169.   cp    c
  170.   ret   nz
  171.   ld    a,' '
  172.   ld    (de),a
  173.   inc   de
  174.   djnz  ConvArc_Loop2
  175.   ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement