Oldskool variety



Hi,
I have been quiet for a while, maybe you can read here why:
fjrp2.alturl.com/party2005.htm

hope you all doing ok,
sloppy

<<As promises must be kept, I will not be able to attend the "2005
Party", but some friend will take care of it. Ask faf to know who to
contact.

Anyway, I will save you the trouble of having to come here for such a
simple and unimportant technique. To follow the next tiny
microexplanation, you need: 1)a cybercafé; 2)fingers. Is the
cyber-café really sine-qua non? Of course it is, that way you don't
even need to own a computer. From such a place, sadly, you can only
mostly expect a windoze operating system.

So you go there (don't even look to the girls, remember that you have
come to put in practize this snippet), ask for a vanilla milk-shake
(or whatever you feel like), and launch a console box
(start/execute/command or go into system/system32 and look it up
yourself, it may be called "cmd" or "cmd32" whatever), and there you
are, like in the good old days: plain vanilla DOS-box.

Now, you will get the prompt, something like '~' or "$" or C:\> or
whatever, and maybe if you want to get the "feeling" you might input
VER, not really to VERify, but to have a look at the VERsion number.
As usual with all kind of systems you enter and donno what to do, type
HELP, and read that nifty list that appears.

>DEBUG, that's the name of the game. You type that, and get into the
built-in debugger. We people of old, have "inherited" crazes from the
times we learned to play with computers. Mine is ddt (dynamic
debugging tool), in its more modern version debug. One can do every
single thing you can think of with debug. Load, merge, chain, save,
grep, search, move, scan, encrypt, decode, steganograph, transform,
anything with chunks of code, sections, segments, memory, data,
whatever, examine, edit, even search the disks cluster by cluster (I'm
not sure though if the new 'colours' of discs will allow this though),
I use it as a hexadecimal calculater (symdeb was even better regarding
that), and most important: you can quickly hack anything you want.

We'll do that now, as my intention is just to show you the quick hack
to interface with the internet. I don't want to go very long, but the
reason why I prefer hardware level, is because that way you don't
depend on operating system, nor nothing. The problem is that you have
to code for every different hardware a different thing. But I am going
to show you the "cyber-café" approach, which takes advantage of the
"reminder" (chuleta en español) that every machine provides for us:
the BIOS (that way we don't even need to bring books or notes or
cd-roms into the cyber)

It's int 14h (20 decimal) that takes care of communications via modem
(we used to call it in the old days via "interface RS-232", or serial
asynchronous interface), the actual hardware behind that interrupt
being the chip known as Universal Async Receiver/transmitter (the
8250, 8250A, 16450, and compatibles). Now, if you are like me, you
just entered there, and forgot to bring your code. Go into the
debugger, the prompt "-" appears, and write "a", for assemble:
int 14 <---type this after the direction in the form 1234:0100 that
the assembler gives you; now hit [enter], and type "t", to trace
through that, and then type repeatedly "u" to unassemble. That's it, a
reminder, the code, the way the BIOS does it is there.

On plus, I will give you a better short-cut. There are some addresses
that after used many times one gets to remember ("commits to memory"
like a teacher of electronics I once had used to say); one of them is
E739 into the last 64Kb block of memory from the old 1 Mb that was the
standard "map" of memory. That's the ROM, it's the BIOS in fact. Since
the times I started using this technique at washington state
university (learn the enemy they say, don't they ;) I didn't study
there, but used the computers in the gigantic library) until today, I
have never encountered a PC based in the x86 family of processors
(other architectures will be different) that uses another address for
the "kernel" async-serial routines. And it's been 15 years since then.
It must be pretty much a 'standard'.

With this info and your own findings, you have pretty much everything
you need to interface "a pelo", as we say here, i.e. by your own
means. To read more about the possibilities of int 14, Ralph Brown's
interrupt list is the de facto reference, you'll have to download, but
you only need the part called "interrupts" and also the one termed
"ports", to delve later deeper into the port 3f8, that's the buddy
that communicates with the chip (the Universal Async
Receiver/Transmitter, aka UART, 8250, 8250A, 8250B, variations and
evolutions).

Btw if any of you has old hardware (8080, Z-80, 8086, 80286, 6800, and
that kind) and wants to get rid of those beauties, you can ask faf my
address. Old computers are like old wines, they get tastier with time.
I'd also accept old PDP machines and "obsolete(sic)" mainframes, but I
think those are too big to send.

I will give you anyway an example of how it goes:

To initialize the 8250 (the first thing to do), and tell her how we're
going to interface from then on, the reminder inside the BIOS at int
14h or 0:50h passes the info (bauds, parity, stop-bits and charsize)
in 1 byte for a maximum of 9.6 Kbauds, or in two words for higher
speeds; later this info is split into the required port addresses
(quite and advantage for lazy folk, that's why we all love BIOS so
much).
I am going to show you how to do it via hardware, telling directly to
each port the required info like this (I'm using here 9.6 KBauds;
Parity Even; Two Stop Bits; Binary Format, i.e. 256 values/byte, using
the first serial port aka COM1):

xor ax,ax
mov al,1f ;binary(2 bits) + 2 stop bits (1 bit) + even (2 bits)
xor bx,bx ;I am using BX as a scratch-register
mov bl,al ;back-up
or al,80 ;DLAB on, Divisor Latch Access bit (bit 7 on)
mov dx,3fb ;LCR (Line Control Register)
out dx,al

mov ax,c00 ;this is 9.6 KBaud, for a maximum of 115200 bauds (see
Ralph Brown's for details)
mov dx,3f9 ;DLM
out dx,al
out ed,al ;Dummy port, for a delay after sending the DLM (Divisor
Latch Most significant byte)
dec dx ;DLL
mov al,ah
out dx,al ;DLL, less significant byte (sent in this order) like if it
were OUT DX,AX
;but it's required to be done this way in the 8250 because of the
delay,
;I'm not sure about other chips, this is the characteristic of
hardware programming,
;that it has to be checked for different chips

mov al,bl ;retrieves the value
mov dx,3fb ;LCR
out dx,al ;DLAB off, enable send and receive (bit 7 off)

mov al,0
mov dx,3f9 ;IER
out dx,al ;when DLAB=0 it's working as IER (Interrupt Enable Register)
;but we are not enabling any of the interrupts yet

mov dx,3fd
in al,dx ;Get LSB (Line Status Register)

mov dx,3fe
in al,dx ;Get MSB (Modem Status Register)

;These last two will tell ready to accept and CTS (Clear To Send), all
is clear now.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some values that you must know:
*) 0:50h is the entry in the interrupt vector table for int 14h, so
sometimes it's easier to just call there

*) 0:400h contains the directions of four possible serial ports you
can be using at the same time; here we use the first, accessed via
0x3f8

*) 0:47Ch contains the wait times (1 byte each) for the 4 ports
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


See an example of the "waste of bandwidth": if you were to initialize
the serial port using billy's API, you would do something like:
invoke InitializeSerialPort,WS_WHATEVER_BILLY_S_WIFE_WANTED_TO_CALL_THIS_WINDOW_STYLE,SW_WHATEVER_LARGEST_NAME_ONE_OF_HIS_RESEARCHERS_PUT_TOGETHER_TO_THE_SHOW_WINDOW,
EX_WHATEVER_EXTENSION_THEY_FELT_LIKE,ADDR ClassName,ADDR
AppName,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,WHATEVER_LONG_NAME_TO_CALL_THE_BAUDS,SAME_WITH_PARITY,AND_STOP_BIT,AND_FINALLY_CHARACTER_SIZE,
which, taking apart the "overhead" that bill's doze adds by itself,
and only looking into the 4 values that we have to send anyway, they
would be passed as doubleword integers each, the 32bit standard (which
makes for 16 bytes), and they would be pushed into the stack, and
another stack frame created (so that BP can easily access it), even
though they are most probably already somewhere else in the stack and
in the nested stack, and in the nested of the nested stack, and in the
pile, and in the heap, and in the buffer, and in the cache (all of
them caches everywhere), and in the swap files, and here and there,
and everywhere (which makes for about 1 Kb; if we add the overhead of
the operating system makes for about 1 Mb). Now compare: down to the
hardware we pass that same info to the serial port with 1 byte, yes,
you heard it right, 8 bits of code (and the "overhead", have you
calculated how much is the above snippet? 50 bytes maybe?)

If you go down into the hardware realms, you will see how important a
bit can be.

Witht hardware (or BIOS) approaches, you don't need to rely on
anybody's operating system, not even on Linus Torvald's & co, or
System 9 from outer space. You boot the machine via a floppy (or el
torito) and use the BIOS calls to interface (or call them directly to
their location in ROM)

Of course, then once you need applications, you don't have why to
build them on your own from scratch. That's the beauty of GNU. The
idea I have of computers is every individual having hacked her own
operating system (hey, you can hack one sort of stable in 30 minutes
with the debug approach, and the more you do it, the quicker and more
exhaustive you do it), and then the universal code, the "interpreted
speech" equal to everybody is the source code, in this case C, but it
could be any other language that translates algos into compact
notation.

I guess Richard Stallman had that same idea when he worked at MIT
(even though by todays standards I'm oldskool, I was a teenager in
WSU, and wasn't even born when rms worked in the Artificial
Intelligence Lab, with those mathematicians and scientist that now
resemble mythic figures), and that's the reason why I also wanted him
to come to the "Party".

I hope I have saved you the troubles of coming here to learn such an
"old" and "obsolete" technique.
Swim well,
fjrp2>>
.



Relevant Pages

  • Re: XP Keeps Restarting
    ... What was the last new hardware or peripheral added? ... You can change the boot sequence in the BIOS by having the CD Rom ... I am unable to boot in safe mode. ... I boot from the CD to my current operating system without doing a repair ...
    (microsoft.public.windowsxp.help_and_support)
  • [slightly OT - not Dell specific] Introduction to the BIOS
    ... The BIOS setup program - an acronym for Basic Input/Output System - is a vital part of a PC's system, ... For how much longer that is the case remains to be seen, because in Apple Macs the operating system OS X performs the function, and some of the leading players in the PC market, namely Microsoft and Intel are working together on a replacement for the BIOS called the Extensible Firmware Interface, which is a mini operating system that supports a high-resolution full-colour graphical interface that allows various tasks to be run before the main operating system boots, such as basic multimedia operations, scanning for viruses, and the use of diagnostic tools. ... the BIOS code provides a uniform interface to the system in order that variable hardware can function without having to make the necessary changes to the operating system when the type of hardware changes. ...
    (alt.sys.pc-clone.dell)
  • Re: Verry slow boot
    ... Is the new hard drive a different type than the old drive (e.g. SATA)? ... It sounds like the BIOS is taking a while to identify the new drive. ... the operating system. ... I'm not sure if i should be looking at hardware, ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Operating system not found
    ... If the drivedon't show up in your BIOS then it sounds like a hardware ... BIOS) then your drive is dead. ... Now it says operating system not found. ... > I checked bios and under primary slave and primary master it says none. ...
    (microsoft.public.windowsxp.help_and_support)
  • L OS releases
    ... proud its upcoming Linux-based 64-bit Operating System codenamed L OS, ... L OS is based on the open source Linux ... key hardware manufacturers and researchers. ... on performance-class hardware and software technologies such as PuRam ...
    (alt.os.linux)