'This example requires VGA.
DIM addr AS LONG
DIM oset AS INTEGER
DIM shft AS INTEGER
DIM addrs(256)
DIM shfts(4)
shfts(0) = 1
shfts(1) = 4
shfts(2) = 8
shfts(3) = 64
SCREEN 12
COLOR 2
WIDTH 80, 60
FOR j% = 0 TO 255
oset = j% MOD 4 'bottom 2 bits is the offset
REM addr = j% ' if we don't play games we address 256 chunks (64k)
shft = 2 ^ (oset * 2) 'offset shifted left 1 is the shift
addr = j% * shft + oset + 1 'shift left bottom 2 bits * 2 times,
' add bottom 2 bits in again and increment
REM shft = 2 ^ oset 'offset is the shift
REM addr = (j% - oset) * shft + oset 'mast off bottom 2 bits,
'shift left bottom 2 bits times and add in the bottom 2 bits.
addrs(j%) = addr
IF z% < addr THEN
z% = addr
END IF
x% = (addr MOD 256) * 2
y% = INT(addr / 256) * 2
IF POINT(x%, y%) = 0 THEN
COLOR 1
PSET (x%, y%)
END IF
COLOR (POINT(x%, y%) + 1)
LINE (x%, y%)-STEP(1, 1), , BF
LOCATE (INT(j% / 16) + 7), ((j% MOD 16) * 5) + 1
PRINT RIGHT$("0000" + HEX$(addr), 4)
NEXT j%
FOR j% = 0 TO 255
FOR k% = 0 TO 255
IF addrs(j%) < addrs(k%) THEN
SWAP addrs(j%), addrs(k%)
END IF
NEXT k%
NEXT j%
FOR j% = 0 TO 255
LOCATE (INT(j% / 8) + 24), ((j% MOD 8) * 9) + 1
PRINT RIGHT$("0000" + HEX$(addrs(j%)), 4); addrs(j% + 1) - addrs(j%)
NEXT j%
LOCATE 58
PRINT "MAX:", z%
file: /Techref/language/meta-l/chnkaddr.bas, 1KB, , updated: 1999/5/25 10:36, local time: 2024/12/24 10:34,
|
| ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/language/meta-l/chnkaddr.bas"> language meta-l chnkaddr</A> |
Did you find what you needed?
|