Skip to content

Instantly share code, notes, and snippets.

@donnaken15

donnaken15/ADV.ASM

Created Jun 7, 2020
Embed
What would you like to do?
Atari Adventure Windows port in Assembly
; ADVENTURE
; windows port by donnaken15
format PE console 3.1 at $10000
use16
align 100h
heap 0
stack 0
org 100h
RESX = 160
RESY = 96
TOTALPX = RESX*RESY
BLOCK = 219
include 'win32a.inc'
include 'opengl.inc'
section 'game' code data readable executable writeable shareable discardable notpageable
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov [cmd], eax
invoke SetConsoleTextAttribute, [cmd], $80
invoke system, lamesysops
;test98:
;cmp [i], TOTALPX+160
;jge test99
;invoke putchar, 0
;inc [i]
;;invoke printf, teststr, ecx
;jmp test98
;test99:
;invoke printf, teststr, [i]
;hlt
;mov eax, 10
;mov ebx, eax
;shr ebx, 3
;and ebx, 1
;invoke ExitProcess, ebx
;invoke putchar, 0
game:
draw:
;invoke printf, teststr, ecx
mov [i], 0
mov [j], 0
mov [k], 0
mov [l], 0
spr:
mov eax, sprdrgn
cmp [i], 32
jl sprnxi1
add eax, 4
sprnxi1:
;DONT DO THIS, CHANGE IT LATER
cmp [i], 64
jb sprnxi2
add eax, 4
sprnxi2:
cmp [i], 96
jb sprnxi3
add eax, 4
sprnxi3:
cmp [i], 128
jb sprnxi4
add eax, 4
sprnxi4:
mov ebx, [eax]
rol ebx, 0
mov cl, [i]
shr ebx, cl
and ebx, 1
push eax
mov eax, 219
mul ebx
mov ebx, eax
pop eax
inc [i]
inc [k]
invoke putchar, ebx
invoke Sleep, 1
cmp [k], 8
je sprnxl
mov eax, sprlines
mul [sprwidth]
mov [j], al
cmp [i], 160
jb spr
ja sprend
sprnxl:
invoke putchar, $a
mov [k], 0
jmp spr
sprend:
invoke putchar, 13
invoke Sleep, 410
hlt
jmp game
name db 'Adventure',0
teststr db '%d ',0
cmd dd ?
scr db ?
pf dw ?
res SIZE RESX,RESY
lamesysops db 'color 80',0
i db ? ; FREAKING REGISTERS
j db ?
k db ?
l db ?
sprwidth db 8
struct OBJECT
pos POINT ?
flags db ?
ends
section 'char' data readable writeable shareable discardable notpageable
; sprites
sprlines db 20 , 22 , 17 , 3 , 5 , 8 , 8 , 11 , 7 , 8 , 7 , 7 , 7 , 2 , 5 , 0
sprsize db 20 *8, 22 *8, 17 *8, 3 *8, 5 *8, 8 *8, 8 *8, 11 *8, 7 *8, 8 *8, 7 *8, 7 *8, 7 *8, 2 *8, 5 *8, 0
sproffs db 0,15h,2Ch,3Eh,42h,48h,51h,5Ah,6Eh,77h,7Fh,87h,8Fh,92h,9Dh,0
sprdrgn db 00000110b,\
00001111b,\
11110011b,\
11111110b,\
00001110b,\
00000100b,\
00000100b,\
00011110b,\
00111111b,\
01111111b,\
11100011b,\
11000011b,\
11000011b,\
11000111b,\
11111111b,\
00111100b,\
00001000b,\
10001111b,\
11100001b,\
00111111b,0 ;)
sprdrgnbite db 10000000b,\
01000000b,\
00100110b,\
00011111b,\
00001011b,\
00001110b,\
00011110b,\
00100100b,\
01000100b,\
10001110b,\
00011110b,\
00111111b,\
01111111b,\
01111111b,\
01111111b,\
01111111b,\
00111110b,\
00011100b,\
00001000b,\
11111000b,\
10000000b,\
11100000b,0
sprdrgndead db 00001100b,\
00001100b,\
00001100b,\
00001110b,\
00011011b,\
01111111b,\
11001110b,\
10000000b,\
11111100b,\
11111110b,\
11111110b,\
01111110b,\
01111000b,\
00100000b,\
01101110b,\
01000010b,\
01111110b,0
sprkey db 00000111b,\
11111101b,\
10100111b,0
sprswrd db 00100000b,\
01000000b,\
11111111b,\
01000000b,\
00100000b,0
sprmag db 00111100b,\
01111110b,\
11100111b,\
11000011b,\
11000011b,\
11000011b,\
11000011b,\
11000011b,0
sprtro db 10000001b,\
10000001b,\
11000011b,\
01111110b,\
01111110b,\
00111100b,\
00011000b,\
11111111b,0
sprbat1 db 00000001b,\
10000000b,\
00000001b,\
10000000b,\
00111100b,\
01011010b,\
01100110b,\
11000011b,\
10000001b,\
10000001b,\
10000001b,0
sprbat2 db 10000001b,\
10000001b,\
11000011b,\
11000011b,\
11111111b,\
01011010b,\
01100110b,0
sprblank db 00000000b,\
00000000b,\
00000000b,\
00000000b,\
00000000b,\
00000000b,\
00000000b,\
00000000b,0
sprno1 db 00100000b,\
01100000b,\
00100000b,\
00100000b,\
00100000b,\
00100000b,\
01110000b,0
sprno2 db 01110000b,\
10001000b,\
00001000b,\
00010000b,\
00100000b,\
01000000b,\
11111000b,0
sprno3 db 01110000b,\
10001000b,\
00001000b,\
00110000b,\
00001000b,\
10001000b,\
01110000b,0
sprent db 11111000b,\
10101000b,0
sptext db 11111110b,\
01010010b,\
01011101b,\
01010010b,\
01011110b
sptext2 db 11110111b,\
10100001b,\
00100011b,\
10100000b,\
10100100b
pfbase db 11111111b,11111111b,11110000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
11111111b,11111111b,11110000b
pfenterup db 11111111b,00001111b,11110000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
11111111b,11111111b,11110000b
pfenterdn db 11111111b,11111111b,11110000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
10000000b,00000000b,00010000b,\
11111111b,00001111b,11110000b
pfhallway db 11111111b,00001111b,11110000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
11111111b,11111111b,11110000b
pfhallway2 db 11111111b,11111111b,11110000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
11111111b,00001111b,11110000b
pf4way db 11111111b,00001111b,11110000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
11111111b,00001111b,11110000b
pfcastle db 11111111b,11101010b,10000001b,01010111b,11111111b,\
11000000b,00111111b,10000001b,11111100b,00000011b,\
11000000b,00111111b,11111111b,11111100b,00000011b,\
11000000b,00001111b,11111111b,11110000b,00000011b,\
11000000b,00001111b,11000011b,11110000b,00000011b,\
11000000b,00000000b,00000000b,00000000b,00000011b,\
11111111b,11111111b,00000000b,11111111b,11111111b
pfbluekd03 db 11111111b,11111111b,11110000b,\
00000000b,00000000b,00000000b,\
11111011b,11111101b,11110000b,\
11000000b,01100000b,00110000b,\
11011111b,01101111b,10110000b,\
00010001b,01101000b,10000000b,\
11110101b,01101010b,11110000b
pfbluekd01 db 11110101b,01101010b,11110000b,\
00010101b,00001010b,10000000b,\
11010101b,11111010b,10110000b,\
00010100b,00000010b,10000000b,\
11110111b,11111110b,11110000b,\
00000000b,00000000b,00000000b,\
11111111b,00001111b,11110000b
pfbluekd05 db 11111111b,00001111b,11110000b,\
00001001b,00001001b,00000000b,\
11001001b,10011001b,00110000b,\
11001000b,00000001b,00110000b,\
11111111b,10011111b,11110000b,\
00010000b,10010001b,10000000b,\
11010111b,10011101b,10110000b
pfbluekd02 db 11010111b,10011101b,10110000b,\
00010001b,10011000b,10000000b,\
11111101b,10011011b,11110000b,\
00000101b,10011010b,00000000b,\
11010101b,10011010b,10110000b,\
00010101b,00001010b,10000000b,\
11110101b,00001010b,11110000b
pfbluekd04 db 11110101b,00001010b,11110000b,\
00010001b,00001000b,10000000b,\
11011111b,00001111b,10110000b,\
11000000b,00000000b,00110000b,\
11110000b,00000000b,11110000b,\
00010000b,00000000b,10000000b,\
11111111b,11111111b,11110000b
pfnothing db 00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b,\
00000000b,00000000b,00000000b
;section '.rsrc' resource data readable
;directory RT_VERSION,versions
;resource versions,\
;1,LANG_NEUTRAL,version
;versioninfo version,VOS_UNKNOWN+VOS_DOS+VOS_NT+VOS__WINDOWS16+VOS__WINDOWS32+VOS_DOS_WINDOWS16+VOS_DOS_WINDOWS32+VOS_NT_WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\
;'CompanyName','donnaken15',\
;'FileDescription','Adventure for Windows',\
;'FileVersion','1.0.0.0',\
;'InternalName','ADVENTURE',\
;'LegalCopyright','© Warren Robinett 1979',\
;'OriginalFilename','ADVENTURE.EXE',\
;'ProductName','Atari Adventure',\
;'ProductVersion','1.0.0.0'
section 'extn' import data readable writeable
library kernel,'KERNEL32.DLL',\
msvcrt,'msvcrt.dll'
import kernel,\
GetStdHandle,'GetStdHandle',\
SetConsoleTextAttribute,'SetConsoleTextAttribute',\
Sleep,'Sleep'
import msvcrt,\
printf,'printf',\
putchar,'putchar',\
puts,'puts',\
system,'system'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.