1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-03-12 16:42:08 +00:00

Add puti to cmdsys and clean up sanity comments

This commit is contained in:
David Schmenk
2017-11-16 10:46:06 -08:00
parent 6ea55e3038
commit f3a6bfbb59
18 changed files with 58 additions and 190 deletions

View File

@@ -37,38 +37,6 @@ def putb(b)
return putc(c)
end
def puti(i)
word tt, th, h, t
byte p
p =0
if i < 0
putc('-')
i = -i
fin
tt = i / 10000
i = i % 10000
th = i / 1000
i = i % 1000
h = i / 100
i = i % 100
t = i / 10
i = i % 10
if tt > 0
putc(tt + '0'); p = 1
fin
if p or th > 0
putc(th + '0'); p = 1
fin
if p or h > 0
putc(h + '0'); p = 1
fin
if p or t > 0
putc(t + '0'); p = 1
fin
return putc(i + '0')
end
def charUpper(c)
if c >= 'a' and c <= 'z'
return c - LOWER_DIFF
@@ -78,7 +46,7 @@ end
def getYN(prompt)
byte yn
puts(prompt)
yn = getc
putln
@@ -87,7 +55,7 @@ end
def trkSecToBlk(bufSec, bufBlk)
byte sector
for sector = 0 to 15
memcpy(bufBlk + (sector << 8), bufSec + (secOrder[sector] << 8), 256)
next
@@ -95,7 +63,7 @@ end
def bigFatWrite(buf, len)
word xferLen, fatLen
xferLen = 0
repeat
if len > MAX_FAT_BUF_SIZE
@@ -118,7 +86,7 @@ end
def fatReadImage(src, drv, order)
word inBuf, outBuf, copyLen, freeAddr
word blocknum, bufblk
inBuf = heapallocalign(COPY_BUF_SIZE * 2, 8, @freeAddr)
if not inBuf
puts("Not enough free memory!\n"); putln
@@ -170,7 +138,7 @@ arg = argNext(argFirst)
if ^arg
image = arg
arg = argNext(arg)
if ^arg
if ^arg
when ^(arg + 1)
is '2' // Drive 2 option
unit = DRIVE2

View File

@@ -38,38 +38,6 @@ def putb(b)
return putc(c)
end
def puti(i)
word tt, th, h, t
byte p
p =0
if i < 0
putc('-')
i = -i
fin
tt = i / 10000
i = i % 10000
th = i / 1000
i = i % 1000
h = i / 100
i = i % 100
t = i / 10
i = i % 10
if tt > 0
putc(tt + '0'); p = 1
fin
if p or th > 0
putc(th + '0'); p = 1
fin
if p or h > 0
putc(h + '0'); p = 1
fin
if p or t > 0
putc(t + '0'); p = 1
fin
return putc(i + '0')
end
def charUpper(c)
if c >= 'a' and c <= 'z'
return c - LOWER_DIFF
@@ -79,7 +47,7 @@ end
def getYN(prompt)
byte yn
puts(prompt)
yn = getc
putln
@@ -88,7 +56,7 @@ end
def trkSecToBlk(bufSec, bufBlk)
byte sector
for sector = 0 to 15
memcpy(bufBlk + (sector << 8), bufSec + (secOrder[sector] << 8), 256)
next
@@ -96,7 +64,7 @@ end
def bigFatRead(buf, len)
word xferLen, fatLen
xferLen = 0
repeat
if len > MAX_FAT_BUF_SIZE
@@ -119,7 +87,7 @@ end
def fatWriteImage(src, drv, order)
word inBuf, outBuf, copyLen, freeAddr
word blocknum, bufblk
outBuf = heapallocalign(COPY_BUF_SIZE * 2, 8, @freeAddr)
if not outBuf
puts("Not enough free memory!\n"); putln
@@ -172,7 +140,7 @@ arg = argNext(argFirst)
if ^arg
image = arg
arg = argNext(arg)
if ^arg
if ^arg
when ^(arg + 1)
is '2' // Drive 2 option
unit = DRIVE2
@@ -206,4 +174,4 @@ else
puts("Write DSK image to floppy disk drive\n")
puts("Usage: +FATWRITEDSK <DSK image file> [1,2,T]\n")
fin
done
done

View File

@@ -129,24 +129,12 @@ end
//
// DEBUG
//
def putln
return putc($0D)
end
def putb(hexb)
return call($FDDA, hexb, 0, 0, 0)
end
def puth(hex)
return call($F941, hex >> 8, hex, 0, 0)
end
def puti(i)
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
def putip(ipptr)
byte i

View File

@@ -7,24 +7,12 @@ end
word a, b, c, d, e, memptr
word memfre, memlrgst
def putln
return putc($0D)
end
def putb(hexb)
return call($FDDA, hexb, 0, 0, 0)
end
def puth(hex)
return call($F941, hex >> 8, hex, 0, 0)
end
def puti(i)
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
sbrk($3000) // Set small pool size

View File

@@ -215,16 +215,6 @@ def a2gotoxy(x, y)
return call($FB5B, y + ^$22, 0, 0, 0)
end
export def puti(i)
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
export def toupper(c)
if c >= 'a' and c <= 'z'
c = c - $20

View File

@@ -9,16 +9,6 @@ include "inc/sane.plh"
word iA, iB, iC
byte xT[t_extended]
def puti(i)
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
iA = 3
iB = 4
iC = -1
@@ -32,19 +22,19 @@ sane:zpRestore()
puti(iA); putc('+'); puti(iB); putc('='); puti(iC); putc('\n')
sane:zpSave()
sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T
sane:fpOp2(FFINT|FOSUB, @xT, @iB) // Add int B to ext T
sane:fpOp2(FFINT|FOSUB, @xT, @iB) // Sub int B from ext T
sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C
sane:zpRestore()
puti(iA); putc('-'); puti(iB); putc('='); puti(iC); putc('\n')
sane:zpSave()
sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T
sane:fpOp2(FFINT|FOMUL, @xT, @iB) // Add int B to ext T
sane:fpOp2(FFINT|FOMUL, @xT, @iB) // Mul int B by ext T
sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C
sane:zpRestore()
puti(iA); putc('*'); puti(iB); putc('='); puti(iC); putc('\n')
sane:zpSave()
sane:fpOp2(FFINT|FOZ2X, @xT, @iA) // Convert int A to ext T
sane:fpOp2(FFINT|FODIV, @xT, @iB) // Add int B to ext T
sane:fpOp2(FFINT|FODIV, @xT, @iB) // Div int B into ext T
sane:fpOp2(FFINT|FOX2Z, @iC, @xT) // Convert ext T to int C
sane:zpRestore()
puti(iA); putc('/'); puti(iB); putc('='); puti(iC); putc('\n')

View File

@@ -14,16 +14,6 @@ def beep
return putc(7)
end
def puti(i)
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
beep
//for iter = 1 to 10
memset(@flag, TRUE, sizepl)

View File

@@ -93,7 +93,7 @@ export def main(range)#0
puts("10 * 8 = "); puti(a * 8); putln
puts("10 / 2 = "); puti(a / 2); putln
puts(@hello)
when MACHID & $C8
when ^MACHID & $C8
is $08
puts(@a1)
break

View File

@@ -5,7 +5,7 @@ include "inc/cmdsys.plh"
//
// Module data.
//
predef puti(i)#0, puth(h)#0
predef puth(h)#0
export word print[] = @puti, @puth, @putln, @puts, @putc
byte valstr[] = '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
byte loadstr[] = "testlib loaded!"
@@ -19,15 +19,6 @@ def puth(h)#0
putc(valstr[(h >> 4) & $0F])
putc(valstr[ h & $0F])
end
export def puti(i)#0
if i < 0; putc('-'); i = -i; fin
if i < 10
putc(i + '0')
else
puti(i / 10)
putc(i % 10 + '0')
fin
end
puts(@loadstr)
putln
done