BBS: Inland Empire Archive Date: 09-16-82 (07:13) Number: 301 From: RICH GELDREICH Refer#: NONE To: ALL Recvd: NO Subj: Postit Assembly Loader Conf: (2) Quik_Bas
To fullfill part of the requirements of the rules I have
just proposed about DEBUG decoders, here is the assembly code to the
DEBUG decoder used in the assembly version of PostIt!. This is the
exact same code which is entered into your computer and executed
whenever a PostIt! DEBUG script is extracted:
;PostIt! Assembly version 1.0 - DEBUG loader
;By Rich Geldreich 1992
;Assembled with TASM v2.0
;(tasm /l loader)
IDEAL
MODEL SMALL
CODESEG
ASSUME CS:@CODE, DS:@CODE, ES:@CODE
Padd db 0100h dup (0) ;ORG would work too
Start:
Mov ax, 03C00h ;Open new file function
Mov dx, offset FN ;Get filename
Xor cx, cx ;
Int 021h ;Open it
Jc @@Error ;Exit if error(beeps and tells user
;"Bad Script"- which really isn't true
;when a disk error occurs
Mov si, 0200h ;Start of encoded data
Push ax ;Push handle
Mov bp, 09999h ;--PostIt! will insert file's length here
Push bp ;Push file's length
Mov di, 37000 ;Hopefully 37000+24500<than the stack!
Push di ;Push start of decoded file
Xor bx, bx
Mov cl, -6
@@05: Mov dh, al ;Got 6 more bits
Add cl, 6
@@10: Xor ah, ah ;Start of main extraction loop
@@15: Lodsb ;Get a character
Cmp al, 57 ;Translate the char to 0-63
Jna @@B
Cmp al, 90
Jna @@A
Sub al, 6 ;variable entry sub table
@@A:
Sub al, 7
@@B:
Sub al, 46
Jcxz @@05 ;Need more bits?
Shl ax, cl ;Shift past what we already got
Or al, dh ;OR it with what we already got
Stosb ;Store 8 bits
Add bl, al ;Update checksum
Xchg ax, dx ;Save for later
Dec cx ;2 less bits now
Dec cx
Dec bp ;1 less byte now
Jnz @@10 ;Jump if more
Cmp bl, 17 ;--PostIt! will insert the file's checksum here
Jne @@Error ;Too bad the file's bad
Pop dx cx bx ;Pop offset, # chars, handle
Mov ah, 040h ;Write it out to disk
Int 021h
Jnc @@Exit ;If no error then just return
@@Error:
Mov ah, 9 ;Show error string(beeps too!)
Mov dx, offset SE ;Get offset
Int 021h
@@Exit:
Int 020h ;Exit program(DEBUG will close the
;open file when it exits)
SE db 7,'Bad Script!$' ;Error string
FN db 'WXYZABCD.123',0 ;--PostIt! will insert the correct
;filename here
END
---
* SLMR 2.0 * uiouiouoiukjk;jkn,m.nm.m,n,mnjkhkjhlkjjj keyboard art
--- RBBSMAIL 17.2A
* Origin: Computer Co-Op RBBS HST, 609-784-9404 Voorhees
NJ (RBBS-PC 1:266/29)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET